diff --git a/src/core.c b/src/core.c index 5e7cc8117..028d7b141 100644 --- a/src/core.c +++ b/src/core.c @@ -885,7 +885,7 @@ void Begin3dMode(Camera camera) // Setup perspective projection float aspect = (float)screenWidth/(float)screenHeight; - double top = 0.01*tan(camera.fovy*PI/360.0); + double top = 0.01*tan(camera.fovy*0.5*DEG2RAD); double right = top*aspect; // NOTE: zNear and zFar values are important when computing depth buffer values diff --git a/src/models.c b/src/models.c index 7df9a10b5..47175b2c2 100644 --- a/src/models.c +++ b/src/models.c @@ -120,8 +120,8 @@ void DrawCube(Vector3 position, float width, float height, float length, Color c rlPushMatrix(); // NOTE: Be careful! Function order matters (scale -> rotate -> translate) - rlScalef(1.0f, 3.0f, 1.0f); - rlRotatef(45, 0, 1, 0); + //rlScalef(1.0f, 3.0f, 1.0f); + //rlRotatef(45, 0, 1, 0); rlTranslatef(position.x, position.y, position.z); rlBegin(RL_TRIANGLES); diff --git a/src/raymath.h b/src/raymath.h index 270441a54..93ae90aee 100644 --- a/src/raymath.h +++ b/src/raymath.h @@ -882,7 +882,7 @@ RMDEF Matrix MatrixFrustum(double left, double right, double bottom, double top, // NOTE: Angle should be provided in radians RMDEF Matrix MatrixPerspective(double fovy, double aspect, double near, double far) { - double top = near*tan(fovy); + double top = near*tan(fovy*0.5); double right = top*aspect; return MatrixFrustum(-right, right, -top, top, near, far); diff --git a/src/rlgl.c b/src/rlgl.c index 936128963..ac4ad20d7 100644 --- a/src/rlgl.c +++ b/src/rlgl.c @@ -3585,7 +3585,7 @@ static void UpdateBuffersDefault(void) // Draw default internal buffers vertex data // NOTE: We draw in this order: lines, triangles, quads -static void DrawBuffersDefault() +static void DrawBuffersDefault(void) { Matrix matProjection = projection; Matrix matModelView = modelview; @@ -3967,9 +3967,9 @@ static void SetStereoConfig(VrDeviceInfo hmd) SetShaderValue(vrConfig.distortionShader, GetShaderLocation(vrConfig.distortionShader, "chromaAbParam"), hmd.chromaAbCorrection, 4); #endif - // Fovy is normally computed with: 2*atan2(hmd.vScreenSize, 2*hmd.eyeToScreenDistance)*RAD2DEG + // Fovy is normally computed with: 2*atan2(hmd.vScreenSize, 2*hmd.eyeToScreenDistance) // ...but with lens distortion it is increased (see Oculus SDK Documentation) - //float fovy = 2.0f*atan2(hmd.vScreenSize*0.5f*distortionScale, hmd.eyeToScreenDistance)*RAD2DEG; // Really need distortionScale? + //float fovy = 2.0f*atan2(hmd.vScreenSize*0.5f*distortionScale, hmd.eyeToScreenDistance); // Really need distortionScale? float fovy = 2.0f*(float)atan2(hmd.vScreenSize*0.5f, hmd.eyeToScreenDistance); // Compute camera projection matrices