fix box construction
This commit is contained in:
parent
f29cb8ee95
commit
c1fa4c62ce
|
|
@ -47,14 +47,10 @@ namespace NzEditor
|
||||||
auto cube = CreateEntity("Cube");
|
auto cube = CreateEntity("Cube");
|
||||||
Nz::GraphicsComponent& graphicsComponent = cube.emplace<Nz::GraphicsComponent>();
|
Nz::GraphicsComponent& graphicsComponent = cube.emplace<Nz::GraphicsComponent>();
|
||||||
|
|
||||||
std::shared_ptr<Nz::GraphicalMesh> boxMesh = Nz::GraphicalMesh::Build(Nz::Primitive::Box(Nz::Vector3f(4.f), Nz::Vector3ui::Zero(), Nz::Matrix4f::Scale(Nz::Vector3f(-1.f)), Nz::Rectf(0.f, 0.f, 2.f, 2.f)));
|
std::shared_ptr<Nz::GraphicalMesh> boxMesh = Nz::GraphicalMesh::Build(Nz::Primitive::Box(Nz::Vector3f(1.f), Nz::Vector3ui::Zero(), Nz::Matrix4f::Scale(Nz::Vector3f(1.f)), Nz::Rectf(0.f, 0.f, 2.f, 2.f)));
|
||||||
|
|
||||||
std::shared_ptr<Nz::MaterialInstance> boxMat = Nz::MaterialInstance::Instantiate(Nz::MaterialType::Phong);
|
std::shared_ptr<Nz::MaterialInstance> boxMat = Nz::MaterialInstance::Instantiate(Nz::MaterialType::Phong);
|
||||||
boxMat->DisablePass("ShadowPass");
|
|
||||||
boxMat->UpdatePassesStates([&](Nz::RenderStates& states)
|
|
||||||
{
|
|
||||||
states.frontFace = Nz::FrontFace::Clockwise;
|
|
||||||
});
|
|
||||||
std::shared_ptr<Nz::Model> boxModel = std::make_shared<Nz::Model>(std::move(boxMesh));
|
std::shared_ptr<Nz::Model> boxModel = std::make_shared<Nz::Model>(std::move(boxMesh));
|
||||||
boxModel->SetMaterial(0, std::move(boxMat));
|
boxModel->SetMaterial(0, std::move(boxMat));
|
||||||
graphicsComponent.AttachRenderable(boxModel);
|
graphicsComponent.AttachRenderable(boxModel);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue