38 int32_t count = (int32_t)cmd_list->
count;
47 (*cmd_ptrs)->progress_q12 = 0;
62 cmd_ptrs = &cmd_ptrs[1];
75 int32_t count = (int32_t)cmd_list->
count;
93 int32_t controller_type = (uint8_t)(color_controller->
type);
102 cmd_ptrs = &cmd_ptrs[1];
114 int32_t count = (int32_t)cmd_list->
count;
115 int32_t remaining_commands = count;
127 char advance_once = 0;
145 event_flags = command->
flags;
148 command->
flags = event_flags;
153 command->
flags = event_flags;
185 command->
flags = flags;
189 command->
flags = direction_flags;
194 command->
flags = event_flags;
218 command->
flags = direction_flags;
223 command->
flags = event_flags;
233 command->
flags = event_flags;
239 command->
flags = event_flags;
244 event_flags = command->
flags;
249 command->
flags = event_flags;
258 remaining_commands -= 1;
270 int32_t advanced_progress_q12 = command->
progress_q12 + step_q12;
278 if (advanced_progress_q12 >= limit_q12)
282 command->
progress_q12 = advanced_progress_q12 - limit_q12 - 0x800;
290 else if (advanced_progress_q12 <= 0)
292 if (advanced_progress_q12 < step_q12)
311 remaining_commands -= 1;
312 }
while (remaining_commands);
316 uint8_t width_minus_one, uint8_t height_minus_one)
318 uint8_t right = u + width_minus_one;
319 uint8_t bottom = v + height_minus_one;
321 uv[0] = (
struct Math_UV8){right, bottom};
339 uint32_t flags = polygon_data->
flags;
352 uint8_t tile_width_minus_one = width - 1;
353 uint8_t tile_height_minus_one = height - 1;
361 u = width / 2 - u - 1;
362 tile_width_minus_one /= 2;
368 v = height / 2 - v - 1;
369 tile_height_minus_one /= 2;
375 if (!polygon_vertices)
383 int count = polygon_vertices[3] ? 4 : 3;
384 for (
int i = 0; i < count; ++i)
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;
392 uv[i].
u = u + ((angle * width) >> 12);
398 if (uv_index_or_sentinel >= 0)
401 for (
int i = 0; i < 4; ++i)
403 uv[i].
u = table[uv_index_or_sentinel + i].
u +
u;
404 uv[i].
v = table[uv_index_or_sentinel + i].
v +
v;
409 for (
int i = 0; i < 4; ++i)
429 for (
int i = 0; i < turns; ++i)
438 if (uv_index_or_sentinel == -2)
440 else if (uv_index_or_sentinel == -3)
459 uint32_t xy0, uint32_t xy1, uint32_t xy2, uint32_t xy3)
469 {.screen.packed_screen = xy0}, {.screen.packed_screen = xy1},
470 {.screen.packed_screen = xy2}, {.screen.packed_screen = xy3}};
472 int16_t left = -right, back = -front;
479 for (
unsigned i = 0; i < 4; ++i)
495 uint32_t color = 0x808080;
503 for (
unsigned i = 0; i < 4; ++i)
522 if (debug_list_count <= 0)
525 int32_t debug_list_index = 0;
532 if (list_polygon_count <= 0)
535 int32_t polygon_index = 0;
537 if (list_polygon_count > 0)
541 if ((uintptr_t)polygon_ref == (uint32_t)polygon_address)
545 polygon_address += 0x18;
546 }
while (polygon_index < list_polygon_count);
549 debug_list_index += 1;
550 }
while (debug_list_index < debug_list_count);
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);
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);
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;
575 if (adjusted_red < 0)
577 else if (adjusted_red > 0xff)
580 int32_t source_green = (uint8_t)(source_vertex->
color.
g);
581 int32_t adjusted_green = source_green + material_green_adjust_byte - 0x80;
583 if (adjusted_green < 0)
585 else if (adjusted_green > 0xff)
586 adjusted_green = 0xff;
588 int32_t source_blue = (uint8_t)(source_vertex->
color.
b);
589 int32_t adjusted_blue = source_blue + blue_adjust;
591 if (adjusted_blue < 0)
593 else if (adjusted_blue > 0xff)
594 adjusted_blue = 0xff;
596 vertex_index_cursor = &vertex_index_cursor[1];
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];
602 if (!vertices_remaining)
#define MESH_CMD_AUTOPLAY
#define MESH_CMD_MODE_MASK
uint32_t Animation_PackedControllerState
uint8_t Mesh_CommandFlags
@ MESH_COMMAND_CONTROLLER
@ MESH_COMMAND_VERTEX_COLOR
@ MESH_EVENT_PLAY_FORWARD
@ MESH_EVENT_PLAY_REVERSE
@ MESH_EVENT_STEP_FORWARD
@ MESH_EVENT_STEP_REVERSE
@ MESH_EVENT_LATCH_STOP_IF_ACTIVE
bool Animation_ProcessController(struct Material_Node **material_nodes, Animation_PackedControllerState *packed_controller_state_in_out, int32_t frame_count_q12)
void Animation_ProcessVertexColor(struct Animation_VertexColorController *color_controller, struct Mesh_NodeExtended *mesh_node)
void Graphics_TransformViewCenter(const struct Math_Vec3I32 *world)
void Graphics_ProjectCorner(struct Graphics_ProjectedCorner *corner, int32_t x, int32_t y, int32_t z)
int Graphics_QuadDepthBucket(const struct Graphics_ProjectedCorner *corners)
uint32_t Graphics_FadeVertexColor(uint32_t color, uint32_t weight)
#define g_cameraTransformMatrix
#define Collision_DebugPolygonListCounts
#define Collision_DebugPolygonListCount
#define Collision_DebugPolygonListBases
#define GAME_OVERLAY_SKIP_NODE_ANIMATION
#define GAME_TRANSITION_COLOR_FADE
#define Game_FrameTransitionFlags
#define Game_FrameOverlayFlags
#define g_currentGameMode
#define MESH_COMMAND_LIST_SKIP_RESET
#define GRAPHICS_CAP_SKIP_COMMAND_CONTROLLER
#define g_polygonBatchRecords
#define g_graphicsCapabilities_high_byte
#define render_list_state
#define MATERIAL_BLEND_MODE_HIGH
#define MATERIAL_UV_ROTATE_HALF
#define MATERIAL_DEPTH_SORT
#define MATERIAL_TILE_V_FIRST
#define MATERIAL_ENVIRONMENT_UV
#define MATERIAL_BLEND_ENABLED
#define MATERIAL_EXPLICIT_UV
#define MATERIAL_TILE_U_SECOND
#define MATERIAL_TILE_V_SECOND
#define MATERIAL_UV_ROTATE_QUARTER
#define MATERIAL_TILE_U_FIRST
#define MATERIAL_BLEND_MODE_LOW
#define g_currentRenderMaterial
void Math_MulMat3x3Q12(struct Math_Matrix3x3I16 *out_matrix, struct Math_Matrix3x3I16 const *right_factor, struct Math_Matrix3x3I16 const *left_factor)
int16_t Math_CalculateAtan2FP12(int32_t y, int32_t x)
BOOL Graphics_IsPolygonInDebugList(struct Graphics_Render_PolygonRenderRef *polygon_ref)
void Graphics_ProcessMeshCommands(struct Mesh_CmdList *cmd_list, struct Material_Node **material_nodes, void *owner_context)
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)
static void swap_uvs(struct Math_UV8 *a, struct Math_UV8 *b)
void Graphics_UpdateMeshCommandState(struct Mesh_CmdList *cmd_list)
void Graphics_RenderFlatQuadCorners(struct Graphics_Render_FlatQuadActorView *actor, uint32_t xy0, uint32_t xy1, uint32_t xy2, uint32_t xy3)
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)
void Graphics_ComputeVertexColors(struct Mesh_RuntimeVertex *runtime_vertices, struct Graphics_Render_PolygonRenderRef *polygon_ref, uint32_t *out_colors)
void Graphics_MarkMeshDirty(struct Mesh_CmdList *cmd_list)
static void Graphics_ProjectFlatCorner(struct Graphics_ProjectedCorner *corner, int32_t x, int32_t z)
uint8_t Signal_Poll(struct Signal_QueueEntry *event_buffer, int32_t max_events)
struct Graphics_Render_ScreenVertexI16Z screen
struct Material_TableEntry * material
struct Math_Vec2I16 half_extents
struct Math_Matrix3x3I16 rot_mat
struct Math_Vec3I32 position
struct Graphics_Render_ScreenVertexI16Z screen_vertices[0x4]
struct Material_RuntimeDescriptor * texture_desc
struct Graphics_Render_PolygonBatchRecord * next_in_bucket
uint32_t render_state_flags
struct Math_UV8 tex_uvs[0x4]
struct Math_Vec3F view_vertices[0x4]
uint32_t vertex_colors[0x4]
uint16_t vertex_indices[0x4]
struct Math_SizeU8 dimensions_minus_1
struct Math_UV8 uv_tile_offset
struct Material_TextureInfo texture_info
struct Math_UV8 explicit_uvs[0x4]
struct Material_RuntimeDescriptor * texture_descriptor
struct Math_ColorRGB8 color_adjust
struct Math_Vec3I16 normal
struct Mesh_Command ** cmdPtrs
enum Mesh_CommandType type
int16_t normal_group_index
struct Math_ColorRGB8 color
void * model_relocated_ptr_80
struct Mesh_AccumulatedNormal * normal_table
#define g_nodeViewTranslationY
#define g_renderingStateFlag
#define g_currentPolygonBatchIndex
#define g_nodeViewTranslationZ
#define g_nodeViewTranslationX