Esempio n. 1
0
        /// <summary>
        /// Draws a 2D line which starts at a screen coordinate and ends at a world coordinate.
        /// </summary>
        /// <param name="color">The color of the line.</param>
        /// <param name="start">The start point of the line.</param>
        /// <param name="end">The end point of the line.</param>
        public void DrawLine2D3D(Color color, Vector2 start, Vector3 end)
        {
            var colorOffset = color.ToOffsetColor(Builder);

            RenderMessage.StartRenderMessage(Builder);
            RenderMessage.AddRenderType(Builder, RenderType.DrawLine2D_3D);
            RenderMessage.AddColor(Builder, colorOffset);
            RenderMessage.AddStart(Builder, start.ToOffsetVector(Builder));
            RenderMessage.AddEnd(Builder, end.ToOffsetVector(Builder));
            var finalOffset = RenderMessage.EndRenderMessage(Builder);

            _renderMessageOffsets.Add(finalOffset);
        }
Esempio n. 2
0
        private void DrawRect3D(Color color, Vector3 position, int width, int height, bool filled, bool centered)
        {
            var colorOffset = color.ToOffsetColor(Builder);

            RenderMessage.StartRenderMessage(Builder);
            RenderMessage.AddRenderType(Builder, centered ? RenderType.DrawCenteredRect3D : RenderType.DrawRect3D);
            RenderMessage.AddColor(Builder, colorOffset);
            RenderMessage.AddStart(Builder, position.ToOffsetVector(Builder));
            RenderMessage.AddScaleX(Builder, width);
            RenderMessage.AddScaleY(Builder, height);
            RenderMessage.AddIsFilled(Builder, filled);
            var finalOffset = RenderMessage.EndRenderMessage(Builder);

            _renderMessageOffsets.Add(finalOffset);
        }
Esempio n. 3
0
        /// <summary>
        /// Draws text in 2D, but the upper-left corner is at a 3D-tracked position in world space.
        /// </summary>
        /// <param name="text">The text to draw.</param>
        /// <param name="color">The color of the string.</param>
        /// <param name="upperLeft">The location of the upper left corner of the text.</param>
        /// <param name="scaleX">The multiplier for the width of the text.</param>
        /// <param name="scaleY">The multiplier for the height of the text</param>
        public void DrawString3D(String text, Color color, Vector3 upperLeft, int scaleX, int scaleY)
        {
            var colorOffset = color.ToOffsetColor(Builder);
            var textOffset  = Builder.CreateString(text);

            RenderMessage.StartRenderMessage(Builder);
            RenderMessage.AddRenderType(Builder, RenderType.DrawString3D);
            RenderMessage.AddColor(Builder, colorOffset);
            RenderMessage.AddStart(Builder, upperLeft.ToOffsetVector(Builder));
            RenderMessage.AddScaleX(Builder, scaleX);
            RenderMessage.AddScaleY(Builder, scaleY);
            RenderMessage.AddText(Builder, textOffset);
            var finalOffset = RenderMessage.EndRenderMessage(Builder);

            _renderMessageOffsets.Add(finalOffset);
        }