Corrected bug on MatrixPerspective()
Some other tweaks...
This commit is contained in:
parent
bee980e90f
commit
00d2768bc9
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user