draw all triangles instead of the first 12,

added todo section to the README.md,
clean up code
This commit is contained in:
Anakin
2016-10-23 16:01:06 +02:00
parent 6d5489a96c
commit 5cec0128cd
6 changed files with 38 additions and 16 deletions

View File

@@ -124,9 +124,6 @@ void Object::loadChunks(std::list<ChunkHeader*>& destination, std::streampos sta
}
} while (true);
std::cout << "got all chunks, totaly found: " << destination.size() << std::endl;
}
void Object::analyseMsh2Chunks(std::list<ChunkHeader*>& chunkList)
@@ -180,7 +177,6 @@ void Object::analyseMsh2Chunks(std::list<ChunkHeader*>& chunkList)
if (!strcmp("MODL", (*it)->name))
{
Modl* tempModl = new Modl;
setModlDefault(tempModl);
@@ -313,12 +309,10 @@ void Object::analyseModlChunks(Modl* dataDestination, std::list<ChunkHeader*>& c
continue;
}
}
}
void Object::analyseGeomChunks(Modl * dataDestination, std::list<ChunkHeader*>& chunkList)
{
for (std::list<ChunkHeader*>::iterator it = chunkList.begin(); it != chunkList.end(); it++)
{
if (!strcmp("SEGM", (*it)->name))
@@ -359,14 +353,13 @@ void Object::analyseGeomChunks(Modl * dataDestination, std::list<ChunkHeader*>&
continue;
}
}
}
void Object::analyseSegmChunks(Modl * dataDestination, std::list<ChunkHeader*>& chunkList)
{
for (std::list<ChunkHeader*>::iterator it = chunkList.begin(); it != chunkList.end(); it++)
{
if (!strcmp("SHDW", (*it)->name))
/*if (!strcmp("SHDW", (*it)->name))
{
fsMesh.seekg((*it)->position);
/* shadow mesh geometry
@@ -379,9 +372,9 @@ void Object::analyseSegmChunks(Modl * dataDestination, std::list<ChunkHeader*>&
> short int - 2 - Reference into an edge. Defines the target vertex (the local edge vertex of the referenced edge) to which the edge should be dran from the local vertex
> short int - 2 - Second reference into an edge. In all example .msh files I've seen this always refers to the same vertex as the first edge reference
> short int - 2 - MAX_VALUE of short integers (65535). Indicates the end of this edge
*/
* /
continue;
}
}*/
if (!strcmp("MATI", (*it)->name))
{
@@ -404,14 +397,14 @@ void Object::analyseSegmChunks(Modl * dataDestination, std::list<ChunkHeader*>&
continue;
}
if (!strcmp("NRML", (*it)->name))
/*if (!strcmp("NRML", (*it)->name))
{
fsMesh.seekg((*it)->position);
// List of normals
// long int - 4 - number of normal vectores stored in this list
// float[3][] - 12 each - UVW vector for each vertex
continue;
}
}*/
if (!strcmp("UV0L", (*it)->name))
{
@@ -494,7 +487,6 @@ void Object::analyseClthChunks(Modl * dataDestination, std::list<ChunkHeader*>&
continue;
}
}
}
void Object::readVertex(Modl* dataDestination, std::streampos position)
@@ -571,6 +563,16 @@ std::vector<GLfloat> Object::getUV() const
return tempData;
}
std::list<std::uint32_t> Object::getSize() const
{
std::list<std::uint32_t> tempData;
for (std::list<Modl*>::const_iterator it = lModls.begin(); it != lModls.end(); it++)
tempData.push_back((*it)->meshSize);
return tempData;
}
std::list<std::string> Object::getTexture() const
{
std::list<std::string> tempData;

View File

@@ -247,7 +247,7 @@ void OpenGLController::updateScene()
glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 0, 0);
//draw objects
glDrawArrays(GL_TRIANGLES, 0, 12 * 3);
glDrawArrays(GL_TRIANGLES, 0, ui32MeshSize * 3);
//close attributes
glDisableVertexAttribArray(0);
@@ -288,6 +288,7 @@ void OpenGLController::loadMsh(const char * path)
vfVertices = obj.getVertex();
vfUV = obj.getUV();
listTextures = obj.getTexture();
ui32MeshSize = obj.getSize().front();
}
catch (std::invalid_argument e)
{