Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
cam_mode_minimal.c File Reference

Go to the source code of this file.

Functions

void update_camera_minimal (Camera *camera)
 

Function Documentation

◆ update_camera_minimal()

void update_camera_minimal ( Camera * camera)

Definition at line 9 of file cam_mode_minimal.c.

9 {
10 f32 dx, dy, dz, dr;
11
12 if (camera->needsInit) {
13 camera->needsInit = FALSE;
14
15 camera->lookAt_obj.x = 0.0f;
16 camera->lookAt_obj.y = 0.0f;
17 camera->lookAt_obj.z = 0.0f;
18
19 camera->lookAt_eye.x = camera->lookAt_obj.x;
20 camera->lookAt_eye.y = camera->lookAt_obj.y;
21 camera->lookAt_eye.z = camera->lookAt_obj.z - (1000.0f / CamLengthScale);
22 }
23
24 dx = camera->lookAt_obj.x - camera->lookAt_eye.x;
25 dy = camera->lookAt_obj.y - camera->lookAt_eye.y;
26 dz = camera->lookAt_obj.z - camera->lookAt_eye.z;
27 dr = sqrtf(SQ(dx) + SQ(dz));
28
29 camera->lookAt_yaw = -atan2(0.0f, 0.0f, dx, dz);
30 camera->lookAt_pitch = atan2(0.0f, 0.0f, dy, -dr);
31 camera->curYaw = atan2(camera->lookAt_eye.x, camera->lookAt_eye.z, camera->lookAt_obj.x, camera->lookAt_obj.z);
32}
f32 CamLengthScale
Definition cam_main.c:12
#define sqrtf
#define atan2
#define SQ(x)
Definition macros.h:166
Vec3f lookAt_obj
f32 lookAt_pitch
Vec3f lookAt_eye

Referenced by update_cameras().