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