Example #1
0
        public void RecreateProjectionMatrix()
        {
            (int width, int height) = WindowManager.Inst.Size;
            float aspectRatio = ((float)width) / height;

            projectionMatrix = Matrix4.CreatePerspectiveFieldOfView((float)Mathmatics.ConvertToRadians(FOV), aspectRatio, NearPlane, FarPlane);
        }
Example #2
0
        private void TraceTest()
        {
            Matrix4 viewMatrix               = Mathmatics.CreateViewMatrix(camera);
            Matrix4 projectionMatrix         = camera.ProjectionMatrix;
            Matrix4 cameraWorldMatrix        = viewMatrix * projectionMatrix;
            Matrix4 cameraWorldInverseMatrix = cameraWorldMatrix.Inverted();

            Matrix4 modelMatrix = Mathmatics.CreateTransformationMatrix(new Vector3d(0, 0, -1), Vector3d.Zero, Vector3d.One);

            GL.UseProgram(quadProgram);

            // Load up the compute shader with data
            GL.UniformMatrix4(cameraToWorldUniformQuad, false, ref cameraWorldMatrix);
            GL.UniformMatrix4(cameraToWorldInverseUniformQuad, false, ref cameraWorldInverseMatrix);
            GL.UniformMatrix4(modelMatrixQuad, false, ref modelMatrix);

            GL.UniformMatrix4(viewMatrixUniformQuad, false, ref viewMatrix);
            GL.UniformMatrix4(projectionMatrixUniformQuad, false, ref projectionMatrix);

            GL.BindVertexArray(vao);

            GL.DrawArrays(PrimitiveType.Triangles, 0, 6);

            GL.BindTexture(TextureTarget.Texture2D, 0);
            GL.BindVertexArray(0);
            GL.UseProgram(0);
        }
Example #3
0
        public void MoveDirectionBased(Vector3d movement)
        {
            Vector3d toAdd = (Quaternion.FromEulerAngles(0, (float)Mathmatics.ConvertToRadians(-Rotation.Y), 0) * (Vector3)movement);

            Position += toAdd;
        }