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

#include <M3DModelManager.h>

Public Member Functions

 ModelManager (std::shared_ptr< STK::ShaderProgramManager > shaderManager, std::shared_ptr< STK::TextureManager > textureManager)
 
bool AddModelJSON (const std::string &string)
 
void Initialize (const std::string &modelDir, bool recursive)
 
void AddModel (const std::string &id, const std::shared_ptr< ManagedGraphicsModel > &model)
 
bool ModelExists (const std::string &id) const
 
bool ModelIsLoaded (const std::string &id) const
 
void RemoveModel (const std::string &id)
 
bool ExportModel (const std::string &id, const std::string &fileName, const std::string rootDir)
 
bool SetModelTransform (const std::string &id, double rx, double ry, double rz, double tx, double ty, double tz, double scale)
 
bool UpdateModelMaterials (const std::string &id, float diff_r, float diff_g, float diff_b, float diff_a, float amb_r, float amb_g, float amb_b, float amb_a, float spec_r, float spec_g, float spec_b, float spec_a, float shininess, const std::string &node_regexp="")
 
bool UpdateModelTextureExt (const std::string &id, const std::string &new_ext, const std::string &file_regexp="")
 
bool getModelTextures (const std::string &id, std::vector< std::string > &texturePaths)
 
std::shared_ptr< STK::GraphicsModelGetModel (const std::string &name, const std::string &fallbackName="") const
 
std::shared_ptr< ManagedGraphicsModelGetManagedModel (const std::string &name, const std::string &fallbackName="") const
 
std::shared_ptr< STK::ShaderProgramManagergetShaderManager () const
 
std::shared_ptr< STK::TextureManagergetTextureManager () const
 
std::shared_ptr< STK::ShaderProgramManagershaderManager ()
 
std::shared_ptr< STK::TextureManagertextureManager ()
 
bool getModelBoundingSphere (const std::string &id, float &x, float &y, float &z, float &radius)
 
bool getModelBoundingBox (const std::string &id, float &xMin, float &yMin, float &zMin, float &xMax, float &yMax, float &zMax)
 
void incMemsize (int64_t memsize)
 Increase size of tracked memory usage.
 
void decMemsize (int64_t memsize)
 Decrease size of tracked memory usage.
 
int64_t getMemsize () const
 Get current memory usage.
 
void setMaxMemsize (int64_t max_memsize)
 Set max memory usage. If set to 0, no cleanup is done.
 
int64_t getMaxMemsize () const
 Get max memory usage.
 
int64_t cleanup (double target_f=0.75, int64_t minAge=500)
 
int64_t getTimestamp () const
 
int numPendingRequests () const
 
void incPendingReqs ()
 
void decPendingReqs ()
 
int numLoadedModels () const
 
void resetLoadedModels ()
 
void incLoadedModels ()
 

Static Public Member Functions

static std::shared_ptr< ManagedGraphicsModelCreateModel (const std::shared_ptr< ModelManager > &modelManager, const std::string &key, const std::string &assetID, const std::string &path, const std::shared_ptr< STK::AssetDataProvider > &dataProvider)
 Static factory methods. Creates a managed model and adds it ot the manager.
 
static void CreateModel (const std::shared_ptr< ModelManager > &modelManager, const std::string &id, std::shared_ptr< STK::GraphicsModel > model)
 
static void CreateModel (const std::shared_ptr< ModelManager > &modelManager, const std::string &id, const std::string &file, const std::string &material, double rx, double ry, double rz, double tx, double ty, double tz, double scale)
 

Detailed Description

ModelManager - Manager for 3D models

Member Function Documentation

◆ GetManagedModel()

std::shared_ptr< ManagedGraphicsModel > Maria3D::ModelManager::GetManagedModel ( const std::string &  name,
const std::string &  fallbackName = "" 
) const
inline

Get a registered model by the given name. If the model does not exist and fallbackName is given, the fallback model is used, if possible.

◆ numLoadedModels()

int Maria3D::ModelManager::numLoadedModels ( ) const
inline

This counter keeps track of all models that have finished loading since last reset. This can be used to determine if we need a redraw due to recently loaded models.


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