Exemple #1
0
        public static void DrawDummy(this Model model, string dummyName, bool enableDepthBuffer)
        {
            Matrix         transform      = model.GetAbsoluteBoneTransform(dummyName);
            VectorRenderer vectorRenderer = Utility.VectorRenderer;
            GraphicsDevice graphicsDevice = Utility.GraphicsDevice;

            vectorRenderer.SetColor(Color.Red);
            vectorRenderer.SetWorldMatrix(Utility.Camera.ViewProjection);
            vectorRenderer.SetWorldMatrix(transform);

            Vector3    scale, translation;
            Quaternion rot;

            transform.Decompose(out scale, out rot, out translation);

            bool depthWasEnabled = graphicsDevice.RenderState.DepthBufferEnable;

            graphicsDevice.RenderState.DepthBufferEnable = enableDepthBuffer;
            vectorRenderer.DrawBoundingBox(
                new BoundingBox(-Vector3.One * scale.Length() * 2.0f, Vector3.One * scale.Length() * 2.0f));

            vectorRenderer.SetColor(Color.Green);
            vectorRenderer.DrawLine(Vector3.Zero, transform.Up * scale.Length() * 2.0f);

            vectorRenderer.SetColor(Color.Yellow);
            vectorRenderer.DrawLine(Vector3.Zero, transform.Forward * scale.Length() * 2.0f);

            vectorRenderer.SetColor(Color.Blue);
            vectorRenderer.DrawLine(Vector3.Zero, transform.Right * scale.Length() * 2.0f);

            graphicsDevice.RenderState.DepthBufferEnable = depthWasEnabled;
        }