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

Go to the source code of this file.

Functions

CameraControlSettingstest_ray_zone (f32 posX, f32 posY, f32 posZ, Collider **zone)
 
s32 calculate_segment_intersection (f32 A1x, f32 A1z, f32 A2x, f32 A2z, f32 B1x, f32 B1z, f32 B2x, f32 B2z, f32 *interX, f32 *interZ, f32 *squared_dist)
 
s32 calculate_line_segment_intersection (f32 A1x, f32 A1z, f32 A2x, f32 A2z, f32 B1x, f32 B1z, f32 B2x, f32 B2z, f32 *interX, f32 *interZ, f32 *squared_dist)
 
s32 func_800328A4 (CameraControlSettings *camSettings, f32 Px, f32 Pz)
 
void update_camera_lead_amount (Camera *camera, f32 candidateLeadAmount)
 
void apply_constraints_to_lead_amount (Camera *camera)
 
void create_camera_leadplayer_matrix (Camera *camera)
 

Variables

s32 gCurrentCameraID = CAM_DEFAULT
 

Function Documentation

◆ test_ray_zone()

CameraControlSettings * test_ray_zone ( f32 posX,
f32 posY,
f32 posZ,
Collider ** zone )

Definition at line 6 of file cam_math.c.

6 {
7 f32 hitX, hitY, hitZ, hitDepth, nX, nY, nZ;
8 s32 zoneID;
9
10 hitDepth = 32767.0f;
11 zoneID = test_ray_zones(posX, posY, posZ, 0.0f, -1.0f, 0.0f, &hitX, &hitY, &hitZ, &hitDepth, &nX, &nY, &nZ);
12 if (zoneID >= 0) {
13 if (zone != NULL) {
14 *zone = &gZoneCollisionData.colliderList[zoneID];
15 }
16 return gZoneCollisionData.colliderList[zoneID].camSettings;
17 } else {
18 return NULL;
19 }
20}
Collider * colliderList
s32 test_ray_zones(f32 startX, f32 startY, f32 startZ, f32 dirX, f32 dirY, f32 dirZ, f32 *hitX, f32 *hitY, f32 *hitZ, f32 *hitDepth, f32 *nx, f32 *ny, f32 *nz)
Definition collision.c:866
CollisionData gZoneCollisionData
Definition collision.c:36

Referenced by apply_constraints_to_lead_amount().

◆ calculate_segment_intersection()

s32 calculate_segment_intersection ( f32 A1x,
f32 A1z,
f32 A2x,
f32 A2z,
f32 B1x,
f32 B1z,
f32 B2x,
f32 B2z,
f32 * interX,
f32 * interZ,
f32 * squared_dist )

Definition at line 22 of file cam_math.c.

22 {
23 f32 B1_side;
24 f32 B2_side;
25 f32 disc;
26
27 f32 alpha;
28 f32 Px;
29 f32 Pz;
30
31 f32 dx12 = A2x - A1x;
32 f32 dz12 = A2z - A1z;
33 f32 dx13 = B1x - A1x;
34 f32 dz13 = B1z - A1z;
35 f32 dx14 = B2x - A1x;
36 f32 dz14 = B2z - A1z;
37 f32 dx34 = B2x - B1x;
38 f32 dz34 = B2z - B1z;
39
40 // if distance between points on the line is 0
41 if (dx12 == 0.0f && dz12 == 0.0f) {
42 return FALSE;
43 }
44 // if length of second segment is 0
45 if (dx34 == 0.0f && dz34 == 0.0f) {
46 return FALSE;
47 }
48
49 disc = -dz12 * dx13 + dx12 * dz13;
50 if (disc < 0.0f) {
51 B1_side = -1.0f;
52 } else if (disc > 0.0f) {
53 B1_side = 1.0f;
54 } else {
55 B1_side = 0.0f;
56 }
57
58 disc = -dz12 * dx14 + dx12 * dz14;
59 if (disc < 0.0f) {
60 B2_side = -1.0f;
61 } else if (disc > 0.0f) {
62 B2_side = 1.0f;
63 } else {
64 B2_side = 0.0f;
65 }
66
67 // B1 and B2 are on the same side relative to the line: no intersection
68 if (B1_side == B2_side) {
69 return FALSE;
70 }
71
72 if (fabsf(dx12) > fabsf(dx34)) {
73 /*
74 We represent intersection point P as P = B1 + alpha * (B2 - B1)
75 and solve the equation (P - A1) x (A2 - A1) = 0, where 'x' is cross product, A1 and A2 are points on the line
76 and B1 and B2 are the ends of the segment.
77 So, (B1 - A1 + alpha * (B2 - B1)) x (A2 - A1) = 0,
78 alpha = [-(B1 - A1) x (A2 - A1)] / [(B2 - B1) x (A2 - A1)]
79 */
80 // same as -(B1 - A1) x (A2 - A1)
81 alpha = A1x * dz12 - A1z * dx12 + dx12 * B1z - dz12 * B1x;
82 // divide by (B2 - B1) x (A2 - A1)
83 alpha /= dz12 * dx34 - dx12 * dz34;
84 /*
85 Now we represent P as P = A1 + beta * (A2 - A1), and we are to find beta.
86 B1 + alpha * (B2 - B1) = A1 + beta * (A2 - A1)
87 beta * (A2 - A1) = B1 + alpha * (B2 - B1) - A1
88 We use only 'x' part of this equation to find beta.
89
90 Actually this step could be omitted and we calculate intersection directly as B1 + alpha * (B2 - B1).
91 Don't know why it's done this way.
92 */
93 alpha = (B1x + dx34 * alpha - A1x) / dx12;
94 Px = A1x + dx12 * alpha;
95 Pz = A1z + dz12 * alpha;
96 } else {
97 /*
98 We represent intersection point P as P = A1 + alpha * (A2 - A1)
99 and solve the equation (B2 - B1) x (P - B1) = 0
100 */
101 // same as (B2 - B1) x (B1 - A1)
102 alpha = B1z * dx34 + A1x * dz34 - B1z * dz34 - A1z * dx34;
103 // divide by (B2 - B1) x (A2 - A1)
104 alpha /= dz12 * dx34 - dx12 * dz34;
105 // Now we represent P as P = B1 + beta * (B2 - B1) and find beta
106 alpha = (A1x + dx12 * alpha - B1x) / dx34;
107 Px = B1x + dx34 * alpha;
108 Pz = B1z + dz34 * alpha;
109 }
110 // (P - A1) * (P - A2) > 0 when P is outside of segment A1-A2
111 if ((Px - A1x) * (Px - A2x) + (Pz - A1z) * (Pz - A2z) > 0.0f) {
112 return FALSE;
113 }
114
115 *interX = Px;
116 *interZ = Pz;
117 // distance between P and B1
118 *squared_dist = SQ(Px - B1x) + SQ(Pz - B1z);
119 return TRUE;
120}
f32 fabsf(f32 f)
#define SQ(x)
Definition macros.h:166

Referenced by apply_constraints_to_lead_amount().

◆ calculate_line_segment_intersection()

s32 calculate_line_segment_intersection ( f32 A1x,
f32 A1z,
f32 A2x,
f32 A2z,
f32 B1x,
f32 B1z,
f32 B2x,
f32 B2z,
f32 * interX,
f32 * interZ,
f32 * squared_dist )

Definition at line 122 of file cam_math.c.

