mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 22:50:21 +00:00
ifcviewer: quantize VBO to 16 B/vertex (sidecar v6)
Position now u16x3 normalized against each mesh's local AABB; normal oct-encoded to i16x2; RGBA8 colour unchanged. Per-mesh dequant basis lives in a new MeshGpu SSBO at binding 2; both main and pick shaders mix() against it before applying the instance transform. Drops VBO and sidecar size by ~43 % (28 -> 16 B/vert), which matters mostly for warm-load downloads of precomputed sidecars and steady-state VRAM. LodBuilder dequantizes positions into a scratch buffer before calling meshopt, since meshoptimizer needs float positions. Also fixes a streaming-time crash in cullAndUploadVisible: bvh_items was only populated at finalize, but the linear fallback indexes it during streaming. Mirror BvhItem appends in uploadInstanceChunk so the hot path stays valid before the BVH is built. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -35,9 +35,10 @@
|
||||
// target_ratio = 0.25 — aim for 25% of original tris
|
||||
// target_error = 0.05 — stop if relative error exceeds 5%
|
||||
//
|
||||
// `sd.vertices` is read (position is the first 3 floats of each
|
||||
// INSTANCED_VERTEX_STRIDE_FLOATS-wide vertex) but not modified — LOD1
|
||||
// reuses the same vertex buffer, just with a different index list.
|
||||
// `sd.vertices` is raw bytes at the quantized layout; positions are
|
||||
// dequantized per-mesh (using MeshInfo.local_aabb_min/max) into a temp
|
||||
// float array before feeding meshoptimizer. Vertices are not modified —
|
||||
// LOD1 reuses the same VBO, just with a different index list.
|
||||
void buildLods(SidecarData& sd,
|
||||
int min_triangles = 500,
|
||||
float target_ratio = 0.25f,
|
||||
|
||||
Reference in New Issue
Block a user