mirror of
https://github.com/Cesarus85/ringfall-mjolnir-vr.git
synced 2026-10-18 10:00:26 +02:00
99 lines
2.7 KiB
C
99 lines
2.7 KiB
C
/*
|
|
TRIANGLE_STRIPS.C
|
|
|
|
symbols in this file:
|
|
0017D7C0 0070:
|
|
_triangle_strip_iterator_new (0000)
|
|
0017D830 0160:
|
|
_triangle_strip_iterator_get_triangle (0000)
|
|
002A044C 001e:
|
|
??_C@_0BO@MPPKGOLO@triangle_strip_vertex_indices?$AA@ (0000)
|
|
002A046C 0028:
|
|
??_C@_0CI@EBGJOIHP@c?3?2halo?2SOURCE?2render?2triangle_s@ (0000)
|
|
002A0494 001a:
|
|
??_C@_0BK@DKBJAIM@iterator?9?$DOvertex_count?$DO?$DN0?$AA@ (0000)
|
|
002A04B0 0035:
|
|
??_C@_0DF@FKCNENJG@iterator?9?$DOsignature?$DN?$DN_valid_stri@ (0000)
|
|
*/
|
|
|
|
/* ---------- headers */
|
|
|
|
#include "cseries.h"
|
|
#include "triangle_strips.h"
|
|
|
|
/* ---------- constants */
|
|
|
|
/* ---------- macros */
|
|
|
|
/* ---------- structures */
|
|
|
|
/* ---------- prototypes */
|
|
|
|
/* ---------- globals */
|
|
|
|
/* ---------- public code */
|
|
|
|
void triangle_strip_iterator_new(
|
|
struct triangle_strip_iterator *iterator,
|
|
word const *triangle_strip_vertex_indices,
|
|
short strip_count)
|
|
{
|
|
match_assert("c:\\halo\\SOURCE\\render\\triangle_strips.c", 22, iterator);
|
|
match_assert("c:\\halo\\SOURCE\\render\\triangle_strips.c", 23, triangle_strip_vertex_indices);
|
|
|
|
iterator->triangle_strip_vertex_indices = triangle_strip_vertex_indices;
|
|
iterator->strip_count = strip_count;
|
|
iterator->vertex_count = 0;
|
|
iterator->signature = _valid_strip_iterator_signature;
|
|
}
|
|
|
|
boolean triangle_strip_iterator_get_triangle(
|
|
struct triangle_strip_iterator *iterator,
|
|
word *vertices)
|
|
{
|
|
boolean result = TRUE;
|
|
|
|
match_assert("c:\\halo\\SOURCE\\render\\triangle_strips.c", 39, iterator);
|
|
match_assert("c:\\halo\\SOURCE\\render\\triangle_strips.c", 40, vertices);
|
|
match_assert("c:\\halo\\SOURCE\\render\\triangle_strips.c", 41, iterator->signature==_valid_strip_iterator_signature);
|
|
|
|
if (iterator->vertex_count)
|
|
{
|
|
if (iterator->reverse_winding)
|
|
{
|
|
vertices[0] = iterator->triangle_strip_vertex_indices[-1];
|
|
vertices[1] = iterator->triangle_strip_vertex_indices[-2];
|
|
}
|
|
else
|
|
{
|
|
vertices[0] = iterator->triangle_strip_vertex_indices[-2];
|
|
vertices[1] = iterator->triangle_strip_vertex_indices[-1];
|
|
}
|
|
|
|
vertices[2] = iterator->triangle_strip_vertex_indices[0];
|
|
iterator->triangle_strip_vertex_indices++;
|
|
iterator->reverse_winding = !iterator->reverse_winding;
|
|
iterator->vertex_count--;
|
|
}
|
|
else if (iterator->strip_count)
|
|
{
|
|
iterator->vertex_count = *iterator->triangle_strip_vertex_indices - 3;
|
|
iterator->triangle_strip_vertex_indices++;
|
|
match_assert("c:\\halo\\SOURCE\\render\\triangle_strips.c", 65, iterator->vertex_count>=0);
|
|
|
|
iterator->reverse_winding = TRUE;
|
|
vertices[0] = *iterator->triangle_strip_vertex_indices++;
|
|
vertices[1] = *iterator->triangle_strip_vertex_indices++;
|
|
vertices[2] = *iterator->triangle_strip_vertex_indices++;
|
|
iterator->strip_count--;
|
|
}
|
|
else
|
|
{
|
|
result = FALSE;
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
/* ---------- private code */
|