summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorMax Danielsson <[email protected]>2018-03-27 19:59:54 +0200
committerMax Danielsson <[email protected]>2018-03-27 19:59:54 +0200
commit6c049fdd76296cb321761b6fa430c9addf58e02b (patch)
tree1fdd307860dab4e661cfbcadba556734999fe258 /src
parente38d28543a6bcb451a3b1176a159d4fc0ff15326 (diff)
downloadraylib-6c049fdd76296cb321761b6fa430c9addf58e02b.tar.gz
raylib-6c049fdd76296cb321761b6fa430c9addf58e02b.zip
Move deduplicate aspect variable in begin render.
Changes motivated by commentary in pull request 513
Diffstat (limited to 'src')
-rw-r--r--src/core.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/core.c b/src/core.c
index 7f7c02c2..823181cf 100644
--- a/src/core.c
+++ b/src/core.c
@@ -919,10 +919,11 @@ void Begin3dMode(Camera camera)
rlPushMatrix(); // Save previous matrix, which contains the settings for the 2d ortho projection
rlLoadIdentity(); // Reset current matrix (PROJECTION)
+ float aspect = (float)screenWidth/(float)screenHeight;
+
if(camera.type == CAMERA_PERSPECTIVE)
{
// Setup perspective projection
- float aspect = (float)screenWidth/(float)screenHeight;
double top = 0.01*tan(camera.fovy*0.5*DEG2RAD);
double right = top*aspect;
@@ -931,7 +932,6 @@ void Begin3dMode(Camera camera)
else if(camera.type == CAMERA_ORTHOGRAPHIC)
{
// Setup orthographic projection
- float aspect = (float)screenWidth/(float)screenHeight;
double top = camera.fovy/2.0;
double right = top*aspect;