Exemplo n.º 1
0
        public override void draw(Graphics graphics, Camera camera, WorldLights worldLights)
        {
            if (Settings.debug)
            {
                distanceToCamera = (float)camera.Position.getMagnitude();
                Matrix4 ModelViewProjection = camera.Frustum * camera.View * StaticMatrices.UniformScaleMatrix(scale);

                renderVertices = GameShapes.UnitAxes();
                foreach (Vector4D vertex in renderVertices)
                {
                    vertex.LeftMultiply(ModelViewProjection);

                    if (Math.Abs(vertex.Z) < Math.Abs(vertex.W))
                    {
                        vertex.divideByW();
                        vertex.moveOriginToCenterScreen();
                    }
                }

                PointF[] pointsAll = renderVertices.Select(x => x.getPointXY()).ToArray();
                graphics.DrawLine(new Pen(Color.Cyan), pointsAll[0], pointsAll[1]);
                graphics.DrawLine(new Pen(Color.Magenta), pointsAll[0], pointsAll[2]);
                graphics.DrawLine(new Pen(Color.Yellow), pointsAll[0], pointsAll[3]);
            }
        }
Exemplo n.º 2
0
 public Origin(double scale)
 {
     this.scale       = scale;
     renderVertices   = GameShapes.UnitAxes();
     distanceToCamera = 0;
 }