You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-13 13:31:48 +00:00
Update thirdparty/meshoptimizer to v0.20
Note: this change completely overwrites the meshoptimizer library source (from git SHA c21d3be6ddf627f8ca852ba4b6db9903b0557858) without including any patches; a distance error metric patch is still needed and will be reapplied in the next commit. The changes elsewhere are due to a signature change for meshopt_simplifyWithAttributes.
This commit is contained in:
21
thirdparty/meshoptimizer/vcacheoptimizer.cpp
vendored
21
thirdparty/meshoptimizer/vcacheoptimizer.cpp
vendored
@@ -221,9 +221,9 @@ void meshopt_optimizeVertexCacheTable(unsigned int* destination, const unsigned
|
||||
triangle_scores[i] = vertex_scores[a] + vertex_scores[b] + vertex_scores[c];
|
||||
}
|
||||
|
||||
unsigned int cache_holder[2 * (kCacheSizeMax + 3)];
|
||||
unsigned int cache_holder[2 * (kCacheSizeMax + 4)];
|
||||
unsigned int* cache = cache_holder;
|
||||
unsigned int* cache_new = cache_holder + kCacheSizeMax + 3;
|
||||
unsigned int* cache_new = cache_holder + kCacheSizeMax + 4;
|
||||
size_t cache_count = 0;
|
||||
|
||||
unsigned int current_triangle = 0;
|
||||
@@ -260,10 +260,8 @@ void meshopt_optimizeVertexCacheTable(unsigned int* destination, const unsigned
|
||||
{
|
||||
unsigned int index = cache[i];
|
||||
|
||||
if (index != a && index != b && index != c)
|
||||
{
|
||||
cache_new[cache_write++] = index;
|
||||
}
|
||||
cache_new[cache_write] = index;
|
||||
cache_write += (index != a && index != b && index != c);
|
||||
}
|
||||
|
||||
unsigned int* cache_temp = cache;
|
||||
@@ -305,6 +303,10 @@ void meshopt_optimizeVertexCacheTable(unsigned int* destination, const unsigned
|
||||
{
|
||||
unsigned int index = cache[i];
|
||||
|
||||
// no need to update scores if we are never going to use this vertex
|
||||
if (adjacency.counts[index] == 0)
|
||||
continue;
|
||||
|
||||
int cache_position = i >= cache_size ? -1 : int(i);
|
||||
|
||||
// update vertex score
|
||||
@@ -325,11 +327,8 @@ void meshopt_optimizeVertexCacheTable(unsigned int* destination, const unsigned
|
||||
float tri_score = triangle_scores[tri] + score_diff;
|
||||
assert(tri_score > 0);
|
||||
|
||||
if (best_score < tri_score)
|
||||
{
|
||||
best_triangle = tri;
|
||||
best_score = tri_score;
|
||||
}
|
||||
best_triangle = best_score < tri_score ? tri : best_triangle;
|
||||
best_score = best_score < tri_score ? tri_score : best_score;
|
||||
|
||||
triangle_scores[tri] = tri_score;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user