122 {
123 f32 B1_side;
124 f32 B2_side;
125 f32 disc;
126
127 f32 alpha;
128 f32 Px;
129 f32 Pz;
130
131 f32 dx12 = A2x - A1x;
132 f32 dz12 = A2z - A1z;
133 f32 dx13 = B1x - A1x;
134 f32 dz13 = B1z - A1z;
135 f32 dx14 = B2x - A1x;
136 f32 dz14 = B2z - A1z;
137 f32 dx34 = B2x - B1x;
138 f32 dz34 = B2z - B1z;
139
140 if (dx12 == 0.0f && dz12 == 0.0f) {
141 return FALSE;
142 }
143 if (dx34 == 0.0f && dz34 == 0.0f) {
144 return FALSE;
145 }
146
147 disc = -dz12 * dx13 + dx12 * dz13;
148 if (disc < 0.0f) {
149 B1_side = -1.0f;
150 } else if (disc > 0.0f) {
151 B1_side = 1.0f;
152 } else {
153 B1_side = 0.0f;
154 }
155
156 disc = -dz12 * dx14 + dx12 * dz14;
157 if (disc < 0.0f) {
158 B2_side = -1.0f;
159 } else if (disc > 0.0f) {
160 B2_side = 1.0f;
161 } else {
162 B2_side = 0.0f;
163 }
164
165 if (B1_side == B2_side) {
166 return FALSE;
167 }
168
169 if (fabsf(dx12) > fabsf(dx34)) {
170 alpha = A1x * dz12 - A1z * dx12 + dx12 * B1z - dz12 * B1x;
171 alpha /= dz12 * dx34 - dx12 * dz34;
172 alpha = (B1x + dx34 * alpha - A1x) / dx12;
173 Px = A1x + dx12 * alpha;
174 Pz = A1z + dz12 * alpha;
175 } else {
176 alpha = B1z * dx34 + A1x * dz34 - B1z * dz34 - A1z * dx34;
177 alpha /= dz12 * dx34 - dx12 * dz34;
178 alpha = (A1x + dx12 * alpha - B1x) / dx34;
179 Px = B1x + dx34 * alpha;
180 Pz = B1z + dz34 * alpha;
181 }
182
183 *interX = Px;
184 *interZ = Pz;
185 *squared_dist = SQ(Px - B1x) + SQ(Pz - B1z);
186 return TRUE;
187}

Referenced by apply_constraints_to_lead_amount().

◆ func_800328A4()

s32 func_800328A4 ( CameraControlSettings * camSettings,
f32 Px,
f32 Pz )

Definition at line 189 of file cam_math.c.

189 {
190 f32 product1, product2;
191 f32 dot1x, dot1z, dot2x, dot2z;
192
193 if (camSettings == NULL) {
194 return 0;
195 }
196 if (camSettings->type != CAM_CONTROL_CONSTAIN_BETWEEN_POINTS) {
197 return 0;
198 }
199
200 f32 Ax = camSettings->points.two.Ax;
201 f32 Az = camSettings->points.two.Az;
202 f32 Bx = camSettings->points.two.Bx;
203 f32 Bz = camSettings->points.two.Bz;
204
205 // dot product of AB and AP
206 dot1x = (Bx - Ax) * (Px - Ax);
207 dot1z = (Bz - Az) * (Pz - Az);
208 product1 = dot1x + dot1z;
209
210 // dot product of AB and BP
211 dot2x = (Bx - Ax) * (Px - Bx);
212 dot2z = (Bz - Az) * (Pz - Bz);
213 product2 = dot2x + dot2z;
214
215 if (product1 < 0 && product2 < 0) {
216 return -1;
217 }
218 if (product1 > 0 && product2 > 0) {
219 return 1;
220 }
221 return 0;
222}
union CameraControlSettings::@14 points
@ CAM_CONTROL_CONSTAIN_BETWEEN_POINTS
Definition enums.h:4818

Referenced by apply_constraints_to_lead_amount().

◆ update_camera_lead_amount()

void update_camera_lead_amount ( Camera * camera,
f32 candidateLeadAmount )

Definition at line 224 of file cam_math.c.

