Ejemplo n.º 1
0
        //prepare the shader for the given entity.
        private void PrepareInstance(Node node)
        {
            Transform transform            = new Transform(node.position, 0, 0, 0, 1);
            Matrix4   transformationMatrix = Mathematics.CreateTransformationMatrix(transform.position, transform.xAxisRotation, transform.yAxisRotation, transform.zAxisRotation, transform.scale);

            nodeShader.LoadTransformationMatrix(transformationMatrix);
            nodeShader.LoadDynamicColor(node.color);
        }
Ejemplo n.º 2
0
        private void PrepareInstance(Data data)
        {
            Transform transform            = new Transform(data.position, data.rotation.X, data.rotation.Y, data.rotation.Z, 1);
            Matrix4   transformationMatrix = Mathematics.CreateTransformationMatrix(transform.position, transform.xAxisRotation, transform.yAxisRotation, transform.zAxisRotation, transform.scale);

            graphingShader.LoadTransformationMatrix(transformationMatrix);
            graphingShader.LoadDynamicColor(new Vector3(1, 1, 1));
        }
Ejemplo n.º 3
0
        //prepare the shader for the given entity.
        private void PrepareInstance(Function function)
        {
            Transform transform            = new Transform(function.position, 0, 0, 0, 1);
            Matrix4   transformationMatrix = Mathematics.CreateTransformationMatrix(transform.position, transform.xAxisRotation, transform.yAxisRotation, transform.zAxisRotation, transform.scale);

            graphingShader.LoadTransformationMatrix(transformationMatrix);
            graphingShader.LoadDynamicColor(function.color);
        }
Ejemplo n.º 4
0
        //determine and load a transformation matrix that manipulates the complex coordinates of the quad.
        private void PrepareInstance(Vector2 mousePositionUnitCoordinates, float mouseWheelDelta, Fractal fractal)
        {
            float   stepPercent          = 1 - (2 * mouseWheelDelta / 100f);
            Vector2 mousePositionComplex = new Vector2(Mathematics.Lerp(mousePositionUnitCoordinates.X, fractal.domain[0].X, fractal.domain[1].X), -Mathematics.Lerp(mousePositionUnitCoordinates.Y, fractal.domain[0].Y, fractal.domain[3].Y));



            Vector2 bottomLeft  = Mathematics.Lerp(stepPercent, mousePositionComplex, fractal.domain[0]);
            Vector2 bottomRight = Mathematics.Lerp(stepPercent, mousePositionComplex, fractal.domain[1]);
            Vector2 topRight    = Mathematics.Lerp(stepPercent, mousePositionComplex, fractal.domain[2]);
            Vector2 topLeft     = Mathematics.Lerp(stepPercent, mousePositionComplex, fractal.domain[3]);

            float xScale = Math.Abs(bottomRight.X - bottomLeft.X);
            float yScale = Math.Abs(topLeft.Y - bottomLeft.Y);

            Matrix4 transformationMatrix = Mathematics.CreateTransformationMatrix(new Vector3(bottomLeft.X, bottomLeft.Y, 0), xScale, yScale);

            mandelbrotShader.LoadTransformationMatrix(transformationMatrix);

            fractal.domain[0] = bottomLeft;
            fractal.domain[1] = bottomRight;
            fractal.domain[2] = topRight;
            fractal.domain[3] = topLeft;
        }