Пример #1
0
        public CameraComponent()
        {
            // OPENGL IS RIGHT HANDED

            // IN OPENGL THE POSITIVE Z IS TOWARDS YOU
            Position = new Vector3(0, 0, 0.0f);

            // THE NEGATIVE IS TO THE DEPTH
            Direction = CalculateEulerDirection(pitch, yaw);
            Up        = new Vector3(0.0f, 1.0f, 0.0f);

            Speed     = 0.15f;
            SpeedStep = 0.05f;

            viewMatrix        = new Matrix4Uniform(ShaderUniformName.ViewMatrix);
            projectionMatrix  = new Matrix4Uniform(ShaderUniformName.ProjectionMatrix);
            orthogonalMatrix  = new Matrix4Uniform(ShaderUniformName.ProjectionMatrix);
            perspectiveMatrix = new Matrix4Uniform(ShaderUniformName.ProjectionMatrix);

            FOV = 90.0f;
            CreateMatrices();

            EnablePerspective();

            viewMatrix.Matrix = GetViewMatrix();
        }
Пример #2
0
        public TransformComponent()
        {
            worldMatrix        = new Matrix4Uniform(ShaderUniformName.WorldMatrix);
            worldMatrix.Matrix = Matrix4.Identity;
            rotationMatrix     = Matrix4.Identity;

            Scale         = 1.0f;
            rotationAxis  = new Vector3(0.0f, 1.0f, 0.0f);
            rotationAngle = 0.0f;

            Parent = null;
        }
Пример #3
0
 public void EnableOrthogonal()
 {
     projectionMatrix = orthogonalMatrix;
 }
Пример #4
0
 public void EnablePerspective()
 {
     projectionMatrix = perspectiveMatrix;
 }