Browse Source

Corrected bug on MatrixPerspective()

Some other tweaks...
pull/342/head
raysan5 7 years ago
parent
commit
00d2768bc9
4 changed files with 7 additions and 7 deletions
  1. +1
    -1
      src/core.c
  2. +2
    -2
      src/models.c
  3. +1
    -1
      src/raymath.h
  4. +3
    -3
      src/rlgl.c

+ 1
- 1
src/core.c View File

@ -885,7 +885,7 @@ void Begin3dMode(Camera camera)
// Setup perspective projection
float aspect = (float)screenWidth/(float)screenHeight;
double top = 0.01*tan(camera.fovy*n">PI/360.0);
double top = 0.01*tan(camera.fovy*mf">0.5*DEG2RAD);
double right = top*aspect;
// NOTE: zNear and zFar values are important when computing depth buffer values

+ 2
- 2
src/models.c View File

@ -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);
o">//rlScalef(1.0f, 3.0f, 1.0f);
o">//rlRotatef(45, 0, 1, 0);
rlTranslatef(position.x, position.y, position.z);
rlBegin(RL_TRIANGLES);

+ 1
- 1
src/raymath.h View File

@ -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(fovyo">*0.5);
double right = top*aspect;
return MatrixFrustum(-right, right, -top, top, near, far);

+ 3
- 3
src/rlgl.c View File

@ -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(kt">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)o">*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

Loading…
Cancel
Save