le3d - LightEngine 3D
A straightforward C++ 3D software engine for real-time graphics
meshcache.h
Go to the documentation of this file.
1 
34 #ifndef LE_MESHCACHE_H
35 #define LE_MESHCACHE_H
36 
37 #include "global.h"
38 #include "config.h"
39 
40 #include "mesh.h"
41 
42 /*****************************************************************************/
48 {
49 public:
50  LeMeshCache();
51  ~LeMeshCache();
52 
53  void clean();
54 
55  void loadDirectory(const char * path);
56  LeMesh * loadOBJ(const char * path);
57 
58  int getSlotFromName(const char * name);
59  LeMesh * getMeshFromName(const char * path);
60 
61 public:
66  typedef struct{
68  char path[LE_MAX_FILE_PATH+1];
69  char name[LE_MAX_FILE_NAME+1];
70  int flags;
71  }Slot;
72 
74  int noSlots;
76 private:
77  int createSlot(LeMesh * mesh, const char * path);
78  void deleteSlot(int slot);
79 };
80 
81 extern LeMeshCache meshCache;
82 
83 #endif // LE_MESHCACHE_H
#define LE_MAX_FILE_NAME
Definition: config.h:40
~LeMeshCache()
Definition: meshcache.cpp:71
Cache and inventory all meshes loaded.
Definition: meshcache.h:47
LightEngine 3D: Mesh container and manipulator.
LightEngine 3D: General engine configuration file.
LeMesh * loadOBJ(const char *path)
Load a OBJ file of given path and apply transforms.
Definition: meshcache.cpp:95
LightEngine 3D: Global helpers and definitions.
LeMesh * mesh
Definition: meshcache.h:67
void clean()
Unload all resources in cache and remove entries.
Definition: meshcache.cpp:81
LeMeshCache meshCache
Definition: meshcache.cpp:50
LeMesh * getMeshFromName(const char *path)
Retrieve a mesh object from its name or path.
Definition: meshcache.cpp:214
void loadDirectory(const char *path)
Load in cache all the recognized mesh files from the given directory.
Definition: meshcache.cpp:118
#define LE_MESHCACHE_SLOTS
Definition: config.h:48
represents a mesh cache slot
Definition: meshcache.h:66
int flags
Definition: meshcache.h:70
int getSlotFromName(const char *name)
Retrieve a mesh slot index from a mesh name or path.
Definition: meshcache.cpp:190
LeMeshCache()
Definition: meshcache.cpp:53
Slot cacheSlots[LE_MESHCACHE_SLOTS]
Definition: meshcache.h:73
int noSlots
Definition: meshcache.h:74
Contain and manage a 3D mesh.
Definition: mesh.h:47
#define LE_MAX_FILE_PATH
Definition: config.h:41