Panda3D
 All Classes Functions Variables Enumerations
physxMeshPool.h
00001 // Filename: physxMeshPool.h
00002 // Created by:  enn0x (14Oct09)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #ifndef PHYSXMESHPOOL_H
00016 #define PHYSXMESHPOOL_H
00017 
00018 #include "pandabase.h"
00019 #include "pointerTo.h"
00020 #include "pnotify.h"
00021 #include "pmap.h"
00022 #include "filename.h"
00023 
00024 #include "physx_includes.h"
00025 
00026 class PhysxConvexMesh;
00027 class PhysxTriangleMesh;
00028 class PhysxClothMesh;
00029 class PhysxSoftBodyMesh;
00030 
00031 ////////////////////////////////////////////////////////////////////
00032 //       Class : PhysxMeshPool
00033 // Description : This class unifies all references to the same
00034 //               filename, so that multiple attempts to load the
00035 //               same mesh will return the same pointer.
00036 //               The mesh filename is automatically resolved before
00037 //               an attempt to load the mesh is made.
00038 ////////////////////////////////////////////////////////////////////
00039 class EXPCL_PANDAPHYSX PhysxMeshPool {
00040 
00041 PUBLISHED:
00042   INLINE PhysxMeshPool();
00043   INLINE ~PhysxMeshPool();
00044 
00045   static PhysxConvexMesh *load_convex_mesh(const Filename &filename);
00046   static PhysxTriangleMesh *load_triangle_mesh(const Filename &filename);
00047   static PhysxClothMesh *load_cloth_mesh(const Filename &filename);
00048   static PhysxSoftBodyMesh *load_soft_body_mesh(const Filename &filename);
00049 
00050   static bool release_convex_mesh(PhysxConvexMesh *mesh);
00051   static bool release_triangle_mesh(PhysxTriangleMesh *mesh);
00052   static bool release_cloth_mesh(PhysxClothMesh *mesh);
00053   static bool release_soft_body_mesh(PhysxSoftBodyMesh *mesh);
00054 
00055   static void list_contents();
00056   static void list_contents(ostream &out);
00057 
00058 private:
00059   static bool check_filename(const Filename &fn);
00060 
00061   typedef pmap<Filename, PT(PhysxConvexMesh)> ConvexMeshes;
00062   static ConvexMeshes _convex_meshes;
00063 
00064   typedef pmap<Filename, PT(PhysxTriangleMesh)> TriangleMeshes;
00065   static TriangleMeshes _triangle_meshes;
00066 
00067   typedef pmap<Filename, PT(PhysxClothMesh)> ClothMeshes;
00068   static ClothMeshes _cloth_meshes;
00069 
00070   typedef pmap<Filename, PT(PhysxSoftBodyMesh)> SoftbodyMeshes;
00071   static SoftbodyMeshes _softbody_meshes;
00072 };
00073 
00074 #include "physxMeshPool.I"
00075 
00076 #endif // PHYSXMESHPOOL_H
 All Classes Functions Variables Enumerations