diff --git a/framework/CMakeLists.txt b/framework/CMakeLists.txt index bbe596e660..3f52acd186 100644 --- a/framework/CMakeLists.txt +++ b/framework/CMakeLists.txt @@ -142,7 +142,6 @@ set(SCENE_GRAPH_FILES scene_graph/hpp_scene.h # Source Files scene_graph/component.cpp - scene_graph/node.cpp scene_graph/scene.cpp scene_graph/script.cpp) diff --git a/framework/common/hpp_utils.h b/framework/common/hpp_utils.h index 1cb07834df..0c0b306936 100644 --- a/framework/common/hpp_utils.h +++ b/framework/common/hpp_utils.h @@ -27,9 +27,10 @@ namespace vkb { namespace common { -inline sg::Node &add_free_camera(vkb::scene_graph::HPPScene &scene, const std::string &node_name, vk::Extent2D const &extent) +inline vkb::scene_graph::NodeCpp &add_free_camera(vkb::scene_graph::HPPScene &scene, const std::string &node_name, vk::Extent2D const &extent) { - return vkb::add_free_camera(reinterpret_cast(scene), node_name, static_cast(extent)); + return reinterpret_cast( + vkb::add_free_camera(reinterpret_cast(scene), node_name, static_cast(extent))); } inline void screenshot(vkb::rendering::RenderContextCpp &render_context, const std::string &filename) diff --git a/framework/common/utils.cpp b/framework/common/utils.cpp index d03e2abeae..631f4b0327 100644 --- a/framework/common/utils.cpp +++ b/framework/common/utils.cpp @@ -215,10 +215,15 @@ std::string to_snake_case(const std::string &text) return result.str(); } -sg::Light &add_light(sg::Scene &scene, sg::LightType type, const glm::vec3 &position, const glm::quat &rotation, const sg::LightProperties &props, sg::Node *parent_node) +sg::Light &add_light(sg::Scene &scene, + sg::LightType type, + const glm::vec3 &position, + const glm::quat &rotation, + const sg::LightProperties &props, + vkb::scene_graph::NodeC *parent_node) { auto light_ptr = std::make_unique("light"); - auto node = std::make_unique(-1, "light node"); + auto node = std::make_unique(-1, "light node"); if (parent_node) { @@ -244,22 +249,22 @@ sg::Light &add_light(sg::Scene &scene, sg::LightType type, const glm::vec3 &posi return light; } -sg::Light &add_point_light(sg::Scene &scene, const glm::vec3 &position, const sg::LightProperties &props, sg::Node *parent_node) +sg::Light &add_point_light(sg::Scene &scene, const glm::vec3 &position, const sg::LightProperties &props, vkb::scene_graph::NodeC *parent_node) { return add_light(scene, sg::LightType::Point, position, {}, props, parent_node); } -sg::Light &add_directional_light(sg::Scene &scene, const glm::quat &rotation, const sg::LightProperties &props, sg::Node *parent_node) +sg::Light &add_directional_light(sg::Scene &scene, const glm::quat &rotation, const sg::LightProperties &props, vkb::scene_graph::NodeC *parent_node) { return add_light(scene, sg::LightType::Directional, {}, rotation, props, parent_node); } -sg::Light &add_spot_light(sg::Scene &scene, const glm::vec3 &position, const glm::quat &rotation, const sg::LightProperties &props, sg::Node *parent_node) +sg::Light &add_spot_light(sg::Scene &scene, const glm::vec3 &position, const glm::quat &rotation, const sg::LightProperties &props, vkb::scene_graph::NodeC *parent_node) { return add_light(scene, sg::LightType::Spot, position, rotation, props, parent_node); } -sg::Node &add_free_camera(sg::Scene &scene, const std::string &node_name, VkExtent2D extent) +vkb::scene_graph::NodeC &add_free_camera(sg::Scene &scene, const std::string &node_name, VkExtent2D extent) { auto camera_node = scene.find_node(node_name); diff --git a/framework/common/utils.h b/framework/common/utils.h index 4d7fed4ce7..a5b68bacad 100644 --- a/framework/common/utils.h +++ b/framework/common/utils.h @@ -66,7 +66,12 @@ void screenshot(vkb::rendering::RenderContextC &render_context, const std::strin * @param parent_node The parent node for the line, defaults to root * @return The newly created light component */ -sg::Light &add_light(sg::Scene &scene, sg::LightType type, const glm::vec3 &position, const glm::quat &rotation = {}, const sg::LightProperties &props = {}, sg::Node *parent_node = nullptr); +sg::Light &add_light(sg::Scene &scene, + sg::LightType type, + const glm::vec3 &position, + const glm::quat &rotation = {}, + const sg::LightProperties &props = {}, + vkb::scene_graph::NodeC *parent_node = nullptr); /** * @brief Adds a point light to the scene with the specified parameters @@ -76,7 +81,8 @@ sg::Light &add_light(sg::Scene &scene, sg::LightType type, const glm::vec3 &posi * @param parent_node The parent node for the line, defaults to root * @return The newly created light component */ -sg::Light &add_point_light(sg::Scene &scene, const glm::vec3 &position, const sg::LightProperties &props = {}, sg::Node *parent_node = nullptr); +sg::Light & + add_point_light(sg::Scene &scene, const glm::vec3 &position, const sg::LightProperties &props = {}, vkb::scene_graph::NodeC *parent_node = nullptr); /** * @brief Adds a directional light to the scene with the specified parameters @@ -86,7 +92,10 @@ sg::Light &add_point_light(sg::Scene &scene, const glm::vec3 &position, const sg * @param parent_node The parent node for the line, defaults to root * @return The newly created light component */ -sg::Light &add_directional_light(sg::Scene &scene, const glm::quat &rotation, const sg::LightProperties &props = {}, sg::Node *parent_node = nullptr); +sg::Light &add_directional_light(sg::Scene &scene, + const glm::quat &rotation, + const sg::LightProperties &props = {}, + vkb::scene_graph::NodeC *parent_node = nullptr); /** * @brief Adds a spot light to the scene with the specified parameters @@ -97,7 +106,11 @@ sg::Light &add_directional_light(sg::Scene &scene, const glm::quat &rotation, co * @param parent_node The parent node for the line, defaults to root * @return The newly created light component */ -sg::Light &add_spot_light(sg::Scene &scene, const glm::vec3 &position, const glm::quat &rotation, const sg::LightProperties &props = {}, sg::Node *parent_node = nullptr); +sg::Light &add_spot_light(sg::Scene &scene, + const glm::vec3 &position, + const glm::quat &rotation, + const sg::LightProperties &props = {}, + vkb::scene_graph::NodeC *parent_node = nullptr); /** * @brief Add free camera script to a node with a camera object. @@ -107,6 +120,6 @@ sg::Light &add_spot_light(sg::Scene &scene, const glm::vec3 &position, const glm * @param extent The initial resolution of the camera * @return Node where the script was attached as component */ -sg::Node &add_free_camera(sg::Scene &scene, const std::string &node_name, VkExtent2D extent); +vkb::scene_graph::NodeC &add_free_camera(sg::Scene &scene, const std::string &node_name, VkExtent2D extent); } // namespace vkb diff --git a/framework/gltf_loader.cpp b/framework/gltf_loader.cpp index 5ca0e6d922..445f472be5 100644 --- a/framework/gltf_loader.cpp +++ b/framework/gltf_loader.cpp @@ -844,7 +844,7 @@ sg::Scene GLTFLoader::load_scene(int scene_index, VkBufferUsageFlags additional_ // Load nodes auto meshes = scene.get_components(); - std::vector> nodes; + std::vector> nodes; for (size_t node_index = 0; node_index < model.nodes.size(); ++node_index) { @@ -1016,7 +1016,7 @@ sg::Scene GLTFLoader::load_scene(int scene_index, VkBufferUsageFlags additional_ scene.set_components(std::move(animations)); // Load scenes - std::queue> traverse_nodes; + std::queue> traverse_nodes; tinygltf::Scene *gltf_scene{nullptr}; @@ -1038,7 +1038,7 @@ sg::Scene GLTFLoader::load_scene(int scene_index, VkBufferUsageFlags additional_ throw std::runtime_error("Couldn't determine which scene to load!"); } - auto root_node = std::make_unique(0, gltf_scene->name); + auto root_node = std::make_unique(0, gltf_scene->name); for (auto node_index : gltf_scene->nodes) { @@ -1075,7 +1075,7 @@ sg::Scene GLTFLoader::load_scene(int scene_index, VkBufferUsageFlags additional_ scene.set_nodes(std::move(nodes)); // Create node for the default camera - auto camera_node = std::make_unique(-1, "default_camera"); + auto camera_node = std::make_unique(-1, "default_camera"); auto default_camera = create_default_camera(); default_camera->set_node(*camera_node); @@ -1320,9 +1320,9 @@ std::unique_ptr GLTFLoader::load_model(uint32_t index, bool storage return std::move(submesh); } -std::unique_ptr GLTFLoader::parse_node(const tinygltf::Node &gltf_node, size_t index) const +std::unique_ptr GLTFLoader::parse_node(const tinygltf::Node &gltf_node, size_t index) const { - auto node = std::make_unique(index, gltf_node.name); + auto node = std::make_unique(index, gltf_node.name); auto &transform = node->get_component(); diff --git a/framework/gltf_loader.h b/framework/gltf_loader.h index 780d05632e..6f25fe5d48 100644 --- a/framework/gltf_loader.h +++ b/framework/gltf_loader.h @@ -27,6 +27,7 @@ #define TINYGLTF_NO_EXTERNAL_IMAGE #include +#include "scene_graph/node.h" #include "timer.h" #include "vulkan/vulkan.h" @@ -91,7 +92,7 @@ class GLTFLoader std::unique_ptr read_model_from_file(const std::string &file_name, uint32_t index, bool storage_buffer = false, VkBufferUsageFlags additional_buffer_usage_flags = 0); protected: - virtual std::unique_ptr parse_node(const tinygltf::Node &gltf_node, size_t index) const; + virtual std::unique_ptr parse_node(const tinygltf::Node &gltf_node, size_t index) const; virtual std::unique_ptr parse_camera(const tinygltf::Camera &gltf_camera) const; diff --git a/framework/rendering/subpasses/geometry_subpass.cpp b/framework/rendering/subpasses/geometry_subpass.cpp index 3531c4e9b1..f39ed52571 100644 --- a/framework/rendering/subpasses/geometry_subpass.cpp +++ b/framework/rendering/subpasses/geometry_subpass.cpp @@ -56,7 +56,8 @@ void GeometrySubpass::prepare() } } -void GeometrySubpass::get_sorted_nodes(std::multimap> &opaque_nodes, std::multimap> &transparent_nodes) +void GeometrySubpass::get_sorted_nodes(std::multimap> &opaque_nodes, + std::multimap> &transparent_nodes) { auto camera_transform = camera.get_node()->get_transform().get_world_matrix(); @@ -90,8 +91,8 @@ void GeometrySubpass::get_sorted_nodes(std::multimap> opaque_nodes; - std::multimap> transparent_nodes; + std::multimap> opaque_nodes; + std::multimap> transparent_nodes; get_sorted_nodes(opaque_nodes, transparent_nodes); @@ -142,7 +143,7 @@ void GeometrySubpass::draw(vkb::core::CommandBufferC &command_buffer) } } -void GeometrySubpass::update_uniform(vkb::core::CommandBufferC &command_buffer, sg::Node &node, size_t thread_index) +void GeometrySubpass::update_uniform(vkb::core::CommandBufferC &command_buffer, vkb::scene_graph::NodeC &node, size_t thread_index) { GlobalUniform global_uniform; diff --git a/framework/rendering/subpasses/geometry_subpass.h b/framework/rendering/subpasses/geometry_subpass.h index 80664143be..9e4706ada1 100644 --- a/framework/rendering/subpasses/geometry_subpass.h +++ b/framework/rendering/subpasses/geometry_subpass.h @@ -35,7 +35,6 @@ using CommandBufferC = CommandBuffer; namespace sg { class Scene; -class Node; class Mesh; class SubMesh; class Camera; @@ -97,7 +96,7 @@ class GeometrySubpass : public vkb::rendering::SubpassC void set_thread_index(uint32_t index); protected: - virtual void update_uniform(vkb::core::CommandBufferC &command_buffer, sg::Node &node, size_t thread_index); + virtual void update_uniform(vkb::core::CommandBufferC &command_buffer, vkb::scene_graph::NodeC &node, size_t thread_index); void draw_submesh(vkb::core::CommandBufferC &command_buffer, sg::SubMesh &sub_mesh, VkFrontFace front_face = VK_FRONT_FACE_COUNTER_CLOCKWISE); @@ -114,8 +113,8 @@ class GeometrySubpass : public vkb::rendering::SubpassC * @brief Sorts objects based on distance from camera and classifies them * into opaque and transparent in the arrays provided */ - void get_sorted_nodes(std::multimap> &opaque_nodes, - std::multimap> &transparent_nodes); + void get_sorted_nodes(std::multimap> &opaque_nodes, + std::multimap> &transparent_nodes); sg::Camera &camera; diff --git a/framework/scene_graph/components/camera.cpp b/framework/scene_graph/components/camera.cpp index 7b1e055190..e7c1710e22 100644 --- a/framework/scene_graph/components/camera.cpp +++ b/framework/scene_graph/components/camera.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2019-2020, Arm Limited and Contributors +/* Copyright (c) 2019-2025, Arm Limited and Contributors * * SPDX-License-Identifier: Apache-2.0 * @@ -44,12 +44,12 @@ glm::mat4 Camera::get_view() return glm::inverse(transform.get_world_matrix()); } -void Camera::set_node(Node &n) +void Camera::set_node(vkb::scene_graph::NodeC &n) { node = &n; } -Node *Camera::get_node() +vkb::scene_graph::NodeC *Camera::get_node() { return node; } diff --git a/framework/scene_graph/components/camera.h b/framework/scene_graph/components/camera.h index d6271a55ad..8b0096ef05 100644 --- a/framework/scene_graph/components/camera.h +++ b/framework/scene_graph/components/camera.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2019-2024, Arm Limited and Contributors +/* Copyright (c) 2019-2025, Arm Limited and Contributors * * SPDX-License-Identifier: Apache-2.0 * @@ -28,6 +28,7 @@ #include "common/helpers.h" #include "scene_graph/component.h" +#include "scene_graph/node.h" namespace vkb { @@ -46,16 +47,16 @@ class Camera : public Component glm::mat4 get_view(); - void set_node(Node &node); + void set_node(vkb::scene_graph::NodeC &node); - Node *get_node(); + vkb::scene_graph::NodeC *get_node(); const glm::mat4 get_pre_rotation(); void set_pre_rotation(const glm::mat4 &pre_rotation); private: - Node *node{nullptr}; + vkb::scene_graph::NodeC *node{nullptr}; glm::mat4 pre_rotation{1.0f}; }; diff --git a/framework/scene_graph/components/light.cpp b/framework/scene_graph/components/light.cpp index db74c1b0da..28fb97c76b 100644 --- a/framework/scene_graph/components/light.cpp +++ b/framework/scene_graph/components/light.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2018-2019, Arm Limited and Contributors +/* Copyright (c) 2018-2025, Arm Limited and Contributors * * SPDX-License-Identifier: Apache-2.0 * @@ -16,6 +16,7 @@ */ #include "light.h" +#include "scene_graph/node.h" namespace vkb { @@ -30,12 +31,12 @@ std::type_index Light::get_type() return typeid(Light); } -void Light::set_node(Node &n) +void Light::set_node(vkb::scene_graph::NodeC &n) { node = &n; } -Node *Light::get_node() +vkb::scene_graph::NodeC *Light::get_node() { return node; } diff --git a/framework/scene_graph/components/light.h b/framework/scene_graph/components/light.h index a6ed3f411c..fd72512a6a 100644 --- a/framework/scene_graph/components/light.h +++ b/framework/scene_graph/components/light.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2018-2024, Arm Limited and Contributors +/* Copyright (c) 2018-2025, Arm Limited and Contributors * * SPDX-License-Identifier: Apache-2.0 * @@ -28,6 +28,7 @@ #include "core/shader_module.h" #include "scene_graph/component.h" +#include "scene_graph/node.h" namespace vkb { @@ -68,9 +69,9 @@ class Light : public Component virtual std::type_index get_type() override; - void set_node(Node &node); + void set_node(vkb::scene_graph::NodeC &node); - Node *get_node(); + vkb::scene_graph::NodeC *get_node(); void set_light_type(const LightType &type); @@ -81,7 +82,7 @@ class Light : public Component const LightProperties &get_properties(); private: - Node *node{nullptr}; + vkb::scene_graph::NodeC *node = nullptr; LightType light_type; diff --git a/framework/scene_graph/components/mesh.cpp b/framework/scene_graph/components/mesh.cpp index b29966ba6d..79430d9b91 100644 --- a/framework/scene_graph/components/mesh.cpp +++ b/framework/scene_graph/components/mesh.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2018-2019, Arm Limited and Contributors +/* Copyright (c) 2018-2025, Arm Limited and Contributors * * SPDX-License-Identifier: Apache-2.0 * @@ -50,12 +50,12 @@ const std::vector &Mesh::get_submeshes() const return submeshes; } -void Mesh::add_node(Node &node) +void Mesh::add_node(vkb::scene_graph::NodeC &node) { nodes.push_back(&node); } -const std::vector &Mesh::get_nodes() const +const std::vector &Mesh::get_nodes() const { return nodes; } diff --git a/framework/scene_graph/components/mesh.h b/framework/scene_graph/components/mesh.h index 400b4ce136..10a959435b 100644 --- a/framework/scene_graph/components/mesh.h +++ b/framework/scene_graph/components/mesh.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2018-2019, Arm Limited and Contributors +/* Copyright (c) 2018-2025, Arm Limited and Contributors * * SPDX-License-Identifier: Apache-2.0 * @@ -24,6 +24,7 @@ #include "scene_graph/component.h" #include "scene_graph/components/aabb.h" +#include "scene_graph/node.h" namespace vkb { @@ -48,16 +49,16 @@ class Mesh : public Component const std::vector &get_submeshes() const; - void add_node(Node &node); + void add_node(vkb::scene_graph::NodeC &node); - const std::vector &get_nodes() const; + const std::vector &get_nodes() const; private: AABB bounds; std::vector submeshes; - std::vector nodes; + std::vector nodes; }; } // namespace sg } // namespace vkb diff --git a/framework/scene_graph/components/transform.cpp b/framework/scene_graph/components/transform.cpp index 8b58e6bb1b..beb0eff2e9 100644 --- a/framework/scene_graph/components/transform.cpp +++ b/framework/scene_graph/components/transform.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2018-2024, Arm Limited and Contributors +/* Copyright (c) 2018-2025, Arm Limited and Contributors * * SPDX-License-Identifier: Apache-2.0 * @@ -26,12 +26,12 @@ namespace vkb { namespace sg { -Transform::Transform(Node &n) : +Transform::Transform(vkb::scene_graph::NodeC &n) : node{n} { } -Node &Transform::get_node() +vkb::scene_graph::NodeC &Transform::get_node() { return node; } diff --git a/framework/scene_graph/components/transform.h b/framework/scene_graph/components/transform.h index ff9b4b84d9..1a4b485d84 100644 --- a/framework/scene_graph/components/transform.h +++ b/framework/scene_graph/components/transform.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2018-2024, Arm Limited and Contributors +/* Copyright (c) 2018-2025, Arm Limited and Contributors * * SPDX-License-Identifier: Apache-2.0 * @@ -31,18 +31,23 @@ namespace vkb { -namespace sg +namespace scene_graph { +template class Node; +using NodeC = Node; +} // namespace scene_graph +namespace sg +{ class Transform : public Component { public: - Transform(Node &node); + Transform(vkb::scene_graph::NodeC &node); virtual ~Transform() = default; - Node &get_node(); + vkb::scene_graph::NodeC &get_node(); virtual std::type_index get_type() override; @@ -72,7 +77,7 @@ class Transform : public Component void invalidate_world_matrix(); private: - Node &node; + vkb::scene_graph::NodeC &node; glm::vec3 translation = glm::vec3(0.0, 0.0, 0.0); diff --git a/framework/scene_graph/node.cpp b/framework/scene_graph/node.cpp deleted file mode 100644 index 8253a84c5e..0000000000 --- a/framework/scene_graph/node.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/* Copyright (c) 2018-2019, Arm Limited and Contributors - * - * 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. - */ - -#include "node.h" - -#include "component.h" -#include "components/transform.h" - -namespace vkb -{ -namespace sg -{ -Node::Node(const size_t id, const std::string &name) : - id{id}, - name{name}, - transform{*this} -{ - set_component(transform); -} - -const size_t Node::get_id() const -{ - return id; -} - -const std::string &Node::get_name() const -{ - return name; -} - -void Node::set_parent(Node &p) -{ - parent = &p; - - transform.invalidate_world_matrix(); -} - -Node *Node::get_parent() const -{ - return parent; -} - -void Node::add_child(Node &child) -{ - children.push_back(&child); -} - -const std::vector &Node::get_children() const -{ - return children; -} - -void Node::set_component(Component &component) -{ - auto it = components.find(component.get_type()); - - if (it != components.end()) - { - it->second = &component; - } - else - { - components.insert(std::make_pair(component.get_type(), &component)); - } -} - -Component &Node::get_component(const std::type_index index) -{ - return *components.at(index); -} - -bool Node::has_component(const std::type_index index) -{ - return components.count(index) > 0; -} - -} // namespace sg -} // namespace vkb diff --git a/framework/scene_graph/node.h b/framework/scene_graph/node.h index 8a06bd8835..c25ef98eed 100644 --- a/framework/scene_graph/node.h +++ b/framework/scene_graph/node.h @@ -1,4 +1,5 @@ -/* Copyright (c) 2018-2019, Arm Limited and Contributors +/* Copyright (c) 2018-2025, Arm Limited and Contributors + * Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved. * * SPDX-License-Identifier: Apache-2.0 * @@ -17,75 +18,160 @@ #pragma once -#include -#include -#include -#include -#include - +#include "scene_graph/component.h" #include "scene_graph/components/transform.h" namespace vkb { -namespace sg +namespace scene_graph { -class Component; - /// @brief A leaf of the tree structure which can have children and a single parent. +template class Node { public: - Node(const size_t id, const std::string &name); + Node(size_t id, std::string const &name); virtual ~Node() = default; - const size_t get_id() const; + void add_child(Node &child); + std::vector *> const &get_children() const; + template + T &get_component(); + vkb::sg::Component &get_component(std::type_index index); + size_t get_id() const; + std::string const &get_name() const; + Node *get_parent(); + vkb::sg::Transform &get_transform(); + template + bool has_component() const; + bool has_component(std::type_index index) const; + void set_component(vkb::sg::Component &component); + void set_parent(Node &parent); + + private: + size_t id; + std::vector *> children; + std::unordered_map components; + std::string name; + Node *parent = nullptr; + vkb::sg::Transform transform; +}; + +using NodeC = Node; +using NodeCpp = Node; - const std::string &get_name() const; +// Member function definitions + +template +inline Node::Node(size_t id_, std::string const &name_) : + id{id_}, name{name_}, transform{*this} +{ + set_component(transform); +} - Transform &get_transform() +template +inline void Node::add_child(Node &child) +{ + if constexpr (bindingType == vkb::BindingType::Cpp) + { + children.push_back(&child); + } + else { - return transform; + children.push_back(reinterpret_cast(&child)); } +} - void set_parent(Node &parent); +template +std::vector *> const &Node::get_children() const +{ + if constexpr (bindingType == vkb::BindingType::Cpp) + { + return children; + } + else + { + return reinterpret_cast const &>(children); + } +} - Node *get_parent() const; +template +template +inline T &Node::get_component() +{ + return dynamic_cast(get_component(typeid(T))); +} - void add_child(Node &child); +template +inline vkb::sg::Component &Node::get_component(std::type_index index) +{ + return *components.at(index); +} - const std::vector &get_children() const; +template +inline size_t Node::get_id() const +{ + return id; +} - void set_component(Component &component); +template +inline std::string const &Node::get_name() const +{ + return name; +} - template - inline T &get_component() +template +inline Node *Node::get_parent() +{ + if constexpr (bindingType == vkb::BindingType::Cpp) { - return dynamic_cast(get_component(typeid(T))); + return parent; } - - Component &get_component(const std::type_index index); - - template - bool has_component() + else { - return has_component(typeid(T)); + return reinterpret_cast(parent); } +} - bool has_component(const std::type_index index); - - private: - size_t id; +template +inline vkb::sg::Transform &Node::get_transform() +{ + return transform; +} - std::string name; +template +template +inline bool Node::has_component() const +{ + return has_component(typeid(T)); +} - Transform transform; +template +inline bool Node::has_component(std::type_index index) const +{ + return components.contains(index); +} - Node *parent{nullptr}; +template +inline void Node::set_component(vkb::sg::Component &component) +{ + components[component.get_type()] = &component; +} - std::vector children; +template +inline void Node::set_parent(Node &p) +{ + if constexpr (bindingType == vkb::BindingType::Cpp) + { + parent = &p; + } + else + { + parent = reinterpret_cast(&p); + } - std::unordered_map components; -}; -} // namespace sg + transform.invalidate_world_matrix(); +} +} // namespace scene_graph } // namespace vkb diff --git a/framework/scene_graph/scene.cpp b/framework/scene_graph/scene.cpp index 4c76d5352f..4705ef78c3 100644 --- a/framework/scene_graph/scene.cpp +++ b/framework/scene_graph/scene.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2018-2023, Arm Limited and Contributors +/* Copyright (c) 2018-2025, Arm Limited and Contributors * * SPDX-License-Identifier: Apache-2.0 * @@ -41,18 +41,18 @@ const std::string &Scene::get_name() const return name; } -void Scene::set_nodes(std::vector> &&n) +void Scene::set_nodes(std::vector> &&n) { assert(nodes.empty() && "Scene nodes were already set"); nodes = std::move(n); } -void Scene::add_node(std::unique_ptr &&n) +void Scene::add_node(std::unique_ptr &&n) { nodes.emplace_back(std::move(n)); } -void Scene::add_child(Node &child) +void Scene::add_child(vkb::scene_graph::NodeC &child) { root->add_child(child); } @@ -65,7 +65,7 @@ std::unique_ptr Scene::get_model(uint32_t index) return std::move(meshes[index]); } -void Scene::add_component(std::unique_ptr &&component, Node &node) +void Scene::add_component(std::unique_ptr &&component, vkb::scene_graph::NodeC &node) { node.set_component(*component); @@ -99,11 +99,11 @@ bool Scene::has_component(const std::type_index &type_info) const return (component != components.end() && !component->second.empty()); } -Node *Scene::find_node(const std::string &node_name) +vkb::scene_graph::NodeC *Scene::find_node(const std::string &node_name) { for (auto root_node : root->get_children()) { - std::queue traverse_nodes{}; + std::queue traverse_nodes{}; traverse_nodes.push(root_node); while (!traverse_nodes.empty()) @@ -126,12 +126,12 @@ Node *Scene::find_node(const std::string &node_name) return nullptr; } -void Scene::set_root_node(Node &node) +void Scene::set_root_node(vkb::scene_graph::NodeC &node) { root = &node; } -Node &Scene::get_root_node() +vkb::scene_graph::NodeC &Scene::get_root_node() { return *root; } diff --git a/framework/scene_graph/scene.h b/framework/scene_graph/scene.h index e572994cf1..0a1e4caad5 100644 --- a/framework/scene_graph/scene.h +++ b/framework/scene_graph/scene.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2018-2020, Arm Limited and Contributors +/* Copyright (c) 2018-2025, Arm Limited and Contributors * * SPDX-License-Identifier: Apache-2.0 * @@ -26,12 +26,12 @@ #include "scene_graph/components/light.h" #include "scene_graph/components/texture.h" +#include "scene_graph/node.h" namespace vkb { namespace sg { -class Node; class Component; class SubMesh; @@ -48,17 +48,17 @@ class Scene const std::string &get_name() const; - void set_nodes(std::vector> &&nodes); + void set_nodes(std::vector> &&nodes); - void add_node(std::unique_ptr &&node); + void add_node(std::unique_ptr &&node); - void add_child(Node &child); + void add_child(vkb::scene_graph::NodeC &child); std::unique_ptr get_model(uint32_t index = 0); void add_component(std::unique_ptr &&component); - void add_component(std::unique_ptr &&component, Node &node); + void add_component(std::unique_ptr &&component, vkb::scene_graph::NodeC &node); /** * @brief Set list of components for the given type @@ -124,19 +124,19 @@ class Scene bool has_component(const std::type_index &type_info) const; - Node *find_node(const std::string &name); + vkb::scene_graph::NodeC *find_node(const std::string &name); - void set_root_node(Node &node); + void set_root_node(vkb::scene_graph::NodeC &node); - Node &get_root_node(); + vkb::scene_graph::NodeC &get_root_node(); private: std::string name; /// List of all the nodes - std::vector> nodes; + std::vector> nodes; - Node *root{nullptr}; + vkb::scene_graph::NodeC *root{nullptr}; std::unordered_map>> components; }; diff --git a/framework/scene_graph/script.cpp b/framework/scene_graph/script.cpp index a7338783c7..3ffbb50f9a 100644 --- a/framework/scene_graph/script.cpp +++ b/framework/scene_graph/script.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2019-2021, Arm Limited and Contributors +/* Copyright (c) 2019-2025, Arm Limited and Contributors * * SPDX-License-Identifier: Apache-2.0 * @@ -38,13 +38,13 @@ void Script::resize(uint32_t /*width*/, uint32_t /*height*/) { } -NodeScript::NodeScript(Node &node, const std::string &name) : +NodeScript::NodeScript(vkb::scene_graph::NodeC &node, const std::string &name) : Script{name}, node{node} { } -Node &NodeScript::get_node() +vkb::scene_graph::NodeC &NodeScript::get_node() { return node; } diff --git a/framework/scene_graph/script.h b/framework/scene_graph/script.h index 32234f3c1f..cf5c661714 100644 --- a/framework/scene_graph/script.h +++ b/framework/scene_graph/script.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2019-2021, Arm Limited and Contributors +/* Copyright (c) 2019-2025, Arm Limited and Contributors * * SPDX-License-Identifier: Apache-2.0 * @@ -24,6 +24,7 @@ #include "platform/input_events.h" #include "scene_graph/component.h" +#include "scene_graph/node.h" namespace vkb { @@ -55,14 +56,14 @@ class Script : public Component class NodeScript : public Script { public: - NodeScript(Node &node, const std::string &name = ""); + NodeScript(vkb::scene_graph::NodeC &node, const std::string &name = ""); virtual ~NodeScript() = default; - Node &get_node(); + vkb::scene_graph::NodeC &get_node(); private: - Node &node; + vkb::scene_graph::NodeC &node; }; } // namespace sg } // namespace vkb diff --git a/framework/scene_graph/scripts/animation.cpp b/framework/scene_graph/scripts/animation.cpp index 38494d3e00..7b1e8b0a1b 100644 --- a/framework/scene_graph/scripts/animation.cpp +++ b/framework/scene_graph/scripts/animation.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2020-2023, Arm Limited and Contributors +/* Copyright (c) 2020-2025, Arm Limited and Contributors * * SPDX-License-Identifier: Apache-2.0 * @@ -33,7 +33,7 @@ Animation::Animation(const Animation &other) : { } -void Animation::add_channel(Node &node, const AnimationTarget &target, const AnimationSampler &sampler) +void Animation::add_channel(vkb::scene_graph::NodeC &node, const AnimationTarget &target, const AnimationSampler &sampler) { channels.push_back({node, target, sampler}); } diff --git a/framework/scene_graph/scripts/animation.h b/framework/scene_graph/scripts/animation.h index e268db8179..bec7c063ca 100644 --- a/framework/scene_graph/scripts/animation.h +++ b/framework/scene_graph/scripts/animation.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2020-2021, Arm Limited and Contributors +/* Copyright (c) 2020-2025, Arm Limited and Contributors * * SPDX-License-Identifier: Apache-2.0 * @@ -55,7 +55,7 @@ struct AnimationSampler struct AnimationChannel { - Node &node; + vkb::scene_graph::NodeC &node; AnimationTarget target; @@ -73,7 +73,7 @@ class Animation : public Script void update_times(float start_time, float end_time); - void add_channel(Node &node, const AnimationTarget &target, const AnimationSampler &sampler); + void add_channel(vkb::scene_graph::NodeC &node, const AnimationTarget &target, const AnimationSampler &sampler); private: std::vector channels; diff --git a/framework/scene_graph/scripts/free_camera.cpp b/framework/scene_graph/scripts/free_camera.cpp index d77d901e98..e2ff16a424 100644 --- a/framework/scene_graph/scripts/free_camera.cpp +++ b/framework/scene_graph/scripts/free_camera.cpp @@ -1,5 +1,5 @@ -/* Copyright (c) 2019-2024, Arm Limited and Contributors - * Copyright (c) 2020-2024, Andrew Cox, Huawei Technologies Research & Development (UK) Limited +/* Copyright (c) 2019-2025, Arm Limited and Contributors + * Copyright (c) 2020-2025, Andrew Cox, Huawei Technologies Research & Development (UK) Limited * * SPDX-License-Identifier: Apache-2.0 * @@ -44,7 +44,7 @@ const float FreeCamera::TRANSLATION_MOVE_STEP = 50.0f; const uint32_t FreeCamera::TRANSLATION_MOVE_SPEED = 4; -FreeCamera::FreeCamera(Node &node) : +FreeCamera::FreeCamera(vkb::scene_graph::NodeC &node) : NodeScript{node, "FreeCamera"} {} diff --git a/framework/scene_graph/scripts/free_camera.h b/framework/scene_graph/scripts/free_camera.h index 49ab2e39e2..c5c06c5809 100644 --- a/framework/scene_graph/scripts/free_camera.h +++ b/framework/scene_graph/scripts/free_camera.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2019-2024, Arm Limited and Contributors +/* Copyright (c) 2019-2025, Arm Limited and Contributors * * SPDX-License-Identifier: Apache-2.0 * @@ -48,7 +48,7 @@ class FreeCamera : public NodeScript static const uint32_t TRANSLATION_MOVE_SPEED; - FreeCamera(Node &node); + FreeCamera(vkb::scene_graph::NodeC &node); virtual ~FreeCamera() = default; diff --git a/framework/scene_graph/scripts/node_animation.cpp b/framework/scene_graph/scripts/node_animation.cpp index 908703fde8..ee1944de71 100644 --- a/framework/scene_graph/scripts/node_animation.cpp +++ b/framework/scene_graph/scripts/node_animation.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2019-2024, Arm Limited and Contributors +/* Copyright (c) 2019-2025, Arm Limited and Contributors * * SPDX-License-Identifier: Apache-2.0 * @@ -31,7 +31,7 @@ namespace vkb { namespace sg { -NodeAnimation::NodeAnimation(Node &node, TransformAnimFn animation_fn) : +NodeAnimation::NodeAnimation(vkb::scene_graph::NodeC &node, TransformAnimFn animation_fn) : NodeScript{node, ""}, animation_fn{animation_fn} { diff --git a/framework/scene_graph/scripts/node_animation.h b/framework/scene_graph/scripts/node_animation.h index 5ee902fc23..3768636ab7 100644 --- a/framework/scene_graph/scripts/node_animation.h +++ b/framework/scene_graph/scripts/node_animation.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2019-2021, Arm Limited and Contributors +/* Copyright (c) 2019-2025, Arm Limited and Contributors * * SPDX-License-Identifier: Apache-2.0 * @@ -39,7 +39,7 @@ namespace sg class NodeAnimation : public NodeScript { public: - NodeAnimation(Node &node, TransformAnimFn animation_fn); + NodeAnimation(vkb::scene_graph::NodeC &node, TransformAnimFn animation_fn); virtual ~NodeAnimation() = default; diff --git a/samples/extensions/conditional_rendering/conditional_rendering.h b/samples/extensions/conditional_rendering/conditional_rendering.h index 31d2fa1e84..5f4274b45c 100644 --- a/samples/extensions/conditional_rendering/conditional_rendering.h +++ b/samples/extensions/conditional_rendering/conditional_rendering.h @@ -32,9 +32,9 @@ class ConditionalRendering : public ApiVulkanSample std::unique_ptr scene; struct SceneNode { - std::string name; - vkb::sg::Node *node; - vkb::sg::SubMesh *sub_mesh; + std::string name; + vkb::scene_graph::NodeC *node; + vkb::sg::SubMesh *sub_mesh; }; std::vector linear_scene_nodes; diff --git a/samples/extensions/dynamic_multisample_rasterization/dynamic_multisample_rasterization.h b/samples/extensions/dynamic_multisample_rasterization/dynamic_multisample_rasterization.h index 04a687fece..75390a2ec4 100644 --- a/samples/extensions/dynamic_multisample_rasterization/dynamic_multisample_rasterization.h +++ b/samples/extensions/dynamic_multisample_rasterization/dynamic_multisample_rasterization.h @@ -35,8 +35,8 @@ class DynamicMultisampleRasterization : public ApiVulkanSample struct SceneNode { - vkb::sg::Node *node; - vkb::sg::SubMesh *sub_mesh; + vkb::scene_graph::NodeC *node; + vkb::sg::SubMesh *sub_mesh; }; std::vector scene_nodes_opaque; std::vector scene_nodes_opaque_flipped; diff --git a/samples/extensions/extended_dynamic_state2/extended_dynamic_state2.cpp b/samples/extensions/extended_dynamic_state2/extended_dynamic_state2.cpp index a9b8530f55..3f24ac1f9c 100644 --- a/samples/extensions/extended_dynamic_state2/extended_dynamic_state2.cpp +++ b/samples/extensions/extended_dynamic_state2/extended_dynamic_state2.cpp @@ -95,9 +95,9 @@ void ExtendedDynamicState2::load_assets() { load_scene("scenes/primitives/primitives.gltf"); - std::vector scene_elements; - std::vector node_scene_list = {&(get_scene().get_root_node())}; - vkb::sg::Node *node = nullptr; + std::vector scene_elements; + std::vector node_scene_list = {&(get_scene().get_root_node())}; + vkb::scene_graph::NodeC *node = nullptr; for (size_t list_it = 0; node_scene_list.size() > list_it; ++list_it) { diff --git a/samples/extensions/extended_dynamic_state2/extended_dynamic_state2.h b/samples/extensions/extended_dynamic_state2/extended_dynamic_state2.h index 52d001d491..83296f97c4 100644 --- a/samples/extensions/extended_dynamic_state2/extended_dynamic_state2.h +++ b/samples/extensions/extended_dynamic_state2/extended_dynamic_state2.h @@ -113,9 +113,9 @@ class ExtendedDynamicState2 : public ApiVulkanSample struct SceneNode { - std::string name; - vkb::sg::Node *node; - vkb::sg::SubMesh *sub_mesh; + std::string name; + vkb::scene_graph::NodeC *node; + vkb::sg::SubMesh *sub_mesh; }; std::vector scene_elements_baseline; std::vector scene_elements_tess; diff --git a/samples/extensions/ray_queries/ray_queries.cpp b/samples/extensions/ray_queries/ray_queries.cpp index d7cfcb193d..f9b677f195 100644 --- a/samples/extensions/ray_queries/ray_queries.cpp +++ b/samples/extensions/ray_queries/ray_queries.cpp @@ -273,7 +273,7 @@ void RayQueries::create_bottom_level_acceleration_structure() bottom_level_acceleration_structure->build(queue, VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_TRACE_BIT_KHR, VK_BUILD_ACCELERATION_STRUCTURE_MODE_BUILD_KHR); } -void RayQueries::load_node(vkb::sg::Node &node) +void RayQueries::load_node(vkb::scene_graph::NodeC &node) { if (node.has_component()) { diff --git a/samples/extensions/ray_queries/ray_queries.h b/samples/extensions/ray_queries/ray_queries.h index 729e22ae8b..995f9bb74c 100644 --- a/samples/extensions/ray_queries/ray_queries.h +++ b/samples/extensions/ray_queries/ray_queries.h @@ -29,7 +29,6 @@ namespace vkb namespace sg { class Scene; -class Node; class Mesh; class SubMesh; class Camera; @@ -88,7 +87,7 @@ class RayQueries : public ApiVulkanSample void build_command_buffers() override; void create_uniforms(); - void load_node(vkb::sg::Node &node); + void load_node(vkb::scene_graph::NodeC &node); void load_scene(); void create_descriptor_pool(); void create_descriptor_sets(); diff --git a/samples/performance/16bit_storage_input_output/16bit_storage_input_output.cpp b/samples/performance/16bit_storage_input_output/16bit_storage_input_output.cpp index bc96d945b1..2d83b7ab77 100644 --- a/samples/performance/16bit_storage_input_output/16bit_storage_input_output.cpp +++ b/samples/performance/16bit_storage_input_output/16bit_storage_input_output.cpp @@ -119,7 +119,7 @@ void KHR16BitStorageInputOutputSample::setup_scene() continue; } - auto node = std::make_unique(-1, "Teapot"); + auto node = std::make_unique(-1, "Teapot"); node->set_component(*teapot_mesh); teapot_mesh->add_node(*node); diff --git a/samples/performance/command_buffer_usage/command_buffer_usage.cpp b/samples/performance/command_buffer_usage/command_buffer_usage.cpp index 7b5f40afa3..91a7fa6497 100644 --- a/samples/performance/command_buffer_usage/command_buffer_usage.cpp +++ b/samples/performance/command_buffer_usage/command_buffer_usage.cpp @@ -261,11 +261,11 @@ CommandBufferUsage::ForwardSubpassSecondary::ForwardSubpassSecondary(vkb::render { } -void CommandBufferUsage::ForwardSubpassSecondary::record_draw(vkb::core::CommandBufferC &command_buffer, - const std::vector> &nodes, - uint32_t mesh_start, - uint32_t mesh_end, - size_t thread_index) +void CommandBufferUsage::ForwardSubpassSecondary::record_draw(vkb::core::CommandBufferC &command_buffer, + const std::vector> &nodes, + uint32_t mesh_start, + uint32_t mesh_end, + size_t thread_index) { command_buffer.set_color_blend_state(color_blend_state); @@ -283,11 +283,11 @@ void CommandBufferUsage::ForwardSubpassSecondary::record_draw(vkb::core::Command } std::shared_ptr - CommandBufferUsage::ForwardSubpassSecondary::record_draw_secondary(vkb::core::CommandBufferC &primary_command_buffer, - const std::vector> &nodes, - uint32_t mesh_start, - uint32_t mesh_end, - size_t thread_index) + CommandBufferUsage::ForwardSubpassSecondary::record_draw_secondary(vkb::core::CommandBufferC &primary_command_buffer, + const std::vector> &nodes, + uint32_t mesh_start, + uint32_t mesh_end, + size_t thread_index) { const auto &queue = get_render_context().get_device().get_queue_by_flags(VK_QUEUE_GRAPHICS_BIT, 0); @@ -311,15 +311,15 @@ std::shared_ptr void CommandBufferUsage::ForwardSubpassSecondary::draw(vkb::core::CommandBufferC &primary_command_buffer) { - std::multimap> opaque_nodes; + std::multimap> opaque_nodes; - std::multimap> transparent_nodes; + std::multimap> transparent_nodes; get_sorted_nodes(opaque_nodes, transparent_nodes); // Sort opaque objects in front-to-back order // Note: sorting objects does not help on PowerVR, so it can be avoided to save CPU cycles - std::vector> sorted_opaque_nodes; + std::vector> sorted_opaque_nodes; for (auto node_it = opaque_nodes.begin(); node_it != opaque_nodes.end(); node_it++) { sorted_opaque_nodes.push_back(node_it->second); @@ -327,7 +327,7 @@ void CommandBufferUsage::ForwardSubpassSecondary::draw(vkb::core::CommandBufferC const auto opaque_submeshes = vkb::to_u32(sorted_opaque_nodes.size()); // Sort transparent objects in back-to-front order - std::vector> sorted_transparent_nodes; + std::vector> sorted_transparent_nodes; for (auto node_it = transparent_nodes.rbegin(); node_it != transparent_nodes.rend(); node_it++) { sorted_transparent_nodes.push_back(node_it->second); diff --git a/samples/performance/command_buffer_usage/command_buffer_usage.h b/samples/performance/command_buffer_usage/command_buffer_usage.h index f0f2010ce6..204ea387c2 100644 --- a/samples/performance/command_buffer_usage/command_buffer_usage.h +++ b/samples/performance/command_buffer_usage/command_buffer_usage.h @@ -169,11 +169,11 @@ class CommandBufferUsage : public vkb::VulkanSampleC * @param mesh_end Index to the mesh where recording will stop (not included) * @param thread_index Identifies the resources allocated for this thread */ - void record_draw(vkb::core::CommandBufferC &command_buffer, - const std::vector> &nodes, - uint32_t mesh_start, - uint32_t mesh_end, - size_t thread_index = 0); + void record_draw(vkb::core::CommandBufferC &command_buffer, + const std::vector> &nodes, + uint32_t mesh_start, + uint32_t mesh_end, + size_t thread_index = 0); /** * @brief Records the necessary commands to draw the specified range of scene meshes @@ -186,11 +186,11 @@ class CommandBufferUsage : public vkb::VulkanSampleC * @param thread_index Identifies the resources allocated for this thread * @return a pointer to the recorded secondary command buffer */ - std::shared_ptr record_draw_secondary(vkb::core::CommandBufferC &primary_command_buffer, - const std::vector> &nodes, - uint32_t mesh_start, - uint32_t mesh_end, - size_t thread_index = 0); + std::shared_ptr record_draw_secondary(vkb::core::CommandBufferC &primary_command_buffer, + const std::vector> &nodes, + uint32_t mesh_start, + uint32_t mesh_end, + size_t thread_index = 0); VkViewport viewport{}; diff --git a/samples/performance/constant_data/constant_data.cpp b/samples/performance/constant_data/constant_data.cpp index efc2f3d78f..a7bda6d223 100644 --- a/samples/performance/constant_data/constant_data.cpp +++ b/samples/performance/constant_data/constant_data.cpp @@ -47,7 +47,7 @@ namespace /** * @brief Helper function to fill the contents of the MVPUniform struct with the transform of the node and the camera view-projection matrix. */ -inline MVPUniform fill_mvp(vkb::sg::Node &node, vkb::sg::Camera &camera) +inline MVPUniform fill_mvp(vkb::scene_graph::NodeC &node, vkb::sg::Camera &camera) { MVPUniform mvp; @@ -304,7 +304,7 @@ void ConstantData::ConstantDataSubpass::prepare() } void ConstantData::PushConstantSubpass::update_uniform(vkb::core::CommandBufferC &command_buffer, - vkb::sg::Node &node, + vkb::scene_graph::NodeC &node, size_t thread_index) { mvp_uniform = fill_mvp(node, camera); @@ -341,7 +341,7 @@ void ConstantData::PushConstantSubpass::prepare_push_constants(vkb::core::Comman } void ConstantData::DescriptorSetSubpass::update_uniform(vkb::core::CommandBufferC &command_buffer, - vkb::sg::Node &node, + vkb::scene_graph::NodeC &node, size_t thread_index) { MVPUniform mvp; @@ -441,7 +441,7 @@ void ConstantData::BufferArraySubpass::draw(vkb::core::CommandBufferC &command_b } void ConstantData::BufferArraySubpass::update_uniform(vkb::core::CommandBufferC &command_buffer, - vkb::sg::Node &node, + vkb::scene_graph::NodeC &node, size_t thread_index) { /** diff --git a/samples/performance/constant_data/constant_data.h b/samples/performance/constant_data/constant_data.h index 06c0fdaa49..195dfaba05 100644 --- a/samples/performance/constant_data/constant_data.h +++ b/samples/performance/constant_data/constant_data.h @@ -137,7 +137,7 @@ class ConstantData : public vkb::VulkanSampleC /** * @brief Updates the MVP uniform member variable to then be pushed into the shader */ - virtual void update_uniform(vkb::core::CommandBufferC &command_buffer, vkb::sg::Node &node, size_t thread_index) override; + virtual void update_uniform(vkb::core::CommandBufferC &command_buffer, vkb::scene_graph::NodeC &node, size_t thread_index) override; /** * @brief Overridden to intentionally disable any dynamic shader module updates @@ -174,7 +174,7 @@ class ConstantData : public vkb::VulkanSampleC /** * @brief Creates a buffer filled with the mvp data and binds it */ - virtual void update_uniform(vkb::core::CommandBufferC &command_buffer, vkb::sg::Node &node, size_t thread_index) override; + virtual void update_uniform(vkb::core::CommandBufferC &command_buffer, vkb::scene_graph::NodeC &node, size_t thread_index) override; /** * @brief Dynamically retrieves the correct pipeline layout depending on the method of UBO @@ -213,7 +213,7 @@ class ConstantData : public vkb::VulkanSampleC /** * @brief No-op, uniform data is sent upfront before the draw call */ - virtual void update_uniform(vkb::core::CommandBufferC &command_buffer, vkb::sg::Node &node, size_t thread_index) override; + virtual void update_uniform(vkb::core::CommandBufferC &command_buffer, vkb::scene_graph::NodeC &node, size_t thread_index) override; /** * @brief Returns a default pipeline layout