Ejemplo n.º 1
0
        /// <summary>
        /// if sub-class really wants to, can override this and determines how to draw
        /// </summary>
        /// <param name="graphicsDevice"></param>
        virtual public void Draw(GraphicsDevice graphicsDevice, ContentManager cm, Camera camera, MatrixStack stack)
        {
            BasicEffect effect = LoadEffect(graphicsDevice);

            stack.Push();
            {
                Xform.ComputeWorldTransform(stack);

                effect.View       = camera.ViewMatrix();
                effect.Projection = camera.ProjectionMatrix();
                effect.World      = stack.GetTopOfStack();
                effect.CurrentTechnique.Passes[0].Apply();

                SetCurrentColor();
                DrawPrimitive(graphicsDevice, cm);
            }
            stack.Pop();

            if (mDrawPivot)
            {
                if (null == mPivot)
                {
                    mPivot = new AxisShape();
                }

                mPivot.DrawPivot         = false; // to ensure no infinite recursion!
                mPivot.Xform.Translation = Xform.Translation + Xform.Pivot;
                mPivot.Xform.Rotation    = Xform.Rotation;
                mPivot.Draw(graphicsDevice, cm, camera, stack);
            }
        }