update WFObj construction, loadFile()/loadTexture()
This commit is contained in:
parent
f1bc763be2
commit
f78c42c8c8
@ -96,6 +96,16 @@ static vector<string> split(const string & str, char delim)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const unsigned char *loadFile(const char *fname, unsigned int *size)
|
||||||
|
{
|
||||||
|
return g_engine->loadFile(fname, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
static GLuint loadTexture(const char *fname)
|
||||||
|
{
|
||||||
|
return g_engine->loadTexture(fname);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/******** Engine functions ********/
|
/******** Engine functions ********/
|
||||||
|
|
||||||
@ -116,7 +126,6 @@ Engine::Engine(const string & path, AV & av)
|
|||||||
m_autoStartFrame = true;
|
m_autoStartFrame = true;
|
||||||
m_autoEndFrame = true;
|
m_autoEndFrame = true;
|
||||||
m_autoDrawObjects = true;
|
m_autoDrawObjects = true;
|
||||||
m_fileLoader = new EngineFileLoader(this);
|
|
||||||
m_event_time = 0;
|
m_event_time = 0;
|
||||||
m_font = NULL;
|
m_font = NULL;
|
||||||
m_engine_cursor_visible = m_av.getCursorVisible();
|
m_engine_cursor_visible = m_av.getCursorVisible();
|
||||||
@ -592,12 +601,12 @@ int Engine::loadModel(const string & name, bool is_static, bool is_reference,
|
|||||||
string path = name;
|
string path = name;
|
||||||
if (validatePath(path))
|
if (validatePath(path))
|
||||||
{
|
{
|
||||||
FileLoader::Path model_path("", path + ".obj");
|
string model_path = path + ".obj";
|
||||||
FileLoader::Path phys_path("", path + ".phy");
|
string phys_path = path + ".phy";
|
||||||
|
|
||||||
WFObj * obj = new WFObj(*m_fileLoader, m_textureCache);
|
WFObj * obj = new WFObj();
|
||||||
|
|
||||||
if (obj->load(model_path))
|
if (obj->load(model_path, &::loadFile, &::loadTexture))
|
||||||
{
|
{
|
||||||
int id = addObject(obj, is_static, is_reference, enable_blending,
|
int id = addObject(obj, is_static, is_reference, enable_blending,
|
||||||
scale);
|
scale);
|
||||||
@ -682,12 +691,6 @@ bool Engine::importFullPath(const char * path)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLuint Engine::loadTexture(const char * name)
|
|
||||||
{
|
|
||||||
FileLoader::Path path("", name);
|
|
||||||
return m_textureCache.load(path, *m_fileLoader);
|
|
||||||
}
|
|
||||||
|
|
||||||
GLuint Engine::startList()
|
GLuint Engine::startList()
|
||||||
{
|
{
|
||||||
GLuint list = glGenLists(1);
|
GLuint list = glGenLists(1);
|
||||||
@ -1295,6 +1298,10 @@ const unsigned char *Engine::loadFile(const char *fname, unsigned int *len)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GLuint Engine::loadTexture(const char *fname)
|
||||||
|
{
|
||||||
|
return m_textureCache.load(fname);
|
||||||
|
}
|
||||||
|
|
||||||
/******** Engine::PickedObject functions ********/
|
/******** Engine::PickedObject functions ********/
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
#include "OdeWorld/OdeWorld.h"
|
#include "OdeWorld/OdeWorld.h"
|
||||||
#include "TextureCache/TextureCache.h"
|
#include "TextureCache/TextureCache.h"
|
||||||
#include "WFObj/WFObj.h"
|
#include "wfobj/WFObj.h"
|
||||||
#include "AV.h"
|
#include "AV.h"
|
||||||
#include "refptr/refptr.h"
|
#include "refptr/refptr.h"
|
||||||
#include "ftgl.h"
|
#include "ftgl.h"
|
||||||
@ -252,6 +252,7 @@ class Engine
|
|||||||
void exit();
|
void exit();
|
||||||
bool import(const char * name);
|
bool import(const char * name);
|
||||||
bool importFullPath(const char * path);
|
bool importFullPath(const char * path);
|
||||||
|
const unsigned char *loadFile(const char *fname, unsigned int *len);
|
||||||
GLuint loadTexture(const char * name);
|
GLuint loadTexture(const char * name);
|
||||||
void debug_hook(lua_Debug * debug);
|
void debug_hook(lua_Debug * debug);
|
||||||
void setGravity(float gx, float gy, float gz)
|
void setGravity(float gx, float gy, float gz)
|
||||||
@ -300,8 +301,6 @@ class Engine
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
static Uint32 updateCallback(Uint32 interval, void * param);
|
static Uint32 updateCallback(Uint32 interval, void * param);
|
||||||
int getFileSize(const char *fname);
|
|
||||||
const unsigned char *loadFile(const char *fname, unsigned int *len);
|
|
||||||
|
|
||||||
Uint32 updateCallback(Uint32 interval);
|
Uint32 updateCallback(Uint32 interval);
|
||||||
void registerLibraries();
|
void registerLibraries();
|
||||||
@ -325,6 +324,7 @@ class Engine
|
|||||||
m_engine_cursor_visible || m_script_cursor_visible);
|
m_engine_cursor_visible || m_script_cursor_visible);
|
||||||
}
|
}
|
||||||
bool validatePath(std::string & path);
|
bool validatePath(std::string & path);
|
||||||
|
int getFileSize(const char *fname);
|
||||||
|
|
||||||
AV & m_av;
|
AV & m_av;
|
||||||
bool m_engine_cursor_visible;
|
bool m_engine_cursor_visible;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user