use spaces not tabs!
git-svn-id: svn://anubis/misc/wfobj@133 bd8a9e45-a331-0410-811e-c64571078777
This commit is contained in:
parent
049cb20c7c
commit
59f7e83a3f
100
WFObj.hh
100
WFObj.hh
@ -7,67 +7,67 @@
|
|||||||
class WFObj
|
class WFObj
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef GLuint (*loadTextureFunc_t)(const char * texture);
|
typedef GLuint (*loadTextureFunc_t)(const char * texture);
|
||||||
typedef void * (*loadFileFunc_t)(const char * filename,
|
typedef void * (*loadFileFunc_t)(const char * filename,
|
||||||
unsigned int * length);
|
unsigned int * length);
|
||||||
bool load(const std::string & filename,
|
bool load(const std::string & filename,
|
||||||
loadTextureFunc_t loadTexture = NULL,
|
loadTextureFunc_t loadTexture = NULL,
|
||||||
loadFileFunc_t loadFile = NULL);
|
loadFileFunc_t loadFile = NULL);
|
||||||
GLuint render(bool doTextureInfo = true);
|
GLuint render(bool doTextureInfo = true);
|
||||||
const float * const getAABB() { return m_aabb; }
|
const float * const getAABB() { return m_aabb; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/* types */
|
/* types */
|
||||||
class Vertex
|
class Vertex
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
float operator[](int idx) const { return data[idx]; }
|
float operator[](int idx) const { return data[idx]; }
|
||||||
float & operator[](int idx) { return data[idx]; }
|
float & operator[](int idx) { return data[idx]; }
|
||||||
float * getData() { return data; }
|
float * getData() { return data; }
|
||||||
private:
|
private:
|
||||||
float data[4];
|
float data[4];
|
||||||
};
|
};
|
||||||
|
|
||||||
/* methods */
|
/* methods */
|
||||||
void clear();
|
void clear();
|
||||||
int filesize(const char * filename);
|
int filesize(const char * filename);
|
||||||
void processInputLine(const std::string & input);
|
void processInputLine(const std::string & input);
|
||||||
Vertex readVertex(const std::vector<std::string> & parts);
|
Vertex readVertex(const std::vector<std::string> & parts);
|
||||||
void parseVertexIndices(const std::string & vtxref, int * ret);
|
void parseVertexIndices(const std::string & vtxref, int * ret);
|
||||||
void updateAABB(const float * const vertex);
|
void updateAABB(const float * const vertex);
|
||||||
bool load(std::istream & istr, unsigned int size);
|
bool load(std::istream & istr, unsigned int size);
|
||||||
|
|
||||||
/* variables */
|
/* variables */
|
||||||
std::vector< std::vector<std::string> > m_data;
|
std::vector< std::vector<std::string> > m_data;
|
||||||
loadTextureFunc_t m_loadTexture;
|
loadTextureFunc_t m_loadTexture;
|
||||||
loadFileFunc_t m_loadFile;
|
loadFileFunc_t m_loadFile;
|
||||||
std::string m_fileName;
|
std::string m_fileName;
|
||||||
float m_aabb[6];
|
float m_aabb[6];
|
||||||
bool m_loadedVertex;
|
bool m_loadedVertex;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class WFMtl
|
class WFMtl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
bool load(const std::string & filename,
|
bool load(const std::string & filename,
|
||||||
WFObj::loadTextureFunc_t loadTexture = NULL,
|
WFObj::loadTextureFunc_t loadTexture = NULL,
|
||||||
WFObj::loadFileFunc_t loadFile = NULL);
|
WFObj::loadFileFunc_t loadFile = NULL);
|
||||||
void renderBegin(const std::string & mtlname, bool doTextureInfo = true);
|
void renderBegin(const std::string & mtlname, bool doTextureInfo = true);
|
||||||
void renderEnd(const std::string & mtlname, bool doTextureInfo = true);
|
void renderEnd(const std::string & mtlname, bool doTextureInfo = true);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/* methods */
|
/* methods */
|
||||||
void clear();
|
void clear();
|
||||||
int filesize(const char * filename);
|
int filesize(const char * filename);
|
||||||
void processInputLine(const std::string & input);
|
void processInputLine(const std::string & input);
|
||||||
void pushAttributes();
|
void pushAttributes();
|
||||||
bool load(std::istream & istr, unsigned int size);
|
bool load(std::istream & istr, unsigned int size);
|
||||||
|
|
||||||
/* variables */
|
/* variables */
|
||||||
std::map< std::string, std::vector< std::vector<std::string> > > m_data;
|
std::map< std::string, std::vector< std::vector<std::string> > > m_data;
|
||||||
std::string m_currentMaterialName;
|
std::string m_currentMaterialName;
|
||||||
bool m_attributesPushed;
|
bool m_attributesPushed;
|
||||||
WFObj::loadTextureFunc_t m_loadTexture;
|
WFObj::loadTextureFunc_t m_loadTexture;
|
||||||
std::string m_fileName;
|
std::string m_fileName;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user