Remove redundancies

This commit is contained in:
Georg Hagen
2025-01-04 03:21:55 +01:00
parent ca93036f31
commit 450f1170b4
7 changed files with 58 additions and 100 deletions

View File

@@ -36,7 +36,7 @@ namespace OpenVulkano
{
OpenVulkano::Scene::Scene scene;
PerspectiveCamera cam;
OpenVulkano::FreeCamCameraController camController;
FreeCamCameraController camController;
Material mat;
Shader shader;
std::vector<SimpleDrawable> drawablesPool;
@@ -44,13 +44,13 @@ namespace OpenVulkano
Vector3f_SIMD position = {0, 0, -10};
std::vector<Geometry> m_geos;
OpenVulkano::Scene::UI::SimpleUi m_ui;
std::shared_ptr<OpenVulkano::Scene::UI::PerformanceInfo> m_perfInfo;
UI::SimpleUi m_ui;
std::shared_ptr<UI::PerformanceInfo> m_perfInfo;
public:
void Init() override
{
auto engineConfig = OpenVulkano::EngineConfiguration::GetEngineConfiguration();
auto engineConfig = EngineConfiguration::GetEngineConfiguration();
//engineConfig->SetNumThreads(4);
engineConfig->SetPreferFramebufferFormatSRGB(false);
@@ -58,9 +58,9 @@ namespace OpenVulkano
scene.Init();
cam.Init(70, 16, 9, 0.1f, 100);
scene.SetCamera(&cam);
shader.AddShaderProgram(OpenVulkano::ShaderProgramType::VERTEX, "Shader/basic");
shader.AddShaderProgram(OpenVulkano::ShaderProgramType::FRAGMENT, "Shader/basic");
shader.AddVertexInputDescription(OpenVulkano::Vertex::GetVertexInputDescription());
shader.AddShaderProgram(ShaderProgramType::VERTEX, "Shader/basic");
shader.AddShaderProgram(ShaderProgramType::FRAGMENT, "Shader/basic");
shader.AddVertexInputDescription(Vertex::GetVertexInputDescription());
drawablesPool.resize(GEOS);
m_geos.reserve(GEOS);
for (uint32_t i = 0; i < GEOS; i++)
@@ -78,7 +78,7 @@ namespace OpenVulkano
scene.GetRoot()->AddChild(&nodesPool[i]);
if (i < DYNAMIC) nodesPool[i].SetUpdateFrequency(UpdateFrequency::Always);
nodesPool[i].AddDrawable(&drawablesPool[std::rand() % GEOS]);
nodesPool[i].SetMatrix(Math::Utils::translate(glm::mat4x4(1), Vector3f((std::rand() % 10000) / 1000.0f - 5, (std::rand() % 10000) / 1000.0f - 5, (std::rand() % 10000) / 1000.0f - 5)));
nodesPool[i].SetMatrix(translate(glm::mat4x4(1), Vector3f((std::rand() % 10000) / 1000.0f - 5, (std::rand() % 10000) / 1000.0f - 5, (std::rand() % 10000) / 1000.0f - 5)));
}
GetGraphicsAppManager()->GetRenderer()->SetScene(&scene);
@@ -87,7 +87,7 @@ namespace OpenVulkano
camController.SetDefaultKeybindings();
camController.SetPosition({0, 0, 10});
std::shared_ptr<OpenVulkano::Scene::UI::PerformanceInfo> m_perfInfo = std::make_shared<OpenVulkano::Scene::UI::PerformanceInfo>();
std::shared_ptr<UI::PerformanceInfo> m_perfInfo = std::make_shared<UI::PerformanceInfo>();
m_ui.AddElement(m_perfInfo);
GetGraphicsAppManager()->GetRenderer()->SetActiveUi(&m_ui);
}
@@ -96,7 +96,7 @@ namespace OpenVulkano
{
for (uint32_t i = 0; i < DYNAMIC; i++)
{
nodesPool[i].SetMatrix(glm::translate(glm::mat4x4(1), glm::vec3((std::rand() % 10000) / 1000.0f - 5, (std::rand() % 10000) / 1000.0f - 5, (std::rand() % 10000) / 1000.0f - 5)));
nodesPool[i].SetMatrix(translate(glm::mat4x4(1), glm::vec3((std::rand() % 10000) / 1000.0f - 5, (std::rand() % 10000) / 1000.0f - 5, (std::rand() % 10000) / 1000.0f - 5)));
}
camController.Tick();