mirror of
https://github.com/open-goal/jak-project
synced 2026-08-06 18:03:30 -04:00
[graphics] merc2 renderer (#1374)
* tfrag3 data for merc2 * dma hooks for merc2 * start designing merc2 opengl, seems like the simple approach will be the best here * before bone packing experiment * fix up bones.gc * use uniform buffer * speedup, fix faces and eyes * final fixes
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
#include "extract_common.h"
|
||||
|
||||
u32 clean_up_vertex_indices(std::vector<u32>& idx) {
|
||||
std::vector<u32> fixed;
|
||||
u32 num_tris = 0;
|
||||
|
||||
bool looking_for_start = true;
|
||||
size_t i_of_start;
|
||||
for (size_t i = 0; i < idx.size(); i++) {
|
||||
if (looking_for_start) {
|
||||
if (idx[i] != UINT32_MAX) {
|
||||
looking_for_start = false;
|
||||
i_of_start = i;
|
||||
}
|
||||
} else {
|
||||
if (idx[i] == UINT32_MAX) {
|
||||
looking_for_start = true;
|
||||
size_t num_verts = i - i_of_start;
|
||||
if (num_verts >= 3) {
|
||||
if (!fixed.empty()) {
|
||||
fixed.push_back(UINT32_MAX);
|
||||
}
|
||||
fixed.insert(fixed.end(), idx.begin() + i_of_start, idx.begin() + i);
|
||||
num_tris += (num_verts - 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!looking_for_start) {
|
||||
size_t num_verts = idx.size() - i_of_start;
|
||||
if (num_verts >= 3) {
|
||||
if (!fixed.empty()) {
|
||||
fixed.push_back(UINT32_MAX);
|
||||
}
|
||||
fixed.insert(fixed.end(), idx.begin() + i_of_start, idx.begin() + idx.size());
|
||||
num_tris += (num_verts - 2);
|
||||
}
|
||||
}
|
||||
|
||||
idx = std::move(fixed);
|
||||
|
||||
return num_tris;
|
||||
}
|
||||
Reference in New Issue
Block a user