This commit is contained in:
xsl
2025-09-04 10:54:47 +08:00
commit 6bc8f61b18
1808 changed files with 208268 additions and 0 deletions
+51
View File
@@ -0,0 +1,51 @@
/* Copyright (c) 2021-2025, 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 <gltf_loader.h>
#include <scene_graph/components/hpp_sub_mesh.h>
#include <scene_graph/hpp_scene.h>
namespace vkb
{
/**
* @brief facade class around vkb::GLTFLoader, providing a vulkan.hpp-based interface
*
* See vkb::GLTFLoader for documentation
*/
class HPPGLTFLoader : private vkb::GLTFLoader
{
public:
HPPGLTFLoader(vkb::core::DeviceCpp &device) :
GLTFLoader(reinterpret_cast<vkb::core::DeviceC &>(device))
{}
std::unique_ptr<vkb::scene_graph::components::HPPSubMesh> read_model_from_file(
const std::string &file_name, uint32_t index, bool storage_buffer = false, vk::BufferUsageFlags additional_buffer_usage_flags = {})
{
return std::unique_ptr<vkb::scene_graph::components::HPPSubMesh>(reinterpret_cast<vkb::scene_graph::components::HPPSubMesh *>(
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)
{
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()));
}
};
} // namespace vkb