add Engine::loadWFObjFile()

This commit is contained in:
Josh Holtrop committed 2011-05-21 23:33:28 -04:00
1 parent 278867b3c8
commit 67010e02c2
3 files changed
+22 -2

No files matched your search

+20 -1
View File
@@ -101,6 +101,11 @@ static const unsigned char *loadFile(const char *fname, unsigned int *size)
return g_engine->loadFile(fname, size);
}
static bool loadWFObjFile(const char *fname, WFObj::Buffer & buff)
{
return g_engine->loadWFObjFile(fname, buff);
}
static GLuint loadTexture(const char *fname)
{
return g_engine->loadTexture(fname);
@@ -605,7 +610,7 @@ int Engine::loadModel(const string & name, bool is_static, bool is_reference,
WFObj * obj = new WFObj();
if (obj->load(model_path.c_str(), &::loadFile, &::loadTexture))
if (obj->load(model_path.c_str(), &::loadWFObjFile, &::loadTexture))
{
int id = addObject(obj, is_static, is_reference, enable_blending,
scale);
@@ -1299,6 +1304,20 @@ const unsigned char *Engine::loadFile(const char *fname, unsigned int *len)
return NULL;
}
bool Engine::loadWFObjFile(const char *fname, WFObj::Buffer & buff)
{
unsigned int size;
unsigned char *data = loadFile(fname, &size);
if (data != NULL)
{
buff.alloc(size);
memcpy(buff.data, data, size);
free(data);
return true;
}
return false;
}
GLuint Engine::loadTexture(const char *fname)
{
return m_textureCache.load(fname);
+1
View File
@@ -253,6 +253,7 @@ class Engine
bool import(const char * name);
bool importFullPath(const char * path);
const unsigned char *loadFile(const char *fname, unsigned int *len);
bool loadWFObjFile(const char *fname, WFObj::Buffer & buff);
GLuint loadTexture(const char * name);
void debug_hook(lua_Debug * debug);
void setGravity(float gx, float gy, float gz)
+1 -1
Submodule wfobj updated: 1ecc6d749b...e6b8c17345.