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
9
void
update_camera_minimal
(
Camera
* camera) {
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
}
update_camera_minimal
void update_camera_minimal(Camera *camera)
Definition
cam_mode_minimal.c:9
camera.h
CamLengthScale
f32 CamLengthScale
Definition
cam_main.c:12
Vec3f::z
f32 z
Definition
common_structs.h:102
Vec3f::x
f32 x
Definition
common_structs.h:100
Vec3f::y
f32 y
Definition
common_structs.h:101
sqrtf
#define sqrtf
Definition
effect_shims.h:60
atan2
#define atan2
Definition
effect_shims.h:57
SQ
#define SQ(x)
Definition
macros.h:166
Camera
Definition
common_structs.h:748
Camera::lookAt_obj
Vec3f lookAt_obj
Definition
common_structs.h:797
Camera::lookAt_yaw
f32 lookAt_yaw
Definition
common_structs.h:807
Camera::curYaw
f32 curYaw
Definition
common_structs.h:800
Camera::needsInit
b16 needsInit
Definition
common_structs.h:752
Camera::lookAt_pitch
f32 lookAt_pitch
Definition
common_structs.h:808
Camera::lookAt_eye
Vec3f lookAt_eye
Definition
common_structs.h:796
src
cam_mode_minimal.c
Generated by
1.10.0