Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 0 additions & 2 deletions framework/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,8 @@ set(SCENE_GRAPH_FILES
scene_graph/node.h
scene_graph/scene.h
scene_graph/script.h
scene_graph/hpp_scene.h
# Source Files
scene_graph/component.cpp
scene_graph/scene.cpp
scene_graph/script.cpp)

set(SCENE_GRAPH_COMPONENT_FILES
Expand Down
7 changes: 3 additions & 4 deletions framework/common/hpp_utils.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2021-2025, NVIDIA CORPORATION. All rights reserved.
/* Copyright (c) 2021-2026, NVIDIA CORPORATION. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
Expand All @@ -18,7 +18,6 @@
#pragma once

#include "common/utils.h"
#include "scene_graph/hpp_scene.h"

/**
* @brief facade helper functions around the functions in common/utils.h, providing a vulkan.hpp-based interface
Expand All @@ -27,10 +26,10 @@ namespace vkb
{
namespace common
{
inline vkb::scene_graph::NodeCpp &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::SceneCpp &scene, const std::string &node_name, vk::Extent2D const &extent)
{
return reinterpret_cast<vkb::scene_graph::NodeCpp &>(
vkb::add_free_camera(reinterpret_cast<vkb::sg::Scene &>(scene), node_name, static_cast<VkExtent2D>(extent)));
vkb::add_free_camera(reinterpret_cast<vkb::scene_graph::SceneC &>(scene), node_name, static_cast<VkExtent2D>(extent)));
}

inline void screenshot(vkb::rendering::RenderContextCpp &render_context, const std::string &filename)
Expand Down
12 changes: 6 additions & 6 deletions framework/common/utils.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2018-2025, Arm Limited and Contributors
/* Copyright (c) 2018-2026, Arm Limited and Contributors
*
* SPDX-License-Identifier: Apache-2.0
*
Expand Down Expand Up @@ -215,7 +215,7 @@ std::string to_snake_case(const std::string &text)
return result.str();
}

sg::Light &add_light(sg::Scene &scene,
sg::Light &add_light(vkb::scene_graph::SceneC &scene,
sg::LightType type,
const glm::vec3 &position,
const glm::quat &rotation,
Expand Down Expand Up @@ -249,22 +249,22 @@ sg::Light &add_light(sg::Scene &scene,
return light;
}

sg::Light &add_point_light(sg::Scene &scene, const glm::vec3 &position, const sg::LightProperties &props, vkb::scene_graph::NodeC *parent_node)
sg::Light &add_point_light(vkb::scene_graph::SceneC &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, vkb::scene_graph::NodeC *parent_node)
sg::Light &add_directional_light(vkb::scene_graph::SceneC &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, vkb::scene_graph::NodeC *parent_node)
sg::Light &add_spot_light(vkb::scene_graph::SceneC &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);
}

vkb::scene_graph::NodeC &add_free_camera(sg::Scene &scene, const std::string &node_name, VkExtent2D extent)
vkb::scene_graph::NodeC &add_free_camera(vkb::scene_graph::SceneC &scene, const std::string &node_name, VkExtent2D extent)
{
auto camera_node = scene.find_node(node_name);

Expand Down
13 changes: 7 additions & 6 deletions framework/common/utils.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2018-2025, Arm Limited and Contributors
/* Copyright (c) 2018-2026, Arm Limited and Contributors
*
* SPDX-License-Identifier: Apache-2.0
*
Expand All @@ -25,6 +25,7 @@
#include "filesystem/legacy.h"
#include "rendering/pipeline_state.h"
#include "rendering/render_context.h"
#include "scene_graph/components/light.h"
#include "scene_graph/components/sub_mesh.h"
#include "scene_graph/scene.h"

Expand Down Expand Up @@ -66,7 +67,7 @@ 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::Light &add_light(vkb::scene_graph::SceneC &scene,
sg::LightType type,
const glm::vec3 &position,
const glm::quat &rotation = {},
Expand All @@ -82,7 +83,7 @@ sg::Light &add_light(sg::Scene &scene,
* @return The newly created light component
*/
sg::Light &
add_point_light(sg::Scene &scene, const glm::vec3 &position, const sg::LightProperties &props = {}, vkb::scene_graph::NodeC *parent_node = nullptr);
add_point_light(vkb::scene_graph::SceneC &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
Expand All @@ -92,7 +93,7 @@ sg::Light &
* @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,
sg::Light &add_directional_light(vkb::scene_graph::SceneC &scene,
const glm::quat &rotation,
const sg::LightProperties &props = {},
vkb::scene_graph::NodeC *parent_node = nullptr);
Expand All @@ -106,7 +107,7 @@ sg::Light &add_directional_light(sg::Scene &scene,
* @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,
sg::Light &add_spot_light(vkb::scene_graph::SceneC &scene,
const glm::vec3 &position,
const glm::quat &rotation,
const sg::LightProperties &props = {},
Expand All @@ -120,6 +121,6 @@ sg::Light &add_spot_light(sg::Scene &scene,
* @param extent The initial resolution of the camera
* @return Node where the script was attached as component
*/
vkb::scene_graph::NodeC &add_free_camera(sg::Scene &scene, const std::string &node_name, VkExtent2D extent);
vkb::scene_graph::NodeC &add_free_camera(vkb::scene_graph::SceneC &scene, const std::string &node_name, VkExtent2D extent);

} // namespace vkb
12 changes: 6 additions & 6 deletions framework/gltf_loader.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Copyright (c) 2018-2025, Arm Limited and Contributors
* Copyright (c) 2019-2025, Sascha Willems
/* Copyright (c) 2018-2026, Arm Limited and Contributors
* Copyright (c) 2019-2026, Sascha Willems
*
* SPDX-License-Identifier: Apache-2.0
*
Expand Down Expand Up @@ -407,7 +407,7 @@ GLTFLoader::GLTFLoader(vkb::core::DeviceC &device) :
{
}

std::unique_ptr<sg::Scene> GLTFLoader::read_scene_from_file(const std::string &file_name, int scene_index, VkBufferUsageFlags additional_buffer_usage_flags)
std::unique_ptr<vkb::scene_graph::SceneC> GLTFLoader::read_scene_from_file(const std::string &file_name, int scene_index, VkBufferUsageFlags additional_buffer_usage_flags)
{
PROFILE_SCOPE("Load GLTF Scene");

Expand Down Expand Up @@ -447,7 +447,7 @@ std::unique_ptr<sg::Scene> GLTFLoader::read_scene_from_file(const std::string &f
model_path.clear();
}

return std::make_unique<sg::Scene>(load_scene(scene_index, additional_buffer_usage_flags));
return std::make_unique<vkb::scene_graph::SceneC>(load_scene(scene_index, additional_buffer_usage_flags));
}

std::unique_ptr<sg::SubMesh> GLTFLoader::read_model_from_file(const std::string &file_name, uint32_t index, bool storage_buffer, VkBufferUsageFlags additional_buffer_usage_flags)
Expand Down Expand Up @@ -494,11 +494,11 @@ std::unique_ptr<sg::SubMesh> GLTFLoader::read_model_from_file(const std::string
return std::move(load_model(index, storage_buffer, additional_buffer_usage_flags));
}

sg::Scene GLTFLoader::load_scene(int scene_index, VkBufferUsageFlags additional_buffer_usage_flags)
vkb::scene_graph::SceneC GLTFLoader::load_scene(int scene_index, VkBufferUsageFlags additional_buffer_usage_flags)
{
PROFILE_SCOPE("Process Scene");

auto scene = sg::Scene();
auto scene = vkb::scene_graph::SceneC();

scene.set_name("gltf_scene");

Expand Down
10 changes: 5 additions & 5 deletions framework/gltf_loader.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Copyright (c) 2018-2025, Arm Limited and Contributors
* Copyright (c) 2019-2025, Sascha Willems
/* Copyright (c) 2018-2026, Arm Limited and Contributors
* Copyright (c) 2019-2026, Sascha Willems
*
* SPDX-License-Identifier: Apache-2.0
*
Expand Down Expand Up @@ -29,6 +29,7 @@

#include "scene_graph/components/sampler.h"
#include "scene_graph/node.h"
#include "scene_graph/scene.h"
#include "timer.h"

#include "vulkan/vulkan.h"
Expand All @@ -54,7 +55,6 @@ class Mesh;
class Node;
class PBRMaterial;
class Sampler;
class Scene;
class SubMesh;
class Texture;
} // namespace sg
Expand Down Expand Up @@ -84,7 +84,7 @@ class GLTFLoader

virtual ~GLTFLoader() = default;

std::unique_ptr<sg::Scene> read_scene_from_file(const std::string &file_name, int scene_index = -1, VkBufferUsageFlags additional_buffer_usage_flags = 0);
std::unique_ptr<vkb::scene_graph::SceneC> read_scene_from_file(const std::string &file_name, int scene_index = -1, VkBufferUsageFlags additional_buffer_usage_flags = 0);

/**
* @brief Loads the first model from a GLTF file for use in simpler samples
Expand Down Expand Up @@ -143,7 +143,7 @@ class GLTFLoader
static std::unordered_map<std::string, bool> supported_extensions;

private:
sg::Scene load_scene(int scene_index = -1, VkBufferUsageFlags additional_buffer_usage_flags = 0);
vkb::scene_graph::SceneC load_scene(int scene_index = -1, VkBufferUsageFlags additional_buffer_usage_flags = 0);

std::unique_ptr<sg::SubMesh> load_model(uint32_t index, bool storage_buffer = false, VkBufferUsageFlags additional_buffer_usage_flags = 0);
};
Expand Down
7 changes: 3 additions & 4 deletions framework/hpp_gltf_loader.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2021-2025, NVIDIA CORPORATION. All rights reserved.
/* Copyright (c) 2021-2026, NVIDIA CORPORATION. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
Expand All @@ -20,7 +20,6 @@
#include <gltf_loader.h>

#include <scene_graph/components/hpp_sub_mesh.h>
#include <scene_graph/hpp_scene.h>

namespace vkb
{
Expand All @@ -43,9 +42,9 @@ class HPPGLTFLoader : private vkb::GLTFLoader
vkb::GLTFLoader::read_model_from_file(file_name, index, storage_buffer, static_cast<VkBufferUsageFlags>(additional_buffer_usage_flags)).release()));
}

std::unique_ptr<vkb::scene_graph::HPPScene> read_scene_from_file(const std::string &file_name, int scene_index = -1)
std::unique_ptr<vkb::scene_graph::SceneCpp> read_scene_from_file(const std::string &file_name, int scene_index = -1)
{
return std::unique_ptr<vkb::scene_graph::HPPScene>(reinterpret_cast<vkb::scene_graph::HPPScene *>(vkb::GLTFLoader::read_scene_from_file(file_name, scene_index).release()));
return std::unique_ptr<vkb::scene_graph::SceneCpp>(reinterpret_cast<vkb::scene_graph::SceneCpp *>(vkb::GLTFLoader::read_scene_from_file(file_name, scene_index).release()));
}
};
} // namespace vkb
5 changes: 2 additions & 3 deletions framework/rendering/subpasses/forward_subpass.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ template <vkb::BindingType bindingType>
class ForwardSubpass : public vkb::rendering::subpasses::GeometrySubpass<bindingType>
{
public:
using SceneType = typename std::conditional<bindingType == vkb::BindingType::Cpp, vkb::scene_graph::HPPScene, vkb::sg::Scene>::type;
using ShaderSourceType = typename std::conditional<bindingType == vkb::BindingType::Cpp, vkb::core::HPPShaderSource, vkb::ShaderSource>::type;

public:
Expand All @@ -69,7 +68,7 @@ class ForwardSubpass : public vkb::rendering::subpasses::GeometrySubpass<binding
ForwardSubpass(vkb::rendering::RenderContext<bindingType> &render_context,
ShaderSourceType &&vertex_shader,
ShaderSourceType &&fragment_shader,
SceneType &scene,
vkb::scene_graph::Scene<bindingType> &scene,
sg::Camera &camera);

virtual ~ForwardSubpass() = default;
Expand All @@ -88,7 +87,7 @@ template <vkb::BindingType bindingType>
inline ForwardSubpass<bindingType>::ForwardSubpass(vkb::rendering::RenderContext<bindingType> &render_context,
ShaderSourceType &&vertex_source,
ShaderSourceType &&fragment_source,
SceneType &scene_,
vkb::scene_graph::Scene<bindingType> &scene_,
sg::Camera &camera) :
GeometrySubpass<bindingType>{render_context, std::move(vertex_source), std::move(fragment_source), scene_, camera}
{}
Expand Down
26 changes: 12 additions & 14 deletions framework/rendering/subpasses/geometry_subpass.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include "scene_graph/components/image.h"
#include "scene_graph/components/pbr_material.h"
#include "scene_graph/components/sub_mesh.h"
#include "scene_graph/hpp_scene.h"
#include "scene_graph/scene.h"

namespace vkb
Expand Down Expand Up @@ -91,7 +90,6 @@ class GeometrySubpass : public vkb::rendering::Subpass<bindingType>
using MeshType = typename std::conditional<bindingType == BindingType::Cpp, vkb::scene_graph::components::HPPMesh, vkb::sg::Mesh>::type;
using PipelineLayoutType = typename std::conditional<bindingType == BindingType::Cpp, vkb::core::HPPPipelineLayout, vkb::PipelineLayout>::type;
using RasterizationStateType = typename std::conditional<bindingType == BindingType::Cpp, vkb::rendering::HPPRasterizationState, vkb::RasterizationState>::type;
using SceneType = typename std::conditional<bindingType == BindingType::Cpp, vkb::scene_graph::HPPScene, vkb::sg::Scene>::type;
using ShaderModuleType = typename std::conditional<bindingType == BindingType::Cpp, vkb::core::HPPShaderModule, vkb::ShaderModule>::type;
using ShaderSourceType = typename std::conditional<bindingType == BindingType::Cpp, vkb::core::HPPShaderSource, vkb::ShaderSource>::type;
using SubMeshType = typename std::conditional<bindingType == BindingType::Cpp, vkb::scene_graph::components::HPPSubMesh, vkb::sg::SubMesh>::type;
Expand All @@ -108,7 +106,7 @@ class GeometrySubpass : public vkb::rendering::Subpass<bindingType>
GeometrySubpass(vkb::rendering::RenderContext<bindingType> &render_context,
ShaderSourceType &&vertex_shader,
ShaderSourceType &&fragment_shader,
SceneType &scene,
vkb::scene_graph::Scene<bindingType> &scene,
sg::Camera &camera);

virtual ~GeometrySubpass() = default;
Expand All @@ -127,12 +125,12 @@ class GeometrySubpass : public vkb::rendering::Subpass<bindingType>
void set_thread_index(uint32_t index);

protected:
void draw_submesh(vkb::core::CommandBuffer<bindingType> &command_buffer, SubMeshType &sub_mesh, FrontFaceType front_face = DefaultFrontFaceTypeValue<FrontFaceType>::value);
virtual void draw_submesh_command(vkb::core::CommandBuffer<bindingType> &command_buffer, SubMeshType &sub_mesh);
vkb::sg::Camera const &get_camera() const;
std::vector<MeshType *> const &get_meshes() const;
RasterizationStateType const &get_rasterization_state() const;
SceneType const &get_scene() const;
void draw_submesh(vkb::core::CommandBuffer<bindingType> &command_buffer, SubMeshType &sub_mesh, FrontFaceType front_face = DefaultFrontFaceTypeValue<FrontFaceType>::value);
virtual void draw_submesh_command(vkb::core::CommandBuffer<bindingType> &command_buffer, SubMeshType &sub_mesh);
vkb::sg::Camera const &get_camera() const;
std::vector<MeshType *> const &get_meshes() const;
RasterizationStateType const &get_rasterization_state() const;
vkb::scene_graph::Scene<bindingType> const &get_scene() const;

/**
* @brief Sorts objects based on distance from camera and classifies them
Expand Down Expand Up @@ -168,7 +166,7 @@ class GeometrySubpass : public vkb::rendering::Subpass<bindingType>
vkb::rendering::HPPRasterizationState base_rasterization_state;
vkb::sg::Camera &camera;
std::vector<vkb::scene_graph::components::HPPMesh *> meshes;
vkb::scene_graph::HPPScene *scene;
vkb::scene_graph::SceneCpp *scene;
uint32_t thread_index = 0;
};

Expand All @@ -181,7 +179,7 @@ template <vkb::BindingType bindingType>
inline GeometrySubpass<bindingType>::GeometrySubpass(vkb::rendering::RenderContext<bindingType> &render_context,
ShaderSourceType &&vertex_source,
ShaderSourceType &&fragment_source,
SceneType &scene_,
vkb::scene_graph::Scene<bindingType> &scene_,
sg::Camera &camera) :
Subpass<bindingType>{render_context, std::move(vertex_source), std::move(fragment_source)}, camera{camera}
{
Expand All @@ -191,7 +189,7 @@ inline GeometrySubpass<bindingType>::GeometrySubpass(vkb::rendering::RenderConte
}
else
{
scene = reinterpret_cast<vkb::scene_graph::HPPScene *>(&scene_);
scene = reinterpret_cast<vkb::scene_graph::SceneCpp *>(&scene_);
}
meshes = scene->get_components<vkb::scene_graph::components::HPPMesh>();
}
Expand Down Expand Up @@ -369,15 +367,15 @@ inline typename GeometrySubpass<bindingType>::RasterizationStateType const &Geom
}

template <vkb::BindingType bindingType>
inline typename GeometrySubpass<bindingType>::SceneType const &GeometrySubpass<bindingType>::get_scene() const
inline vkb::scene_graph::Scene<bindingType> const &GeometrySubpass<bindingType>::get_scene() const
{
if constexpr (bindingType == BindingType::Cpp)
{
return *scene;
}
else
{
return *reinterpret_cast<vkb::sg::Scene const *>(scene);
return *reinterpret_cast<vkb::scene_graph::SceneC const *>(scene);
}
}

Expand Down
4 changes: 2 additions & 2 deletions framework/rendering/subpasses/lighting_subpass.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2019-2025, Arm Limited and Contributors
/* Copyright (c) 2019-2026, Arm Limited and Contributors
*
* SPDX-License-Identifier: Apache-2.0
*
Expand Down Expand Up @@ -27,7 +27,7 @@
namespace vkb
{
LightingSubpass::LightingSubpass(
vkb::rendering::RenderContextC &render_context, ShaderSource &&vertex_shader, ShaderSource &&fragment_shader, sg::Camera &cam, sg::Scene &scene_) :
vkb::rendering::RenderContextC &render_context, ShaderSource &&vertex_shader, ShaderSource &&fragment_shader, sg::Camera &cam, vkb::scene_graph::SceneC &scene_) :
Subpass{render_context, std::move(vertex_shader), std::move(fragment_shader)}, camera{cam}, scene{scene_}
{
}
Expand Down
Loading
Loading