From d0aede13eca8fd24aab6e7b2435a37c03b050ed3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=80=D0=B0=D0=BD=D0=B8=D0=BC=D0=B8=D1=80=20=D0=9A?= =?UTF-8?q?=D0=B0=D1=80=D0=B0=D1=9F=D0=B8=D1=9B?= Date: Mon, 27 Nov 2023 22:27:43 -0800 Subject: [PATCH] Updated meshoptimizer. --- 3rdparty/meshoptimizer/src/overdrawanalyzer.cpp | 3 +-- 3rdparty/meshoptimizer/src/simplifier.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/3rdparty/meshoptimizer/src/overdrawanalyzer.cpp b/3rdparty/meshoptimizer/src/overdrawanalyzer.cpp index 8b6f25413..31cf6f146 100644 --- a/3rdparty/meshoptimizer/src/overdrawanalyzer.cpp +++ b/3rdparty/meshoptimizer/src/overdrawanalyzer.cpp @@ -53,11 +53,10 @@ static void rasterize(OverdrawBuffer* buffer, float v1x, float v1y, float v1z, f // flip backfacing triangles to simplify rasterization logic if (sign) { - // flipping v2 & v3 preserves depth gradients since they're based on v1 + // flipping v2 & v3 preserves depth gradients since they're based on v1; only v1z is used below float t; t = v2x, v2x = v3x, v3x = t; t = v2y, v2y = v3y, v3y = t; - t = v2z, v2z = v3z, v3z = t; // flip depth since we rasterize backfacing triangles to second buffer with reverse Z; only v1z is used below v1z = kViewport - v1z; diff --git a/3rdparty/meshoptimizer/src/simplifier.cpp b/3rdparty/meshoptimizer/src/simplifier.cpp index 5ba857007..4073bb4dc 100644 --- a/3rdparty/meshoptimizer/src/simplifier.cpp +++ b/3rdparty/meshoptimizer/src/simplifier.cpp @@ -580,7 +580,7 @@ static float quadricError(const Quadric& Q, const QuadricGrad* G, size_t attribu } // TODO: weight normalization is breaking attribute error somehow - float s = 1;// Q.w == 0.f ? 0.f : 1.f / Q.w; + float s = 1; // Q.w == 0.f ? 0.f : 1.f / Q.w; return fabsf(r) * s; } @@ -1325,7 +1325,7 @@ static void fillCellQuadrics(Quadric* cell_quadrics, const unsigned int* indices static void fillCellReservoirs(Reservoir* cell_reservoirs, size_t cell_count, const Vector3* vertex_positions, const float* vertex_colors, size_t vertex_colors_stride, size_t vertex_count, const unsigned int* vertex_cells) { - static const float dummy_color[] = { 0.f, 0.f, 0.f }; + static const float dummy_color[] = {0.f, 0.f, 0.f}; size_t vertex_colors_stride_float = vertex_colors_stride / sizeof(float); @@ -1380,7 +1380,7 @@ static void fillCellRemap(unsigned int* cell_remap, float* cell_errors, size_t c static void fillCellRemap(unsigned int* cell_remap, float* cell_errors, size_t cell_count, const unsigned int* vertex_cells, const Reservoir* cell_reservoirs, const Vector3* vertex_positions, const float* vertex_colors, size_t vertex_colors_stride, float color_weight, size_t vertex_count) { - static const float dummy_color[] = { 0.f, 0.f, 0.f }; + static const float dummy_color[] = {0.f, 0.f, 0.f}; size_t vertex_colors_stride_float = vertex_colors_stride / sizeof(float); @@ -1611,7 +1611,7 @@ size_t meshopt_simplifyEdge(unsigned int* destination, const unsigned int* indic } #if TRACE - printf("result: %d triangles, error: %e; total %d passes\n", int(result_count), sqrtf(result_error), int(pass_count)); + printf("result: %d triangles, error: %e; total %d passes\n", int(result_count / 3), sqrtf(result_error), int(pass_count)); #endif #ifndef NDEBUG