Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
cam_mode_minimal.c
Go to the documentation of this file.
1#include "common.h"
2#include "camera.h"
3
4// implements CAM_UPDATE_MINIMAL
5// simple camera based on lookAt_eye and lookAt_obj with no blending or interpolation
6// control this camera by directly setting these positions
7//
8// no control parameters
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}
void update_camera_minimal(Camera *camera)
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