/* Copyright (c) 2024, NVIDIA CORPORATION. All rights reserved. * * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 the "License"; * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #pragma once #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" namespace vkb { namespace scene_graph { /** * @brief facade class around vkb::sg::Scene, providing a vulkan.hpp-based interface * * See vkb::sb::Scene for documentation */ class HPPScene : private vkb::sg::Scene { public: template std::vector get_components() const { if constexpr (std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value) { return vkb::sg::Scene::get_components(); } else if constexpr (std::is_same::value) { std::vector meshes = vkb::sg::Scene::get_components(); return *reinterpret_cast *>(&meshes); } else { assert(false); // path never passed -> Please add a type-check here! return {}; } } template bool has_component() const { if constexpr (std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value) { return vkb::sg::Scene::has_component(typeid(T)); } else if constexpr (std::is_same::value) { return vkb::sg::Scene::has_component(); } else { assert(false); // path never passed -> Please add a type-check here! return false; } } }; } // namespace scene_graph } // namespace vkb