예제 #1
0
        private void String3D(String3DCommand command, FlatBufferBuilder builder, List <Offset <RenderMessage> > messages)
        {
            //FlatBuffer doesn't like nesting "create" commands within each other so declare them early instead (vectors are immune for some reason)
            var color = command.Color.ToFlatBuffer(builder);
            var text  = builder.CreateString(command.Text);

            RenderMessage.StartRenderMessage(builder);
            RenderMessage.AddRenderType(builder, RenderType.DrawString3D);
            RenderMessage.AddColor(builder, color);
            RenderMessage.AddStart(builder, command.UpperLeft.ToFlatBuffer(builder));
            RenderMessage.AddScaleX(builder, command.ScaleX);
            RenderMessage.AddScaleY(builder, command.ScaleY);
            RenderMessage.AddText(builder, text);
            messages.Add(RenderMessage.EndRenderMessage(builder));
        }
예제 #2
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);
        }