Nirtcpp 2.1.0
Nirtcpp is a high-performance c++ graphics engine.
Loading...
Searching...
No Matches
IMeshCache.hpp
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in nirtcpp/nirtcpp.hpp
4
5#ifndef NIRT_I_MESH_CACHE_HPP_INCLUDED
6#define NIRT_I_MESH_CACHE_HPP_INCLUDED
7
8#include <nirtcpp/core/engine/IReferenceCounted.hpp>
9#include <nirtcpp/core/engine/path.hpp>
10
11namespace nirt
12{
13
14namespace scene
15{
16 class IMesh;
17 class IAnimatedMesh;
18 class IAnimatedMeshSceneNode;
19 class IMeshLoader;
20
22
27 class IMeshCache : public virtual IReferenceCounted
28 {
29 public:
30
32 virtual ~IMeshCache() {}
33
35
50 virtual void addMesh(const io::path& name, IAnimatedMesh* mesh) = 0;
51
53
57 virtual void removeMesh(const IMesh* const mesh) = 0;
58
60
65 virtual u32 getMeshCount() const = 0;
66
68
70 virtual s32 getMeshIndex(const IMesh* const mesh) const = 0;
71
73
79 virtual IAnimatedMesh* getMeshByIndex(u32 index) = 0;
80
82
84 NIRT_DEPRECATED IAnimatedMesh* getMeshByFilename(const io::path& filename)
85 {
86 return getMeshByName(filename);
87 }
88
90
92 NIRT_DEPRECATED const io::path& getMeshFilename(u32 index) const
93 {
94 return getMeshName(index).getInternalName();
95 }
96
98
100 NIRT_DEPRECATED const io::path& getMeshFilename(const IMesh* const mesh) const
101 {
102 return getMeshName(mesh).getInternalName();
103 }
104
106
108 NIRT_DEPRECATED bool setMeshFilename(u32 index, const io::path& filename)
109 {
110 return renameMesh(index, filename);
111 }
112
114
116 NIRT_DEPRECATED bool setMeshFilename(const IMesh* const mesh, const io::path& filename)
117 {
118 return renameMesh(mesh, filename);
119 }
120
122
124 virtual IAnimatedMesh* getMeshByName(const io::path& name) = 0;
125
127
129 virtual const io::SNamedPath& getMeshName(u32 index) const = 0;
130
132
134 virtual const io::SNamedPath& getMeshName(const IMesh* const mesh) const = 0;
135
137
143 virtual bool renameMesh(u32 index, const io::path& name) = 0;
144
146
152 virtual bool renameMesh(const IMesh* const mesh, const io::path& name) = 0;
153
155
157 virtual bool isMeshLoaded(const io::path& name) = 0;
158
160
164 virtual void clear() = 0;
165
167
169 virtual void clearUnusedMeshes() = 0;
170 };
171
172
173} // end namespace scene
174} // end namespace nirt
175
176#endif
Base class of most objects of the Nirtcpp Engine.
Definition IReferenceCounted.hpp:46
Used in places where we identify objects by a filename, but don't actually work with the real filenam...
Definition path.hpp:24
const path & getInternalName() const
Definition path.hpp:56
Interface for an animated mesh.
Definition IAnimatedMesh.hpp:21
The mesh cache stores already loaded meshes and provides an interface to them.
Definition IMeshCache.hpp:28
virtual IAnimatedMesh * getMeshByName(const io::path &name)=0
Returns a mesh based on its name.
virtual ~IMeshCache()
Destructor.
Definition IMeshCache.hpp:32
virtual void addMesh(const io::path &name, IAnimatedMesh *mesh)=0
Adds a mesh to the internal list of loaded meshes.
NIRT_DEPRECATED const 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).
Definition IMeshCache.hpp:100
virtual const io::SNamedPath & getMeshName(const IMesh *const mesh) const =0
Get the name of the loaded mesh if there is any.
virtual u32 getMeshCount() const =0
Returns amount of loaded meshes in the cache.
virtual bool renameMesh(const IMesh *const mesh, const io::path &name)=0
Renames the loaded mesh.
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.
virtual s32 getMeshIndex(const IMesh *const mesh) const =0
Returns current index number of the mesh or -1 when not found.
NIRT_DEPRECATED IAnimatedMesh * getMeshByFilename(const io::path &filename)
Returns a mesh based on its name (often a filename).
Definition IMeshCache.hpp:84
NIRT_DEPRECATED bool setMeshFilename(u32 index, const io::path &filename)
Renames a loaded mesh.
Definition IMeshCache.hpp:108
virtual void removeMesh(const IMesh *const mesh)=0
Removes the mesh from the cache.
virtual IAnimatedMesh * getMeshByIndex(u32 index)=0
Returns a mesh based on its index number.
virtual const io::SNamedPath & getMeshName(u32 index) const =0
Get the name of a loaded mesh, based on its index.
NIRT_DEPRECATED const io::path & getMeshFilename(u32 index) const
Get the name of a loaded mesh, based on its index. (Name is often identical to the filename).
Definition IMeshCache.hpp:92
virtual bool isMeshLoaded(const io::path &name)=0
Check if a mesh was already loaded.
NIRT_DEPRECATED bool setMeshFilename(const IMesh *const mesh, const io::path &filename)
Renames a loaded mesh.
Definition IMeshCache.hpp:116
virtual bool renameMesh(u32 index, const io::path &name)=0
Renames a loaded mesh.
Class which holds the geometry of an object.
Definition IMesh.hpp:72
As of Nirtcpp 1.6, position2d is a synonym for vector2d.
Definition vector3d.hpp:11
signed int s32
32 bit signed variable.
Definition irrTypes.hpp:72
unsigned int u32
32 bit unsigned variable.
Definition irrTypes.hpp:64

Nirtcpp    @cppfx.xyz

Esvcpp    esv::print