load tank model, not drawing it yet

This commit is contained in:
Josh Holtrop 2012-09-07 23:59:16 -04:00
parent 4d3f088e3f
commit c70cc450cc
2 changed files with 19 additions and 0 deletions

View File

@ -11,6 +11,19 @@
using namespace std; using namespace std;
static bool load_file(const char *fname, WFObj::Buffer & buff)
{
unsigned int length;
uint8_t *contents = (uint8_t *) CFS.get_file(fname, &length);
if (contents != NULL)
{
buff.data = contents;
buff.length = length;
return true;
}
return false;
}
Client::Client(bool fullscreen, bool compatibility_context, Client::Client(bool fullscreen, bool compatibility_context,
unsigned int antialias_level) unsigned int antialias_level)
{ {
@ -52,6 +65,10 @@ Client::Client(bool fullscreen, bool compatibility_context,
{ {
cerr << "Error creating obj program" << endl; cerr << "Error creating obj program" << endl;
} }
if (!tank_obj.load("models/tank.obj", load_file))
{
cerr << "Error loading tank model" << endl;
}
} }
void Client::run() void Client::run()

View File

@ -7,6 +7,7 @@
#include "Map.h" #include "Map.h"
#include "Player.h" #include "Player.h"
#include "GLProgram.h" #include "GLProgram.h"
#include "WFObj.h"
class Client class Client
{ {
@ -27,6 +28,7 @@ class Client
int m_width; int m_width;
int m_height; int m_height;
GLProgram m_obj_program; GLProgram m_obj_program;
WFObj tank_obj;
}; };
#endif #endif