Conversation
There was a problem hiding this comment.
Pull request overview
This PR extends Caramel鈥檚 shape system by introducing instancing and an inline triangle-mesh JSON format, while also refactoring mesh shapes (OBJ/PLY/inline) to share a unified TriangleMesh implementation based on indexed triangles.
Changes:
- Refactors OBJ/PLY meshes onto a shared
TriangleMeshbase withm_face_indicesand a commonfinalize()path (AABB/area/BVH/solid-angle polygon extraction). - Adds
Instanceshape type (per-placement transform around a shared template shape). - Adds
InlineTriangleMeshand scene parsing support for"type": "trianglemesh"with inline vertex/index arrays; adds/updates tests and a new render test scene.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
test/unit_tests.cpp |
Adds unit tests for Instance ray intersection and inline triangle mesh behavior. |
test/simple_render_test.cpp |
Adds a new render regression test (test7) and scaffolding for instance-related render tests (currently commented). |
src/shapes/triangle_mesh.cpp |
Introduces shared TriangleMesh implementation (finalize, sampling, BVH integration, solid-angle polygon extraction). |
src/shapes/plymesh.cpp |
Simplifies PLY mesh loading to populate shared TriangleMesh buffers and call finalize(). |
src/shapes/objmesh.cpp |
Updates OBJ loading to weld vertices by (v/n/uv) and emit indexed faces into TriangleMesh. |
src/shapes/instance.cpp |
Implements instanced shape intersection + transformed AABB, sampling, and solid-angle PDF. |
src/shapes/inline_triangle_mesh.cpp |
Implements mesh construction directly from inline vertex/index arrays and calls finalize(). |
src/scene_parser.cpp |
Adds parsing for "type":"instance" expansion and for inline "type":"trianglemesh". |
include/shape.h |
Refactors TriangleMesh to a concrete base class; adds InlineTriangleMesh + Instance declarations. |
include/scene_parser.h |
Declares parse_instanced_shapes() and documents instance schema. |
CMakeLists.txt |
Registers new shape sources in the build. |
馃挕 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TriangleMeshto handle triangle vertex by index (no longer store duplicated vertices)Instanceshape type for multiple instances of the same shape with different transforms :InlineTriangleMeshto specify triangle mesh in json file :