Skip to content

feat: model loader - #28

Merged
AhmedSobhy01 merged 41 commits into
mainfrom
feat/model-loader
Apr 19, 2026
Merged

feat: model loader#28
AhmedSobhy01 merged 41 commits into
mainfrom
feat/model-loader

Conversation

@AhmedAmrNabil

@AhmedAmrNabil AhmedAmrNabil commented Apr 15, 2026

Copy link
Copy Markdown
Owner

This Pr introduces the ability to load entire models yaaay
Supported model types:
AMF 3DS AC ASE ASSBIN B3D BVH COLLADA DXF CSM HMP IRRMESH IQM IRR LWO LWS MD2 MD3 MD5 MDC MDL NFF NDO OFF OBJ OGRE OPENGEX PLY MS3D COB BLEND IFC XGL FBX Q3D Q3BSP RAW SIB SMD STL TERRAGEN 3D X X3D GLTF GLB 3MF MMD

yeah alot of model types
to use this:

  1. add the model to the assets directory (will discuss a convension for asset naming and location)
  2. add an entry under the key "assets.models" in the config.jsonc
  3. to use in entity add the component { "type": "Model Renderer", "model": "<your-model-name>" }

the model currently support reading the material of the model meaning lighting works out of the box
will need to later add a new shader called pbr shader and have the model check if it supports pbr shader then use it else use normal phong lighting (which is what we have currently in #25 branch

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds Assimp-based full model loading to the engine and integrates it into the ECS rendering pipeline via a new Model Renderer component, including material/texture extraction for lit rendering.

Changes:

  • Introduces our::Model (Assimp importer) + ModelRendererComponent, and wires model submeshes into ForwardRenderer.
  • Extends lit material/texturing to support packed metallic-roughness workflows and embedded texture loading from memory.
  • Updates build system to vendor/link Assimp and adds sample configs showcasing model usage.

Reviewed changes

Copilot reviewed 25 out of 28 changed files in this pull request and generated 19 comments.

Show a summary per file
File Description
src/common/texture/texture2d.hpp Adds a new texture unit for packed metallic/roughness.
src/common/texture/texture-utils.hpp / .cpp Adds image upload helper + loading images from in-memory buffers (embedded textures).
src/common/systems/render-command.hpp Extracts RenderCommand into a shared header.
src/common/systems/forward-renderer.hpp / .cpp Integrates ModelRendererComponent submesh rendering into forward pass.
src/common/model/model.hpp / .cpp New Assimp model importer with material/texture extraction and combined-mesh generation.
src/common/model/ai-glm-utils.hpp Adds Assimp-to-GLM conversion helpers.
src/common/mesh/vertex.hpp Adds bone IDs/weights fields to vertex format.
src/common/mesh/mesh.hpp Adds bone vertex attributes + stores CPU-side copies of vertices/indices.
src/common/material/material.hpp / .cpp Adds TextureMask + packed metal/roughness texture support to lit materials.
src/common/components/model-renderer.hpp / .cpp New ECS component to render Model assets.
src/common/components/mesh-renderer.hpp / .cpp Adds per-mesh relative transform storage for submeshes.
src/common/components/component-deserializer.hpp Registers the new Model Renderer component type.
src/common/asset-loader.cpp Adds AssetLoader<Model> deserialization and lifecycle clearing.
assets/shaders/lit.vert / lit.frag Adds bone attributes + packed metal/roughness sampling changes in lit shader.
config/playgrounds/model.jsonc New playground config showcasing model loading and rendering.
config/app.jsonc Adds an example model entry (currently placed outside assets).
CMakeLists.txt / .gitmodules Vendors and links Assimp as a new submodule dependency.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/common/material/material.cpp
Comment thread src/common/model/model.cpp Outdated
Comment thread src/common/model/model.cpp
Comment thread assets/shaders/lit.frag
Comment thread src/common/mesh/mesh.hpp Outdated
Comment thread src/common/model/model.cpp Outdated
Comment thread src/common/model/model.cpp Outdated
Comment thread src/common/components/model-renderer.cpp
Comment thread src/common/asset-loader.cpp Outdated
Comment thread src/common/material/material.cpp
@AhmedSobhy01 AhmedSobhy01 changed the title Feat/model loader feat: model loader Apr 18, 2026
@OmarGamal10
OmarGamal10 requested review from OmarGamal10 and removed request for OmarGamal10 April 18, 2026 18:34
@AhmedSobhy01
AhmedSobhy01 merged commit e82b339 into main Apr 19, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants