Skip to content
Snippets Groups Projects
Commit 2f27b3ac authored by Joseph Walton-Rivers's avatar Joseph Walton-Rivers
Browse files

rewite ECS to avoid undefined behaviour

parent 0c365159
No related branches found
No related tags found
No related merge requests found
...@@ -127,6 +127,7 @@ namespace demo { ...@@ -127,6 +127,7 @@ namespace demo {
Game::activate(); Game::activate();
fggl::debug::log(fggl::debug::Level::info, "RollBall::activate()"); fggl::debug::log(fggl::debug::Level::info, "RollBall::activate()");
auto* assetLoader = m_owner.service<fggl::assets::Loader>(); auto* assetLoader = m_owner.service<fggl::assets::Loader>();
assetLoader->load("rollball.yml", fggl::entity::PROTOTYPE_ASSET); assetLoader->load("rollball.yml", fggl::entity::PROTOTYPE_ASSET);
......
...@@ -74,6 +74,8 @@ namespace fggl::gfx::ogl4 { ...@@ -74,6 +74,8 @@ namespace fggl::gfx::ogl4 {
} }
auto& meshComp = world.get<data::StaticMesh>(renderable); auto& meshComp = world.get<data::StaticMesh>(renderable);
auto& modelComp = world.add<StaticModel>(renderable);
auto shader = m_phong; auto shader = m_phong;
try { try {
shader = std::make_shared<ogl::Shader>( m_shaders->get( meshComp.pipeline ) ); shader = std::make_shared<ogl::Shader>( m_shaders->get( meshComp.pipeline ) );
...@@ -81,7 +83,6 @@ namespace fggl::gfx::ogl4 { ...@@ -81,7 +83,6 @@ namespace fggl::gfx::ogl4 {
debug::log(debug::Level::warning, "Could not find shader: {}", meshComp.pipeline); debug::log(debug::Level::warning, "Could not find shader: {}", meshComp.pipeline);
} }
auto& modelComp = world.add<StaticModel>(renderable);
setupComponent(modelComp, shader, meshComp.mesh); setupComponent(modelComp, shader, meshComp.mesh);
debug::log(debug::Level::info, "Added static mesh to {}", (uint64_t)renderable); debug::log(debug::Level::info, "Added static mesh to {}", (uint64_t)renderable);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment