feat: add pbr support
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user