102 Dalmatians: Puppies to the Rescue
Decompilation Source Reference | GitLab repository
Loading...
Searching...
No Matches
meshes.c
Go to the documentation of this file.
1/* Recovered game implementation; original addresses identify provenance. */
2#include "billboard.h"
12#include "pcdogs/game/globals.h"
22#include "pcdogs/math/types.h"
24#include "pcdogs/scene/types.h"
26#include "pcdogs/script/types.h"
27#include <math.h>
28#include <stdarg.h>
29#include <string.h>
30
31// Original pcdogs.exe: 0x413380
32// Resets eligible mesh commands, clears progress and transient flags, activates autoplay commands and marks them dirty.
34{ // Setting prototype: void ResetAnimationControllers(byte *controllerList)
35 if (!cmd_list || cmd_list->flags & MESH_COMMAND_LIST_SKIP_RESET)
36 return;
37
38 int32_t count = (int32_t)cmd_list->count;
39
40 if (!count)
41 return;
42
43 struct Mesh_Command **cmd_ptrs = cmd_list->cmdPtrs;
44
45 do
46 {
47 (*cmd_ptrs)->progress_q12 = 0;
48
49 struct Mesh_Command *command_to_reset = (struct Mesh_Command *)(uintptr_t)(*(uint32_t *)cmd_ptrs);
50
51 command_to_reset->flags &= (uint8_t)~(MESH_CMD_ACTIVE | MESH_CMD_LATCHED | MESH_CMD_REVERSE);
52
53 struct Mesh_Command *command_to_autoplay = (struct Mesh_Command *)(uintptr_t)(*(uint32_t *)cmd_ptrs);
54
55 Mesh_CommandFlags flags = command_to_autoplay->flags;
56
58 command_to_autoplay->flags = flags | MESH_CMD_ACTIVE;
59
60 struct Mesh_Command *command_to_mark_dirty = (struct Mesh_Command *)(uintptr_t)(*(uint32_t *)cmd_ptrs);
61
62 cmd_ptrs = &cmd_ptrs[1];
63 count -= 1;
64 command_to_mark_dirty->flags |= MESH_CMD_DIRTY;
65 } while (count);
66}
67
68// Original pcdogs.exe: 0x4133d0
69// Clears each dirty command flag and dispatches material-controller or supported vertex-color updates.
70void Graphics_ProcessMeshCommands(struct Mesh_CmdList *cmd_list, struct Material_Node **material_nodes, void *owner_context)
71{
72 if (!cmd_list)
73 return;
74
75 int32_t count = (int32_t)cmd_list->count;
76
77 if (!count)
78 return;
79
80 struct Mesh_Command **cmd_ptrs = cmd_list->cmdPtrs;
81
82 do
83 {
84 struct Mesh_Command *dirty_command = *cmd_ptrs;
85
86 Mesh_CommandFlags flags = dirty_command->flags;
87
89 {
90 dirty_command->flags = flags & ~MESH_CMD_DIRTY;
91
92 struct Mesh_Command *color_controller = *cmd_ptrs;
93 int32_t controller_type = (uint8_t)(color_controller->type);
94
95 if (controller_type == MESH_COMMAND_CONTROLLER)
96 Animation_ProcessController(material_nodes, (Animation_PackedControllerState *)&color_controller->payload,
97 color_controller->progress_q12);
99 Animation_ProcessVertexColor((struct Animation_VertexColorController *)color_controller, owner_context);
100 }
101
102 cmd_ptrs = &cmd_ptrs[1];
103 count -= 1;
104 } while (count);
105}
106
107// Original pcdogs.exe: 0x413830
108// Polls command signals and advances active mesh-controller progress, handling loop, reverse and endpoint state before marking changed commands dirty. Overlay pause suppresses all updates.
110{ // Setting prototype: void HandleAnimationControllerInput(int controllerList)
112 return;
113
114 int32_t count = (int32_t)cmd_list->count;
115 int32_t remaining_commands = count;
116
117 if (!count)
118 return;
119
120 struct Mesh_Command **cmd_ptrs = cmd_list->cmdPtrs;
121
122 cmd_list = (struct Mesh_CmdList *)(cmd_ptrs);
123
124 do
125 {
126 struct Mesh_Command *command = (struct Mesh_Command *)(uintptr_t)(*(uint32_t *)cmd_ptrs);
127 char advance_once = 0;
128 int16_t signal_id = command->signal_id;
129 struct Signal_QueueEntry event_buffer;
130
131 event_buffer.signal_id = signal_id;
132
133 if (signal_id > 0 && Signal_Poll(&event_buffer, 1))
134 {
135 enum Mesh_CommandEvent mesh_event = event_buffer.event_type;
136
137 if (mesh_event <= MESH_EVENT_LATCH_STOP_IF_ACTIVE)
138 {
139 Mesh_CommandFlags event_flags;
140 Mesh_CommandFlags direction_flags;
141
142 switch (mesh_event)
143 {
144 case MESH_EVENT_RESET:
145 event_flags = command->flags;
146 command->progress_q12 = 0xfffff000;
147 event_flags = (event_flags & (uint8_t)~(MESH_CMD_ACTIVE | MESH_CMD_LATCHED | MESH_CMD_REVERSE)) | MESH_CMD_DIRTY;
148 command->flags = event_flags;
149
150 if (event_flags & MESH_CMD_AUTOPLAY)
151 {
152 event_flags |= MESH_CMD_ACTIVE;
153 command->flags = event_flags;
154 }
155 else
156 advance_once = 1;
157
158 break;
159
162 break;
163
165 advance_once = 1;
166 command->flags = (command->flags & ~MESH_CMD_ACTIVE) | MESH_CMD_LATCHED;
167
168 /* fall through */
170 {
171 Mesh_CommandFlags flags = command->flags;
172
174 {
175 if (!(flags & MESH_CMD_LATCHED))
176 {
177 if (command->progress_q12)
178 command->progress_q12 = 0xfffff000;
179
180 direction_flags = command->flags & ~MESH_CMD_REVERSE;
181 }
182 else
183 {
184 flags &= ~MESH_CMD_LATCHED;
185 command->flags = flags;
186 direction_flags = flags & ~MESH_CMD_REVERSE;
187 }
188
189 command->flags = direction_flags;
190
191 if (!advance_once)
192 {
193 event_flags = direction_flags | MESH_CMD_ACTIVE;
194 command->flags = event_flags;
195 }
196 }
197
198 break;
199 }
200
202 advance_once = 1;
203 command->flags = (command->flags & ~MESH_CMD_ACTIVE) | MESH_CMD_LATCHED;
204
205 /* fall through */
207 {
208 Mesh_CommandFlags reverse_play_flags = command->flags;
209
210 if ((reverse_play_flags & (MESH_CMD_ACTIVE | MESH_CMD_REVERSE)) != (MESH_CMD_ACTIVE | MESH_CMD_REVERSE))
211 {
212 if (reverse_play_flags & MESH_CMD_LATCHED)
213 command->flags = reverse_play_flags & ~MESH_CMD_LATCHED;
214 else if (command->progress_q12 != command->limit_q12)
215 command->progress_q12 = 0xfffff000;
216
217 direction_flags = command->flags | MESH_CMD_REVERSE;
218 command->flags = direction_flags;
219
220 if (!advance_once)
221 {
222 event_flags = direction_flags | MESH_CMD_ACTIVE;
223 command->flags = event_flags;
224 }
225 }
226
227 break;
228 }
229
231 event_flags = command->flags & ~MESH_CMD_LATCHED;
232 event_flags |= MESH_CMD_ACTIVE;
233 command->flags = event_flags;
234
235 break;
236
237 case MESH_EVENT_PAUSE:
238 event_flags = command->flags & ~MESH_CMD_ACTIVE;
239 command->flags = event_flags;
240
241 break;
242
244 event_flags = command->flags;
245
246 if (event_flags & MESH_CMD_ACTIVE)
247 {
248 event_flags = (event_flags & ~MESH_CMD_ACTIVE) | MESH_CMD_LATCHED;
249 command->flags = event_flags;
250 }
251
252 break;
253
254 default:
255 cmd_ptrs = (struct Mesh_Command **)(&cmd_list->cmdPtrs);
256
257 cmd_list = (struct Mesh_CmdList *)(cmd_ptrs);
258 remaining_commands -= 1;
259
260 continue;
261 }
262 }
263 }
264
265 Mesh_CommandFlags advance_flags = command->flags;
266
267 if (advance_flags & MESH_CMD_ACTIVE || advance_once)
268 {
269 int32_t step_q12 = (advance_flags & MESH_CMD_REVERSE) ? -MATH_Q12_ONE : MATH_Q12_ONE;
270 int32_t advanced_progress_q12 = command->progress_q12 + step_q12;
271
272 command->progress_q12 = advanced_progress_q12;
273
274 if (step_q12 > 0)
275 {
276 int32_t limit_q12 = command->limit_q12;
277
278 if (advanced_progress_q12 >= limit_q12)
279 {
280 // Nonzero low mode bits wrap with a -0x800 phase correction; zero clamps and clears ACTIVE.
281 if (advance_flags & MESH_CMD_MODE_MASK)
282 command->progress_q12 = advanced_progress_q12 - limit_q12 - 0x800;
283 else
284 {
285 command->progress_q12 = limit_q12;
286 command->flags = advance_flags & ~MESH_CMD_ACTIVE;
287 }
288 }
289 }
290 else if (advanced_progress_q12 <= 0)
291 {
292 if (advanced_progress_q12 < step_q12)
293 command->progress_q12 = command->limit_q12;
294 else if (advance_flags & MESH_CMD_MODE_MASK)
295 command->progress_q12 = command->limit_q12 + advanced_progress_q12 + 0x800;
296 // Nonzero low mode bits wrap with a +0x800 phase correction; zero clamps and clears ACTIVE.
297 else
298 {
299 command->progress_q12 = 0;
300 command->flags = advance_flags & ~MESH_CMD_ACTIVE;
301 }
302 }
303
304 command->flags |= MESH_CMD_DIRTY;
305 }
306
307 // Event 9 leaves event state unchanged.
308 cmd_ptrs = (struct Mesh_Command **)(&cmd_list->cmdPtrs);
309
310 cmd_list = (struct Mesh_CmdList *)(cmd_ptrs);
311 remaining_commands -= 1;
312 } while (remaining_commands);
313}
314
315static void set_uv_rectangle(struct Math_UV8 uv[4], uint8_t u, uint8_t v,
316 uint8_t width_minus_one, uint8_t height_minus_one)
317{
318 uint8_t right = u + width_minus_one;
319 uint8_t bottom = v + height_minus_one;
320
321 uv[0] = (struct Math_UV8){right, bottom};
322 uv[1] = (struct Math_UV8){right, v};
323 uv[2] = (struct Math_UV8){u, v};
324 uv[3] = (struct Math_UV8){u, bottom};
325}
326
327static void swap_uvs(struct Math_UV8 *a, struct Math_UV8 *b)
328{
329 struct Math_UV8 tmp = *a;
330 *a = *b;
331 *b = tmp;
332}
333
334// Original pcdogs.exe: 0x41ac00
336 struct Material_TableEntry *polygon_data, int16_t uv_index_or_sentinel,
337 struct Mesh_RuntimeVertex **polygon_vertices)
338{
339 uint32_t flags = polygon_data->flags;
340 struct Material_RuntimeDescriptor *texture = polygon_data->texture_descriptor;
341
342 out_batch->flags = flags;
343 out_batch->texture_desc = texture;
344 out_batch->material_tint = polygon_data->material_tint;
345 memcpy(&out_batch->tex_wrap_mode, &polygon_data->texture_info, sizeof(polygon_data->texture_info));
346 out_batch->render_state_flags = 0;
347 if (!texture)
348 return;
349
350 int width = texture->dimensions_minus_1.width + 1;
351 int height = texture->dimensions_minus_1.height + 1;
352 uint8_t tile_width_minus_one = width - 1;
353 uint8_t tile_height_minus_one = height - 1;
354 uint8_t u = 0;
355 uint8_t v = 0;
356
358 {
359 u = polygon_data->uv_tile_offset.u;
361 u = width / 2 - u - 1;
362 tile_width_minus_one /= 2;
363 }
365 {
366 v = polygon_data->uv_tile_offset.v;
368 v = height / 2 - v - 1;
369 tile_height_minus_one /= 2;
370 }
371
372 struct Math_UV8 *uv = out_batch->tex_uvs;
373 if (flags & MATERIAL_ENVIRONMENT_UV)
374 {
375 if (!polygon_vertices)
376 {
377 // Flat quads have no vertex normals. Their fallback starts at the tile origin (0, 0).
378 set_uv_rectangle(uv, 0, 0, tile_width_minus_one, tile_height_minus_one);
379 return;
380 }
381
382 const struct Math_Matrix3x3I16 *camera = &g_cameraTransformMatrix;
383 int count = polygon_vertices[3] ? 4 : 3;
384 for (int i = 0; i < count; ++i)
385 {
386 int index = polygon_vertices[i]->normal_group_index;
387 const struct Math_Vec3I16 *normal = &node->normal_table[index].normal;
388 int32_t x = (camera->m00 * normal->x + camera->m01 * normal->y + camera->m02 * normal->z) >> 12;
389 int32_t y = (camera->m10 * normal->x + camera->m11 * normal->y + camera->m12 * normal->z) >> 12;
390 int32_t z = (camera->m20 * normal->x + camera->m21 * normal->y + camera->m22 * normal->z) >> 12;
391 int16_t angle = Math_CalculateAtan2FP12(z, -x);
392 uv[i].u = u + ((angle * width) >> 12);
393 uv[i].v = v + (((y + MATH_Q12_ONE) * (height / 2)) >> 12);
394 }
395 return;
396 }
397
398 if (uv_index_or_sentinel >= 0)
399 {
400 const struct Math_UV8 *table = node->model_relocated_ptr_80;
401 for (int i = 0; i < 4; ++i)
402 {
403 uv[i].u = table[uv_index_or_sentinel + i].u + u;
404 uv[i].v = table[uv_index_or_sentinel + i].v + v;
405 }
406 }
407 else if (flags & MATERIAL_EXPLICIT_UV)
408 {
409 for (int i = 0; i < 4; ++i)
410 uv[i] = polygon_data->explicit_uvs[i];
411 }
412 else
413 {
414 set_uv_rectangle(uv, u, v, tile_width_minus_one, tile_height_minus_one);
415 }
416
417 if (flags & MATERIAL_FLIP_U)
418 {
419 swap_uvs(&uv[0], &uv[3]);
420 swap_uvs(&uv[1], &uv[2]);
421 }
422 if (flags & MATERIAL_FLIP_V)
423 {
424 swap_uvs(&uv[0], &uv[1]);
425 swap_uvs(&uv[2], &uv[3]);
426 }
427
428 int turns = ((flags & MATERIAL_UV_ROTATE_QUARTER) != 0) + 2 * ((flags & MATERIAL_UV_ROTATE_HALF) != 0);
429 for (int i = 0; i < turns; ++i)
430 {
431 struct Math_UV8 last = uv[3];
432 uv[3] = uv[2];
433 uv[2] = uv[1];
434 uv[1] = uv[0];
435 uv[0] = last;
436 }
437
438 if (uv_index_or_sentinel == -2)
439 uv[2] = uv[3];
440 else if (uv_index_or_sentinel == -3)
441 {
442 uv[0] = uv[2];
443 uv[2] = uv[1];
444 uv[1] = uv[3];
445 }
446}
447
448static void Graphics_ProjectFlatCorner(struct Graphics_ProjectedCorner *corner, int32_t x, int32_t z)
449{
450 const struct Math_Matrix3x3I16 *matrix = &g_cameraTransformMatrix;
452 ((matrix->m00 * x + matrix->m02 * z) >> 6) + g_nodeViewTranslationX,
453 ((matrix->m10 * x + matrix->m12 * z) >> 6) + g_nodeViewTranslationY,
454 ((matrix->m20 * x + matrix->m22 * z) >> 6) + g_nodeViewTranslationZ);
455}
456
457/* The x86 entry supplies the four packed coordinates left by the caller. */
459 uint32_t xy0, uint32_t xy1, uint32_t xy2, uint32_t xy3)
460{
463 const struct Math_Matrix3x3I16 *matrix = &g_cameraTransformMatrix;
464 int64_t facing = (int64_t)matrix->m01 * g_nodeViewTranslationX + (int64_t)matrix->m11 * g_nodeViewTranslationY + (int64_t)matrix->m21 * g_nodeViewTranslationZ;
465 if ((int32_t)(facing >> MATH_Q12_SHIFT) >= 0)
466 return;
467
468 struct Graphics_ProjectedCorner corners[4] = {
469 {.screen.packed_screen = xy0}, {.screen.packed_screen = xy1},
470 {.screen.packed_screen = xy2}, {.screen.packed_screen = xy3}};
471 int16_t right = actor->half_extents.x, front = actor->half_extents.y;
472 int16_t left = -right, back = -front;
473 Graphics_ProjectFlatCorner(&corners[0], left, back);
474 Graphics_ProjectFlatCorner(&corners[1], left, front);
475 Graphics_ProjectFlatCorner(&corners[2], right, front);
476 Graphics_ProjectFlatCorner(&corners[3], right, back);
477
479 for (unsigned i = 0; i < 4; ++i)
480 batch->view_vertices[i] = corners[i].view;
481 Graphics_SetPolygonUVs(NULL, batch, actor->material, 0xffff, NULL);
482
483 int32_t bucket = Graphics_QuadDepthBucket(corners);
484 struct Graphics_Render_PolygonBatchRecord **head = &render_list_state->sorted_list_head;
486 head = &render_list_state->polygon_queue_heads[bucket];
488 head = &render_list_state->sorted_list_buckets[0x3ffe];
489 batch->next_in_bucket = *head;
490 *head = batch;
491
493 batch->face_normal_dot = 0;
494 batch->depth_bias = g_currentGameMode == GAME_MODE_GAMEPLAY_3D ? -10.0f : -0.5f;
495 uint32_t color = 0x808080;
497 {
498 /* The original reads the 32-bit fade word at the 16-bit state field. */
499 uint32_t fade_word;
500 memcpy(&fade_word, &g_renderingStateFlag, sizeof(fade_word));
501 color = Graphics_FadeVertexColor(color, MATH_Q12_ONE - fade_word);
502 }
503 for (unsigned i = 0; i < 4; ++i)
504 {
505 corners[i].screen.z -= 0x800;
506 batch->screen_vertices[i] = corners[i].screen;
507 batch->view_vertices[i] = corners[i].view;
508 batch->vertex_colors[i] = color;
509 }
511}
512
513// Original pcdogs.exe: 0x41dc90
514// Checks whether a polygon address belongs to any active debug polygon list, stopping when a list has a nonpositive count.
516{
518 return 0;
519
520 int32_t debug_list_count = Collision_DebugPolygonListCount;
521
522 if (debug_list_count <= 0)
523 return 0;
524
525 int32_t debug_list_index = 0;
526
527 do
528 {
529 int32_t list_polygon_count = (&Collision_DebugPolygonListCounts)[debug_list_index];
530 int32_t polygon_address = ((uint32_t *)&Collision_DebugPolygonListBases)[debug_list_index];
531
532 if (list_polygon_count <= 0)
533 break;
534
535 int32_t polygon_index = 0;
536
537 if (list_polygon_count > 0)
538 {
539 do
540 {
541 if ((uintptr_t)polygon_ref == (uint32_t)polygon_address)
542 return 1;
543
544 polygon_index += 1;
545 polygon_address += 0x18;
546 } while (polygon_index < list_polygon_count);
547 }
548
549 debug_list_index += 1;
550 } while (debug_list_index < debug_list_count);
551
552 return 0;
553}
554
555// Original pcdogs.exe: 0x440550
556// Reads the polygon's three or four vertex colors, applies the current material's centered RGB adjustments and writes clamped packed colors.
557void Graphics_ComputeVertexColors(struct Mesh_RuntimeVertex *runtime_vertices, struct Graphics_Render_PolygonRenderRef *polygon_ref, uint32_t *out_colors)
558{
559 struct Material_TableEntry *color_material = g_currentRenderMaterial;
560 int32_t material_green_adjust_byte = (uint8_t)(color_material->color_adjust.g);
561 int32_t material_red_adjust_byte = (uint8_t)(color_material->color_adjust.r);
562 int32_t material_blue_adjust_byte = (uint8_t)(color_material->color_adjust.b);
563 int32_t vertices_remaining = 4 - ((uint32_t)polygon_ref->flags & POLYGON_TRIANGLE);
564 int32_t red_adjust = material_red_adjust_byte - 0x80;
565 int32_t blue_adjust = material_blue_adjust_byte - 0x80;
566 int16_t *vertex_index_cursor = (int16_t *)(&polygon_ref->vertex_indices);
567
568 while (true)
569 {
570 struct Mesh_RuntimeVertex *source_vertex =
571 &runtime_vertices[(int32_t)*(uint16_t *)vertex_index_cursor];
572 int32_t source_red = (uint8_t)(source_vertex->color.r);
573 int32_t adjusted_red = source_red + red_adjust;
574
575 if (adjusted_red < 0)
576 adjusted_red = 0;
577 else if (adjusted_red > 0xff)
578 adjusted_red = 0xff;
579
580 int32_t source_green = (uint8_t)(source_vertex->color.g);
581 int32_t adjusted_green = source_green + material_green_adjust_byte - 0x80;
582
583 if (adjusted_green < 0)
584 adjusted_green = 0;
585 else if (adjusted_green > 0xff)
586 adjusted_green = 0xff;
587
588 int32_t source_blue = (uint8_t)(source_vertex->color.b);
589 int32_t adjusted_blue = source_blue + blue_adjust;
590
591 if (adjusted_blue < 0)
592 adjusted_blue = 0;
593 else if (adjusted_blue > 0xff)
594 adjusted_blue = 0xff;
595
596 vertex_index_cursor = &vertex_index_cursor[1];
597
598 vertices_remaining -= 1;
599 *out_colors = ((uint32_t)adjusted_blue << 16) | ((uint32_t)adjusted_green << 8) | (uint32_t)adjusted_red;
600 out_colors = &out_colors[1];
601
602 if (!vertices_remaining)
603 break;
604 }
605}
#define MESH_CMD_AUTOPLAY
Definition enums.h:133
#define MESH_CMD_MODE_MASK
Definition enums.h:121
#define MESH_CMD_LATCHED
Definition enums.h:127
uint32_t Animation_PackedControllerState
Definition enums.h:14
#define MESH_CMD_DIRTY
Definition enums.h:136
uint8_t Mesh_CommandFlags
Definition enums.h:109
#define MESH_CMD_ACTIVE
Definition enums.h:124
#define MESH_CMD_REVERSE
Definition enums.h:130
@ MESH_COMMAND_CONTROLLER
Definition enums.h:145
@ MESH_COMMAND_VERTEX_COLOR
Definition enums.h:148
Mesh_CommandEvent
Definition enums.h:70
@ MESH_EVENT_PAUSE
Definition enums.h:97
@ MESH_EVENT_PLAY_FORWARD
Definition enums.h:82
@ MESH_EVENT_RESERVED_2
Definition enums.h:79
@ MESH_EVENT_PLAY_REVERSE
Definition enums.h:88
@ MESH_EVENT_RESET
Definition enums.h:73
@ MESH_EVENT_RESERVED_1
Definition enums.h:76
@ MESH_EVENT_STEP_FORWARD
Definition enums.h:85
@ MESH_EVENT_RESUME
Definition enums.h:94
@ MESH_EVENT_STEP_REVERSE
Definition enums.h:91
@ MESH_EVENT_LATCH_STOP_IF_ACTIVE
Definition enums.h:103
bool Animation_ProcessController(struct Material_Node **material_nodes, Animation_PackedControllerState *packed_controller_state_in_out, int32_t frame_count_q12)
Definition controller.c:133
void Animation_ProcessVertexColor(struct Animation_VertexColorController *color_controller, struct Mesh_NodeExtended *mesh_node)
Definition controller.c:231
void Graphics_TransformViewCenter(const struct Math_Vec3I32 *world)
Definition mesh_nodes.c:56
void Graphics_ProjectCorner(struct Graphics_ProjectedCorner *corner, int32_t x, int32_t y, int32_t z)
Definition mesh_nodes.c:36
int Graphics_QuadDepthBucket(const struct Graphics_ProjectedCorner *corners)
Definition mesh_nodes.c:122
uint32_t Graphics_FadeVertexColor(uint32_t color, uint32_t weight)
Definition mesh_nodes.c:138
#define g_cameraTransformMatrix
Definition globals.h:81
#define Collision_DebugPolygonListCounts
Definition globals.h:81
#define Collision_DebugPolygonListCount
Definition globals.h:75
#define Collision_DebugPolygonListBases
Definition globals.h:84
#define GAME_OVERLAY_SKIP_NODE_ANIMATION
Definition constants.h:34
#define GAME_TRANSITION_COLOR_FADE
Definition constants.h:30
@ GAME_MODE_GAMEPLAY_3D
Definition enums.h:38
#define Game_FrameTransitionFlags
Definition globals.h:47
#define Game_FrameOverlayFlags
Definition globals.h:44
#define g_currentGameMode
Definition globals.h:74
#define MESH_COMMAND_LIST_SKIP_RESET
Definition constants.h:66
#define GRAPHICS_CAP_SKIP_COMMAND_CONTROLLER
Definition constants.h:18
#define POLYGON_TRIANGLE
Definition constants.h:7
#define g_polygonBatchRecords
Definition globals.h:290
#define g_graphicsCapabilities_high_byte
Definition globals.h:335
#define render_list_state
Definition globals.h:152
#define MATERIAL_BLEND_MODE_HIGH
Definition constants.h:28
#define MATERIAL_UV_ROTATE_HALF
Definition constants.h:41
#define MATERIAL_DEPTH_SORT
Definition constants.h:39
#define MATERIAL_TILE_V_FIRST
Definition constants.h:35
#define MATERIAL_ENVIRONMENT_UV
Definition constants.h:32
#define MATERIAL_BLEND_ENABLED
Definition constants.h:29
#define MATERIAL_EXPLICIT_UV
Definition constants.h:30
#define MATERIAL_FLIP_V
Definition constants.h:26
#define MATERIAL_FLIP_U
Definition constants.h:25
#define MATERIAL_TILE_U_SECOND
Definition constants.h:34
#define MATERIAL_TILE_V_SECOND
Definition constants.h:36
#define MATERIAL_UV_ROTATE_QUARTER
Definition constants.h:40
#define MATERIAL_TILE_U_FIRST
Definition constants.h:33
#define MATERIAL_BLEND_MODE_LOW
Definition constants.h:27
#define g_currentRenderMaterial
Definition globals.h:15
#define MATH_Q12_SHIFT
Definition constants.h:8
#define MATH_Q12_ONE
Definition constants.h:9
void Math_MulMat3x3Q12(struct Math_Matrix3x3I16 *out_matrix, struct Math_Matrix3x3I16 const *right_factor, struct Math_Matrix3x3I16 const *left_factor)
Definition matrices.c:11
int16_t Math_CalculateAtan2FP12(int32_t y, int32_t x)
BOOL Graphics_IsPolygonInDebugList(struct Graphics_Render_PolygonRenderRef *polygon_ref)
Definition meshes.c:515
void Graphics_ProcessMeshCommands(struct Mesh_CmdList *cmd_list, struct Material_Node **material_nodes, void *owner_context)
Definition meshes.c:70
static void set_uv_rectangle(struct Math_UV8 uv[4], uint8_t u, uint8_t v, uint8_t width_minus_one, uint8_t height_minus_one)
Definition meshes.c:315
static void swap_uvs(struct Math_UV8 *a, struct Math_UV8 *b)
Definition meshes.c:327
void Graphics_UpdateMeshCommandState(struct Mesh_CmdList *cmd_list)
Definition meshes.c:109
void Graphics_RenderFlatQuadCorners(struct Graphics_Render_FlatQuadActorView *actor, uint32_t xy0, uint32_t xy1, uint32_t xy2, uint32_t xy3)
Definition meshes.c:458
void Graphics_SetPolygonUVs(struct Scene_Node *node, struct Graphics_Render_PolygonBatchRecord *out_batch, struct Material_TableEntry *polygon_data, int16_t uv_index_or_sentinel, struct Mesh_RuntimeVertex **polygon_vertices)
Definition meshes.c:335
void Graphics_ComputeVertexColors(struct Mesh_RuntimeVertex *runtime_vertices, struct Graphics_Render_PolygonRenderRef *polygon_ref, uint32_t *out_colors)
Definition meshes.c:557
void Graphics_MarkMeshDirty(struct Mesh_CmdList *cmd_list)
Definition meshes.c:33
static void Graphics_ProjectFlatCorner(struct Graphics_ProjectedCorner *corner, int32_t x, int32_t z)
Definition meshes.c:448
uint8_t Signal_Poll(struct Signal_QueueEntry *event_buffer, int32_t max_events)
Definition signals.c:37
struct Math_Vec3F view
Definition billboard.h:10
struct Graphics_Render_ScreenVertexI16Z screen
Definition billboard.h:9
struct Material_TableEntry * material
Definition types.h:460
struct Math_Vec2I16 half_extents
Definition types.h:458
struct Math_Matrix3x3I16 rot_mat
Definition types.h:454
struct Math_Vec3I32 position
Definition types.h:456
struct Graphics_Render_ScreenVertexI16Z screen_vertices[0x4]
Definition types.h:512
struct Material_RuntimeDescriptor * texture_desc
Definition types.h:496
struct Graphics_Render_PolygonBatchRecord * next_in_bucket
Definition types.h:511
struct Math_UV8 tex_uvs[0x4]
Definition types.h:517
struct Math_Vec3F view_vertices[0x4]
Definition types.h:513
struct Math_SizeU8 dimensions_minus_1
Definition types.h:264
struct Math_UV8 uv_tile_offset
Definition types.h:367
struct Material_TextureInfo texture_info
Definition types.h:361
struct Math_UV8 explicit_uvs[0x4]
Definition types.h:378
struct Material_RuntimeDescriptor * texture_descriptor
Definition types.h:353
uint32_t material_tint
Definition types.h:357
uint32_t flags
Definition types.h:342
struct Math_ColorRGB8 color_adjust
Definition types.h:375
uint8_t b
Definition types.h:40
uint8_t g
Definition types.h:39
uint8_t r
Definition types.h:38
int16_t m21
Definition types.h:169
int16_t m00
Definition types.h:162
int16_t m01
Definition types.h:163
int16_t m12
Definition types.h:167
int16_t m11
Definition types.h:166
int16_t m20
Definition types.h:168
int16_t m22
Definition types.h:170
int16_t m02
Definition types.h:164
int16_t m10
Definition types.h:165
uint8_t width
Definition types.h:347
uint8_t height
Definition types.h:348
uint8_t v
Definition types.h:370
uint8_t u
Definition types.h:369
int16_t x
Definition types.h:402
int16_t y
Definition types.h:403
int16_t z
Definition types.h:460
int16_t x
Definition types.h:458
int16_t y
Definition types.h:459
struct Math_Vec3I16 normal
Definition types.h:951
int16_t count
Definition types.h:497
struct Mesh_Command ** cmdPtrs
Definition types.h:498
uint8_t flags
Definition types.h:495
Mesh_CommandFlags flags
Definition types.h:510
int32_t limit_q12
Definition types.h:514
uint8_t payload[0x1]
Definition types.h:515
enum Mesh_CommandType type
Definition types.h:508
int16_t signal_id
Definition types.h:512
int32_t progress_q12
Definition types.h:513
int16_t normal_group_index
Definition types.h:1116
struct Math_ColorRGB8 color
Definition types.h:1126
void * model_relocated_ptr_80
Definition types.h:163
struct Mesh_AccumulatedNormal * normal_table
Definition types.h:153
int16_t signal_id
Definition types.h:60
uint8_t event_type
Definition types.h:61
#define g_nodeViewTranslationY
Definition values.h:774
#define g_renderingStateFlag
Definition values.h:627
#define g_currentPolygonBatchIndex
Definition values.h:768
#define g_nodeViewTranslationZ
Definition values.h:777
#define g_nodeViewTranslationX
Definition values.h:771