Beispiel #1
0
    void FixedUpdate()
    {
        float xAxisValue = Input.GetAxis("Horizontal");
        float zAxisValue = Input.GetAxis("Vertical");

        if (Camera.current != null)
        {
            Camera.current.transform.Translate(new Vector3(xAxisValue * 0.6f, zAxisValue * 0.6f, 0));
        }

        ObliqueProjection op         = gameObject.GetComponent <ObliqueProjection>();
        float             rAxisValue = Input.GetAxis("RotateCamera");

        //Debug.Log(rAxisValue);
        if (op != null)
        {
            if (rAxisValue != 0)
            {
                op.angle += rAxisValue;
                op.Apply();
            }
        }
        else
        {
            if (Camera.current != null)
            {
                Transform target = Camera.current.transform;
                target.eulerAngles = new Vector3(target.localRotation.eulerAngles.x, target.localRotation.eulerAngles.y + rAxisValue, target.localRotation.eulerAngles.z);
            }
        }
    }
Beispiel #2
0
        private void pictureBox_paint(object sender, PaintEventArgs e)
        {
            Graphics g = e.Graphics;

            //  PointF center = new PointF(pictureBox1.Width / 2, pictureBox1.Height / 2);
            // g.DrawLine(new Pen(Brushes.Black), new PointF(center.X, 0), new PointF(center.X, center.X * 2));
            // g.DrawLine(new Pen(Brushes.Black), new PointF(0, center.Y), new PointF(center.Y * 4, center.Y));



            if (projection is CentralProjection)
            {
                CentralProjection proj = projection as CentralProjection;
                figuresForDraw = utils.getCentralProjection(proj.getZ());
            }
            else if (projection is OrthogonalProjection)
            {
                figuresForDraw = utils.getOrthoProjection();
            }
            else if (projection is ObliqueProjection)
            {
                ObliqueProjection proj = projection as ObliqueProjection;
                figuresForDraw = utils.getObliqueProjection(proj.getAlpha(), proj.getL());
            }
            float[,] pov = new float[1, 4] {
                { 1000, 0, 0, 1 }
            };
            float[,] visabilityMatrix = utils.getVisibilityMatrix(pov);
            Color[] colors = utils.getFiguresColors();
            for (int i = 0; i < figuresForDraw.Count; i++)
            {
                //  if (visabilityMatrix[0,i] > 0 )
                // {
                SolidBrush solidBrush = new SolidBrush(colors[i]);
                g.DrawPolygon(new Pen(Brushes.Black), Centrate(figuresForDraw[i]));
                g.FillPolygon(solidBrush, Centrate(figuresForDraw[i]));
                //   }
            }
        }