Repository navigation
fix(Gltf): load non-indexed static GLB primitives - #9
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (7)
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe GLB mesh processor now validates primitives, assembles accepted geometry, and can generate missing normals and tangents. A Unity runtime test project exercises importer behavior in Mono and IL2CPP. The loading guide documents the importer’s compatibility profile and usage constraints. ChangesGLTF import behavior
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to No identified issue blocks merging this GLB importer change after normal checks. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The loader accepts more valid model data, but the review found no new privilege or trust-boundary bypass. Handling of every malformed model remains uncertain. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 27.27% which is insufficient. The required threshold is 50.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 3 files. (4 skipped: 4 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. A rabbit checks each triangle’s place, Comment |
Summary
GltfLoader.LoadGlb(byte[], Shader?)currently drops non-indexed primitives and leaves the first primitive using a fallback material with a null material slot. This change imports consecutive vertex triples, preserves submesh/material offsets, and fixes fallback assignment without changing the public API.Related fixes stay in the active mesh-loading path:
Validation
The initial 17-case suite reproduced the same 13 failures on both runtimes before the implementation change; the existing three unsigned index formats and disabled-generation case passed. The final suite adds material ordering, attribute preservation in both orders, malformed attribute/missing position rejection, and rendering.
Build commands:
Fresh library builds reported only two existing CS8618 warnings in
Building/InteriorNavigatorCore.cs; no new build warnings. Runtime tests go through the public byte-array loader, use synthetic self-contained GLBs, and need only Menu. Both attached 256x256 captures were visually inspected; the render test also checks a minimum red-pixel count. Rendering uses URP Unlit to isolate geometry visibility/winding. Test setup and cleanup are documented inTests/Gltf/README.md.DocFX completed with 0 errors and 4 warnings: unresolved 0Harmony/Newtonsoft metadata references, the existing README LICENSE link, and an existing building-guide bookmark. No warnings reference the changed guide or test instructions.
Hosted documentation build: passed (run 36235979636); deployment was correctly skipped for the PR. CodeRabbit review was still pending when this implementation pass finished.
Compatibility boundaries
Supported static profile: dense float32 POSITION/NORMAL/TEXCOORD_0/TANGENT in buffer 0; unsigned 8/16/32-bit indices or consecutive non-indexed TRIANGLES; combined primitives and material slots. Missing UVs are zero-filled where necessary; Unity generates missing normals/tangents by default, preserving authored data. Export authored shading attributes for controlled results.
Still unsupported or unreliable: sparse/normalized integer/quantized vertex attributes, Draco/meshopt, geometry in additional buffers, COLOR_0, extra UV sets/texture transforms, external images, KTX2/Basis, skinning and morph rendering. Only triangle mode is supported. The active path imports all nodes instead of selecting one scene. Required extensions are not comprehensively validated. Animation parsing exists but is not certified here;
ImportSkins,ImportBlendShapes, andReadableMeshesare not wired into the active path. Some malformed accessor/buffer references can still throw, and non-null results can be partial/empty. This is not full glTF compliance or an input-validation API.The guide documents embedded PNG/JPEG/material implementation paths separately from the tested geometry profile. Texture/PBR fidelity, arbitrary exporter output, mirrored matrix decomposition, loaded-save product/furniture behavior, and networking were not tested.
No release/version change. No proprietary game files, copied installs, binary fixtures, or smoke logs are committed. The original checkout's unrelated
TerrainClearer.csedit remains untouched.GltfLoader.LoadGlb(byte[], Shader?).