224 {
225 s32 ignoreStickInput = camera->flags & CAMERA_FLAG_SUPRESS_LEADING;
226 f32 stickX;
227 f32 deltaLeadAmount;
228
229 if (camera->curSettings != NULL && camera->curSettings->type == CAM_CONTROL_FIXED_POS_AND_ORIENTATION) {
230 ignoreStickInput = TRUE;
231 }
232
233 if (ignoreStickInput) {
234 stickX = 0.0f;
235 camera->increasingLeadInterp = TRUE;
236 camera->leadInterpAlpha = 1.0f;
237 camera->targetLeadAmount = 0.0f;
238 } else {
240 stickX = gPartnerStatus.stickX;
241 } else {
242 stickX = gPlayerStatusPtr->stickAxis[0];
243 }
244 if (stickX > 0.0f) {
245 stickX = 50.0f;
246 }
247 if (stickX < 0.0f) {
248 stickX = -50.0f;
249 }
250 }
251
252 if (stickX != 0.0f) {
253 if (stickX < 0.0f) {
254 if (camera->accumulatedStickLead > 0.0f) {
255 // reversing direction
256 camera->accumulatedStickLead = stickX;
257 } else {
258 camera->accumulatedStickLead += stickX;
259 }
260 if (camera->accumulatedStickLead <= -300.0f) {
261 // max accumulation
262 camera->increasingLeadInterp = TRUE;
263 if (camera->targetLeadAmount > 0.0f) {
264 camera->leadInterpAlpha = 0.0f;
265 }
266 camera->targetLeadAmount = -candidateLeadAmount;
267 camera->accumulatedStickLead = -300.0f;
268 }
269 } else {
270 if (camera->accumulatedStickLead < 0.0f) {
271 // reversing direction
272 camera->accumulatedStickLead = stickX;
273 } else {
274 camera->accumulatedStickLead += stickX;
275 }
276 if (camera->accumulatedStickLead >= 300.0f) {
277 // max accumulation
278 camera->increasingLeadInterp = TRUE;
279 if (camera->targetLeadAmount < 0.0f) {
280 camera->leadInterpAlpha = 0.0f;
281 }
282 camera->targetLeadAmount = candidateLeadAmount;
283 camera->accumulatedStickLead = 300.0f;
284 }
285 }
286 }
287
288 if (camera->increasingLeadInterp) {
289 camera->leadInterpAlpha += 0.01f;
290 if (camera->leadInterpAlpha > 1.0f) {
291 camera->leadInterpAlpha = 1.0f;
292 }
293 }
294
295 // determine ratio to interp leadAmount by
296 if (camera->targetLeadAmount - camera->leadAmount == 0.0f) {
297 camera->leadInterpAlpha = 0.0f;
298 camera->increasingLeadInterp = FALSE;
299 }
300
301 deltaLeadAmount = (camera->targetLeadAmount - camera->leadAmount) * camera->leadInterpAlpha;
302 if (camera->targetLeadAmount - camera->leadAmount > 0.0f) {
303 // snap small changes
304 if (camera->targetLeadAmount - camera->leadAmount < 0.1) {
305 deltaLeadAmount = camera->targetLeadAmount - camera->leadAmount;
306 }
307 // clamp large changes to 3.0
308 if (deltaLeadAmount > 3.0f) {
309 deltaLeadAmount = 3.0f;
310 }
311 } else {
312 // snap small changes
313 if (camera->targetLeadAmount - camera->leadAmount > -0.1) {
314 deltaLeadAmount = camera->targetLeadAmount - camera->leadAmount;
315 }
316 // clamp large changes to -3.0
317 if (deltaLeadAmount < -3.0f) {
318 deltaLeadAmount = -3.0f;
319 }
320 }
321
322 if (stickX != 0.0f || ignoreStickInput) {
323 camera->leadAmount += deltaLeadAmount;
324 } else {
325 camera->leadInterpAlpha = 0.0f;
326 }
327}
@ CAM_CONTROL_FIXED_POS_AND_ORIENTATION
Definition enums.h:4810
@ CAMERA_FLAG_SUPRESS_LEADING
Definition enums.h:4728
@ PA_FLAG_RIDING_PARTNER
Definition enums.h:3116
s32 increasingLeadInterp
f32 leadInterpAlpha
CameraControlSettings * curSettings
f32 targetLeadAmount
f32 accumulatedStickLead
PlayerStatus * gPlayerStatusPtr
PartnerStatus gPartnerStatus
Definition partners.c:42

Referenced by create_camera_leadplayer_matrix().

◆ apply_constraints_to_lead_amount()

void apply_constraints_to_lead_amount ( Camera * camera)

Definition at line 329 of file cam_math.c.

329 {
330 CameraControlSettings* settings;
331 Collider* zone;
332 f32 leadAmount;
333 s32 s2;
334
335 // check settings directly under the target position
336 settings = test_ray_zone(camera->targetPos.x, camera->targetPos.y + 10.0f, camera->targetPos.z, NULL);
337
338 leadAmount = camera->leadAmount;
339 s2 = 0;
340
341 if (settings != NULL) {
342 if (settings->type == CAM_CONTROL_CONSTRAIN_TO_LINE
344 || (s2 = func_800328A4(settings, camera->targetPos.x, camera->targetPos.z)) != 0
345 ) {
346 if (camera->needsInitialConstrainDir) {
347 f32 X, Y, Z, W;
348
349 guPerspectiveF(camera->mtxPerspective, &camera->perspNorm, camera->vfov,
350 (f32)camera->viewportW / (f32)camera->viewportH, camera->nearClip, camera->farClip, 1.0f);
351 guMtxCatF(camera->mtxViewPlayer, camera->mtxPerspective, camera->mtxPerspective);
352 transform_point(camera->mtxPerspective, camera->targetPos.x, camera->targetPos.y, camera->targetPos.z,
353 1.0f, &X, &Y, &Z, &W);
354 if (W == 0.0f) {
355 W = 1.0f;
356 }
357 W = 1.0f / W;
358 X *= W;
359 camera->leadConstrainDir = (X > 0.0f) ? 1 : (X < 0.0f) ? -1 : 0;
360 camera->needsInitialConstrainDir = FALSE;
361 } else {
362 CameraControlSettings* leadSettings = camera->prevLeadSettings;
363
364 if (leadSettings == NULL
365 || !(leadSettings->type == CAM_CONTROL_CONSTRAIN_TO_LINE
367 || func_800328A4(settings, camera->prevLeadPosX, camera->prevLeadPosZ) != 0)
368 ) {
369 if (leadSettings != NULL && s2 != 0) {
370 camera->leadConstrainDir = s2;
371 } else {
372 f32 dx = camera->prevLeadPosX - camera->targetPos.x;
373 f32 dz = camera->prevLeadPosZ - camera->targetPos.z;
374 f32 cosYaw = cos_deg(camera->curYaw);
375 f32 sinYaw = sin_deg(camera->curYaw);
376 f32 product = dx * cosYaw + dz * sinYaw;
377 camera->leadConstrainDir = (product > 0) ? -1 : (product < 0) ? 1 : 0;
378 }
379 }
380 }
381
382 if (leadAmount > 0.0f && camera->leadConstrainDir > 0 || leadAmount < 0.0f && camera->leadConstrainDir < 0) {
383 camera->leadInterpAlpha = 0.0f;
384 camera->leadAmount = 0.0f;
385 }
386 camera->prevLeadSettings = settings;
387 camera->prevLeadPosX = camera->targetPos.x;
388 camera->prevLeadPosZ = camera->targetPos.z;
389 return;
390 }
391 }
392
393 camera->leadConstrainDir = 0;
394 camera->prevLeadSettings = settings;
395 camera->prevLeadPosX = camera->targetPos.x;
396 camera->prevLeadPosZ = camera->targetPos.z;
397
398 // find settings under (target + lead) position
399 f32 yaw = DEG_TO_RAD(camera->curBoomYaw);
400 f32 newPosX = camera->targetPos.x + leadAmount * cos_rad(yaw);
401 f32 newPosZ = camera->targetPos.z + leadAmount * sin_rad(yaw);
402 f32 newPosY = camera->targetPos.y + 10.0f;
403
404 settings = test_ray_zone(newPosX, newPosY, newPosZ, &zone);
405 if (settings == NULL) {
406 return;
407 }
408
409 if (settings->type == CAM_CONTROL_CONSTRAIN_TO_LINE
411 || func_800328A4(camera->prevLeadSettings, newPosX, newPosZ) != 0
412 ) {
413 f32 intX, intZ, intDistSq;
414 f32 minDistSq = SQ(1000.0f);
415 b32 constrainToZoneTriangles = TRUE;
416
417 // clamp lead amount to the points when using CAM_CONTROL_CONSTAIN_BETWEEN_POINTS
419 settings = camera->prevLeadSettings;
420 constrainToZoneTriangles = FALSE;
421
422 f32 ABx = settings->points.two.Bx - settings->points.two.Ax;
423 f32 ABz = settings->points.two.Bz - settings->points.two.Az;
424
425 if (calculate_line_segment_intersection(settings->points.two.Ax, settings->points.two.Az,
426 settings->points.two.Ax - ABz, settings->points.two.Az + ABx,
427 camera->targetPos.x, camera->targetPos.z, newPosX, newPosZ, &intX, &intZ, &intDistSq)
428 && intDistSq < minDistSq
429 ) {
430 minDistSq = intDistSq;
431 }
432 if (calculate_line_segment_intersection(settings->points.two.Bx, settings->points.two.Bz,
433 settings->points.two.Bx - ABz, settings->points.two.Bz + ABx,
434 camera->targetPos.x, camera->targetPos.z, newPosX, newPosZ, &intX, &intZ, &intDistSq)
435 && intDistSq < minDistSq
436 ) {
437 minDistSq = intDistSq;
438 }
439 }
440
441 if (constrainToZoneTriangles) {
442 for (s32 i = 0; i < zone->numTriangles; i++) {
444 zone->triangleTable[i].v2->x, zone->triangleTable[i].v2->z,
445 camera->targetPos.x, camera->targetPos.z, newPosX, newPosZ, &intX, &intZ, &intDistSq)
446 && intDistSq < minDistSq
447 ) {
448 minDistSq = intDistSq;
449 }
451 zone->triangleTable[i].v3->x, zone->triangleTable[i].v3->z,
452 camera->targetPos.x, camera->targetPos.z, newPosX, newPosZ, &intX, &intZ, &intDistSq)
453 && intDistSq < minDistSq
454 ) {
455 minDistSq = intDistSq;
456 }
458 zone->triangleTable[i].v1->x, zone->triangleTable[i].v1->z,
459 camera->targetPos.x, camera->targetPos.z, newPosX, newPosZ, &intX, &intZ, &intDistSq)
460 && intDistSq < minDistSq
461 ) {
462 minDistSq = intDistSq;
463 }
464 }
465 }
466
467 if (minDistSq == SQ(1000.0f) || minDistSq == 0.0f) {
468 camera->leadAmount = 0.0f;
469 } else {
470 camera->leadAmount = abs(camera->leadAmount > 0.0f) ? sqrtf(minDistSq) : -sqrtf(minDistSq);
471 }
472 camera->leadInterpAlpha = 0.0f;
473 }
474}
s32 calculate_segment_intersection(f32 A1x, f32 A1z, f32 A2x, f32 A2z, f32 B1x, f32 B1z, f32 B2x, f32 B2z, f32 *interX, f32 *interZ, f32 *squared_dist)
Definition cam_math.c:22
CameraControlSettings * test_ray_zone(f32 posX, f32 posY, f32 posZ, Collider **zone)
Definition cam_math.c:6
s32 func_800328A4(CameraControlSettings *camSettings, f32 Px, f32 Pz)
Definition cam_math.c:189
s32 calculate_line_segment_intersection(f32 A1x, f32 A1z, f32 A2x, f32 A2z, f32 B1x, f32 B1z, f32 B2x, f32 B2z, f32 *interX, f32 *interZ, f32 *squared_dist)
Definition cam_math.c:122
s32 b32
struct ColliderTriangle * triangleTable
#define transform_point
#define sqrtf
#define sin_deg
#define guMtxCatF
#define guPerspectiveF
#define cos_deg
@ CAM_CONTROL_CONSTRAIN_TO_LINE
Definition enums.h:4804
@ CAM_CONTROL_LOOK_AT_POINT_CONSTAIN_TO_LINE
Definition enums.h:4814
f32 cos_rad(f32 x)
Definition 43F0.c:717
f32 sin_rad(f32 x)
Definition 43F0.c:713
#define DEG_TO_RAD(deg)
Definition macros.h:134
f32 prevLeadPosX
b32 needsInitialConstrainDir
CameraControlSettings * prevLeadSettings
s32 leadConstrainDir
Vec3f targetPos
Matrix4f mtxPerspective
Matrix4f mtxViewPlayer
f32 prevLeadPosZ

