/// <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); } }
/// <summary> /// Override the super class Draw to draw the AxisShape /// </summary> /// <param name="graphicsDevice"></param> public override void Draw(GraphicsDevice graphicsDevice, ContentManager cm, Camera camera, MatrixStack stack) { base.Draw(graphicsDevice, cm, camera, stack); mMainAxis.Xform.Translation = Xform.Translation; // mMainAxis.Scale = Scale; mMainAxis.Xform.Rotation = Xform.Rotation; mMainAxis.Draw(graphicsDevice, cm, camera, stack); }
public void Draw(GraphicsDevice device, ContentManager cm, Camera camera, MatrixStack stack) { stack.Push(); { mXform.ComputeWorldTransform(stack); foreach (var s in mShapes) { s.Draw(device, cm, camera, stack); } foreach (var c in mChildren) { c.Draw(device, cm, camera, stack); } #if M1 if (mShowPivot) { mPivotShape.Xform.Translation = Xform.Pivot; mPivotShape.Draw(device, cm, camera, stack); } #endif } stack.Pop(); #if M2 if (mShowPivot) { mPivotShape.Xform.Translation = Xform.Pivot + Xform.Translation; mPivotShape.Xform.Rotation = Xform.Rotation; mPivotShape.Draw(device, cm, camera, stack); } #endif }