Esempio n. 1
0
        private Ch01_01EmptyProject.Graphic.Shaders.BufferTypes.WorldViewProj ComputeWorldViewProjectionMatrix()
        {
            var worldMatrix      = Matrix.Identity;
            var projectionMatrix = Matrix.Identity;
            var viewMatrix       = Matrix.Identity;

            Matrix.RotationY(Rotation, out worldMatrix);
            viewMatrix = camera.ViewMatrix;
            // Setup and create the projection matrix.
            projectionMatrix = Matrix.PerspectiveFovLH((float)(Math.PI / 4), (float)windowConfig.Width / (float)windowConfig.Height, 1.0f, 1000.0f);

            var WWPComputed = new Ch01_01EmptyProject.Graphic.Shaders.BufferTypes.WorldViewProj();

            WWPComputed.worldMatrix = worldMatrix;

            WWPComputed.worldViewProj = worldMatrix * viewMatrix * projectionMatrix;

            WWPComputed.worldInverseTranspose = Matrix.Transpose(Matrix.Invert(WWPComputed.worldMatrix));

            return(WWPComputed);
        }
Esempio n. 2
0
        private Ch01_01EmptyProject.Graphic.Shaders.BufferTypes.WorldViewProj ComputeWorldViewProjectionMatrix()
        {
            var worldMatrix = Matrix.Identity;
            var projectionMatrix = Matrix.Identity;
            var viewMatrix = Matrix.Identity;

            Matrix.RotationY(Rotation, out worldMatrix);
            viewMatrix = camera.ViewMatrix;
            // Setup and create the projection matrix.
            projectionMatrix = Matrix.PerspectiveFovLH((float)(Math.PI / 4), (float)windowConfig.Width / (float)windowConfig.Height, 1.0f, 1000.0f);

            var WWPComputed = new Ch01_01EmptyProject.Graphic.Shaders.BufferTypes.WorldViewProj();
            WWPComputed.worldMatrix = worldMatrix;

            WWPComputed.worldViewProj = worldMatrix * viewMatrix * projectionMatrix;

            WWPComputed.worldInverseTranspose = Matrix.Transpose(Matrix.Invert(WWPComputed.worldMatrix));

            return WWPComputed;
        }