Skip to content

Conversation

@google-labs-jules
Copy link
Contributor

Jules PR

…to the CMake build system. This includes the header file `include/frame/file/mtl.h`, the implementation file `src/frame/file/mtl.cpp`, and the necessary changes to `src/frame/file/CMakeLists.txt`.

I modified `src/frame/file/obj.h` to change the `Obj` constructor and replace `ObjMaterial` with `MtlMaterial`. I also modified `src/frame/file/obj.cpp` to use the new `Mtl` class to parse material files, including path resolution for textures.

I modified `src/frame/proto/scene.proto` to add an `obj_file` field to the `NodeStaticMesh` message. I also modified `src/frame/json/parse_scene_tree.cpp` to handle this new field, loading the `.obj` file, its materials, and creating the necessary objects in the level.
@google-labs-jules
Copy link
Contributor Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll acknowledge your comments with a 👀 emoji and then get to work. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

I will automatically address your feedback. For any comments you don't want me to act on, just include (aside).



For security, I will only act on instructions from the user who triggered this task for this pull request.

This commit refactors the material loading system to be more robust and flexible. It also adds a new feature to import OBJ files and their associated MTL materials directly from the JSON scene description files.

Key changes:
- Added a new `Mtl` class to parse `.mtl` files. This class correctly resolves texture paths by searching in a list of provided directories.
- The `Obj` class now uses the `Mtl` class to load materials, instead of relying on `tinyobjloader`'s material parsing. This gives more control over the material loading process.
- The JSON parser for the scene tree has been updated to support a new `obj_file` field in the `NodeStaticMesh` definition. When this field is used, the specified `.obj` file and its materials are loaded automatically.
- The existing code for loading static meshes from files (`load_static_mesh.cpp`) has been updated to use the new material system.
- The `scene_simple.json` example has been updated to use the new `obj_file` import feature.

These changes address the user's request to handle material files from different locations and to simplify large JSON files.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant