Maria GDK 5.0.0.738
Documentation of native code in develop branch
Loading...
Searching...
No Matches
STK::GraphicsModelLoader Class Reference

Classes

struct  EmbeddedTexture
 

Public Member Functions

 GraphicsModelLoader (std::shared_ptr< TextureManager > tex_mgr, std::shared_ptr< ShaderProgramManager > prg_mgr, std::shared_ptr< FilePathResolver > tex_resolver=nullptr)
 
void setAssetDataProvider (const std::string &asset_id, std::shared_ptr< AssetDataProvider > asset_provider)
 
void setProgressHandler (const std::shared_ptr< ProgressHandler > &progress)
 
std::shared_ptr< ProgressHandlergetProgressHandler () const
 
void addTexturePath (const std::string &path)
 
std::shared_ptr< MeshGraphicsModelload (const std::string &filename)
 
std::shared_ptr< MeshGraphicsModelload (const std::vector< char > &glbBuffer, const std::string &modelName, const std::string &ext)
 
bool exportModel (const std::string &format, const aiExportDataBlob *&dataBlob)
 
void convertTextureNameExtension (const std::string &fromExt, const std::string &toExt)
 
void setCalculateTangents (bool calc_tangents)
 
void setCalculateNormals (bool calc_normals)
 
void setSmoothingAngle (float smooth_angle)
 
void setOptimizeMaterials (bool opt_materials)
 
void setOptimizeMeshes (bool opt_meshes)
 
void setOptimizeNodes (bool opt_nodes)
 
void setRemovePointsAndLines (bool no_points_lines)
 
bool getCalculateTangents () const
 
bool getCalculateNormals () const
 
bool getOptimizeMaterials () const
 
bool getOptimizeMeshes () const
 
bool getOptimizeNodes () const
 
bool getRemovePointsAndLines () const
 
float getSmoothingAngle () const
 
void setTextureFilter (GLenum min_filter, GLenum mag_filter)
 
GLenum getDefaultMinFilter () const
 
GLenum getDefaultMagFilter () const
 
void addPreserveNode (const std::string &node_name)
 
std::vector< std::string > & getPreserveNodes ()
 
void setPreserveNodes (const std::vector< std::string > &nodes)
 
void addPreserveMaterial (const std::string &mat_name)
 
std::vector< std::string > & getPreserveMaterials ()
 
void setPreserveMaterials (const std::vector< std::string > &mats)
 
void setSimpleShaderName (const std::string &shader_simple)
 Set shader name for meshes with neither texture nor normal vectors.
 
void setTextureNormalsShaderName (const std::string &shader_tex_normals)
 Set shader name for meshes with textures and normal vectors.
 
void setNormalsOnlyShaderName (const std::string &shader_normals)
 Set shader name for meshes with only normal vectors.
 
void saveEmbeddedTextures (const std::string &output_dir)
 

Protected Member Functions

std::shared_ptr< VertexBuffergetVertexBuffer (const aiScene *scene, const aiMesh *mesh)
 
void copyVertices (const aiMesh *ai_mesh, Mesh *mesh, VertexBuffer &vertex_buffer)
 
int getMeshGroupId (const aiScene *scene, const aiMesh *ai_mesh, MeshGraphicsModel *model, const std::shared_ptr< VertexBuffer > &vertex_buffer)
 
void processNode (const aiScene *scene, aiNode *node, const std::shared_ptr< MeshGraphicsModel > &model, const std::shared_ptr< MeshNode > &parent, const STK::Matrix4x4f &xfm, int level=0)
 
bool processAnimations (const aiScene *scene, MeshGraphicsModel &model)
 
bool processAnimation (const aiAnimation *anim, MeshGraphicsModel &model)
 
void processBones (const MeshGraphicsModel &model)
 
unsigned int setLoadFlags (Assimp::Importer &importer)
 
void processModel (const std::shared_ptr< MeshGraphicsModel > &model, const aiScene *scene, const std::string &modelName)
 
void addEmbeddedTexture (aiTexture *tex)
 
std::shared_ptr< STK::Texture2DgetEmbeddedTexture (aiMaterial *ai_material)
 

Protected Attributes

std::shared_ptr< TextureManagertex_mgr_
 
