8 #include <glm\gtc\matrix_transform.hpp>
9 #include <glm\gtc\type_ptr.hpp>
14 #define MAX_NUM_LODS 8
15 #define MAX_NUM_BONES_PER_VERT 3
23 float weight[MAX_NUM_BONES_PER_VERT];
24 char bone[MAX_NUM_BONES_PER_VERT];
30 boneWeight m_boneweights;
31 glm::vec3 m_vecPosition;
32 glm::vec3 m_vecNormal;
33 glm::vec2 m_vecTexCoord;
42 int numLodVertexes[MAX_NUM_LODS];
52 class vvd_data : public util::verboseControl
58 std::vector<VVD::Vertex> verticesLOD0;
60 vvd_data(std::string filepath, bool verbose = false)
62 this->use_verbose = verbose;
65 std::ifstream reader(filepath, std::ios::in | std::ios::binary);
68 throw std::exception("VVD::OPEN FAILED"); return;
71 reader.read((char*)&this->header, sizeof(this->header));
72 this->debug("VVD Version:", this->header.version);
75 reader.seekg(header.vertexDataStart);
78 for (int i = 0; i < header.numLodVertexes[0]; i++)
81 reader.read((char*)&vert, sizeof(vert));
85 // forgot to copy this... spent 9 hours trying to learning studiomdl.
86 // note to self: dont dupe your code.
87 // Do the sorce->opengl flipperoo
88 glm::vec3 temp = vert.m_vecPosition;
89 vert.m_vecPosition = glm::vec3(-temp.x, temp.z, temp.y);
91 this->verticesLOD0.push_back(vert);
97 vvd_data(std::ifstream* stream, unsigned int offset, bool verbost = false) {
98 this->use_verbose = verbost;
100 stream->seekg(offset);
101 stream->read((char*)&this->header, sizeof(this->header));
102 this->debug("VVD Version:", this->header.version);
105 stream->seekg(offset + header.vertexDataStart);
108 for (int i = 0; i < header.numLodVertexes[0]; i++)
111 stream->read((char*)&vert, sizeof(vert));
113 // Do the sorce->opengl flipperoo
114 glm::vec3 temp = vert.m_vecPosition;
115 vert.m_vecPosition = glm::vec3(-temp.x, temp.z, temp.y);
117 this->verticesLOD0.push_back(vert);
120 this->debug("Data length: ", this->verticesLOD0.size());