Skip to content

Commit a2cf878

Browse files
committed
cleanup variable shadowing
1 parent 4233544 commit a2cf878

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

examples/core/core_3d_fps_controller.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ void UpdateDrawFrame(void); // Update and Draw one frame
7474

7575
void DrawLevel();
7676

77-
void UpdateCameraAngle(Camera* camera, Vector2* rot, float headTimer, float walkLerp, Vector2 lean);
77+
void UpdateCameraAngle();
7878

7979
void UpdateBody(Body* body, float rot, char side, char forward, bool jumpPressed, bool crouchHold);
8080

@@ -167,7 +167,7 @@ void UpdateDrawFrame(void)
167167
lean.x = Lerp(lean.x, sideway * 0.02f, 10.f * delta);
168168
lean.y = Lerp(lean.y, forward * 0.015f, 10.f * delta);
169169

170-
UpdateCameraAngle(&camera, &lookRotation, headTimer, walkLerp, lean);
170+
UpdateCameraAngle();
171171

172172
// Draw
173173
//----------------------------------------------------------------------------------
@@ -272,46 +272,46 @@ void UpdateBody(Body* body, float rot, char side, char forward, bool jumpPressed
272272
}
273273
}
274274

275-
void UpdateCameraAngle(Camera* camera, Vector2* rot, float headTimer, float walkLerp, Vector2 lean)
275+
void UpdateCameraAngle()
276276
{
277277
const Vector3 up = (Vector3){ 0.f, 1.f, 0.f };
278278
const Vector3 targetOffset = (Vector3){ 0.f, 0.f, -1.f };
279279

280280
/* Left & Right */
281-
Vector3 yaw = Vector3RotateByAxisAngle(targetOffset, up, rot->x);
281+
Vector3 yaw = Vector3RotateByAxisAngle(targetOffset, up, lookRotation.x);
282282

283283
// Clamp view up
284284
float maxAngleUp = Vector3Angle(up, yaw);
285285
maxAngleUp -= 0.001f; // avoid numerical errors
286-
if ( -(rot->y) > maxAngleUp) { rot->y = -maxAngleUp; }
286+
if ( -(lookRotation.y) > maxAngleUp) { lookRotation.y = -maxAngleUp; }
287287

288288
// Clamp view down
289289
float maxAngleDown = Vector3Angle(Vector3Negate(up), yaw);
290290
maxAngleDown *= -1.0f; // downwards angle is negative
291291
maxAngleDown += 0.001f; // avoid numerical errors
292-
if ( -(rot->y) < maxAngleDown) { rot->y = -maxAngleDown; }
292+
if ( -(lookRotation.y) < maxAngleDown) { lookRotation.y = -maxAngleDown; }
293293

294294
/* Up & Down */
295295
Vector3 right = Vector3Normalize(Vector3CrossProduct(yaw, up));
296296

297297
// Rotate view vector around right axis
298-
Vector3 pitch = Vector3RotateByAxisAngle(yaw, right, -rot->y - lean.y);
298+
Vector3 pitch = Vector3RotateByAxisAngle(yaw, right, -lookRotation.y - lean.y);
299299

300300
// Head animation
301301
// Rotate up direction around forward axis
302302
float _sin = sin(headTimer * PI);
303303
float _cos = cos(headTimer * PI);
304304
const float stepRotation = 0.01f;
305-
camera->up = Vector3RotateByAxisAngle(up, pitch, _sin * stepRotation + lean.x);
305+
camera.up = Vector3RotateByAxisAngle(up, pitch, _sin * stepRotation + lean.x);
306306

307307
/* BOB */
308308
const float bobSide = 0.1f;
309309
const float bobUp = 0.15f;
310310
Vector3 bobbing = Vector3Scale(right, _sin * bobSide);
311311
bobbing.y = fabsf(_cos * bobUp);
312-
camera->position = Vector3Add(camera->position, Vector3Scale(bobbing, walkLerp));
312+
camera.position = Vector3Add(camera.position, Vector3Scale(bobbing, walkLerp));
313313

314-
camera->target = Vector3Add(camera->position, pitch);
314+
camera.target = Vector3Add(camera.position, pitch);
315315
}
316316

317317

0 commit comments

Comments
 (0)