Referenced by create_camera_leadplayer_matrix().

◆ create_camera_leadplayer_matrix()

void create_camera_leadplayer_matrix ( Camera * camera)

Definition at line 476 of file cam_math.c.

476 {
477 f32 dx = camera->lookAt_eye.x - camera->lookAt_obj.x;
478 f32 dy = camera->lookAt_eye.y - camera->lookAt_obj.y;
479 f32 dz = camera->lookAt_eye.z - camera->lookAt_obj.z;
480 f32 dist = sqrtf(SQ(dx) + SQ(dy) + SQ(dz));
481 f32 theta = ((camera->vfov * 0.5f) / 180.0f) * PI;
482 f32 distTanTheta = dist * (sin_rad(theta) / cos_rad(theta));
483 f32 hfov = distTanTheta * camera->viewportW / camera->viewportH;
484
485 update_camera_lead_amount(camera, hfov * camera->leadAmtScale);
487 guTranslateF(camera->mtxViewLeading, -camera->leadAmount, 0.0f, 0.0f);
488}
void apply_constraints_to_lead_amount(Camera *camera)
Definition cam_math.c:329
void update_camera_lead_amount(Camera *camera, f32 candidateLeadAmount)
Definition cam_math.c:224
#define guTranslateF
#define PI
Definition macros.h:126
Vec3f lookAt_obj
Matrix4f mtxViewLeading
Vec3f lookAt_eye
f32 leadAmtScale

