aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/irrlicht-1.8/source/Irrlicht/CMeshCache.h
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/irrlicht-1.8/source/Irrlicht/CMeshCache.h')
-rw-r--r--libraries/irrlicht-1.8/source/Irrlicht/CMeshCache.h246
1 files changed, 123 insertions, 123 deletions
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/CMeshCache.h b/libraries/irrlicht-1.8/source/Irrlicht/CMeshCache.h
index e3cdc9f..fe7fe51 100644
--- a/libraries/irrlicht-1.8/source/Irrlicht/CMeshCache.h
+++ b/libraries/irrlicht-1.8/source/Irrlicht/CMeshCache.h
@@ -1,123 +1,123 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt 1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine". 2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h 3// For conditions of distribution and use, see copyright notice in irrlicht.h
4 4
5#ifndef __C_MESH_CACHE_H_INCLUDED__ 5#ifndef __C_MESH_CACHE_H_INCLUDED__
6#define __C_MESH_CACHE_H_INCLUDED__ 6#define __C_MESH_CACHE_H_INCLUDED__
7 7
8#include "IMeshCache.h" 8#include "IMeshCache.h"
9#include "irrArray.h" 9#include "irrArray.h"
10 10
11namespace irr 11namespace irr
12{ 12{
13 13
14namespace scene 14namespace scene
15{ 15{
16 class CMeshCache : public IMeshCache 16 class CMeshCache : public IMeshCache
17 { 17 {
18 public: 18 public:
19 19
20 virtual ~CMeshCache(); 20 virtual ~CMeshCache();
21 21
22 //! Adds a mesh to the internal list of loaded meshes. 22 //! Adds a mesh to the internal list of loaded meshes.
23 /** Usually, ISceneManager::getMesh() is called to load a mesh from file. 23 /** Usually, ISceneManager::getMesh() is called to load a mesh from file.
24 That method searches the list of loaded meshes if a mesh has already been loaded and 24 That method searches the list of loaded meshes if a mesh has already been loaded and
25 returns a pointer to if it is in that list and already in memory. Otherwise it loads 25 returns a pointer to if it is in that list and already in memory. Otherwise it loads
26 the mesh. With IMeshCache::addMesh(), it is possible to pretend that a mesh already 26 the mesh. With IMeshCache::addMesh(), it is possible to pretend that a mesh already
27 has been loaded. This method can be used for example by mesh loaders who need to 27 has been loaded. This method can be used for example by mesh loaders who need to
28 load more than one mesh with one call. They can add additional meshes with this 28 load more than one mesh with one call. They can add additional meshes with this
29 method to the scene manager. The COLLADA loader for example uses this method. 29 method to the scene manager. The COLLADA loader for example uses this method.
30 \param filename: Filename of the mesh. When called ISceneManager::getMesh() with this 30 \param filename: Filename of the mesh. When called ISceneManager::getMesh() with this
31 parameter, the method will return the mesh parameter given with this method. 31 parameter, the method will return the mesh parameter given with this method.
32 \param mesh: Pointer to a mesh which will now be referenced by this name. */ 32 \param mesh: Pointer to a mesh which will now be referenced by this name. */
33 virtual void addMesh(const io::path& filename, IAnimatedMesh* mesh); 33 virtual void addMesh(const io::path& filename, IAnimatedMesh* mesh);
34 34
35 //! Removes a mesh from the cache. 35 //! Removes a mesh from the cache.
36 /** After loading a mesh with getMesh(), the mesh can be removed from the cache 36 /** After loading a mesh with getMesh(), the mesh can be removed from the cache
37 using this method, freeing a lot of memory. */ 37 using this method, freeing a lot of memory. */
38 virtual void removeMesh(const IMesh* const mesh); 38 virtual void removeMesh(const IMesh* const mesh);
39 39
40 //! Returns amount of loaded meshes in the cache. 40 //! Returns amount of loaded meshes in the cache.
41 /** You can load new meshes into the cache using getMesh() and addMesh(). 41 /** You can load new meshes into the cache using getMesh() and addMesh().
42 If you ever need to access the internal mesh cache, you can do this using 42 If you ever need to access the internal mesh cache, you can do this using
43 removeMesh(), getMeshNumber(), getMeshByIndex() and getMeshFilename() */ 43 removeMesh(), getMeshNumber(), getMeshByIndex() and getMeshFilename() */
44 virtual u32 getMeshCount() const; 44 virtual u32 getMeshCount() const;
45 45
46 //! Returns current index number of the mesh, and -1 if it is not in the cache. 46 //! Returns current index number of the mesh, and -1 if it is not in the cache.
47 virtual s32 getMeshIndex(const IMesh* const mesh) const; 47 virtual s32 getMeshIndex(const IMesh* const mesh) const;
48 48
49 //! Returns a mesh based on its index number. 49 //! Returns a mesh based on its index number.
50 /** \param index: Index of the mesh, number between 0 and getMeshCount()-1. 50 /** \param index: Index of the mesh, number between 0 and getMeshCount()-1.
51 Note that this number is only valid until a new mesh is loaded or removed * 51 Note that this number is only valid until a new mesh is loaded or removed *
52 \return Returns pointer to the mesh or 0 if there is none with this number. */ 52 \return Returns pointer to the mesh or 0 if there is none with this number. */
53 virtual IAnimatedMesh* getMeshByIndex(u32 index); 53 virtual IAnimatedMesh* getMeshByIndex(u32 index);
54 54
55 //! Returns a mesh based on its name. 55 //! Returns a mesh based on its name.
56 /** \param name Name of the mesh. Usually a filename. 56 /** \param name Name of the mesh. Usually a filename.
57 \return Pointer to the mesh or 0 if there is none with this number. */ 57 \return Pointer to the mesh or 0 if there is none with this number. */
58 virtual IAnimatedMesh* getMeshByName(const io::path& name); 58 virtual IAnimatedMesh* getMeshByName(const io::path& name);
59 59
60 //! Get the name of a loaded mesh, based on its index. 60 //! Get the name of a loaded mesh, based on its index.
61 /** \param index: Index of the mesh, number between 0 and getMeshCount()-1. 61 /** \param index: Index of the mesh, number between 0 and getMeshCount()-1.
62 \return The name if mesh was found and has a name, else the path is empty. */ 62 \return The name if mesh was found and has a name, else the path is empty. */
63 virtual const io::SNamedPath& getMeshName(u32 index) const; 63 virtual const io::SNamedPath& getMeshName(u32 index) const;
64 64
65 //! Get the name of a loaded mesh, if there is any. 65 //! Get the name of a loaded mesh, if there is any.
66 /** \param mesh Pointer to mesh to query. 66 /** \param mesh Pointer to mesh to query.
67 \return The name if mesh was found and has a name, else the path is empty. */ 67 \return The name if mesh was found and has a name, else the path is empty. */
68 virtual const io::SNamedPath& getMeshName(const IMesh* const mesh) const; 68 virtual const io::SNamedPath& getMeshName(const IMesh* const mesh) const;
69 69
70 //! Renames a loaded mesh. 70 //! Renames a loaded mesh.
71 /** Note that renaming meshes might change the ordering of the 71 /** Note that renaming meshes might change the ordering of the
72 meshes, and so the index of the meshes as returned by 72 meshes, and so the index of the meshes as returned by
73 getMeshIndex() or taken by some methods will change. 73 getMeshIndex() or taken by some methods will change.
74 \param index The index of the mesh in the cache. 74 \param index The index of the mesh in the cache.
75 \param name New name for the mesh. 75 \param name New name for the mesh.
76 \return True if mesh was renamed. */ 76 \return True if mesh was renamed. */
77 virtual bool renameMesh(u32 index, const io::path& name); 77 virtual bool renameMesh(u32 index, const io::path& name);
78 78
79 //! Renames a loaded mesh. 79 //! Renames a loaded mesh.
80 /** Note that renaming meshes might change the ordering of the 80 /** Note that renaming meshes might change the ordering of the
81 meshes, and so the index of the meshes as returned by 81 meshes, and so the index of the meshes as returned by
82 getMeshIndex() or taken by some methods will change. 82 getMeshIndex() or taken by some methods will change.
83 \param mesh Mesh to be renamed. 83 \param mesh Mesh to be renamed.
84 \param name New name for the mesh. 84 \param name New name for the mesh.
85 \return True if mesh was renamed. */ 85 \return True if mesh was renamed. */
86 virtual bool renameMesh(const IMesh* const mesh, const io::path& name); 86 virtual bool renameMesh(const IMesh* const mesh, const io::path& name);
87 87
88 //! returns if a mesh already was loaded 88 //! returns if a mesh already was loaded
89 virtual bool isMeshLoaded(const io::path& name); 89 virtual bool isMeshLoaded(const io::path& name);
90 90
91 //! Clears the whole mesh cache, removing all meshes. 91 //! Clears the whole mesh cache, removing all meshes.
92 virtual void clear(); 92 virtual void clear();
93 93
94 //! Clears all meshes that are held in the mesh cache but not used anywhere else. 94 //! Clears all meshes that are held in the mesh cache but not used anywhere else.
95 virtual void clearUnusedMeshes(); 95 virtual void clearUnusedMeshes();
96 96
97 protected: 97 protected:
98 98
99 struct MeshEntry 99 struct MeshEntry
100 { 100 {
101 MeshEntry ( const io::path& name ) 101 MeshEntry ( const io::path& name )
102 : NamedPath ( name ) 102 : NamedPath ( name )
103 { 103 {
104 } 104 }
105 io::SNamedPath NamedPath; 105 io::SNamedPath NamedPath;
106 IAnimatedMesh* Mesh; 106 IAnimatedMesh* Mesh;
107 107
108 bool operator < (const MeshEntry& other) const 108 bool operator < (const MeshEntry& other) const
109 { 109 {
110 return (NamedPath < other.NamedPath); 110 return (NamedPath < other.NamedPath);
111 } 111 }
112 }; 112 };
113 113
114 //! loaded meshes 114 //! loaded meshes
115 core::array<MeshEntry> Meshes; 115 core::array<MeshEntry> Meshes;
116 }; 116 };
117 117
118 118
119} // end namespace scene 119} // end namespace scene
120} // end namespace irr 120} // end namespace irr
121 121
122#endif 122#endif
123 123