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
58 typedef pmap<Filename, PT(PhysxConvexMesh)> ConvexMeshes;
59 static ConvexMeshes _convex_meshes;
60
61 typedef pmap<Filename, PT(PhysxTriangleMesh)> TriangleMeshes;
62 static TriangleMeshes _triangle_meshes;
63
64 typedef pmap<Filename, PT(PhysxClothMesh)> ClothMeshes;
65 static ClothMeshes _cloth_meshes;
66
67 typedef pmap<Filename, PT(PhysxSoftBodyMesh)> SoftbodyMeshes;
68 static SoftbodyMeshes _softbody_meshes;
69 };
70
71 #include "physxMeshPool.I"
72
73 #endif // PHYSXMESHPOOL_H
Filename
The name of a file, such as a texture file or an Egg file.
Definition: filename.h:39
PhysxClothMesh
Definition: physxClothMesh.h:25
PhysxConvexMesh
A Convex Mesh.
Definition: physxConvexMesh.h:26
PhysxMeshPool
This class unifies all references to the same filename, so that multiple attempts to load the same me...
Definition: physxMeshPool.h:36
PhysxSoftBodyMesh
Definition: physxSoftBodyMesh.h:25
PhysxTriangleMesh
Definition: physxTriangleMesh.h:25
pmap
This is our own Panda specialization on the default STL map.
Definition: pmap.h:49
filename.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
physxMeshPool.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
physx_includes.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pmap.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pnotify.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pointerTo.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.