Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend supported classes in vkb::scene_graph::HPPScene::get_components and vkb::scene_graph::HPPScene::has_components #1203

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions framework/scene_graph/hpp_scene.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@

#pragma once

#include "components/hpp_mesh.h"
#include "scene.h"
#include "scene_graph/components/camera.h"
#include "scene_graph/components/hpp_mesh.h"
#include "scene_graph/script.h"
#include "scene_graph/scripts/animation.h"

Expand All @@ -37,7 +38,8 @@ class HPPScene : private vkb::sg::Scene
template <class T>
std::vector<T *> get_components() const
{
if constexpr (std::is_same<T, vkb::sg::Script>::value)
if constexpr (std::is_same<T, vkb::sg::Animation>::value || std::is_same<T, vkb::sg::Camera>::value || std::is_same<T, vkb::sg::Script>::value ||
std::is_same<T, vkb::sg::SubMesh>::value || std::is_same<T, vkb::sg::Texture>::value)
{
return vkb::sg::Scene::get_components<T>();
}
Expand All @@ -56,10 +58,15 @@ class HPPScene : private vkb::sg::Scene
template <class T>
bool has_component() const
{
if constexpr (std::is_same<T, vkb::sg::Animation>::value || std::is_same<T, vkb::sg::Script>::value)
if constexpr (std::is_same<T, vkb::sg::Animation>::value || std::is_same<T, vkb::sg::Camera>::value || std::is_same<T, vkb::sg::Script>::value ||
std::is_same<T, vkb::sg::SubMesh>::value || std::is_same<T, vkb::sg::Texture>::value)
{
return vkb::sg::Scene::has_component(typeid(T));
}
else if constexpr (std::is_same<T, vkb::scene_graph::components::HPPMesh>::value)
{
return vkb::sg::Scene::has_component<vkb::sg::Mesh>();
}
else
{
assert(false); // path never passed -> Please add a type-check here!
Expand Down
Loading