Foray Library
rapid prototyping framework for crossplatform development of vulkan hardware ray tracing applications
Loading...
Searching...
No Matches
Classes | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
foray::gltf::ModelConverter Class Reference

Type which reads glTF files and merges a scene of the file into the scene graph. More...

#include <foray_modelconverter.hpp>

Inheritance diagram for foray::gltf::ModelConverter:
foray::NoMoveDefaults

Classes

struct  IndexBindings
 Variables which determine how to map gltf-model indices to scene indices/pointers. More...
 

Public Member Functions

 ModelConverter (scene::Scene *scene)
 
void LoadGltfModel (osi::Utf8Path utf8Path, core::Context *context=nullptr, const ModelConverterOptions &options=ModelConverterOptions())
 Loads glTF model and integrates it into the scene set in constructor.
 
- Public Member Functions inherited from foray::NoMoveDefaults
 NoMoveDefaults ()=default
 
 NoMoveDefaults (const NoMoveDefaults &other)=delete
 
 NoMoveDefaults (NoMoveDefaults &&other)=default
 
NoMoveDefaultsoperator= (const NoMoveDefaults &other)=delete
 

Protected Member Functions

void RecursivelyTranslateNodes (int32_t currentIndex, scene::Node *parent=nullptr)
 
void InitTransformFromGltf (scene::ncomp::Transform *transform, const std::vector< double > &matrix, const std::vector< double > &translation, const std::vector< double > &rotation, const std::vector< double > &scale)
 
void BuildGeometryBuffer ()
 
void PushGltfMeshToBuffers (const tinygltf::Mesh &mesh, std::vector< scene::Primitive > &outprimitives)
 
void LoadTextures ()
 
void LoadMaterials ()
 
void LoadAnimations ()
 
void TranslateAnimationSampler (scene::Animation &animation, const tinygltf::Animation &gltfAnimation, int32_t samplerIndex, const std::map< std::string_view, scene::EAnimationInterpolation > &interpolationMap, std::map< int, int > &samplerIndexMap)
 
void TranslateLight (scene::ncomp::PunctualLight *component, const tinygltf::Light &light)
 
void TranslateCamera (scene::ncomp::Camera *component, const tinygltf::Camera &camera)
 
void DetectAnimatedNodes ()
 
void InitialUpdate ()
 
void Reset ()
 

Static Protected Member Functions

static void sTranslateSampler (const tinygltf::Sampler &tinygltfSampler, VkSamplerCreateInfo &outsamplerCI, bool &generateMipMaps)
 

Protected Attributes

core::ContextmContext = nullptr
 
tinygltf::Model mGltfModel = {}
 
tinygltf::Scene * mGltfScene = nullptr
 
ModelConverterOptions mOptions
 
osi::Utf8Path mUtf8Dir
 
std::vector< scene::Vertex > * mVertexBuffer = nullptr
 
std::vector< uint32_t > * mIndexBuffer = nullptr
 
struct foray::gltf::ModelConverter::IndexBindings mIndexBindings = {}
 
int32_t mNextMeshInstanceIndex = 0
 
scene::ScenemScene = nullptr
 
scene::gcomp::MaterialManagermMaterialBuffer
 
scene::gcomp::GeometryStoremGeo
 
scene::gcomp::TextureManagermTextures
 
bench::HostBenchmark mBenchmark
 

Detailed Description

Type which reads glTF files and merges a scene of the file into the scene graph.

Constructor & Destructor Documentation

◆ ModelConverter()

foray::gltf::ModelConverter::ModelConverter ( scene::Scene scene)
explicit

Member Function Documentation

◆ BuildGeometryBuffer()

void foray::gltf::ModelConverter::BuildGeometryBuffer ( )
protected

◆ DetectAnimatedNodes()

void foray::gltf::ModelConverter::DetectAnimatedNodes ( )
protected

◆ InitialUpdate()

void foray::gltf::ModelConverter::InitialUpdate ( )
protected

◆ InitTransformFromGltf()

void foray::gltf::ModelConverter::InitTransformFromGltf ( scene::ncomp::Transform transform,
const std::vector< double > &  matrix,
const std::vector< double > &  translation,
const std::vector< double > &  rotation,
const std::vector< double > &  scale 
)
protected

◆ LoadAnimations()

void foray::gltf::ModelConverter::LoadAnimations ( )
protected

◆ LoadGltfModel()

void foray::gltf::ModelConverter::LoadGltfModel ( osi::Utf8Path  utf8Path,
core::Context context = nullptr,
const ModelConverterOptions options = ModelConverterOptions() 
)

Loads glTF model and integrates it into the scene set in constructor.

Parameters
utf8PathRelative or absolute path to a .gltf or .glb file
contextSet this to override use of the scene's context
optionsSet this to customize default behavior

◆ LoadMaterials()

void foray::gltf::ModelConverter::LoadMaterials ( )
protected

◆ LoadTextures()

void foray::gltf::ModelConverter::LoadTextures ( )
protected

◆ PushGltfMeshToBuffers()

void foray::gltf::ModelConverter::PushGltfMeshToBuffers ( const tinygltf::Mesh &  mesh,
std::vector< scene::Primitive > &  outprimitives 
)
protected

◆ RecursivelyTranslateNodes()

void foray::gltf::ModelConverter::RecursivelyTranslateNodes ( int32_t  currentIndex,
scene::Node parent = nullptr 
)
protected

◆ Reset()

void foray::gltf::ModelConverter::Reset ( )
protected

◆ sTranslateSampler()

static void foray::gltf::ModelConverter::sTranslateSampler ( const tinygltf::Sampler &  tinygltfSampler,
VkSamplerCreateInfo &  outsamplerCI,
bool &  generateMipMaps 
)
staticprotected

◆ TranslateAnimationSampler()

void foray::gltf::ModelConverter::TranslateAnimationSampler ( scene::Animation animation,
const tinygltf::Animation &  gltfAnimation,
int32_t  samplerIndex,
const std::map< std::string_view, scene::EAnimationInterpolation > &  interpolationMap,
std::map< int, int > &  samplerIndexMap 
)
protected

◆ TranslateCamera()

void foray::gltf::ModelConverter::TranslateCamera ( scene::ncomp::Camera component,
const tinygltf::Camera &  camera 
)
protected

◆ TranslateLight()

void foray::gltf::ModelConverter::TranslateLight ( scene::ncomp::PunctualLight component,
const tinygltf::Light &  light 
)
protected

Member Data Documentation

◆ mBenchmark

bench::HostBenchmark foray::gltf::ModelConverter::mBenchmark
protected

◆ mContext

core::Context* foray::gltf::ModelConverter::mContext = nullptr
protected

◆ mGeo

scene::gcomp::GeometryStore& foray::gltf::ModelConverter::mGeo
protected

◆ mGltfModel

tinygltf::Model foray::gltf::ModelConverter::mGltfModel = {}
protected

◆ mGltfScene

tinygltf::Scene* foray::gltf::ModelConverter::mGltfScene = nullptr
protected

◆ mIndexBindings

struct foray::gltf::ModelConverter::IndexBindings foray::gltf::ModelConverter::mIndexBindings = {}
protected

◆ mIndexBuffer

std::vector<uint32_t>* foray::gltf::ModelConverter::mIndexBuffer = nullptr
protected

◆ mMaterialBuffer

scene::gcomp::MaterialManager& foray::gltf::ModelConverter::mMaterialBuffer
protected

◆ mNextMeshInstanceIndex

int32_t foray::gltf::ModelConverter::mNextMeshInstanceIndex = 0
protected

◆ mOptions

ModelConverterOptions foray::gltf::ModelConverter::mOptions
protected

◆ mScene

scene::Scene* foray::gltf::ModelConverter::mScene = nullptr
protected

◆ mTextures

scene::gcomp::TextureManager& foray::gltf::ModelConverter::mTextures
protected

◆ mUtf8Dir

osi::Utf8Path foray::gltf::ModelConverter::mUtf8Dir
protected

◆ mVertexBuffer

std::vector<scene::Vertex>* foray::gltf::ModelConverter::mVertexBuffer = nullptr
protected

The documentation for this class was generated from the following file: