diff --git a/CMakeLists.txt b/CMakeLists.txt index 97a9f9d..12fe910 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ FILE(GLOB RES_SRC_FILE shaders/*.glsl) SET(RESOURCE_DST_FILE shaders.cpp) # choose source file -file(GLOB LIB_SRC_LIST src/*.cpp src/glew.c) +file(GLOB LIB_SRC_LIST src/*.cpp) list(APPEND LIB_SRC_LIST ${RESOURCE_DST_FILE}) file(GLOB LIB_HEAD_LIST src/*.h) diff --git a/src/glew.c b/src/glew.cpp similarity index 100% rename from src/glew.c rename to src/glew.cpp diff --git a/src/mesh.cpp b/src/mesh.cpp index 7000e3d..f09aa31 100644 --- a/src/mesh.cpp +++ b/src/mesh.cpp @@ -37,8 +37,8 @@ Mesh::Mesh() : isBillboard(false), isShadowCaster(true), depth(0), - vao(0), - primitive_type(GL_TRIANGLES) + primitive_type(GL_TRIANGLES), + vao(0) { clearBuffers(); } @@ -289,13 +289,15 @@ void Mesh::mergeVertices() for(std::size_t i=0; i::iterator,bool> ret = vertexSet.insert(indices[i]); - deleted[indices[i]] = !ret.second && *(ret.first) != indices[i]; + std::pair::iterator, bool> ret = vertexSet.insert(indices[i]); + std::set::iterator it = ret.first; + bool success = ret.second; + deleted[indices[i]] = !success && *it != int(indices[i]); if(deleted[indices[i]]) { if(!tangents.empty()) - tangents[*(ret.first)].tangent += tangents[indices[i]].tangent; - indices[i] = *(ret.first); + tangents[*it].tangent += tangents[indices[i]].tangent; + indices[i] = *it; } } int offset = 0; @@ -330,7 +332,7 @@ void Mesh::mergeVertices() normals.resize(normals.size()-offset); if(!tangents.empty()) tangents.resize(tangents.size()-offset); - for(int i=0; i