Cleanup PhysicsDemo example
This commit is contained in:
parent
801b06abfe
commit
9b1583501b
|
|
@ -14,7 +14,6 @@
|
||||||
#include <Nazara/Shader/SpirvPrinter.hpp>
|
#include <Nazara/Shader/SpirvPrinter.hpp>
|
||||||
#include <Nazara/Utility.hpp>
|
#include <Nazara/Utility.hpp>
|
||||||
#include <Nazara/Utility/Components.hpp>
|
#include <Nazara/Utility/Components.hpp>
|
||||||
#include <Nazara/Widgets.hpp>
|
|
||||||
#include <entt/entt.hpp>
|
#include <entt/entt.hpp>
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
@ -37,7 +36,7 @@ int main()
|
||||||
|
|
||||||
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
|
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
|
||||||
|
|
||||||
Nz::Modules<Nz::Graphics, Nz::Physics3D, Nz::Widgets> nazara(rendererConfig);
|
Nz::Modules<Nz::Graphics, Nz::Physics3D> nazara(rendererConfig);
|
||||||
|
|
||||||
Nz::RenderWindow window;
|
Nz::RenderWindow window;
|
||||||
|
|
||||||
|
|
@ -70,7 +69,7 @@ int main()
|
||||||
|
|
||||||
std::shared_ptr<Nz::MaterialPass> depthPass = std::make_shared<Nz::MaterialPass>(Nz::DepthMaterial::GetSettings());
|
std::shared_ptr<Nz::MaterialPass> depthPass = std::make_shared<Nz::MaterialPass>(Nz::DepthMaterial::GetSettings());
|
||||||
depthPass->EnableDepthBuffer(true);
|
depthPass->EnableDepthBuffer(true);
|
||||||
//depthPass->EnableDepthClamp(true);
|
depthPass->EnableDepthClamp(true);
|
||||||
depthPass->EnableFaceCulling(true);
|
depthPass->EnableFaceCulling(true);
|
||||||
|
|
||||||
std::shared_ptr<Nz::MaterialPass> materialPass = std::make_shared<Nz::MaterialPass>(Nz::PhongLightingMaterial::GetSettings());
|
std::shared_ptr<Nz::MaterialPass> materialPass = std::make_shared<Nz::MaterialPass>(Nz::PhongLightingMaterial::GetSettings());
|
||||||
|
|
@ -90,7 +89,7 @@ int main()
|
||||||
|
|
||||||
Nz::BasicMaterial basicMat(*materialPass);
|
Nz::BasicMaterial basicMat(*materialPass);
|
||||||
basicMat.EnableAlphaTest(false);
|
basicMat.EnableAlphaTest(false);
|
||||||
//basicMat.SetAlphaMap(Nz::Texture::LoadFromFile(resourceDir / "alphatile.png", texParams));
|
basicMat.SetAlphaMap(Nz::Texture::LoadFromFile(resourceDir / "alphatile.png", texParams));
|
||||||
basicMat.SetDiffuseMap(Nz::Texture::LoadFromFile(resourceDir / "Spaceship/Texture/diffuse.png", texParams));
|
basicMat.SetDiffuseMap(Nz::Texture::LoadFromFile(resourceDir / "Spaceship/Texture/diffuse.png", texParams));
|
||||||
basicMat.SetDiffuseSampler(samplerInfo);
|
basicMat.SetDiffuseSampler(samplerInfo);
|
||||||
|
|
||||||
|
|
@ -103,16 +102,10 @@ int main()
|
||||||
|
|
||||||
std::shared_ptr<Nz::Material> spriteMaterial = std::make_shared<Nz::Material>();
|
std::shared_ptr<Nz::Material> spriteMaterial = std::make_shared<Nz::Material>();
|
||||||
|
|
||||||
/*std::shared_ptr<Nz::MaterialPass> spriteDepthPass = std::make_shared<Nz::MaterialPass>(Nz::DepthMaterial::GetSettings());
|
|
||||||
spriteDepthPass->EnableDepthBuffer(true);
|
|
||||||
spriteDepthPass->EnableDepthClamp(true);
|
|
||||||
//spriteDepthPass->EnableFaceCulling(true);*/
|
|
||||||
|
|
||||||
std::shared_ptr<Nz::MaterialPass> spriteMaterialPass = std::make_shared<Nz::MaterialPass>(Nz::BasicMaterial::GetSettings());
|
std::shared_ptr<Nz::MaterialPass> spriteMaterialPass = std::make_shared<Nz::MaterialPass>(Nz::BasicMaterial::GetSettings());
|
||||||
spriteMaterialPass->EnableDepthBuffer(true);
|
spriteMaterialPass->EnableDepthBuffer(true);
|
||||||
spriteMaterialPass->EnableDepthWrite(false);
|
spriteMaterialPass->EnableDepthWrite(false);
|
||||||
spriteMaterialPass->EnableDepthClamp(true);
|
spriteMaterialPass->EnableDepthClamp(true);
|
||||||
//spriteMaterialPass->EnableFaceCulling(true);
|
|
||||||
|
|
||||||
spriteMaterialPass->EnableFlag(Nz::MaterialPassFlag::SortByDistance);
|
spriteMaterialPass->EnableFlag(Nz::MaterialPassFlag::SortByDistance);
|
||||||
|
|
||||||
|
|
@ -120,18 +113,11 @@ int main()
|
||||||
spriteMaterialPass->SetBlendEquation(Nz::BlendEquation::Add, Nz::BlendEquation::Add);
|
spriteMaterialPass->SetBlendEquation(Nz::BlendEquation::Add, Nz::BlendEquation::Add);
|
||||||
spriteMaterialPass->SetBlendFunc(Nz::BlendFunc::SrcAlpha, Nz::BlendFunc::InvSrcAlpha, Nz::BlendFunc::One, Nz::BlendFunc::Zero);
|
spriteMaterialPass->SetBlendFunc(Nz::BlendFunc::SrcAlpha, Nz::BlendFunc::InvSrcAlpha, Nz::BlendFunc::One, Nz::BlendFunc::Zero);
|
||||||
|
|
||||||
//Nz::BasicMaterial basicSpriteMat(*spriteMaterialPass);
|
|
||||||
//basicSpriteMat.SetDiffuseMap(Nz::Texture::LoadFromFile(resourceDir / "dev_grey.png", texParams));
|
|
||||||
|
|
||||||
//spriteMaterial->AddPass("DepthPass", spriteDepthPass);
|
|
||||||
spriteMaterial->AddPass("ForwardPass", spriteMaterialPass);
|
spriteMaterial->AddPass("ForwardPass", spriteMaterialPass);
|
||||||
|
|
||||||
std::shared_ptr<Nz::TextSprite> sprite = std::make_shared<Nz::TextSprite>(spriteMaterial);
|
std::shared_ptr<Nz::TextSprite> sprite = std::make_shared<Nz::TextSprite>(spriteMaterial);
|
||||||
sprite->Update(Nz::SimpleTextDrawer::Draw("Voix ambiguë d'un cœur qui, au zéphyr, préfère les jattes de kiwis", 72), 0.01f);
|
sprite->Update(Nz::SimpleTextDrawer::Draw("Voix ambiguë d'un cœur qui, au zéphyr, préfère les jattes de kiwis", 72), 0.01f);
|
||||||
|
|
||||||
//for (std::size_t i = 16; i < 200; i += 3)
|
|
||||||
// sprite->Update(Nz::SimpleTextDrawer::Draw("Voix ambiguë d'un cœur qui, au zéphyr, préfère les jattes de kiwis", i), 0.01f);
|
|
||||||
|
|
||||||
Nz::Vector2ui windowSize = window.GetSize();
|
Nz::Vector2ui windowSize = window.GetSize();
|
||||||
|
|
||||||
Nz::VertexMapper vertexMapper(*spaceshipMesh->GetSubMesh(0));
|
Nz::VertexMapper vertexMapper(*spaceshipMesh->GetSubMesh(0));
|
||||||
|
|
@ -215,7 +201,6 @@ int main()
|
||||||
entt::entity entity = registry.create();
|
entt::entity entity = registry.create();
|
||||||
auto& entityGfx = registry.emplace<Nz::GraphicsComponent>(entity);
|
auto& entityGfx = registry.emplace<Nz::GraphicsComponent>(entity);
|
||||||
entityGfx.AttachRenderable(model, 1);
|
entityGfx.AttachRenderable(model, 1);
|
||||||
//entityGfx.AttachRenderable(sprite);
|
|
||||||
|
|
||||||
auto& entityNode = registry.emplace<Nz::NodeComponent>(entity);
|
auto& entityNode = registry.emplace<Nz::NodeComponent>(entity);
|
||||||
entityNode.SetPosition(Nz::Vector3f(x * 2.f, y * 1.5f, z * 2.f));
|
entityNode.SetPosition(Nz::Vector3f(x * 2.f, y * 1.5f, z * 2.f));
|
||||||
|
|
@ -237,7 +222,7 @@ int main()
|
||||||
Nz::Clock secondClock;
|
Nz::Clock secondClock;
|
||||||
unsigned int fps = 0;
|
unsigned int fps = 0;
|
||||||
|
|
||||||
//Nz::Mouse::SetRelativeMouseMode(true);
|
Nz::Mouse::SetRelativeMouseMode(true);
|
||||||
|
|
||||||
float elapsedTime = 0.f;
|
float elapsedTime = 0.f;
|
||||||
Nz::UInt64 time = Nz::GetElapsedMicroseconds();
|
Nz::UInt64 time = Nz::GetElapsedMicroseconds();
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
target("PhysicsDemo")
|
target("PhysicsDemo")
|
||||||
set_group("Examples")
|
set_group("Examples")
|
||||||
set_kind("binary")
|
set_kind("binary")
|
||||||
add_deps("NazaraGraphics", "NazaraPhysics3D", "NazaraWidgets")
|
add_deps("NazaraGraphics", "NazaraPhysics3D")
|
||||||
add_packages("entt")
|
add_packages("entt")
|
||||||
add_files("main.cpp")
|
add_files("main.cpp")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue