![]() |
Duckcpp 2.1.0
Duckcpp is a high-performance c++ graphics engine.
|
The mesh cache stores already loaded meshes and provides an interface to them. More...
#include <duckcpp/core/engine/IMeshCache.hpp>
Public Member Functions | |
virtual | ~IMeshCache () |
Destructor. | |
virtual void | addMesh (const dcpp::io::path &name, IAnimatedMesh *mesh)=0 |
Adds a mesh to the internal list of loaded meshes. | |
virtual void | removeMesh (const IMesh *const mesh)=0 |
Removes the mesh from the cache. | |
virtual dcpp::uint32_kt | getMeshCount () const =0 |
Returns amount of loaded meshes in the cache. | |
virtual dcpp::int32_kt | getMeshIndex (const IMesh *const mesh) const =0 |
Returns current index number of the mesh or -1 when not found. | |
virtual IAnimatedMesh * | getMeshByIndex (dcpp::uint32_kt index)=0 |
Returns a mesh based on its index number. | |
DCPP_DEPRECATED IAnimatedMesh * | getMeshByFilename (const dcpp::io::path &filename) |
Returns a mesh based on its name (often a filename). | |
DCPP_DEPRECATED const dcpp::io::path & | getMeshFilename (dcpp::uint32_kt index) const |
Get the name of a loaded mesh, based on its index. (Name is often identical to the filename). | |
DCPP_DEPRECATED const dcpp::io::path & | getMeshFilename (const IMesh *const mesh) const |
Get the name of a loaded mesh, if there is any. (Name is often identical to the filename). | |
DCPP_DEPRECATED bool | setMeshFilename (dcpp::uint32_kt index, const dcpp::io::path &filename) |
Renames a loaded mesh. | |
DCPP_DEPRECATED bool | setMeshFilename (const IMesh *const mesh, const dcpp::io::path &filename) |
Renames a loaded mesh. | |
virtual IAnimatedMesh * | getMeshByName (const dcpp::io::path &name)=0 |
Returns a mesh based on its name. | |
virtual const dcpp::io::SNamedPath & | getMeshName (dcpp::uint32_kt index) const =0 |
Get the name of a loaded mesh, based on its index. | |
virtual const dcpp::io::SNamedPath & | getMeshName (const IMesh *const mesh) const =0 |
Get the name of the loaded mesh if there is any. | |
virtual bool | renameMesh (dcpp::uint32_kt index, const dcpp::io::path &name)=0 |
Renames a loaded mesh. | |
virtual bool | renameMesh (const IMesh *const mesh, const dcpp::io::path &name)=0 |
Renames the loaded mesh. | |
virtual bool | isMeshLoaded (const dcpp::io::path &name)=0 |
Check if a mesh was already loaded. | |
virtual void | clear ()=0 |
Clears the whole mesh cache, removing all meshes. | |
virtual void | clearUnusedMeshes ()=0 |
Clears all meshes that are held in the mesh cache but not used anywhere else. | |
![]() | |
IReferenceCounted () | |
Constructor. | |
virtual | ~IReferenceCounted () |
Destructor. | |
void | grab () const |
Grabs the object. Increments the reference counter by one. | |
bool | drop () const |
Drops the object. Decrements the reference counter by one. | |
dcpp::int32_kt | getReferenceCount () const |
Get the reference count. | |
const dcpp::char_kt * | getDebugName () const |
Returns the debug name of the object. | |
Additional Inherited Members | |
![]() | |
void | setDebugName (const dcpp::char_kt *newName) |
Sets the debug name of the object. | |
The mesh cache stores already loaded meshes and provides an interface to them.
You can access it using ISceneManager::getMeshCache(). All existing scene managers will return a pointer to the same mesh cache, because it is shared between them. With this interface, it is possible to manually add new loaded meshes (if ISceneManager::getMesh() is not sufficient), to remove them and to iterate through already loaded meshes.
|
pure virtual |
Adds a mesh to the internal list of loaded meshes.
Usually, ISceneManager::getMesh() is called to load a mesh from a file. That method searches the list of loaded meshes if a mesh has already been loaded and returns a pointer to if it is in that list and already in memory. Otherwise it loads the mesh. With IMeshCache::addMesh(), it is possible to pretend that a mesh already has been loaded. This method can be used for example by mesh loaders who need to load more than one mesh with one call. They can add additional meshes with this method to the scene manager. The COLLADA loader for example uses this method.
name | Name of the mesh. When calling ISceneManager::getMesh() with this name it will return the mesh set by this method. |
mesh | Pointer to a mesh which will now be referenced by this name. |
|
pure virtual |
Clears the whole mesh cache, removing all meshes.
All meshes will be reloaded completely when using ISceneManager::getMesh() after calling this method. Warning: If you have pointers to meshes that were loaded with ISceneManager::getMesh() and you did not grab them, then they may become invalid.
|
pure virtual |
Clears all meshes that are held in the mesh cache but not used anywhere else.
Warning: If you have pointers to meshes that were loaded with ISceneManager::getMesh() and you did not grab them, then they may become invalid.
|
inline |
Returns a mesh based on its name (often a filename).
|
pure virtual |
Returns a mesh based on its index number.
index | Index of the mesh, number between 0 and getMeshCount()-1. Note that this number is only valid until a new mesh is loaded or removed. |
|
pure virtual |
Returns a mesh based on its name.
name | Name of the mesh. Usually a filename. |
|
pure virtual |
Returns amount of loaded meshes in the cache.
You can load new meshes into the cache using getMesh() and addMesh(). If you ever need to access the internal mesh cache, you can do this using removeMesh(), getMeshNumber(), getMeshByIndex() and getMeshName().
|
inline |
Get the name of a loaded mesh, if there is any. (Name is often identical to the filename).
|
inline |
Get the name of a loaded mesh, based on its index. (Name is often identical to the filename).
|
pure virtual |
Returns current index number of the mesh or -1 when not found.
mesh | Pointer to the mesh to search for. |
|
pure virtual |
Get the name of the loaded mesh if there is any.
mesh | Pointer to mesh to query. |
|
pure virtual |
Get the name of a loaded mesh, based on its index.
index | Index of the mesh, number between 0 and getMeshCount()-1. |
|
pure virtual |
Check if a mesh was already loaded.
name | Name of the mesh. Usually a filename. |
|
pure virtual |
Removes the mesh from the cache.
After loading a mesh with getMesh(), the mesh can be removed from the cache using this method, freeing a lot of memory.
mesh | Pointer to the mesh which shall be removed. |
|
pure virtual |
Renames the loaded mesh.
Note that renaming meshes might change the ordering of the meshes, and so the index of the meshes as returned by getMeshIndex() or taken by some methods will change.
mesh | Mesh to be renamed. |
name | New name for the mesh. |
|
pure virtual |
Renames a loaded mesh.
Note that renaming meshes might change the ordering of the meshes, and so the index of the meshes as returned by getMeshIndex() or taken by some methods will change.
index | The index of the mesh in the cache. |
name | New name for the mesh. |
|
inline |
Renames a loaded mesh.
|
inline |
Renames a loaded mesh.