58 int32_t *fourth_screen_vertex;
59 int32_t projection_state_or_face_flags_bits;
60 int32_t fourth_projection_y_q12;
61 int32_t fourth_screen_x;
65 int32_t vertex0_scale4_index = (uint16_t)(polygon_ref->
vertex_indices[0]);
68 int32_t vertex0_scale4_model_z = (int32_t)runtime_vertices[vertex0_scale4_index].pos.z;
69 struct Math_Vec3I16 *vertex0_scale4_position = &runtime_vertices[vertex0_scale4_index].
pos;
70 int32_t vertex0_scale4_model_y = (int32_t)vertex0_scale4_position->
y;
71 int32_t vertex0_scale4_model_x = (int32_t)vertex0_scale4_position->
x;
77 (float)((
long double)vertex0_scale4_view_x_fp * (
long double)0.015625f);
79 (float)((
long double)vertex0_scale4_view_y_fp * (
long double)0.015625f);
81 (float)((
long double)vertex0_scale4_view_z_fp * (
long double)0.015625f);
89 int32_t vertex0_scale4_focal_distance = vertex0_scale4_render_state->
focal_distance;
90 int32_t vertex0_scale4_perspective_scale =
91 ((int64_t)vertex0_scale4_focal_distance *
MATH_Q12_ONE) / vertex0_scale4_view_z_fp;
92 int64_t vertex0_scale4_projection_x_product = (int64_t)vertex0_scale4_perspective_scale * vertex0_scale4_view_x_fp;
93 int32_t vertex0_scale4_screen_x =
94 (((int32_t)(uint32_t)((uint64_t)vertex0_scale4_projection_x_product >> 12)) >> 0xc) + (
Graphics_WindowWidth >> 1);
95 int64_t vertex0_scale4_projection_y_product = (int64_t)vertex0_scale4_perspective_scale * vertex0_scale4_view_y_fp;
96 int32_t vertex0_scale4_screen_y =
97 (((int32_t)(uint32_t)((uint64_t)vertex0_scale4_projection_y_product >> 12)) >> 0xc) + (
Graphics_WindowHeight >> 1);
99 if (vertex0_scale4_screen_x != (int32_t)(int16_t)vertex0_scale4_screen_x || vertex0_scale4_screen_y != (int32_t)(int16_t)vertex0_scale4_screen_y)
108 int32_t vertex1_scale4_index = (uint16_t)(polygon_ref->
vertex_indices[1]);
109 int32_t vertex1_scale4_model_z = (int32_t)runtime_vertices[vertex1_scale4_index].pos.z;
110 struct Math_Vec3I16 *vertex1_scale4_position = &runtime_vertices[vertex1_scale4_index].
pos;
111 int32_t vertex1_scale4_model_y = (int32_t)vertex1_scale4_position->
y;
112 int32_t vertex1_scale4_model_x = (int32_t)vertex1_scale4_position->
x;
118 (float)((
long double)vertex1_scale4_view_x_fp * (
long double)0.015625f);
120 (float)((
long double)vertex1_scale4_view_y_fp * (
long double)0.015625f);
122 (float)((
long double)vertex1_scale4_view_z_fp * (
long double)0.015625f);
130 int32_t vertex1_scale4_focal_distance = vertex1_scale4_render_state->
focal_distance;
131 int32_t vertex1_scale4_perspective_scale =
132 ((int64_t)vertex1_scale4_focal_distance *
MATH_Q12_ONE) / vertex1_scale4_view_z_fp;
133 int64_t vertex1_scale4_projection_x_product = (int64_t)vertex1_scale4_perspective_scale * vertex1_scale4_view_x_fp;
134 int32_t vertex1_scale4_screen_x =
135 (((int32_t)(uint32_t)((uint64_t)vertex1_scale4_projection_x_product >> 12)) >> 0xc) + (
Graphics_WindowWidth >> 1);
136 int64_t vertex1_scale4_projection_y_product = (int64_t)vertex1_scale4_perspective_scale * vertex1_scale4_view_y_fp;
137 int32_t vertex1_scale4_screen_y =
138 (((int32_t)(uint32_t)((uint64_t)vertex1_scale4_projection_y_product >> 12)) >> 0xc) + (
Graphics_WindowHeight >> 1);
140 if (vertex1_scale4_screen_x != (int32_t)(int16_t)vertex1_scale4_screen_x || vertex1_scale4_screen_y != (int32_t)(int16_t)vertex1_scale4_screen_y)
149 int32_t vertex2_scale4_index = (uint16_t)(polygon_ref->
vertex_indices[2]);
150 struct Math_Vec3I16 *vertex2_scale4_position = &runtime_vertices[vertex2_scale4_index].
pos;
151 int32_t vertex2_z_scale4 = (int32_t)runtime_vertices[vertex2_scale4_index].pos.z;
152 int32_t vertex2_scale4_model_y = (int32_t)vertex2_scale4_position->
y;
153 int32_t vertex2_scale4_model_x = (int32_t)vertex2_scale4_position->
x;
158 projection_state_or_face_flags_bits = vertex2_scale4_view_z_fp;
160 (float)((
long double)vertex2_scale4_view_x_fp * (
long double)0.015625f);
162 (float)((
long double)vertex2_scale4_view_y_fp * (
long double)0.015625f);
164 (float)((
long double)vertex2_scale4_view_z_fp * (
long double)0.015625f);
170 if (projection_state_or_face_flags_bits > vertex2_scale4_render_state->
projection_near_fp)
172 int32_t vertex2_scale4_focal_distance = vertex2_scale4_render_state->
focal_distance;
173 int32_t vertex2_scale4_perspective_scale = ((int64_t)vertex2_scale4_focal_distance *
MATH_Q12_ONE) / vertex2_scale4_view_z_fp;
174 int64_t vertex2_scale4_projection_x_product = (int64_t)vertex2_scale4_perspective_scale * vertex2_scale4_view_x_fp;
175 int32_t vertex2_scale4_screen_x =
176 (((int32_t)(uint32_t)((uint64_t)vertex2_scale4_projection_x_product >> 12)) >> 0xc) + (
Graphics_WindowWidth >> 1);
177 int64_t vertex2_scale4_projection_y_product = (int64_t)vertex2_scale4_perspective_scale * vertex2_scale4_view_y_fp;
179 projection_state_or_face_flags_bits =
180 (((int32_t)(uint32_t)((uint64_t)vertex2_scale4_projection_y_product >> 12)) >> 0xc) + (
Graphics_WindowHeight >> 1);
182 if (vertex2_scale4_screen_x != (int32_t)(int16_t)vertex2_scale4_screen_x || projection_state_or_face_flags_bits != (int32_t)(int16_t)projection_state_or_face_flags_bits)
198 int32_t vertex3_scale4_index = (uint16_t)(polygon_ref->
vertex_indices[3]);
199 struct Math_Vec3I16 *vertex3_scale4_position = &runtime_vertices[vertex3_scale4_index].
pos;
200 int32_t vertex3_z_scale4 = (int32_t)runtime_vertices[vertex3_scale4_index].pos.z;
201 int32_t vertex3_scale4_model_y = (int32_t)vertex3_scale4_position->
y;
202 int32_t vertex3_scale4_model_x = (int32_t)vertex3_scale4_position->
x;
207 projection_state_or_face_flags_bits = vertex3_scale4_view_z_fp;
209 (float)((
long double)vertex3_scale4_view_x_fp * (
long double)0.015625f);
211 (float)((
long double)vertex3_scale4_view_y_fp * (
long double)0.015625f);
213 (float)((
long double)vertex3_scale4_view_z_fp * (
long double)0.015625f);
219 if (projection_state_or_face_flags_bits > vertex3_scale4_render_state->
projection_near_fp)
221 int32_t vertex3_scale4_focal_distance = vertex3_scale4_render_state->
focal_distance;
222 int32_t vertex3_scale4_perspective_scale = ((int64_t)vertex3_scale4_focal_distance *
MATH_Q12_ONE) / vertex3_scale4_view_z_fp;
223 int64_t vertex3_scale4_projection_x_product = (int64_t)vertex3_scale4_perspective_scale * vertex3_scale4_view_x_fp;
225 fourth_screen_x = (((int32_t)(uint32_t)((uint64_t)vertex3_scale4_projection_x_product >> 12)) >> 0xc) + (
Graphics_WindowWidth >> 1);
227 int64_t vertex3_scale4_projection_y_product = (int64_t)vertex3_scale4_perspective_scale * vertex3_scale4_view_y_fp;
229 fourth_projection_y_q12 = (int32_t)(uint32_t)((uint64_t)vertex3_scale4_projection_y_product >> 12);
231 projection_state_or_face_flags_bits = (fourth_projection_y_q12 >> 0xc) + (
Graphics_WindowHeight >> 1);
233 if (fourth_screen_x != (int32_t)(int16_t)fourth_screen_x || projection_state_or_face_flags_bits != (int32_t)(int16_t)projection_state_or_face_flags_bits)
246 fourth_screen_vertex = NULL;
250 int32_t vertex0_scale6_index = (uint16_t)(polygon_ref->
vertex_indices[0]);
251 struct Math_Vec3I16 *vertex0_scale6_position = &runtime_vertices[vertex0_scale6_index].
pos;
252 int32_t vertex0_z_scale6 = (int32_t)runtime_vertices[vertex0_scale6_index].pos.z;
253 int32_t vertex0_scale6_model_y = (int32_t)vertex0_scale6_position->
y;
254 int32_t vertex0_scale6_model_x = (int32_t)vertex0_scale6_position->
x;
260 (float)((
long double)vertex0_scale6_view_x_fp * (
long double)0.015625f);
262 (float)((
long double)vertex0_scale6_view_y_fp * (
long double)0.015625f);
264 (float)((
long double)vertex0_scale6_view_z_fp * (
long double)0.015625f);
272 int32_t vertex0_scale6_focal_distance = vertex0_scale6_render_state->
focal_distance;
273 int32_t vertex0_scale6_perspective_scale =
274 ((int64_t)vertex0_scale6_focal_distance *
MATH_Q12_ONE) / vertex0_scale6_view_z_fp;
275 int64_t vertex0_scale6_projection_x_product = (int64_t)vertex0_scale6_perspective_scale * vertex0_scale6_view_x_fp;
276 int32_t vertex0_scale6_screen_x =
277 (((int32_t)(uint32_t)((uint64_t)vertex0_scale6_projection_x_product >> 12)) >> 0xc) + (
Graphics_WindowWidth >> 1);
278 int64_t vertex0_scale6_projection_y_product = (int64_t)vertex0_scale6_perspective_scale * vertex0_scale6_view_y_fp;
279 int32_t vertex0_scale6_screen_y =
280 (((int32_t)(uint32_t)((uint64_t)vertex0_scale6_projection_y_product >> 12)) >> 0xc) + (
Graphics_WindowHeight >> 1);
282 if (vertex0_scale6_screen_x != (int32_t)(int16_t)vertex0_scale6_screen_x || vertex0_scale6_screen_y != (int32_t)(int16_t)vertex0_scale6_screen_y)
291 int32_t vertex1_scale6_index = (uint16_t)(polygon_ref->
vertex_indices[1]);
292 struct Math_Vec3I16 *vertex1_scale6_position = &runtime_vertices[vertex1_scale6_index].
pos;
293 int32_t vertex1_z_scale6 = (int32_t)runtime_vertices[vertex1_scale6_index].pos.z;
294 int32_t vertex1_scale6_model_y = (int32_t)vertex1_scale6_position->
y;
295 int32_t vertex1_scale6_model_x = (int32_t)vertex1_scale6_position->
x;
301 (float)((
long double)vertex1_scale6_view_x_fp * (
long double)0.015625f);
303 (float)((
long double)vertex1_scale6_view_y_fp * (
long double)0.015625f);
305 (float)((
long double)vertex1_scale6_view_z_fp * (
long double)0.015625f);
313 int32_t vertex1_scale6_focal_distance = vertex1_scale6_render_state->
focal_distance;
314 int32_t vertex1_scale6_perspective_scale =
315 ((int64_t)vertex1_scale6_focal_distance *
MATH_Q12_ONE) / vertex1_scale6_view_z_fp;
316 int64_t vertex1_scale6_projection_x_product = (int64_t)vertex1_scale6_perspective_scale * vertex1_scale6_view_x_fp;
317 int32_t vertex1_scale6_screen_x =
318 (((int32_t)(uint32_t)((uint64_t)vertex1_scale6_projection_x_product >> 12)) >> 0xc) + (
Graphics_WindowWidth >> 1);
319 int64_t vertex1_scale6_projection_y_product = (int64_t)vertex1_scale6_perspective_scale * vertex1_scale6_view_y_fp;
320 int32_t vertex1_scale6_screen_y =
321 (((int32_t)(uint32_t)((uint64_t)vertex1_scale6_projection_y_product >> 12)) >> 0xc) + (
Graphics_WindowHeight >> 1);
323 if (vertex1_scale6_screen_x != (int32_t)(int16_t)vertex1_scale6_screen_x || vertex1_scale6_screen_y != (int32_t)(int16_t)vertex1_scale6_screen_y)
332 int32_t vertex2_scale6_index = (uint16_t)(polygon_ref->
vertex_indices[2]);
333 struct Math_Vec3I16 *vertex2_scale6_position = &runtime_vertices[vertex2_scale6_index].
pos;
334 int32_t vertex2_z_scale6 = (int32_t)runtime_vertices[vertex2_scale6_index].pos.z;
335 int32_t vertex2_scale6_model_y = (int32_t)vertex2_scale6_position->
y;
336 int32_t vertex2_scale6_model_x = (int32_t)vertex2_scale6_position->
x;
342 (float)((
long double)vertex2_scale6_view_x_fp * (
long double)0.015625f);
344 (float)((
long double)vertex2_scale6_view_y_fp * (
long double)0.015625f);
346 (float)((
long double)vertex2_scale6_view_z_fp * (
long double)0.015625f);
354 int32_t vertex2_scale6_focal_distance = vertex2_scale6_render_state->
focal_distance;
355 int32_t vertex2_scale6_perspective_scale =
356 ((int64_t)vertex2_scale6_focal_distance *
MATH_Q12_ONE) / vertex2_scale6_view_z_fp;
357 int64_t vertex2_scale6_projection_x_product = (int64_t)vertex2_scale6_perspective_scale * vertex2_scale6_view_x_fp;
358 int32_t vertex2_scale6_screen_x =
359 (((int32_t)(uint32_t)((uint64_t)vertex2_scale6_projection_x_product >> 12)) >> 0xc) + (
Graphics_WindowWidth >> 1);
360 int64_t vertex2_scale6_projection_y_product = (int64_t)vertex2_scale6_perspective_scale * vertex2_scale6_view_y_fp;
361 int32_t vertex2_scale6_screen_y =
362 (((int32_t)(uint32_t)((uint64_t)vertex2_scale6_projection_y_product >> 12)) >> 0xc) + (
Graphics_WindowHeight >> 1);
364 if (vertex2_scale6_screen_x != (int32_t)(int16_t)vertex2_scale6_screen_x || vertex2_scale6_screen_y != (int32_t)(int16_t)vertex2_scale6_screen_y)
377 int32_t vertex3_scale6_index = (uint16_t)(polygon_ref->
vertex_indices[3]);
378 struct Math_Vec3I16 *vertex3_scale6_position = &runtime_vertices[vertex3_scale6_index].
pos;
379 int32_t vertex3_z_scale6 = (int32_t)runtime_vertices[vertex3_scale6_index].pos.z;
380 int32_t vertex3_scale6_model_y = (int32_t)vertex3_scale6_position->
y;
381 int32_t vertex3_scale6_model_x = (int32_t)vertex3_scale6_position->
x;
386 projection_state_or_face_flags_bits = vertex3_scale6_view_z_fp;
388 (float)((
long double)vertex3_scale6_view_x_fp * (
long double)0.015625f);
390 (float)((
long double)vertex3_scale6_view_y_fp * (
long double)0.015625f);
392 (float)((
long double)vertex3_scale6_view_z_fp * (
long double)0.015625f);
398 if (projection_state_or_face_flags_bits > vertex3_scale6_render_state->
projection_near_fp)
400 int32_t vertex3_scale6_focal_distance = vertex3_scale6_render_state->
focal_distance;
401 int32_t vertex3_scale6_perspective_scale =
402 ((int64_t)vertex3_scale6_focal_distance *
MATH_Q12_ONE) / vertex3_scale6_view_z_fp;
403 int64_t vertex3_scale6_projection_x_product = (int64_t)vertex3_scale6_perspective_scale * vertex3_scale6_view_x_fp;
404 int32_t vertex3_scale6_screen_x = (((int32_t)(uint32_t)((uint64_t)vertex3_scale6_projection_x_product >> 12)) >> 0xc) + (
Graphics_WindowWidth >> 1);
405 int64_t vertex3_scale6_projection_y_product = (int64_t)vertex3_scale6_perspective_scale * vertex3_scale6_view_y_fp;
407 projection_state_or_face_flags_bits = (((int32_t)(uint32_t)((uint64_t)vertex3_scale6_projection_y_product >> 12)) >> 0xc) + (
Graphics_WindowHeight >> 1);
409 if (vertex3_scale6_screen_x != (int32_t)(int16_t)vertex3_scale6_screen_x || projection_state_or_face_flags_bits != (int32_t)(int16_t)projection_state_or_face_flags_bits)
423 projection_state_or_face_flags_bits = 0;
424 fourth_screen_vertex = NULL;
432 int32_t vertex0_scale10_index = (uint16_t)(polygon_ref->
vertex_indices[0]);
433 struct Math_Vec3I16 *vertex0_scale10_position = &runtime_vertices[vertex0_scale10_index].
pos;
434 int32_t vertex0_z_scale10 = (int32_t)runtime_vertices[vertex0_scale10_index].pos.z;
435 int32_t vertex0_scale10_model_y = (int32_t)vertex0_scale10_position->
y;
436 int32_t vertex0_scale10_model_x = (int32_t)vertex0_scale10_position->
x;
442 (float)((
long double)vertex0_scale10_view_x_fp * (
long double)0.015625f);
444 (float)((
long double)vertex0_scale10_view_y_fp * (
long double)0.015625f);
446 (float)((
long double)vertex0_scale10_view_z_fp * (
long double)0.015625f);
454 int32_t vertex0_scale10_focal_distance = vertex0_scale10_render_state->
focal_distance;
455 int32_t vertex0_scale10_perspective_scale =
456 ((int64_t)vertex0_scale10_focal_distance *
MATH_Q12_ONE) / vertex0_scale10_view_z_fp;
457 int64_t vertex0_scale10_projection_x_product = (int64_t)vertex0_scale10_perspective_scale * vertex0_scale10_view_x_fp;
458 int32_t vertex0_scale10_screen_x =
459 (((int32_t)(uint32_t)((uint64_t)vertex0_scale10_projection_x_product >> 12)) >> 0xc) + (
Graphics_WindowWidth >> 1);
460 int64_t vertex0_scale10_projection_y_product = (int64_t)vertex0_scale10_perspective_scale * vertex0_scale10_view_y_fp;
461 int32_t vertex0_scale10_screen_y =
462 (((int32_t)(uint32_t)((uint64_t)vertex0_scale10_projection_y_product >> 12)) >> 0xc) + (
Graphics_WindowHeight >> 1);
464 if (vertex0_scale10_screen_x != (int32_t)(int16_t)vertex0_scale10_screen_x || vertex0_scale10_screen_y != (int32_t)(int16_t)vertex0_scale10_screen_y)
473 int32_t vertex1_scale10_index = (uint16_t)(polygon_ref->
vertex_indices[1]);
474 struct Math_Vec3I16 *vertex1_scale10_position = &runtime_vertices[vertex1_scale10_index].
pos;
475 int32_t vertex1_z_scale10 = (int32_t)runtime_vertices[vertex1_scale10_index].pos.z;
476 int32_t vertex1_scale10_model_y = (int32_t)vertex1_scale10_position->
y;
477 int32_t vertex1_scale10_model_x = (int32_t)vertex1_scale10_position->
x;
483 (float)((
long double)vertex1_scale10_view_x_fp * (
long double)0.015625f);
485 (float)((
long double)vertex1_scale10_view_y_fp * (
long double)0.015625f);
487 (float)((
long double)vertex1_scale10_view_z_fp * (
long double)0.015625f);
495 int32_t vertex1_scale10_focal_distance = vertex1_scale10_render_state->
focal_distance;
496 int32_t vertex1_scale10_perspective_scale =
497 ((int64_t)vertex1_scale10_focal_distance *
MATH_Q12_ONE) / vertex1_scale10_view_z_fp;
498 int64_t vertex1_scale10_projection_x_product = (int64_t)vertex1_scale10_perspective_scale * vertex1_scale10_view_x_fp;
499 int32_t vertex1_scale10_screen_x =
500 (((int32_t)(uint32_t)((uint64_t)vertex1_scale10_projection_x_product >> 12)) >> 0xc) + (
Graphics_WindowWidth >> 1);
501 int64_t vertex1_scale10_projection_y_product = (int64_t)vertex1_scale10_perspective_scale * vertex1_scale10_view_y_fp;
502 int32_t vertex1_scale10_screen_y =
503 (((int32_t)(uint32_t)((uint64_t)vertex1_scale10_projection_y_product >> 12)) >> 0xc) + (
Graphics_WindowHeight >> 1);
505 if (vertex1_scale10_screen_x != (int32_t)(int16_t)vertex1_scale10_screen_x || vertex1_scale10_screen_y != (int32_t)(int16_t)vertex1_scale10_screen_y)
514 int32_t vertex2_scale10_index = (uint16_t)(polygon_ref->
vertex_indices[2]);
515 struct Math_Vec3I16 *vertex2_scale10_position = &runtime_vertices[vertex2_scale10_index].
pos;
516 int32_t vertex2_z_scale10 = (int32_t)runtime_vertices[vertex2_scale10_index].pos.z;
517 int32_t vertex2_scale10_model_y = (int32_t)vertex2_scale10_position->
y;
518 int32_t vertex2_scale10_model_x = (int32_t)vertex2_scale10_position->
x;
524 (float)((
long double)vertex2_scale10_view_x_fp * (
long double)0.015625f);
526 (float)((
long double)vertex2_scale10_view_y_fp * (
long double)0.015625f);
528 (float)((
long double)vertex2_scale10_view_z_fp * (
long double)0.015625f);
536 int32_t vertex2_scale10_focal_distance = vertex2_scale10_render_state->
focal_distance;
537 int32_t vertex2_scale10_perspective_scale =
538 ((int64_t)vertex2_scale10_focal_distance *
MATH_Q12_ONE) / vertex2_scale10_view_z_fp;
539 int64_t vertex2_scale10_projection_x_product = (int64_t)vertex2_scale10_perspective_scale * vertex2_scale10_view_x_fp;
540 int32_t vertex2_scale10_screen_x =
541 (((int32_t)(uint32_t)((uint64_t)vertex2_scale10_projection_x_product >> 12)) >> 0xc) + (
Graphics_WindowWidth >> 1);
542 int64_t vertex2_scale10_projection_y_product = (int64_t)vertex2_scale10_perspective_scale * vertex2_scale10_view_y_fp;
543 int32_t vertex2_scale10_screen_y =
544 (((int32_t)(uint32_t)((uint64_t)vertex2_scale10_projection_y_product >> 12)) >> 0xc) + (
Graphics_WindowHeight >> 1);
546 if (vertex2_scale10_screen_x != (int32_t)(int16_t)vertex2_scale10_screen_x || vertex2_scale10_screen_y != (int32_t)(int16_t)vertex2_scale10_screen_y)
559 int32_t vertex3_scale10_index = (uint16_t)(polygon_ref->
vertex_indices[3]);
560 struct Math_Vec3I16 *vertex3_scale10_position = &runtime_vertices[vertex3_scale10_index].
pos;
561 int32_t vertex3_z_scale10 = (int32_t)runtime_vertices[vertex3_scale10_index].pos.z;
562 int32_t vertex3_scale10_model_y = (int32_t)vertex3_scale10_position->
y;
563 int32_t vertex3_scale10_model_x = (int32_t)vertex3_scale10_position->
x;
568 projection_state_or_face_flags_bits = vertex3_scale10_view_z_fp;
570 (float)((
long double)vertex3_scale10_view_x_fp * (
long double)0.015625f);
572 (float)((
long double)vertex3_scale10_view_y_fp * (
long double)0.015625f);
574 (float)((
long double)vertex3_scale10_view_z_fp * (
long double)0.015625f);
580 if (projection_state_or_face_flags_bits > vertex3_scale10_render_state->
projection_near_fp)
582 int32_t vertex3_scale10_focal_distance = vertex3_scale10_render_state->
focal_distance;
583 int32_t vertex3_scale10_perspective_scale = ((int64_t)vertex3_scale10_focal_distance *
MATH_Q12_ONE) / vertex3_scale10_view_z_fp;
584 int64_t vertex3_scale10_projection_x_product = (int64_t)vertex3_scale10_perspective_scale * vertex3_scale10_view_x_fp;
586 fourth_screen_x = (((int32_t)(uint32_t)((uint64_t)vertex3_scale10_projection_x_product >> 12)) >> 0xc) + (
Graphics_WindowWidth >> 1);
588 int64_t vertex3_scale10_projection_y_product = (int64_t)vertex3_scale10_perspective_scale * vertex3_scale10_view_y_fp;
590 fourth_projection_y_q12 = (int32_t)(uint32_t)((uint64_t)vertex3_scale10_projection_y_product >> 12);
592 projection_state_or_face_flags_bits = (fourth_projection_y_q12 >> 0xc) + (
Graphics_WindowHeight >> 1);
594 if (fourth_screen_x != (int32_t)(int16_t)fourth_screen_x || projection_state_or_face_flags_bits != (int32_t)(int16_t)projection_state_or_face_flags_bits)
608 projection_state_or_face_flags_bits = 0;
609 fourth_screen_vertex = NULL;
621 uint16_t polygon_flags = polygon_ref->
flags;
622 int32_t oriented_depth_bias;
630 if (face_normal_dot_view + plane_dist >= 0)
632 oriented_depth_bias = depth_bias_q12 << 3;
641 oriented_depth_bias = -((depth_bias_q12 << 3));
647 polygon_ref->
flags = (uint16_t)polygon_flags;
652 int32_t initial_uv_vertex0_index = (uint16_t)(polygon_ref->
vertex_indices[0]);
655 initial_uv_vertices[0] = &runtime_vertices[initial_uv_vertex0_index];
657 int32_t initial_uv_vertex1_index = (uint16_t)(polygon_ref->
vertex_indices[1]);
658 int32_t initial_uv_vertex2_index = (uint16_t)(polygon_ref->
vertex_indices[2]);
659 void *initial_uv_vertex_or_index_bits = &runtime_vertices[initial_uv_vertex1_index];
661 initial_uv_vertices[1] = initial_uv_vertex_or_index_bits;
665 initial_uv_vertices[2] = &runtime_vertices[initial_uv_vertex2_index];
667 if (initial_uv_has_fourth_vertex)
669 int32_t initial_uv_vertex3_index = (uint16_t)(polygon_ref->
vertex_indices[3]);
671 initial_uv_vertices[3] = &runtime_vertices[initial_uv_vertex3_index];
674 initial_uv_vertices[3] = 0;
697 deferred_material = NULL;
700 deferred_material = initial_material;
704 int32_t linked_uv_vertex0_index = (uint16_t)(polygon_ref->
vertex_indices[0]);
705 int32_t linked_uv_vertex1_index = (uint16_t)(polygon_ref->
vertex_indices[1]);
708 linked_uv_vertices[0] = &runtime_vertices[linked_uv_vertex0_index];
710 int32_t linked_uv_vertex2_index = (uint16_t)(polygon_ref->
vertex_indices[2]);
712 linked_uv_vertices[1] = &runtime_vertices[linked_uv_vertex1_index];
714 void *linked_uv_vertex_or_index_bits = &runtime_vertices[linked_uv_vertex2_index];
717 linked_uv_vertices[2] = linked_uv_vertex_or_index_bits;
719 if (linked_uv_has_fourth_vertex)
721 int32_t linked_uv_vertex3_index = (uint16_t)(polygon_ref->
vertex_indices[3]);
723 linked_uv_vertex_or_index_bits = &runtime_vertices[linked_uv_vertex3_index];
724 linked_uv_vertices[3] = linked_uv_vertex_or_index_bits;
727 linked_uv_vertices[3] = 0;
733 int32_t depth_comparison_flag = 1;
734 long double first_three_depth_sum = (
long double)saved_vertex2_view_z + (
long double)saved_vertex1_view_z + (
long double)saved_vertex0_view_z;
735 long double first_depth_extended = (
long double)saved_vertex0_view_z;
736 long double second_depth_extended = (
long double)saved_vertex1_view_z;
738 if (!((first_depth_extended == second_depth_extended)))
739 depth_comparison_flag = 0;
741 long double depth_equality_flag_extended = (
long double)depth_comparison_flag;
742 long double third_depth_extended = (
long double)saved_vertex2_view_z;
744 long double scaled_sort_depth;
746 if ((depth_equality_flag_extended == third_depth_extended))
748 else if (!fourth_screen_vertex)
753 int32_t scaled_depth_integer =
__ftol_msvc(scaled_sort_depth);
755 if (scaled_depth_integer > 0x3fff)
756 scaled_depth_integer = 0x3fff;
758 int32_t depth_bucket_index = 0x3fff - scaled_depth_integer;
760 if (depth_bucket_index < 1)
761 depth_bucket_index = 1;
762 else if (depth_bucket_index > 0x3fff)
763 depth_bucket_index = 0x3fff;
769 uint32_t flags = out_batch->
flags;
773 if (depth_bucket_index < 1)
774 depth_bucket_index = 1;
795 (uint16_t)((uint32_t)vertex0_packed_screen_xy >> 16);
802 (uint16_t)((uint32_t)vertex1_packed_screen_xy >> 16);
809 (uint16_t)((uint32_t)vertex2_packed_screen_xy >> 16);
821 if (fourth_screen_vertex)
823 int32_t vertex3_packed_screen_xy = *(uint32_t *)fourth_screen_vertex;
842 if (fourth_screen_vertex)
854 uint32_t vertex0_color_before_fade = out_batch->
vertex_colors[0];
855 int32_t vertex0_green_before_fade = (uint8_t)((uint8_t)((uint32_t)vertex0_color_before_fade >> 8));
856 uint32_t vertex1_color_before_fade = out_batch->
vertex_colors[1];
858 out_batch->
vertex_colors[0] = (((vertex0_green_before_fade * fade_intensity_q12) & 0xff000) | ((uint32_t)(uint8_t)vertex0_color_before_fade * fade_intensity_q12) >> 8) >> 4 | (((vertex0_color_before_fade >> 0xc & 0xff0) * fade_intensity_q12) & 0xff0000);
860 int32_t vertex1_green_before_fade = (uint8_t)((uint8_t)((uint32_t)vertex1_color_before_fade >> 8));
861 uint32_t vertex2_color_before_fade = out_batch->
vertex_colors[2];
863 out_batch->
vertex_colors[1] = (((vertex1_green_before_fade * fade_intensity_q12) & 0xff000) | ((uint32_t)(uint8_t)vertex1_color_before_fade * fade_intensity_q12) >> 8) >> 4 | (((vertex1_color_before_fade >> 0xc & 0xff0) * fade_intensity_q12) & 0xff0000);
865 int32_t vertex2_green_before_fade = (uint8_t)((uint8_t)((uint32_t)vertex2_color_before_fade >> 8));
866 uint32_t vertex3_color_before_fade = out_batch->
vertex_colors[3];
868 out_batch->
vertex_colors[2] = (((vertex2_green_before_fade * fade_intensity_q12) & 0xff000) | ((uint32_t)(uint8_t)vertex2_color_before_fade * fade_intensity_q12) >> 8) >> 4 | (((vertex2_color_before_fade >> 0xc & 0xff0) * fade_intensity_q12) & 0xff0000);
870 int32_t vertex3_green_before_fade = (uint8_t)((uint8_t)((uint32_t)vertex3_color_before_fade >> 8));
872 runtime_vertices = saved_runtime_vertices;
873 out_batch->
vertex_colors[3] = (((vertex3_green_before_fade * fade_intensity_q12) & 0xff000) | ((uint32_t)(uint8_t)vertex3_color_before_fade * fade_intensity_q12) >> 8) >> 4 | (((vertex3_color_before_fade >> 0xc & 0xff0) * fade_intensity_q12) & 0xff0000);
900 int32_t second_pass_uv_vertex0_index = (uint16_t)(polygon_ref->
vertex_indices[0]);
902 deferred_material = NULL;
906 second_pass_uv_vertices[0] = &runtime_vertices[second_pass_uv_vertex0_index];
908 int32_t second_pass_uv_vertex1_index = (uint16_t)(polygon_ref->
vertex_indices[1]);
910 second_pass_uv_vertices[1] = &runtime_vertices[second_pass_uv_vertex1_index];
912 int32_t second_pass_uv_vertex2_index = (uint16_t)(polygon_ref->
vertex_indices[2]);
913 void *second_pass_uv_vertex_flags_or_index_bits = &runtime_vertices[second_pass_uv_vertex2_index];
915 second_pass_uv_vertices[2] = second_pass_uv_vertex_flags_or_index_bits;
919 int32_t second_pass_uv_vertex3_index = (uint16_t)(polygon_ref->
vertex_indices[3]);
921 second_pass_uv_vertex_flags_or_index_bits = &runtime_vertices[second_pass_uv_vertex3_index];
922 second_pass_uv_vertices[3] = second_pass_uv_vertex_flags_or_index_bits;
925 second_pass_uv_vertices[3] = 0;
932 polygon_ref = &polygon_ref[1];