std::shared_ptr< ShaderProgramManagerprg_mgr_
 
std::shared_ptr< STK::FilePathResolvertexture_paths_
 
std::string asset_id_
 
std::shared_ptr< STK::AssetDataProviderasset_provider_
 
std::map< std::string, EmbeddedTextureembedded_textures_
 
std::unique_ptr< const aiScene > assimp_scene_
 
std::shared_ptr< VertexBufferPvertex_buffer_p_
 
std::shared_ptr< VertexBufferPNvertex_buffer_pn_
 
std::shared_ptr< VertexBufferPTvertex_buffer_pt_
 
std::shared_ptr< VertexBufferPNTvertex_buffer_pnt_
 
std::shared_ptr< VertexBufferPNWIvertex_buffer_pnwi_
 
std::shared_ptr< VertexBufferPNTWIvertex_buffer_pntwi_
 
bool calc_tangents_ = false
 
bool calc_normals_ = true
 
bool opt_materials_ = false
 
bool opt_meshes_ = false
 
bool opt_nodes_ = false
 
bool no_points_lines_ = false
 
bool create_root_node_ = false
 
float smooth_angle_ = 80.0f
 
std::string shader_tex_normals_ = "DefaultTextureShading"
 
std::string shader_normals_ = "DefaultShading"
 
std::string shader_simple_ = "DefaultTextureNoLighting"
 
std::string shader_tex_skinning_ = "DefaultTextureSkinning"
 
std::string shader_skinning_ = "DefaultSkinning"
 
std::vector< std::string > preserve_nodes_
 
std::vector< std::string > preserve_materials_
 
GLenum def_min_filter_ = GL_LINEAR_MIPMAP_LINEAR
 
GLenum def_mag_filter_ = GL_LINEAR
 
std::multimap< int, int > mesh_grp_id_
 
std::map< const aiMesh *, std::shared_ptr< Mesh > > bone_meshes_
 
std::shared_ptr< STK::ProgressHandlerprogress_
 

Member Function Documentation

◆ addPreserveMaterial()

void STK::GraphicsModelLoader::addPreserveMaterial ( const std::string &  mat_name)
inline

Add a material name to be preserved when optimizing nodes. Add to a list of material names to be kept untouched when optimizing materials. Names with whitespace must be quoted with single quotes, like this \'a node name\'.

◆ addPreserveNode()

void STK::GraphicsModelLoader::addPreserveNode ( const std::string &  node_name)
inline

Add a node name to be preserved when optimizing nodes. Add to a list of node names to be kept untouched when optimizing nodes. Names with whitespace must be quoted with single quotes, like this \'a node name\'.

◆ setCalculateNormals()

void STK::GraphicsModelLoader::setCalculateNormals ( bool  calc_normals)
inline

Tell the loader to calculate normals for the model if not already present (default on). Default: true

◆ setCalculateTangents()

void STK::GraphicsModelLoader::setCalculateTangents ( bool  calc_tangents)
inline

Tell the loader to calculate tangents for the model This is useful for models with normal/bump mapping. Default: false

◆ setOptimizeMaterials()

void STK::GraphicsModelLoader::setOptimizeMaterials ( bool  opt_materials)
inline

Optimize materials. This flag will tell the loader to try and remove redundant materials. Default: false

◆ setOptimizeMeshes()

void STK::GraphicsModelLoader::setOptimizeMeshes ( bool  opt_meshes)
inline

Optimize meshes. Try to reduce the number of meshes. Default: false

◆ setOptimizeNodes()

void STK::GraphicsModelLoader::setOptimizeNodes ( bool  opt_nodes)
inline

Optimize nodes. Try to reduce the number of nodes. Default: false

◆ setRemovePointsAndLines()

void STK::GraphicsModelLoader::setRemovePointsAndLines ( bool  no_points_lines)
inline

Remove points and lines. Set this to remove points and lines from the mesh. Default: false

◆ setSmoothingAngle()

void STK::GraphicsModelLoader::setSmoothingAngle ( float  smooth_angle)
inline

Set a smoothing angle for normal generation. All angles less than this angle will be considered smooth and the normals will be averaged. Default: 80 degrees.


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