Graphics/GraphicalMesh: Add AABB
This commit is contained in:
@@ -226,11 +226,11 @@ int main()
|
||||
std::shared_ptr<Nz::MaterialInstance> planeMat = deferredMaterial->Instantiate();
|
||||
planeMat->SetTextureProperty("BaseColorMap", Nz::Texture::LoadFromFile(resourceDir / "dev_grey.png", texParams), planeSampler);
|
||||
|
||||
Nz::Model spaceshipModel(std::move(gfxMesh), spaceship->GetAABB());
|
||||
Nz::Model spaceshipModel(std::move(gfxMesh));
|
||||
for (std::size_t i = 0; i < spaceshipModel.GetSubMeshCount(); ++i)
|
||||
spaceshipModel.SetMaterial(i, spaceshipMat);
|
||||
|
||||
Nz::Model planeModel(std::move(planeMeshGfx), planeMesh->GetAABB());
|
||||
Nz::Model planeModel(std::move(planeMeshGfx));
|
||||
for (std::size_t i = 0; i < planeModel.GetSubMeshCount(); ++i)
|
||||
planeModel.SetMaterial(i, planeMat);
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ int main()
|
||||
std::size_t normalMapProperty = materialInstance->FindTextureProperty("NormalMap");
|
||||
materialInstance->SetTextureProperty(normalMapProperty, normalMap);
|
||||
|
||||
Nz::Model model(std::move(gfxMesh), sphereMesh->GetAABB());
|
||||
Nz::Model model(std::move(gfxMesh));
|
||||
for (std::size_t i = 0; i < model.GetSubMeshCount(); ++i)
|
||||
model.SetMaterial(i, materialInstance);
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ int main()
|
||||
material->SetTextureProperty("AlphaMap", Nz::Texture::LoadFromFile(resourceDir / "alphatile.png", texParams));
|
||||
material->SetTextureProperty("BaseColorMap", Nz::Texture::LoadFromFile(resourceDir / "Spaceship/Texture/diffuse.png", texParams));
|
||||
|
||||
std::shared_ptr<Nz::Model> model = std::make_shared<Nz::Model>(std::move(gfxMesh), spaceshipAABB);
|
||||
std::shared_ptr<Nz::Model> model = std::make_shared<Nz::Model>(std::move(gfxMesh));
|
||||
for (std::size_t i = 0; i < model->GetSubMeshCount(); ++i)
|
||||
model->SetMaterial(i, material);
|
||||
|
||||
@@ -118,7 +118,7 @@ int main()
|
||||
std::shared_ptr<Nz::Mesh> colliderMesh = Nz::Mesh::Build(shipCollider->GenerateMesh());
|
||||
std::shared_ptr<Nz::GraphicalMesh> colliderGraphicalMesh = Nz::GraphicalMesh::BuildFromMesh(*colliderMesh);
|
||||
|
||||
colliderModel = std::make_shared<Nz::Model>(colliderGraphicalMesh, spaceshipAABB);
|
||||
colliderModel = std::make_shared<Nz::Model>(colliderGraphicalMesh);
|
||||
for (std::size_t i = 0; i < colliderModel->GetSubMeshCount(); ++i)
|
||||
colliderModel->SetMaterial(i, colliderMat);
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ int main()
|
||||
|
||||
//std::shared_ptr<Nz::Material> material = Nz::Graphics::Instance()->GetDefaultMaterials().basicTransparent;
|
||||
|
||||
std::shared_ptr<Nz::Model> bobModel = std::make_shared<Nz::Model>(std::move(bobGfxMesh), bobAABB);
|
||||
std::shared_ptr<Nz::Model> bobModel = std::make_shared<Nz::Model>(std::move(bobGfxMesh));
|
||||
std::vector<std::shared_ptr<Nz::MaterialInstance>> materials(bobMesh->GetMaterialCount());
|
||||
|
||||
std::bitset<5> alphaMaterials("01010");
|
||||
@@ -212,7 +212,7 @@ int main()
|
||||
std::shared_ptr<Nz::MaterialInstance> sphereMat = Nz::Graphics::Instance()->GetDefaultMaterials().phongMaterial->Instantiate();
|
||||
sphereMat->SetTextureProperty("BaseColorMap", Nz::Texture::LoadFromFile(resourceDir / "Rusty/rustediron2_basecolor.png", srgbTexParams));
|
||||
|
||||
std::shared_ptr<Nz::Model> sphereModel = std::make_shared<Nz::Model>(std::move(gfxMesh), sphereMesh->GetAABB());
|
||||
std::shared_ptr<Nz::Model> sphereModel = std::make_shared<Nz::Model>(std::move(gfxMesh));
|
||||
for (std::size_t i = 0; i < sphereModel->GetSubMeshCount(); ++i)
|
||||
sphereModel->SetMaterial(i, sphereMat);
|
||||
|
||||
@@ -318,7 +318,7 @@ int main()
|
||||
|
||||
floorBox = planeMesh.GetAABB();
|
||||
|
||||
std::shared_ptr<Nz::Model> planeModel = std::make_shared<Nz::Model>(std::move(planeMeshGfx), planeMesh.GetAABB());
|
||||
std::shared_ptr<Nz::Model> planeModel = std::make_shared<Nz::Model>(std::move(planeMeshGfx));
|
||||
planeModel->SetMaterial(0, planeMat);
|
||||
|
||||
auto& planeGfx = planeEntity.emplace<Nz::GraphicsComponent>();
|
||||
@@ -336,7 +336,7 @@ int main()
|
||||
|
||||
std::shared_ptr<Nz::GraphicalMesh> boxMeshGfx = Nz::GraphicalMesh::BuildFromMesh(boxMesh);
|
||||
|
||||
std::shared_ptr<Nz::Model> boxModel = std::make_shared<Nz::Model>(std::move(boxMeshGfx), boxMesh.GetAABB());
|
||||
std::shared_ptr<Nz::Model> boxModel = std::make_shared<Nz::Model>(std::move(boxMeshGfx));
|
||||
boxModel->SetMaterial(0, planeMat);
|
||||
|
||||
entt::handle boxEntity = world.CreateEntity();
|
||||
|
||||
Reference in New Issue
Block a user