Referenced by update_cameras().

Variable Documentation

◆ gCurrentCameraID

s32 gCurrentCameraID = CAM_DEFAULT

Definition at line 4 of file cam_math.c.

Referenced by _render_transition_stencil(), _show_message(), action_hammer_end_swing(), action_hammer_test_swing_collision(), action_update_parasol(), action_update_spin(), action_update_tornado_jump(), appendGfx_background_texture(), appendGfx_darkness_stencil(), appendGfx_interact_prompt(), appendGfx_ispy_icon(), appendGfx_pulse_stone_icon(), appendGfx_shading_palette(), appendGfx_speech_bubble(), aura_appendGfx(), balloon_appendGfx(), big_smoke_puff_appendGfx(), big_snowflakes_appendGfx(), blast_appendGfx(), bombette_breaking_appendGfx(), breaking_junk_appendGfx(), btl_restore_world_cameras(), btl_state_draw_end_battle(), btl_state_update_normal_start(), can_dismount(), check_conversation_trigger(), cloud_puff_appendGfx(), cloud_trail_appendGfx(), cold_breath_appendGfx(), collision_main_above(), collision_main_lateral(), confetti_appendGfx(), create_shading_palette(), damage_indicator_render_impl(), damage_stars_appendGfx(), damage_stars_main(), debuff_appendGfx(), draw_all_status_icons(), draw_encounters_pre_battle(), draw_shop_items(), drop_leaves_appendGfx(), dust_appendGfx(), effect_3D_appendGfx(), effect_46_appendGfx(), effect_63_appendGfx(), effect_75_appendGfx(), effect_75_render(), effect_86_appendGfx(), embers_appendGfx(), emote_appendGfx(), ending_decals_appendGfx(), energy_in_out_appendGfx(), energy_orb_wave_appendGfx(), entity_BlueWarpPipe_enter_pipe_init(), explosion_appendGfx(), falling_leaves_appendGfx(), fire_breath_appendGfx(), fire_flower_appendGfx(), firework_rocket_appendGfx(), flame_appendGfx(), flame_render(), flashing_box_shockwave_appendGfx(), floating_cloud_puff_appendGfx(), fright_jar_appendGfx(), func_800E4AD8(), func_800E4B40(), func_E0020000(), func_E005E334(), func_E0080448(), func_E0082580(), func_E00863B4(), func_E008A000(), func_E008A290(), func_E0090444(), func_E00AC2A4(), func_E0112330(), func_E01166E8(), func_E011A700(), gather_energy_pink_appendGfx(), gather_energy_pink_update(), gather_magic_appendGfx(), gfx_draw_background(), got_item_outline_appendGfx(), green_impact_appendGfx(), hieroglyphs_appendGfx(), huff_puff_breath_appendGfx(), ice_pillar_appendGfx(), ice_shard_appendGfx(), imgfx_appendGfx_mesh(), interact_inspect_setup(), interact_speech_setup(), is_model_center_visible(), is_point_visible(), landing_dust_appendGfx(), lens_flare_appendGfx(), lightning_appendGfx(), load_map_by_IDs(), misc_particles_appendGfx(), misc_particles_update(), moving_cloud_appendGfx(), music_note_appendGfx(), offset_player_from_camera(), partner_do_player_collision(), partner_get_out(), peach_disguise_check_overlaps(), peach_star_beam_appendGfx(), phys_check_interactable_collision(), pink_sparkles_appendGfx(), PiranhaPlantAI_10(), player_get_side_angle(), player_raycast_below_cam_relative(), player_update_sprite(), quizmo_assistant_appendGfx(), quizmo_audience_appendGfx(), quizmo_stage_appendGfx(), radial_shimmer_appendGfx(), radial_shimmer_update(), radiating_energy_orb_appendGfx(), red_impact_appendGfx(), render_effects_UI(), render_models(), ring_blast_appendGfx(), rising_bubble_appendGfx(), set_npc_yaw(), set_screen_overlay_center_worldpos(), sfx_compute_spatialized_sound_params_full(), sfx_compute_spatialized_sound_params_ignore_depth(), sfx_compute_spatialized_sound_params_with_depth(), shape_spell_appendGfx(), shattering_stones_appendGfx(), shiny_flare_appendGfx(), shockwave_appendGfx(), sleep_bubble_appendGfx(), small_gold_sparkle_appendGfx(), smoke_burst_appendGfx(), smoke_impact_appendGfx(), smoke_ring_appendGfx(), snaking_static_appendGfx(), snowfall_appendGfx(), snowfall_update(), snowflake_appendGfx(), sparkles_appendGfx(), spawn_drops(), spiky_white_aura_appendGfx(), spiky_white_aura_main(), star_appendGfx(), star_main(), star_outline_appendGfx(), star_spirits_energy_appendGfx(), stars_burst_appendGfx(), stars_shimmer_appendGfx(), stars_spread_appendGfx(), state_init_file_select(), state_init_logos(), state_init_title_screen(), static_status_appendGfx(), steam_burst_appendGfx(), stop_watch_appendGfx(), sun_appendGfx(), sweat_appendGfx(), sweat_main(), sync_player_position(), test_item_player_collision(), throw_spiny_appendGfx(), thunderbolt_ring_appendGfx(), tubba_heart_attack_appendGfx(), underwater_appendGfx(), update_encounters_neutral(), update_entities(), update_player_shadow(), update_riding_physics(), update_shadows(), walking_dust_appendGfx(), water_fountain_appendGfx(), water_splash_appendGfx(), waterfall_appendGfx(), and windy_leaves_appendGfx().