add Engine::loadWFObjFile()
This commit is contained in:
parent
278867b3c8
commit
67010e02c2
@ -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);
|
||||
|
@ -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)
|
||||
|
2
wfobj
2
wfobj
@ -1 +1 @@
|
||||
Subproject commit 1ecc6d749be3bc3f5dc0de230b5e8e3ca079377a
|
||||
Subproject commit e6b8c173451603db46f33aa2f55cb899d8bbfc5e
|
Loading…
x
Reference in New Issue
Block a user