Esempio n. 1
0
        private void renderEdge(SpatialVectorDouble vertex0, SpatialVectorDouble vertex1)
        {
            Matrix point0 = new Matrix(new double[] { vertex0.x, vertex0.y, vertex0.z, vertex0.w }, 1);
            Matrix point1 = new Matrix(new double[] { vertex1.x, vertex1.y, vertex1.z, vertex1.w }, 1);

            Matrix projectedPoint0 = modelViewProjection * point0;
            Matrix projectedPoint1 = modelViewProjection * point1;

            Matrix normalizedProjectedPoint0 = SoftwareRendererUtilities.project(projectedPoint0);
            Matrix normalizedProjectedPoint1 = SoftwareRendererUtilities.project(projectedPoint1);

            graphics.DrawLine(pen,
                              viewSize / 2 + (int)normalizedProjectedPoint0[0, 0], viewSize / 2 + (int)normalizedProjectedPoint0[1, 0],
                              viewSize / 2 + (int)normalizedProjectedPoint1[0, 0], viewSize / 2 + (int)normalizedProjectedPoint1[1, 0]);
        }
Esempio n. 2
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            softwareGuiRenderer.graphics = e.Graphics;

            softwareRenderer.graphics = e.Graphics;
            softwareRenderer.pen      = new Pen(Color.FromArgb(0, 0, 0));
            softwareRenderer.viewSize = 300;

            Matrix projectionMatrix = SoftwareRendererUtilities.createProjectionMatrix(0.0, 0.0, -softwareRenderer.viewSize);

            softwareRenderer.modelViewProjection = projectionMatrix; // TODO< calculate model view projection

            softwareRenderer.render();

            guiContext.render();
        }