wfobj/WFObj.hh
josh 5b34c54c96 added (in progress) WFMtl class, clear() method
git-svn-id: svn://anubis/misc/wfobj@20 bd8a9e45-a331-0410-811e-c64571078777
2008-01-27 14:00:34 +00:00

37 lines
846 B
C++

#include <GL/gl.h>
#include <vector>
#include <string>
class WFObj
{
public:
bool load(const std::string & filename);
GLuint render();
private:
/* types */
class Vertex
{
public:
float operator[](int idx) const { return data[idx]; }
const float & operator[](int idx) { return data[idx]; }
float * getData() { return data; }
private:
float data[4];
};
/* methods */
void clear();
std::string trim(std::string s);
int filesize(const char * filename);
void processInputLine(const std::string & input);
std::string stripFirstToken(std::string & input);
Vertex readVertex(const std::vector<std::string> & parts);
void parseVertexIndices(const std::string & vtxref, int * ret);
std::vector<std::string> splitString(const std::string & str, char delim);
/* variables */
std::vector< std::vector<std::string> > m_data;
};