示例#1
0
 public BmFontDrawCall(TextureVertexDrawable drawable, Vector3D location, Vector3D offset, uint rotation)
 {
     this.Drawable = drawable;
     this.Offset   = offset;
     this.Location = location;
     this.Rotation = rotation;
 }
示例#2
0
        /// <summary>
        /// Draw all of the drawcalls to the DeviceContext
        /// </summary>
        /// <param name="graphics"></param>
        /// <param name="renderOrigin"></param>
        /// <param name="matrix"></param>
        public void Draw(DeviceContext graphics, Vector3D renderOrigin, Matrix4F matrix)
        {
            if (this._drawCalls.Count > 0)
            {
                graphics.PushShader();
                graphics.PushRenderState();
                graphics.DepthBuffer(true, false);
                graphics.SetShader(graphics.GetShader("NameTag"));
                graphics.Graphics.GraphicsDevice.BlendState = BlendState.AlphaBlend;
                graphics.SetTexture(WorldTextRenderer.FontTexture);
                graphics.SetRasterizerState(CullMode.None);

                foreach (BmFontDrawCall drawCall in this._drawCalls)
                {
                    TextureVertexDrawable drawable = drawCall.Drawable;
                    Vector3F delta    = (drawCall.Location - renderOrigin).ToVector3F();
                    float    rotation = VectorHelper.GetRotationInRadians(drawCall.Rotation);

                    // this._configuration.GetRotationInRadians(this._variant);

                    drawable.Render(graphics, Matrix4F.Identity
                                    .Translate(drawCall.Offset.ToVector3F())
                                    .Rotate(rotation, Vector3F.UnitY)
                                    .Translate(delta)
                                    .Multiply(matrix));
                }

                graphics.SetRasterizerState(CullMode.CullCounterClockwiseFace);
                graphics.PopShader();
                graphics.PopRenderState();
            }
        }