diff --git a/.hgignore b/.hgignore index 39d4830..1d76a2c 100644 --- a/.hgignore +++ b/.hgignore @@ -1,3 +1,4 @@ glob:.scons* glob:*.o glob:dwss +glob:LoadFile-gen.inc diff --git a/FileLoader.h b/FileLoader.h new file mode 100644 index 0000000..8a6cffb --- /dev/null +++ b/FileLoader.h @@ -0,0 +1,88 @@ + +#ifndef FILELOADER_H +#define FILELOADER_H FILELOADER_H + +#include +#include + +class FileLoader +{ + public: + class Path + { + public: + std::string fullPath; + std::string shortPath; + Path() { } + Path(const std::string & full_path, + const std::string & short_path) + : fullPath(full_path), shortPath(short_path) { } + std::string toString() const + { + std::string ret; + if (shortPath != "") + ret += shortPath + ","; + if (fullPath != "") + ret += fullPath; + return ret; + } + }; + + class Buffer + { + public: + char * data; + int size; + Buffer(int sz) + { + size = sz; + data = new char[size]; + _refcnt = new int; + *_refcnt = 1; + m_alloced = true; + } + Buffer(char * data, int sz) + { + size = sz; + this->data = data; + m_alloced = false; + } + void copy(const Buffer & other) + { + data = other.data; + size = other.size; + m_alloced = other.m_alloced; + if (m_alloced) + { + _refcnt = other._refcnt; + (*_refcnt)++; + } + } + Buffer(const Buffer & other) { copy(other); } + Buffer & operator=(const Buffer & other) + { + copy(other); + return *this; + } + ~Buffer() + { + if (m_alloced) + { + (*_refcnt)--; + if (*_refcnt < 1) + { + delete _refcnt; + delete data; + } + } + } + protected: + int * _refcnt; + bool m_alloced; + }; + + virtual int getSize(const Path & path) = 0; + virtual Buffer load(const Path & path) = 0; +}; + +#endif diff --git a/LoadFile.cc b/LoadFile.cc new file mode 100644 index 0000000..373acf3 --- /dev/null +++ b/LoadFile.cc @@ -0,0 +1,41 @@ + +#include "LoadFile.h" + +using namespace std; + +/* The data section is generated by a perl script. The contents of the + * included file are part of this logical program unit, which is why it + * is directly included instead of compiling it separately. + */ +#include "LoadFile-gen.inc" + +LoadFile::LoadFile() +{ + for (unsigned int i = 0; + i < sizeof(LoadFileData)/sizeof(LoadFileData[0]); + i++) + { + m_filemap[LoadFileData[i].filename] = &LoadFileData[i]; + } +} + +FileLoader::Buffer LoadFile::load(const FileLoader::Path & path) +{ + map::iterator it = m_filemap.find(path.shortPath); + + if (it == m_filemap.end()) + return Buffer(0); + + return Buffer((char *) it->second->data, it->second->length); +} + +int LoadFile::getSize(const FileLoader::Path & path) +{ + map::iterator it = m_filemap.find(path.shortPath); + + if (it == m_filemap.end()) + return 0; + + return it->second->length; +} + diff --git a/LoadFile.h b/LoadFile.h new file mode 100644 index 0000000..7a5845f --- /dev/null +++ b/LoadFile.h @@ -0,0 +1,25 @@ + +#ifndef LOADFILE_H +#define LOADFILE_H + +#include +#include +#include "FileLoader.h" + +typedef struct { + const char * filename; + unsigned char * data; + int length; +} fileref_t; + +class LoadFile : public FileLoader +{ + public: + LoadFile(); + int getSize(const Path & path); + Buffer load(const Path & path); + protected: + std::map< std::string, fileref_t * > m_filemap; +}; + +#endif diff --git a/SConstruct b/SConstruct index e616958..b634ca2 100644 --- a/SConstruct +++ b/SConstruct @@ -1,10 +1,17 @@ install_dir = '/usr/lib/gnome-screensaver/gnome-screensaver' +load_files = ['logo/dwlogo.obj', 'logo/dwlogo.mtl'] -env = Environment() +env = Environment(CPPPATH = ['.']) env.ParseConfig("pkg-config --cflags --libs glib-2.0 gdk-2.0 atk gtk+-2.0 gtkglext-1.0") -dwss = env.Program('dwss', [Glob('*.c'), Glob('*.cc')]) +genLoadFile = Builder(action = 'perl genLoadFile.pl --root=logo $SOURCES') +env.Append(BUILDERS = {'LoadFile' : genLoadFile}) + +sources = [Glob('*.c'), Glob('*.cc'), Glob('LoadFile/*.cc')] +env.LoadFile('LoadFile-gen.inc', load_files) +env.Depends('LoadFile-gen.inc', 'genLoadFile.pl') +dwss = env.Program('dwss', sources) env.Install(install_dir, dwss) env.Alias('install', install_dir) diff --git a/TextureLoader.h b/TextureLoader.h new file mode 100644 index 0000000..a7b9ca5 --- /dev/null +++ b/TextureLoader.h @@ -0,0 +1,18 @@ + +#ifndef TEXTURELOADER_H +#define TEXTURELOADER_H TEXTURELOADER_H + +#include +#include +#include "FileLoader.h" + +class TextureLoader +{ + public: + virtual GLuint load( + const FileLoader::Path & path, + FileLoader & fileLoader, bool mipmaps = true, + int mode = GL_DECAL, int quality = 1) = 0; +}; + +#endif diff --git a/WFObj.cc b/WFObj.cc new file mode 100644 index 0000000..68b0ab6 --- /dev/null +++ b/WFObj.cc @@ -0,0 +1,703 @@ + +#include +#include +#include +#include +#include // isspace() +#include // strlen() +#include +#include +#include +#include +#include +#include +#include +#include "WFObj.h" +using namespace std; + +#define WHITESPACE " \n\r\t\v" +//#define DEBUGGL + +/****** static functions ******/ + +static string trimString(string s) +{ + size_t lastpos = s.find_last_not_of(WHITESPACE); + if (lastpos == string::npos) + return ""; + s.erase(lastpos + 1); + s.erase(0, s.find_first_not_of(WHITESPACE)); + return s; +} + +static string stripFirstToken(string & input) +{ + size_t firstnonspace = input.find_first_not_of(WHITESPACE); + if (firstnonspace == string::npos) + return ""; + size_t spaceafter = input.find_first_of(WHITESPACE, firstnonspace); + string token = input.substr(firstnonspace, spaceafter - firstnonspace); + input.erase(0, spaceafter); + return token; +} + +static vector splitString(const string & str, char delim) +{ + vector ret; + string s = str; + size_t pos; + while ( (pos = s.find(delim)) != string::npos ) + { + string t = s.substr(0, pos); + ret.push_back(t); + s.erase(0, pos + 1); + } + if (s != "") + ret.push_back(s); + return ret; +} + +static string basePath(const string & str) +{ + string path = str; + size_t pos; + if ( (pos = path.find_last_of("/\\")) != string::npos ) + { + path.erase(pos + 1); + return path; + } + return ""; +} + +//#define DEBUG_GL_ERROR +#ifdef DEBUG_GL_ERROR +#define checkGLError() checkGLErrorLine(__FUNCTION__, __LINE__) +static void checkGLErrorLine(const char * function, int line) +{ + GLenum err = glGetError(); + if (err != 0) + { + cerr << "gl error in " << function + << ": " << err << " (0x" << hex << err << ") at line " + << dec << line << endl; + } +} +#else +#define checkGLError() +#endif + + +/****** WFObj functions ******/ + +WFObj::WFObj() +{ + init(); +} + +WFObj::WFObj(FileLoader & fileLoader) +{ + init(&fileLoader); +} + +WFObj::WFObj(TextureLoader & textureLoader) +{ + init(NULL, &textureLoader); +} + +WFObj::WFObj(FileLoader & fileLoader, TextureLoader & textureLoader) +{ + init(&fileLoader, &textureLoader); +} + +void WFObj::init (FileLoader * fileLoader, + TextureLoader * textureLoader) +{ + m_fileLoader = fileLoader; + if (m_fileLoader == NULL) + { + m_fileLoader = new WFFileLoader(); + m_iCreatedFileLoader = true; + } + else + { + m_iCreatedFileLoader = false; + } + m_textureLoader = textureLoader; +} + +WFObj::~WFObj() +{ + if (m_iCreatedFileLoader) + delete m_fileLoader; +} + +void WFObj::clear() +{ + m_data = std::vector< std::vector >(); + m_loadedVertex = false; +} + +bool WFObj::load(const FileLoader::Path & path) +{ + clear(); + + FileLoader::Buffer buff = m_fileLoader->load(path); + if (buff.size <= 0) + return false; + + m_path = path; + string str(buff.data, buff.size); + stringstream istr(str, ios_base::in); + load(istr, buff.size); + + return true; +} + +bool WFObj::load(std::istream & istr, unsigned int size) +{ + char buf[size+1]; + + string buildup; + while (istr.good()) + { + istr.getline(buf, size+1); + string input = trimString(buf); + int sz = input.size(); + if (sz == 0 || input[0] == '#') + continue; + if (input[sz-1] == '\\') + { + input[sz-1] = ' '; + buildup = input; + continue; + } + if (buildup != "") + input = buildup + input; + buildup = ""; + processInputLine(input); + } + return true; +} + +void WFObj::processInputLine(const std::string & input) +{ + string line = input; + vector lineParts; + for (;;) + { + string token = stripFirstToken(line); + if (token == "") + break; + lineParts.push_back(token); + } + if (lineParts.size() > 0) + m_data.push_back(lineParts); +} + + +GLuint WFObj::render(bool doTextureInfo, bool enableBlending) +{ + checkGLError(); + GLuint list = glGenLists(1); + glNewList(list, GL_COMPILE); + int len = m_data.size(); + enum { VERTEX, VERTEX_TEXTURE, VERTEX_NORMAL, VERTEX_TYPES }; + vector vertices[VERTEX_TYPES]; + int numVertsLast = 0; + bool inFace = false; + bool inMaterial = false; + string currentMaterialName; + WFMtl material(this); + for (int i = 0; i < len; i++) + { + string type = m_data[i][0]; + if (type == "v") + { + Vertex v = readVertex(m_data[i]); + updateAABB(v.getData()); + vertices[VERTEX].push_back(v); + } + else if (type == "vt") + vertices[VERTEX_TEXTURE].push_back(readVertex(m_data[i])); + else if (type == "vn") + vertices[VERTEX_NORMAL].push_back(readVertex(m_data[i])); + else if (type == "f") + { + int numVerts = m_data[i].size() - 1; + if (inFace && (numVerts != numVertsLast || numVertsLast > 4)) + { +#ifdef DEBUGGL + cout << "glEnd()" << endl; +#endif + glEnd(); + inFace = false; + } + if (!inFace) + { + if (numVerts == 3) + { +#ifdef DEBUGGL + cout << "glBegin(GL_TRIANGLES)" << endl; +#endif + glBegin(GL_TRIANGLES); + } + else if (numVerts == 4) + { +#ifdef DEBUGGL + cout << "glBegin(GL_QUADS)" << endl; +#endif + glBegin(GL_QUADS); + } + else + { +#ifdef DEBUGGL + cout << "glBegin(GL_POLYGON)" << endl; +#endif + glBegin(GL_POLYGON); + } + inFace = true; + } + for (int v = 1; v <= numVerts; v++) + { + int vertexIndices[3] = {0, 0, 0}; + parseVertexIndices(m_data[i][v], vertexIndices); + for (int j = 0; j < 3; j++) + { + if (vertexIndices[j] < 0) + vertexIndices[j] += vertices[j].size() + 1; + } + bool valid = true; + for (int j = 0; j < 3; j++) + { + if (vertexIndices[j] > (int) vertices[j].size()) + { + valid = false; + break; + } + } + if (vertexIndices[VERTEX] <= 0) + valid = false; + if (!valid) + continue; + if (vertexIndices[VERTEX_NORMAL] != 0) + { + /* a normal is present */ +#ifdef DEBUGGL + cout << " glNormal3f(" << + vertices[VERTEX_NORMAL][vertexIndices[VERTEX_NORMAL]-1] + [0] << ", " << + vertices[VERTEX_NORMAL][vertexIndices[VERTEX_NORMAL]-1] + [1] << ", " << + vertices[VERTEX_NORMAL][vertexIndices[VERTEX_NORMAL]-1] + [2] << ")" << endl; +#endif + glNormal3fv(vertices[VERTEX_NORMAL] + [vertexIndices[VERTEX_NORMAL]-1].getData()); + } + if (vertexIndices[VERTEX_TEXTURE] != 0) + { + /* a texture coordinate is present */ +#ifdef DEBUGGL + cout << " glTexCoord2f(" << + vertices[VERTEX_TEXTURE][vertexIndices[VERTEX_TEXTURE]-1] + [0] << ", " << + vertices[VERTEX_TEXTURE][vertexIndices[VERTEX_TEXTURE]-1] + [1] << ')' << endl; +#endif + glTexCoord2fv(vertices[VERTEX_TEXTURE] + [vertexIndices[VERTEX_TEXTURE]-1].getData()); + } +#ifdef DEBUGGL + cout << " glVertex3f(" << + vertices[VERTEX][vertexIndices[VERTEX]-1][0] << ", " << + vertices[VERTEX][vertexIndices[VERTEX]-1][1] << ", " << + vertices[VERTEX][vertexIndices[VERTEX]-1][2] << ")" << + " [" << vertexIndices[VERTEX] << "]" << endl; +#endif + glVertex3fv(vertices[VERTEX][vertexIndices[VERTEX]-1].getData()); + } + + numVertsLast = numVerts; + } + else if (type == "usemtl") + { + if (inFace) + { +#ifdef DEBUGGL + cout << "glEnd()" << endl; +#endif + glEnd(); + inFace = false; + } + if (inMaterial) + { + material.renderEnd(currentMaterialName, doTextureInfo, + enableBlending); + inMaterial = false; + } + if (m_data[i].size() >= 2) + { + currentMaterialName = m_data[i][1]; + material.renderBegin(currentMaterialName, doTextureInfo, + enableBlending); + inMaterial = true; + } + } + else if (type == "mtllib") + { + if (m_data[i].size() >= 2) + { + FileLoader::Path path( + basePath(m_path.fullPath) + m_data[i][1], + m_data[i][1]); + material.load(path); + } + } + } + if (inFace) + { +#ifdef DEBUGGL + cout << "glEnd()" << endl; +#endif + glEnd(); + inFace = false; + } + if (inMaterial) + { + material.renderEnd(currentMaterialName, doTextureInfo, enableBlending); + inMaterial = false; + } + glEndList(); + checkGLError(); + return list; +} + +void WFObj::updateAABB(const float * const vertex) +{ + if (m_loadedVertex) + { + if (vertex[0] < m_aabb[0]) + m_aabb[0] = vertex[0]; + else if (vertex[0] > m_aabb[3]) + m_aabb[3] = vertex[0]; + if (vertex[1] < m_aabb[1]) + m_aabb[1] = vertex[1]; + else if (vertex[1] > m_aabb[4]) + m_aabb[4] = vertex[1]; + if (vertex[2] < m_aabb[2]) + m_aabb[2] = vertex[2]; + else if (vertex[2] > m_aabb[5]) + m_aabb[5] = vertex[2]; + } + else + { + m_aabb[0] = m_aabb[3] = vertex[0]; + m_aabb[1] = m_aabb[4] = vertex[1]; + m_aabb[2] = m_aabb[5] = vertex[2]; + m_loadedVertex = true; + } +} + +WFObj::Vertex WFObj::readVertex(const vector & parts) +{ + int partslen = parts.size(); + Vertex v; + for (int i = 1; i < partslen && i <= 4; i++) + { + sscanf(parts[i].c_str(), "%f", &v[i - 1]); + } + return v; +} + +void WFObj::parseVertexIndices(const string & vtxref, int * ret) +{ + vector parts = splitString(vtxref, '/'); + int num = parts.size(); + for (int i = 0; i < num && i < 3; i++) + sscanf(parts[i].c_str(), "%d", ret + i); +} + + + + +/****** WFMtl functions ******/ + +void WFObj::WFMtl::clear() +{ + m_data = map< string, vector< vector > >(); + m_currentMaterialName = ""; + m_attributesPushed = false; +} + +bool WFObj::WFMtl::load(const FileLoader::Path & path) +{ + clear(); + + FileLoader::Buffer buff = m_obj->m_fileLoader->load(path); + if (buff.size <= 0) + return false; + + m_path = path; + string str(buff.data, buff.size); + stringstream istr(str, ios_base::in); + load(istr, buff.size); + + return true; +} + +bool WFObj::WFMtl::load(std::istream & istr, unsigned int size) +{ + char buf[size+1]; + + string buildup; + while (istr.good()) + { + istr.getline(buf, size+1); + string input = trimString(buf); + int sz = input.size(); + if (sz == 0 || input[0] == '#') + continue; + if (input[sz-1] == '\\') + { + input[sz-1] = ' '; + buildup = input; + continue; + } + if (buildup != "") + input = buildup + input; + buildup = ""; + processInputLine(input); + } + return true; +} + +void WFObj::WFMtl::processInputLine(const std::string & input) +{ + string line = input; + vector lineParts; + for (;;) + { + string token = stripFirstToken(line); + if (token == "") + break; + lineParts.push_back(token); + } + if (lineParts.size() > 0) + { + if ( (lineParts.size() >= 2) && (lineParts[0] == "newmtl") ) + { + m_currentMaterialName = lineParts[1]; + } + else if (m_currentMaterialName != "") + { + m_data[m_currentMaterialName].push_back(lineParts); + } + } +} + +void WFObj::WFMtl::renderBegin(const string & mtlname, bool doTextureInfo, + bool enableBlending) +{ + map< string, vector< vector > >::iterator it = m_data.find(mtlname); + if (it == m_data.end()) + return; + vector< vector > & stmts = it->second; + int num_stmts = stmts.size(); + bool foundTexture = false; + bool didSomething = false; + checkGLError(); + for (int i = 0; i < num_stmts; i++) + { + string & type = stmts[i][0]; + if (type == "Ka") /* set ambient color */ + { + if ( (stmts[i].size() == 4) && (stmts[i][1] != "spectral") ) + { + pushAttributes(); + float mat[4] = {0.0f, 0.0f, 0.0f, 1.0f}; + for (int j = 0; j < 3; j++) + sscanf(stmts[i][j+1].c_str(), "%f", &mat[j]); +#ifdef DEBUGGL + cout << " glMaterialfv(GL_FRONT, GL_AMBIENT, {"; + for (int j = 0; j < 4; j++) + cout << mat[j] << (j < 3 ? ", " : "})"); + cout << endl; +#endif + glMaterialfv(GL_FRONT, GL_AMBIENT, mat); + didSomething = true; + } + } + else if (type == "Kd") /* set diffuse color */ + { + if ( (stmts[i].size() == 4) && (stmts[i][1] != "spectral") ) + { + pushAttributes(); + float mat[4] = {0.0f, 0.0f, 0.0f, 1.0f}; + for (int j = 0; j < 3; j++) + sscanf(stmts[i][j+1].c_str(), "%f", &mat[j]); +#ifdef DEBUGGL + cout << " glMaterialfv(GL_FRONT, GL_DIFFUSE, {"; + for (int j = 0; j < 4; j++) + cout << mat[j] << (j < 3 ? ", " : "})"); + cout << endl; +#endif + glMaterialfv(GL_FRONT, GL_DIFFUSE, mat); + didSomething = true; + } + } + else if (type == "Ks") /* set specular color */ + { + if ( (stmts[i].size() == 4) && (stmts[i][1] != "spectral") ) + { + pushAttributes(); + float mat[4] = {0.0f, 0.0f, 0.0f, 1.0f}; + for (int j = 0; j < 3; j++) + sscanf(stmts[i][j+1].c_str(), "%f", &mat[j]); +#ifdef DEBUGGL + cout << " glMaterialfv(GL_FRONT, GL_SPECULAR, {"; + for (int j = 0; j < 4; j++) + cout << mat[j] << (j < 3 ? ", " : "})"); + cout << endl; +#endif + glMaterialfv(GL_FRONT, GL_SPECULAR, mat); + didSomething = true; + } + } + else if (type == "Ns") /* set shininess */ + { + if (stmts[i].size() == 2) + { + pushAttributes(); + GLfloat shininess = 0.0f; + sscanf(stmts[i][1].c_str(), "%f", &shininess); +#ifdef DEBUGGL + cout << " glMaterialf(GL_FRONT, GL_SHININESS, " + << shininess << ")" << endl; +#endif + glMaterialf(GL_FRONT, GL_SHININESS, shininess); + didSomething = true; + } + } + else if (type == "map_Kd") /* load a diffuse texture */ + { + if (doTextureInfo) + { + if (stmts[i].size() == 2) + { + if (m_obj->m_textureLoader != NULL) + { + FileLoader::Path path( + basePath(m_path.fullPath + stmts[i][1]), + stmts[i][1]); + GLuint tex = m_obj->m_textureLoader->load(path, + *m_obj->m_fileLoader); + if (tex > 0) + { + pushAttributes(); /* jh 2009-11-16 */ +#ifdef DEBUGGL + cout << " glBindTexture(GL_TEXTURE_2D, " << tex << ")" << endl; +#endif + glBindTexture(GL_TEXTURE_2D, tex); + foundTexture = true; + didSomething = true; + } + } + } + } + } + } + + checkGLError(); + if (didSomething) + { + pushAttributes(); + if (doTextureInfo) + { + if (enableBlending) + { + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); + } + if (foundTexture) + { +#ifdef DEBUGGL + cout << " glEnable(GL_TEXTURE_2D)" << endl; +#endif + glEnable(GL_TEXTURE_2D); + } + else + { +#ifdef DEBUGGL + cout << " glDisable(GL_TEXTURE_2D)" << endl; +#endif + glDisable(GL_TEXTURE_2D); + } + } + } + checkGLError(); +} + +void WFObj::WFMtl::pushAttributes() +{ + if (m_attributesPushed) + return; + m_attributesPushed = true; +#ifdef DEBUGGL + cout << " glPushAttrib(GL_LIGHTING_BIT | GL_TEXTURE_BIT | GL_ENABLE_BIT | GL_COLOR_BUFFER_BIT)" + << endl; +#endif + checkGLError(); + glPushAttrib(GL_LIGHTING_BIT | GL_TEXTURE_BIT | GL_ENABLE_BIT | GL_COLOR_BUFFER_BIT); + checkGLError(); +} + +void WFObj::WFMtl::renderEnd(const string & mtlname, bool doTextureInfo, + bool enableBlending) +{ + map< string, vector< vector > >::iterator it = m_data.find(mtlname); + if (it == m_data.end()) + return; + if (m_attributesPushed) + { +#ifdef DEBUGGL + cout << " glPopAttrib()" << endl; +#endif + checkGLError(); + glPopAttrib(); + checkGLError(); + m_attributesPushed = false; + } +} + + +/****** WFFileLoader functions ******/ + +int WFObj::WFFileLoader::getSize(const Path & path) +{ + struct stat st; + + if (path.fullPath == "") + return -1; + if (stat(path.fullPath.c_str(), &st)) + return -2; + return st.st_size; +} + +FileLoader::Buffer WFObj::WFFileLoader::load(const Path & path) +{ + int size = getSize(path); + if (size > 0) + { + int fd = open(path.fullPath.c_str(), O_RDONLY); + if (fd > 0) + { + Buffer buf(size); + int num_read = read(fd, buf.data, size); + close(fd); + if (num_read > 0) + return buf; + } + } + return Buffer(0); +} diff --git a/WFObj.h b/WFObj.h new file mode 100644 index 0000000..fd7a5a1 --- /dev/null +++ b/WFObj.h @@ -0,0 +1,92 @@ + +#ifndef WFOBJ_H +#define WFOBJ_H + +#include "FileLoader.h" +#include "TextureLoader.h" +#include +#include +#include +#include + +class WFObj +{ +public: + WFObj(); + WFObj(FileLoader & fileLoader); + WFObj(TextureLoader & textureLoader); + WFObj(FileLoader & fileLoader, TextureLoader & textureLoader); + ~WFObj(); + + class WFMtl + { + public: + WFMtl(WFObj * obj) { m_obj = obj; } + bool load(const FileLoader::Path & path); + void renderBegin(const std::string & mtlname, + bool doTextureInfo = true, + bool enableBlending = false); + void renderEnd(const std::string & mtlname, + bool doTextureInfo = true, + bool enableBlending = false); + + protected: + /* methods */ + void clear(); + void processInputLine(const std::string & input); + void pushAttributes(); + bool load(std::istream & istr, unsigned int size); + + /* variables */ + std::map< std::string, std::vector< std::vector > > m_data; + std::string m_currentMaterialName; + bool m_attributesPushed; + FileLoader::Path m_path; + WFObj * m_obj; + }; + + class WFFileLoader : public FileLoader + { + public: + virtual int getSize(const Path & path); + virtual Buffer load(const Path & path); + }; + + bool load(const FileLoader::Path & path); + GLuint render(bool doTextureInfo = true, + bool enableBlending = false); + const float * const getAABB() { return m_aabb; } + +protected: + /* types */ + class Vertex + { + public: + float operator[](int idx) const { return data[idx]; } + float & operator[](int idx) { return data[idx]; } + float * getData() { return data; } + private: + float data[4]; + }; + + /* methods */ + void init(FileLoader * fileLoader = NULL, + TextureLoader * textureLoader = NULL); + void clear(); + void processInputLine(const std::string & input); + Vertex readVertex(const std::vector & parts); + void parseVertexIndices(const std::string & vtxref, int * ret); + void updateAABB(const float * const vertex); + bool load(std::istream & istr, unsigned int size); + + /* variables */ + std::vector< std::vector > m_data; + FileLoader::Path m_path; + float m_aabb[6]; + bool m_loadedVertex; + FileLoader * m_fileLoader; + TextureLoader * m_textureLoader; + bool m_iCreatedFileLoader; +}; + +#endif diff --git a/genLoadFile.pl b/genLoadFile.pl new file mode 100755 index 0000000..f5880f4 --- /dev/null +++ b/genLoadFile.pl @@ -0,0 +1,60 @@ +#!/usr/bin/perl + +use strict; +use warnings; +use Getopt::Long; + +my $root = '.'; +GetOptions('root=s' => \$root); +$root = "$root/" if ($root ne ''); + +my @fileList = @ARGV; +if ($#fileList < 0) +{ + print "$0 \n"; + exit(42); +} + +my %fileData; +my $index = 0; + +open(OUTPUT, '>', 'LoadFile-gen.inc'); +foreach my $fileName (@fileList) +{ + local $/; + open(FILE, '<', $fileName); + my $fileContents = ; + close(FILE); + my $length = length($fileContents); + my @fileContents = split(//, $fileContents); + my $cname = "dat$index"; + print OUTPUT "\nstatic unsigned char ${cname} [] = {\n"; + for (my $byteNum = 0; $byteNum <= $#fileContents; $byteNum++) + { + print OUTPUT " " if ($byteNum % 12 == 0); + printf OUTPUT ("0x%02x", ord($fileContents[$byteNum])); + print OUTPUT ", " unless ($byteNum == $#fileContents); + print OUTPUT "\n" if ($byteNum % 12 == 11); + } + print OUTPUT "\n};\n"; + $index++; + my $shortName = $fileName; + $shortName =~ s/^$root//; + $fileData{$shortName} = [$cname, $length]; +} + +print OUTPUT "\nfileref_t LoadFileData[] = {\n"; + +my @fileNames = keys(%fileData); +for (my $fileIndex = 0; $fileIndex <= $#fileNames; $fileIndex++) +{ + my $fileName = $fileNames[$fileIndex]; + printf OUTPUT (' {"%s", %s, %s}', + $fileName, + $fileData{$fileName}->[0], + $fileData{$fileName}->[1]); + print OUTPUT "," unless ($fileIndex == $#fileNames); + print OUTPUT "\n"; +} +print OUTPUT "};\n"; +close(OUTPUT); diff --git a/logo/dwlogo.blend b/logo/dwlogo.blend new file mode 100644 index 0000000..b01601b Binary files /dev/null and b/logo/dwlogo.blend differ diff --git a/logo/dwlogo.mtl b/logo/dwlogo.mtl new file mode 100644 index 0000000..06fff4a --- /dev/null +++ b/logo/dwlogo.mtl @@ -0,0 +1,22 @@ +# Blender3D MTL File: dwlogo.blend +# Material Count: 2 +newmtl Material.002 +Ns 96.078431 +Ka 0.396 0.392 0.078 +Kd 0.396 0.392 0.078 +Ks 0.2 0.2 0.2 +Ni 1.000000 +d 1.000000 +illum 2 + + +newmtl Material.001 +Ns 96.078431 +Ka 0.000000 0.326 0.341 +Kd 0.000000 0.326 0.341 +Ks 0.2 0.2 0.2 +Ni 1.000000 +d 1.000000 +illum 2 + + diff --git a/logo/dwlogo.obj b/logo/dwlogo.obj new file mode 100644 index 0000000..9f0a1bf --- /dev/null +++ b/logo/dwlogo.obj @@ -0,0 +1,645 @@ +# Blender3D v245 OBJ File: dwlogo.blend +# www.blender3d.org +mtllib dwlogo.mtl +v -1.967500 3.292557 0.000000 +v -1.539864 2.771481 0.000000 +v -1.222102 2.176990 0.000000 +v -1.026424 1.531928 0.000000 +v -0.969990 1.037352 0.000000 +v -0.578603 1.035548 0.000000 +v 0.007450 -0.426248 0.000000 +v 1.376684 3.048505 0.000000 +v 2.744326 -0.341223 0.000000 +v 3.879164 2.783177 0.000000 +v 4.794436 2.784227 0.000000 +v 4.794755 3.733678 0.000000 +v -2.503128 3.729895 0.000000 +v -2.503128 3.729895 0.500000 +v 4.794755 3.733678 0.500000 +v 4.794436 2.784227 0.500000 +v 3.879164 2.783177 0.500000 +v 2.744326 -0.341223 0.500000 +v 1.376684 3.048505 0.500000 +v 0.007450 -0.426248 0.500000 +v -0.578603 1.035548 0.500000 +v -0.969990 1.037352 0.500000 +v -1.026424 1.531928 0.500000 +v -1.222102 2.176990 0.500000 +v -1.539864 2.771481 0.500000 +v -1.967500 3.292557 0.500000 +vn 0.000000 0.000000 -1.000000 +vn -0.928184 -0.372121 0.000000 +vn -0.000518 1.000000 0.000000 +vn 1.000000 -0.000336 0.000000 +vn 0.001147 -0.999999 0.000000 +vn 0.939920 -0.341396 0.000000 +vn -0.927364 -0.374160 0.000000 +vn 0.930373 -0.366615 0.000000 +vn -0.004611 -0.999989 0.000000 +vn 0.000000 0.000000 1.000000 +g Cube.005_Cube.006_Material.002 +usemtl Material.002 +s off +f 11//1 13//1 12//1 +f 8//1 1//1 13//1 +f 11//1 8//1 13//1 +f 2//1 1//1 8//1 +f 3//1 2//1 8//1 +f 6//1 3//1 8//1 +f 7//1 6//1 8//1 +f 10//1 9//1 8//1 +f 11//1 10//1 8//1 +f 6//1 4//1 3//1 +f 6//1 5//1 4//1 +f 7//2 20//2 21//2 6//2 +f 13//3 14//3 15//3 12//3 +f 12//4 15//4 16//4 11//4 +f 11//5 16//5 17//5 10//5 +f 10//6 17//6 18//6 9//6 +f 9//7 18//7 19//7 8//7 +f 8//8 19//8 20//8 7//8 +f 6//9 21//9 22//9 5//9 +f 14//10 16//10 15//10 +f 26//10 19//10 14//10 +f 19//10 16//10 14//10 +f 25//10 19//10 26//10 +f 25//10 24//10 19//10 +f 24//10 21//10 19//10 +f 21//10 20//10 19//10 +f 18//10 17//10 19//10 +f 17//10 16//10 19//10 +f 23//10 21//10 24//10 +f 22//10 21//10 23//10 +v 2.768149 -1.634091 0.000000 +v 1.384947 1.793045 0.000000 +v 0.012920 -1.618155 0.000000 +v -0.883670 0.580436 0.000000 +v -0.972935 0.581641 0.000000 +v -1.028585 0.087289 0.000000 +v -1.218865 -0.539980 0.000000 +v -1.527863 -1.118075 0.000000 +v -1.943704 -1.624779 0.000000 +v -2.450409 -2.040621 0.000000 +v -2.782750 -2.236504 0.000000 +v 4.806163 -2.230783 0.000000 +v 4.807395 2.336444 0.000000 +v 4.206083 2.335061 0.000000 +v 4.206083 2.335061 0.500000 +v 4.807395 2.336444 0.500000 +v 4.806163 -2.230783 0.500000 +v -2.782750 -2.236504 0.500000 +v -2.450409 -2.040621 0.500000 +v -1.943704 -1.624779 0.500000 +v -1.527863 -1.118075 0.500000 +v -1.218865 -0.539980 0.500000 +v -1.028585 0.087289 0.500000 +v -0.972935 0.581641 0.500000 +v -0.883670 0.580436 0.500000 +v 0.012920 -1.618155 0.500000 +v 1.384947 1.793045 0.500000 +v 2.768149 -1.634091 0.500000 +vn 0.000754 -1.000000 0.000000 +vn -0.940203 0.340614 0.000000 +vn -0.002300 0.999997 0.000000 +vn 1.000000 -0.000270 0.000000 +vn 0.013502 0.999909 0.000000 +vn 0.925965 0.377610 0.000000 +vn -0.927767 0.373159 0.000000 +vn 0.927320 0.374269 0.000000 +g Cube.004_Cube.005_Material.001 +usemtl Material.001 +s off +f 38//1 40//1 39//1 +f 38//1 27//1 40//1 +f 27//1 29//1 28//1 +f 30//1 32//1 31//1 +f 29//1 32//1 30//1 +f 29//1 33//1 32//1 +f 29//1 34//1 33//1 +f 29//1 35//1 34//1 +f 27//1 35//1 29//1 +f 27//1 36//1 35//1 +f 36//1 27//1 38//1 +f 38//1 37//1 36//1 +f 38//11 43//11 44//11 37//11 +f 27//12 54//12 41//12 40//12 +f 40//13 41//13 42//13 39//13 +f 39//14 42//14 43//14 38//14 +f 31//15 50//15 51//15 30//15 +f 30//16 51//16 52//16 29//16 +f 29//17 52//17 53//17 28//17 +f 54//18 27//18 28//18 53//18 +f 41//10 43//10 42//10 +f 54//10 43//10 41//10 +f 52//10 54//10 53//10 +f 49//10 51//10 50//10 +f 49//10 52//10 51//10 +f 48//10 52//10 49//10 +f 47//10 52//10 48//10 +f 46//10 52//10 47//10 +f 46//10 54//10 52//10 +f 45//10 54//10 46//10 +f 45//10 43//10 54//10 +f 44//10 43//10 45//10 +v -3.414269 0.996186 0.000000 +v -3.360440 0.922096 0.000000 +v -3.332140 0.834999 0.000000 +v -3.332140 0.743420 0.000000 +v -3.360440 0.656322 0.000000 +v -3.414269 0.582233 0.000000 +v -3.488358 0.528404 0.000000 +v -3.575455 0.500104 0.000000 +v -3.667035 0.500104 0.000000 +v -3.754132 0.528404 0.000000 +v -3.828222 0.582233 0.000000 +v -3.882050 0.656322 0.000000 +v -3.910350 0.743420 0.000000 +v -3.910350 0.834999 0.000000 +v -3.882050 0.922097 0.000000 +v -3.828221 0.996186 0.000000 +v -3.754131 1.050015 0.000000 +v -3.667034 1.078314 0.000000 +v -3.575454 1.078314 0.000000 +v -3.488358 1.050014 0.000000 +v -3.488358 1.050014 0.500000 +v -3.575454 1.078314 0.500000 +v -3.667034 1.078314 0.500000 +v -3.754131 1.050015 0.500000 +v -3.828221 0.996186 0.500000 +v -3.882050 0.922097 0.500000 +v -3.910350 0.834999 0.500000 +v -3.910350 0.743420 0.500000 +v -3.882050 0.656322 0.500000 +v -3.828222 0.582233 0.500000 +v -3.754132 0.528404 0.500000 +v -3.667035 0.500104 0.500000 +v -3.575455 0.500104 0.500000 +v -3.488358 0.528404 0.500000 +v -3.414269 0.582233 0.500000 +v -3.360440 0.656322 0.500000 +v -3.332140 0.743420 0.500000 +v -3.332140 0.834999 0.500000 +v -3.360440 0.922096 0.500000 +v -3.414269 0.996186 0.500000 +g Cube.003_Cube.004_Material.002 +usemtl Material.002 +s off +f 73//1 71//1 72//1 +f 74//1 71//1 73//1 +f 74//1 70//1 71//1 +f 55//1 70//1 74//1 +f 55//1 69//1 70//1 +f 69//1 55//1 56//1 +f 56//1 68//1 69//1 +f 57//1 68//1 56//1 +f 57//1 67//1 68//1 +f 58//1 67//1 57//1 +f 58//1 66//1 67//1 +f 59//1 66//1 58//1 +f 59//1 65//1 66//1 +f 60//1 65//1 59//1 +f 60//1 64//1 65//1 +f 61//1 64//1 60//1 +f 61//1 63//1 64//1 +f 62//1 63//1 61//1 +f 78//10 76//10 77//10 +f 78//10 75//10 76//10 +f 79//10 75//10 78//10 +f 79//10 94//10 75//10 +f 80//10 94//10 79//10 +f 80//10 93//10 94//10 +f 81//10 93//10 80//10 +f 81//10 92//10 93//10 +f 82//10 92//10 81//10 +f 82//10 91//10 92//10 +f 83//10 91//10 82//10 +f 83//10 90//10 91//10 +f 84//10 90//10 83//10 +f 84//10 89//10 90//10 +f 85//10 89//10 84//10 +f 85//10 88//10 89//10 +f 86//10 88//10 85//10 +f 86//10 87//10 88//10 +v -2.327900 2.981822 0.000000 +v -1.946631 2.517246 0.000000 +v -1.663324 1.987213 0.000000 +v -1.488863 1.412095 0.000000 +v -1.441604 0.586849 0.000000 +v -1.488863 0.215889 0.000000 +v -1.663323 -0.359229 0.000000 +v -1.946631 -0.889262 0.000000 +v -2.327900 -1.353839 0.000000 +v -2.792477 -1.735108 0.000000 +v -3.322510 -2.018416 0.000000 +v -3.897629 -2.192876 0.000000 +v -4.747342 -2.200104 0.000000 +v -4.747336 3.727444 0.000000 +v -3.550383 3.725241 0.000000 +v -3.322504 3.646397 0.000000 +v -2.792472 3.363088 0.000000 +v -3.110140 1.315794 0.000000 +v -2.962800 1.105371 0.000000 +v -2.943537 1.031374 0.000000 +v -2.924606 0.589536 0.000000 +v -3.027266 0.368530 0.000000 +v -3.208907 0.186889 0.000000 +v -3.441719 0.078327 0.000000 +v -3.697621 0.055938 0.000000 +v -3.945747 0.122423 0.000000 +v -4.156171 0.269763 0.000000 +v -4.303511 0.480187 0.000000 +v -4.369996 0.728313 0.000000 +v -4.347608 0.984215 0.000000 +v -4.239046 1.217027 0.000000 +v -4.057405 1.398669 0.000000 +v -3.824593 1.507231 0.000000 +v -3.568691 1.529619 0.000000 +v -3.320565 1.463135 0.000000 +v -1.442270 1.039348 0.000000 +v -1.442270 1.039348 0.500000 +v -3.320565 1.463135 0.500000 +v -3.568691 1.529619 0.500000 +v -3.824593 1.507231 0.500000 +v -4.057405 1.398669 0.500000 +v -4.239046 1.217027 0.500000 +v -4.347608 0.984215 0.500000 +v -4.369996 0.728313 0.500000 +v -4.303511 0.480187 0.500000 +v -4.156171 0.269763 0.500000 +v -3.945747 0.122423 0.500000 +v -3.697621 0.055938 0.500000 +v -3.441719 0.078327 0.500000 +v -3.208907 0.186889 0.500000 +v -3.027266 0.368530 0.500000 +v -2.924606 0.589536 0.500000 +v -2.943537 1.031374 0.500000 +v -2.962800 1.105371 0.500000 +v -3.110140 1.315794 0.500000 +v -2.792472 3.363088 0.500000 +v -3.322504 3.646397 0.500000 +v -3.550383 3.725241 0.500000 +v -4.747336 3.727444 0.500000 +v -4.747342 -2.200104 0.500000 +v -3.897629 -2.192876 0.500000 +v -3.322510 -2.018416 0.500000 +v -2.792477 -1.735108 0.500000 +v -2.327900 -1.353839 0.500000 +v -1.946631 -0.889262 0.500000 +v -1.663323 -0.359229 0.500000 +v -1.488863 0.215889 0.500000 +v -1.441604 0.586849 0.500000 +v -1.488863 1.412095 0.500000 +v -1.663324 1.987213 0.500000 +v -1.946631 2.517246 0.500000 +v -2.327900 2.981822 0.500000 +vn 0.001812 0.999998 0.000000 +vn 0.005311 -0.999986 0.000000 +vn -1.000000 0.000001 0.000000 +vn 0.001840 0.999998 0.000000 +vn 0.008506 -0.999964 0.000000 +g Cylinder.001_Cylinder.001_Material.001 +usemtl Material.001 +s off +f 124//1 107//1 108//1 +f 125//1 124//1 108//1 +f 126//1 125//1 108//1 +f 109//1 126//1 108//1 +f 110//1 126//1 109//1 +f 111//1 126//1 110//1 +f 95//1 126//1 111//1 +f 126//1 95//1 96//1 +f 127//1 126//1 96//1 +f 128//1 127//1 96//1 +f 97//1 128//1 96//1 +f 98//1 128//1 97//1 +f 98//1 129//1 128//1 +f 98//1 112//1 129//1 +f 130//1 112//1 98//1 +f 130//1 113//1 112//1 +f 130//1 114//1 113//1 +f 123//1 107//1 124//1 +f 122//1 107//1 123//1 +f 99//1 116//1 115//1 +f 100//1 116//1 99//1 +f 121//1 107//1 122//1 +f 100//1 117//1 116//1 +f 120//1 107//1 121//1 +f 101//1 117//1 100//1 +f 101//1 118//1 117//1 +f 119//1 107//1 120//1 +f 101//1 119//1 118//1 +f 101//1 107//1 119//1 +f 102//1 107//1 101//1 +f 103//1 107//1 102//1 +f 104//1 107//1 103//1 +f 105//1 107//1 104//1 +f 106//1 107//1 105//1 +f 115//19 146//19 162//19 99//19 +f 130//20 131//20 147//20 114//20 +f 107//21 154//21 153//21 108//21 +f 108//22 153//22 152//22 109//22 +f 106//23 155//23 154//23 107//23 +f 154//10 137//10 153//10 +f 137//10 136//10 153//10 +f 136//10 135//10 153//10 +f 135//10 152//10 153//10 +f 135//10 151//10 152//10 +f 135//10 150//10 151//10 +f 135//10 166//10 150//10 +f 135//10 165//10 166//10 +f 135//10 134//10 165//10 +f 134//10 133//10 165//10 +f 133//10 164//10 165//10 +f 133//10 163//10 164//10 +f 132//10 163//10 133//10 +f 149//10 163//10 132//10 +f 149//10 131//10 163//10 +f 148//10 131//10 149//10 +f 147//10 131//10 148//10 +f 154//10 138//10 137//10 +f 154//10 139//10 138//10 +f 145//10 162//10 146//10 +f 145//10 161//10 162//10 +f 154//10 140//10 139//10 +f 144//10 161//10 145//10 +f 154//10 141//10 140//10 +f 144//10 160//10 161//10 +f 143//10 160//10 144//10 +f 154//10 142//10 141//10 +f 142//10 160//10 143//10 +f 154//10 160//10 142//10 +f 154//10 159//10 160//10 +f 154//10 158//10 159//10 +f 154//10 157//10 158//10 +f 154//10 156//10 157//10 +f 154//10 155//10 156//10 +v -1.967500 3.292557 0.000000 +v -1.539864 2.771481 0.000000 +v -1.222102 2.176990 0.000000 +v -1.026424 1.531928 0.000000 +v -0.969990 1.037352 0.000000 +v -2.503128 3.729895 0.000000 +v -2.503128 3.729895 0.500000 +v -0.969990 1.037352 0.500000 +v -1.026424 1.531928 0.500000 +v -1.222102 2.176990 0.500000 +v -1.539864 2.771481 0.500000 +v -1.967500 3.292557 0.500000 +vn -0.706198 -0.707968 0.000000 +vn -0.632435 -0.774590 0.000000 +vn -0.993530 -0.113346 0.000000 +vn -0.979247 -0.202643 0.000000 +vn -0.923856 -0.382672 0.000000 +vn -0.831446 -0.555559 0.000000 +g Cube.002_Cube.003_Material.002 +usemtl Material.002 +s 1 +f 167//24 178//24 173//25 172//25 +f 171//26 174//26 175//27 170//27 +f 170//27 175//27 176//28 169//28 +f 169//28 176//28 177//29 168//29 +f 178//24 167//24 168//29 177//29 +v -3.414269 0.996186 0.000000 +v -3.360440 0.922096 0.000000 +v -3.332140 0.834999 0.000000 +v -3.332140 0.743420 0.000000 +v -3.360440 0.656322 0.000000 +v -3.414269 0.582233 0.000000 +v -3.488358 0.528404 0.000000 +v -3.575455 0.500104 0.000000 +v -3.667035 0.500104 0.000000 +v -3.754132 0.528404 0.000000 +v -3.828222 0.582233 0.000000 +v -3.882050 0.656322 0.000000 +v -3.910350 0.743420 0.000000 +v -3.910350 0.834999 0.000000 +v -3.882050 0.922097 0.000000 +v -3.828221 0.996186 0.000000 +v -3.754131 1.050015 0.000000 +v -3.667034 1.078314 0.000000 +v -3.575454 1.078314 0.000000 +v -3.488358 1.050014 0.000000 +v -3.488358 1.050014 0.500000 +v -3.575454 1.078314 0.500000 +v -3.667034 1.078314 0.500000 +v -3.754131 1.050015 0.500000 +v -3.828221 0.996186 0.500000 +v -3.882050 0.922097 0.500000 +v -3.910350 0.834999 0.500000 +v -3.910350 0.743420 0.500000 +v -3.882050 0.656322 0.500000 +v -3.828222 0.582233 0.500000 +v -3.754132 0.528404 0.500000 +v -3.667035 0.500104 0.500000 +v -3.575455 0.500104 0.500000 +v -3.488358 0.528404 0.500000 +v -3.414269 0.582233 0.500000 +v -3.360440 0.656322 0.500000 +v -3.332140 0.743420 0.500000 +v -3.332140 0.834999 0.500000 +v -3.360440 0.922096 0.500000 +v -3.414269 0.996186 0.500000 +vn 0.707083 0.707083 0.000000 +vn 0.453963 0.890988 0.000000 +vn 0.156407 0.987671 0.000000 +vn -0.156407 0.987671 0.000000 +vn -0.453963 0.890988 0.000000 +vn -0.707083 0.707083 0.000000 +vn -0.890988 0.453993 0.000000 +vn -0.987671 0.156407 0.000000 +vn -0.987671 -0.156407 0.000000 +vn -0.890988 -0.453963 0.000000 +vn -0.707083 -0.707083 0.000000 +vn -0.453963 -0.890988 0.000000 +vn -0.156407 -0.987671 0.000000 +vn 0.156407 -0.987671 0.000000 +vn 0.453963 -0.890988 0.000000 +vn 0.707083 -0.707083 0.000000 +vn 0.890988 -0.453963 0.000000 +vn 0.987671 -0.156407 0.000000 +vn 0.987671 0.156407 0.000000 +vn 0.890988 0.453963 0.000000 +g Cube.001_Cube.002_Material.002 +usemtl Material.002 +s 1 +f 218//30 179//30 198//31 199//31 +f 197//32 200//32 199//31 198//31 +f 196//33 201//33 200//32 197//32 +f 195//34 202//34 201//33 196//33 +f 194//35 203//35 202//34 195//34 +f 193//36 204//36 203//35 194//35 +f 192//37 205//37 204//36 193//36 +f 191//38 206//38 205//37 192//37 +f 190//39 207//39 206//38 191//38 +f 189//40 208//40 207//39 190//39 +f 188//41 209//41 208//40 189//40 +f 187//42 210//42 209//41 188//41 +f 186//43 211//43 210//42 187//42 +f 185//44 212//44 211//43 186//43 +f 184//45 213//45 212//44 185//44 +f 183//46 214//46 213//45 184//45 +f 182//47 215//47 214//46 183//46 +f 181//48 216//48 215//47 182//47 +f 180//49 217//49 216//48 181//48 +f 179//30 218//30 217//49 180//49 +v -0.972935 0.581641 0.000000 +v -1.028585 0.087289 0.000000 +v -1.218865 -0.539980 0.000000 +v -1.527863 -1.118075 0.000000 +v -1.943704 -1.624779 0.000000 +v -2.450409 -2.040621 0.000000 +v -2.782750 -2.236504 0.000000 +v -2.782750 -2.236504 0.500000 +v -2.450409 -2.040621 0.500000 +v -1.943704 -1.624779 0.500000 +v -1.527863 -1.118075 0.500000 +v -1.218865 -0.539980 0.500000 +v -1.028585 0.087289 0.500000 +v -0.972935 0.581641 0.500000 +vn -0.507767 0.861476 0.000000 +vn -0.572771 0.819697 0.000000 +vn -0.831446 0.555559 0.000000 +vn -0.923856 0.382672 0.000000 +vn -0.979400 0.201910 0.000000 +vn -0.993713 0.111850 0.000000 +g Cube_Cube.001_Material.001 +usemtl Material.001 +s 1 +f 225//50 226//50 227//51 224//51 +f 224//51 227//51 228//35 223//35 +f 223//35 228//35 229//52 222//52 +f 222//52 229//52 230//53 221//53 +f 221//53 230//53 231//54 220//54 +f 232//55 219//55 220//54 231//54 +v -2.327900 2.981822 0.000000 +v -1.946631 2.517246 0.000000 +v -1.663324 1.987213 0.000000 +v -1.488863 1.412095 0.000000 +v -1.441604 0.586849 0.000000 +v -1.488863 0.215889 0.000000 +v -1.663323 -0.359229 0.000000 +v -1.946631 -0.889262 0.000000 +v -2.327900 -1.353839 0.000000 +v -2.792477 -1.735108 0.000000 +v -3.322510 -2.018416 0.000000 +v -3.897629 -2.192876 0.000000 +v -3.550383 3.725241 0.000000 +v -3.322504 3.646397 0.000000 +v -2.792472 3.363088 0.000000 +v -3.110140 1.315794 0.000000 +v -2.962800 1.105371 0.000000 +v -2.943537 1.031374 0.000000 +v -2.924606 0.589536 0.000000 +v -3.027266 0.368530 0.000000 +v -3.208907 0.186889 0.000000 +v -3.441719 0.078327 0.000000 +v -3.697621 0.055938 0.000000 +v -3.945747 0.122423 0.000000 +v -4.156171 0.269763 0.000000 +v -4.303511 0.480187 0.000000 +v -4.369996 0.728313 0.000000 +v -4.347608 0.984215 0.000000 +v -4.239046 1.217027 0.000000 +v -4.057405 1.398669 0.000000 +v -3.824593 1.507231 0.000000 +v -3.568691 1.529619 0.000000 +v -3.320565 1.463135 0.000000 +v -1.442270 1.039348 0.000000 +v -1.442270 1.039348 0.500000 +v -3.320565 1.463135 0.500000 +v -3.568691 1.529619 0.500000 +v -3.824593 1.507231 0.500000 +v -4.057405 1.398669 0.500000 +v -4.239046 1.217027 0.500000 +v -4.347608 0.984215 0.500000 +v -4.369996 0.728313 0.500000 +v -4.303511 0.480187 0.500000 +v -4.156171 0.269763 0.500000 +v -3.945747 0.122423 0.500000 +v -3.697621 0.055938 0.500000 +v -3.441719 0.078327 0.500000 +v -3.208907 0.186889 0.500000 +v -3.027266 0.368530 0.500000 +v -2.924606 0.589536 0.500000 +v -2.943537 1.031374 0.500000 +v -2.962800 1.105371 0.500000 +v -3.110140 1.315794 0.500000 +v -2.792472 3.363088 0.500000 +v -3.322504 3.646397 0.500000 +v -3.550383 3.725241 0.500000 +v -3.897629 -2.192876 0.500000 +v -3.322510 -2.018416 0.500000 +v -2.792477 -1.735108 0.500000 +v -2.327900 -1.353839 0.500000 +v -1.946631 -0.889262 0.500000 +v -1.663323 -0.359229 0.500000 +v -1.488863 0.215889 0.500000 +v -1.441604 0.586849 0.500000 +v -1.488863 1.412095 0.500000 +v -1.663324 1.987213 0.500000 +v -1.946631 2.517246 0.500000 +v -2.327900 2.981822 0.500000 +vn 0.978118 0.207892 0.000000 +vn 0.992248 0.124027 0.000000 +vn -0.422590 -0.906308 0.000000 +vn -0.087130 -0.996185 0.000000 +vn 0.258797 -0.965911 0.000000 +vn 0.573565 -0.819147 0.000000 +vn 0.819147 -0.573565 0.000000 +vn 0.965911 -0.258797 0.000000 +vn 0.996185 0.087130 0.000000 +vn 0.906278 0.422590 0.000000 +vn 0.422590 0.906278 0.000000 +vn 0.087130 0.996185 0.000000 +vn -0.258797 0.965911 0.000000 +vn -0.573565 0.819147 0.000000 +vn -0.819575 0.572954 0.000000 +vn -0.906919 0.421277 0.000000 +vn -0.967742 -0.251930 0.000000 +vn -0.907804 -0.419385 0.000000 +vn 0.555559 0.831446 0.000000 +vn 0.400403 0.916318 0.000000 +vn 0.326945 0.945006 0.000000 +vn 0.382672 -0.923856 0.000000 +vn 0.290262 -0.956938 0.000000 +vn 0.555559 -0.831446 0.000000 +vn 0.831446 -0.555559 0.000000 +vn 0.923856 -0.382672 0.000000 +vn 0.977874 -0.209052 0.000000 +vn 0.991974 -0.126347 0.000000 +vn 0.923856 0.382672 0.000000 +vn 0.831446 0.555559 0.000000 +g Cylinder_Cylinder_Material.001 +usemtl Material.001 +s 1 +f 236//56 297//56 267//57 266//57 +f 248//40 285//40 268//58 265//58 +f 265//58 268//58 269//59 264//59 +f 264//59 269//59 270//60 263//60 +f 263//60 270//60 271//61 262//61 +f 262//61 271//61 272//62 261//62 +f 261//62 272//62 273//63 260//63 +f 260//63 273//63 274//64 259//64 +f 259//64 274//64 275//65 258//65 +f 258//65 275//65 276//30 257//30 +f 257//30 276//30 277//66 256//66 +f 256//66 277//66 278//67 255//67 +f 255//67 278//67 279//68 254//68 +f 254//68 279//68 280//69 253//69 +f 253//69 280//69 281//70 252//70 +f 252//70 281//70 282//71 251//71 +f 250//72 283//72 284//73 249//73 +f 249//73 284//73 285//40 248//40 +f 300//30 233//30 247//74 286//74 +f 246//75 287//75 286//74 247//74 +f 245//76 288//76 287//75 246//75 +f 243//77 290//77 289//78 244//78 +f 242//79 291//79 290//77 243//77 +f 241//45 292//45 291//79 242//79 +f 240//80 293//80 292//45 241//45 +f 239//81 294//81 293//80 240//80 +f 238//82 295//82 294//81 239//81 +f 237//83 296//83 295//82 238//82 +f 235//84 298//84 297//56 236//56 +f 234//85 299//85 298//84 235//84 +f 233//30 300//30 299//85 234//85