Review PR #1040 naming and formating
This commit is contained in:
parent
c0d1425aac
commit
c20ccfe274
1 changed files with 8 additions and 10 deletions
18
src/camera.h
18
src/camera.h
|
@ -428,16 +428,14 @@ void UpdateCamera(Camera *camera)
|
||||||
if (cameraAngle.y > CAMERA_FIRST_PERSON_MIN_CLAMP*DEG2RAD) cameraAngle.y = CAMERA_FIRST_PERSON_MIN_CLAMP*DEG2RAD;
|
if (cameraAngle.y > CAMERA_FIRST_PERSON_MIN_CLAMP*DEG2RAD) cameraAngle.y = CAMERA_FIRST_PERSON_MIN_CLAMP*DEG2RAD;
|
||||||
else if (cameraAngle.y < CAMERA_FIRST_PERSON_MAX_CLAMP*DEG2RAD) cameraAngle.y = CAMERA_FIRST_PERSON_MAX_CLAMP*DEG2RAD;
|
else if (cameraAngle.y < CAMERA_FIRST_PERSON_MAX_CLAMP*DEG2RAD) cameraAngle.y = CAMERA_FIRST_PERSON_MAX_CLAMP*DEG2RAD;
|
||||||
|
|
||||||
// Camera is always looking at player
|
// Recalculate camera target considering translation and rotation
|
||||||
//camera->target.x = camera->position.x - sinf(cameraAngle.x)*CAMERA_FIRST_PERSON_FOCUS_DISTANCE;
|
Matrix translation = MatrixTranslate(0, 0, (cameraTargetDistance/CAMERA_FREE_PANNING_DIVIDER));
|
||||||
//camera->target.y = camera->position.y + sinf(cameraAngle.y)*CAMERA_FIRST_PERSON_FOCUS_DISTANCE;
|
Matrix rotation = MatrixRotateXYZ((Vector3){ PI*2 - cameraAngle.y, PI*2 - cameraAngle.x, 0 });
|
||||||
//camera->target.z = camera->position.z - cosf(cameraAngle.x)*CAMERA_FIRST_PERSON_FOCUS_DISTANCE;
|
Matrix transform = MatrixMultiply(translation, rotation);
|
||||||
Matrix t = MatrixTranslate(0,0,(cameraTargetDistance/CAMERA_FREE_PANNING_DIVIDER));
|
|
||||||
Matrix r = MatrixRotateXYZ((Vector3){PI*2-cameraAngle.y,PI*2-cameraAngle.x,0});
|
camera->target.x = camera->position.x - transform.m12;
|
||||||
r = MatrixMultiply(t,r);
|
camera->target.y = camera->position.y - transform.m13;
|
||||||
camera->target.x = camera->position.x - r.m12;
|
camera->target.z = camera->position.z - transform.m14;
|
||||||
camera->target.y = camera->position.y - r.m13;
|
|
||||||
camera->target.z = camera->position.z - r.m14;
|
|
||||||
|
|
||||||
if (isMoving) swingCounter++;
|
if (isMoving) swingCounter++;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue