MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::IO::ModelReader Class Reference

Assimp-backed loader for 3D model files. More...

#include <ModelReader.hpp>

+ Inheritance diagram for MayaFlux::IO::ModelReader:
+ Collaboration diagram for MayaFlux::IO::ModelReader:

Classes

struct  Impl
 

Public Member Functions

bool can_read (const std::string &filepath) const override
 Check if a file can be read by this reader.
 
void close () override
 Close the currently open file.
 
std::shared_ptr< Kakshya::SignalSourceContainercreate_container () override
 No-op.
 
std::vector< std::shared_ptr< Buffers::MeshBuffer > > create_mesh_buffers (const TextureResolver &resolver=nullptr) const
 Construct one MeshBuffer per mesh in the currently loaded scene.
 
std::shared_ptr< Nodes::Network::MeshNetworkcreate_mesh_network (const TextureResolver &resolver=nullptr) const
 Construct a MeshNetwork from all meshes in the currently loaded scene.
 
std::vector< Kakshya::MeshDataextract_meshes () const
 Load all meshes after open() has already been called.
 
std::type_index get_container_type () const override
 Get the container type this reader creates.
 
std::type_index get_data_type () const override
 Get the data type this reader produces.
 
std::vector< uint64_t > get_dimension_sizes () const override
 Get size of each dimension in the file data.
 
std::string get_last_error () const override
 Get the last error message.
 
std::optional< FileMetadataget_metadata () const override
 Get metadata from the open file.
 
size_t get_num_dimensions () const override
 Get the dimensionality of the file data.
 
uint64_t get_preferred_chunk_size () const override
 Get the preferred chunk size for streaming.
 
std::vector< uint64_t > get_read_position () const override
 Get current read position in primary dimension.
 
std::vector< FileRegionget_regions () const override
 Get semantic regions from the file.
 
std::vector< std::string > get_supported_extensions () const override
 Get supported file extensions for this reader.
 
bool is_open () const override
 Check if a file is currently open.
 
std::vector< Kakshya::MeshDataload (const std::string &filepath)
 Load all meshes from a file in one call.
 
bool load_into_container (std::shared_ptr< Kakshya::SignalSourceContainer > container) override
 No-op.
 
 ModelReader ()
 
bool open (const std::string &filepath, FileReadOptions options=FileReadOptions::ALL) override
 Open a file for reading.
 
std::vector< Kakshya::DataVariantread_all () override
 Read all data from the file into memory.
 
std::vector< Kakshya::DataVariantread_region (const FileRegion &region) override
 Read a specific region of data.
 
bool seek (const std::vector< uint64_t > &position) override
 Seek to a specific position in the file.
 
bool supports_streaming () const override
 Check if streaming is supported for the current file.
 
 ~ModelReader () override
 
- Public Member Functions inherited from MayaFlux::IO::FileReader
virtual ~FileReader ()=default
 

Private Member Functions

Kakshya::MeshData extract_single_mesh (const void *ai_mesh, const void *ai_scene, std::string_view mesh_name, std::string_view material_name) const
 
void set_error (std::string msg) const
 

Private Attributes

std::unique_ptr< Implm_impl
 
bool m_is_open { false }
 
std::string m_last_error
 

Additional Inherited Members

- Static Public Member Functions inherited from MayaFlux::IO::FileReader
static std::string resolve_path (const std::string &filepath)
 Resolve a filepath against the project source root if not found as-is.
 
- Static Protected Member Functions inherited from MayaFlux::IO::FileReader
static std::unordered_map< std::string, Kakshya::RegionGroupregions_to_groups (const std::vector< FileRegion > &regions)
 Convert file regions to region groups.
 

Detailed Description

Assimp-backed loader for 3D model files.

Produces vector<Kakshya::MeshData> — one entry per assimp mesh in the imported scene. Each MeshData owns its vertex bytes (vector<uint8_t> in the canonical 60-byte interleaved MeshVertex format) and index array (vector<uint32_t>). Submesh identity is preserved in the single-entry case via MeshData::submeshes (a RegionGroup named "submeshes" with one Region). Multi-mesh files produce one MeshData per aiMesh, each with its own single-submesh RegionGroup.

Supported formats: glTF 2.0 (.glb, .gltf), OBJ, FBX, PLY, STL, DAE, and any other format Assimp supports on the target platform.

Post-processing applied unconditionally:

  • aiProcess_Triangulate: all faces become triangles
  • aiProcess_GenSmoothNormals: generate normals if absent
  • aiProcess_CalcTangentSpace: tangent + bitangent from UVs
  • aiProcess_FlipUVs: V-flip to match Vulkan UV convention
  • aiProcess_JoinIdenticalVertices: deduplicate vertices
  • aiProcess_SortByPType: isolate TRIANGLE primitives

FileReader contract: create_container() and load_into_container() are no-ops for this reader; mesh data does not go through the SignalSourceContainer streaming path. Use load() or the IOManager::load_mesh() convenience wrapper instead.

Definition at line 57 of file ModelReader.hpp.


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