Panda3D
physxMeshPool.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file physxMeshPool.h
10  * @author enn0x
11  * @date 2009-10-14
12  */
13 
14 #ifndef PHYSXMESHPOOL_H
15 #define PHYSXMESHPOOL_H
16 
17 #include "pandabase.h"
18 #include "pointerTo.h"
19 #include "pnotify.h"
20 #include "pmap.h"
21 #include "filename.h"
22 
23 #include "physx_includes.h"
24 
25 class PhysxConvexMesh;
26 class PhysxTriangleMesh;
27 class PhysxClothMesh;
28 class PhysxSoftBodyMesh;
29 
30 /**
31  * This class unifies all references to the same filename, so that multiple
32  * attempts to load the same mesh will return the same pointer. The mesh
33  * filename is automatically resolved before an attempt to load the mesh is
34  * made.
35  */
36 class EXPCL_PANDAPHYSX PhysxMeshPool {
37 
38 PUBLISHED:
39  INLINE PhysxMeshPool();
40  INLINE ~PhysxMeshPool();
41 
42  static PhysxConvexMesh *load_convex_mesh(const Filename &filename);
43  static PhysxTriangleMesh *load_triangle_mesh(const Filename &filename);
44  static PhysxClothMesh *load_cloth_mesh(const Filename &filename);
45  static PhysxSoftBodyMesh *load_soft_body_mesh(const Filename &filename);
46 
47  static bool release_convex_mesh(PhysxConvexMesh *mesh);
48  static bool release_triangle_mesh(PhysxTriangleMesh *mesh);
49  static bool release_cloth_mesh(PhysxClothMesh *mesh);
50  static bool release_soft_body_mesh(PhysxSoftBodyMesh *mesh);
51 
52  static void list_contents();
53  static void list_contents(std::ostream &out);
54 
55 private:
56  static bool check_filename(const Filename &fn);
57 
59  static ConvexMeshes _convex_meshes;
60 
62  static TriangleMeshes _triangle_meshes;
63 
65  static ClothMeshes _cloth_meshes;
66 
68  static SoftbodyMeshes _softbody_meshes;
69 };
70 
71 #include "physxMeshPool.I"
72 
73 #endif // PHYSXMESHPOOL_H
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is our own Panda specialization on the default STL map.
Definition: pmap.h:49
This class unifies all references to the same filename, so that multiple attempts to load the same me...
Definition: physxMeshPool.h:36
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
The name of a file, such as a texture file or an Egg file.
Definition: filename.h:39
A Convex Mesh.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.