feat: add pbr support

This commit is contained in:
2026-10-13 00:57:35 +02:00
parent ce55f75ac3
commit 21621001c2
34 changed files with 968 additions and 135 deletions
+30
View File
@@ -142,6 +142,33 @@ void LightKeeper::customInit()
floorRb->SetType(RigidbodyType::Static);
scene.GetPhysics().RegisterGameObject(*planeObj);
const auto helmetObj = scene.CreateGameObject("FlightHelmet");
helmetObj->GetTransform().SetWorldPosition(glm::vec3(2.f, -1.f, 0.f));
helmetObj->GetTransform().SetWorldScale(glm::vec3(2.f));
const auto helmetModel = AssetManager::GetInstance().LoadModel(
"engine://flight-helmet/FlightHelmet.gltf",
staticModelOptions);
ModelDocUtils::LogModelDocSummary(helmetModel, "FlightHelmet.gltf");
std::vector<MaterialID> helmetMaterialIDs;
for (const auto& material : helmetModel.materials)
{
helmetMaterialIDs.push_back(resources.addModelMaterial(gfxDevice, material));
}
for (const auto& primitive : helmetModel.primitives)
{
const auto partObj = scene.CreateGameObject(primitive.nodeName);
partObj->GetTransform().SetParent(&helmetObj->GetTransform(), false);
const auto partMeshComp = partObj->AddComponent<MeshRendererComponent>();
partMeshComp->SetMeshID(resources.meshes().addMesh(gfxDevice, primitive.mesh));
partMeshComp->SetMaterialID(primitive.materialIndex < helmetMaterialIDs.size()
? helmetMaterialIDs[primitive.materialIndex]
: resources.materials().getPlaceholderMaterialId());
}
const auto CharObj = scene.CreateGameObject("Character");
capybara = CharObj;
@@ -504,6 +531,9 @@ void LightKeeper::customInit()
const auto texPath = AssetFS::GetInstance().GetFullPath("engine://textures/kobe.png");
texID = resources.loadImageFromFile(gfxDevice, texPath);
}
void LightKeeper::customUpdate(float dt)