Browse Source

GCC 4.5 compatibility: removed range-based for cycles.

Vladimír Vondruš 14 years ago
parent
commit
a34c006ca5
  1. 16
      src/Mesh.cpp
  2. 4
      src/MeshTools/FlipNormals.cpp
  3. 4
      src/MeshTools/Tipsify.cpp
  4. 6
      src/Trade/MeshData.cpp

16
src/Mesh.cpp

@ -21,8 +21,8 @@ using namespace std;
namespace Magnum {
Mesh::~Mesh() {
for(auto& it: _buffers)
delete it.first;
for(auto it = _buffers.begin(); it != _buffers.end(); ++it)
delete it->first;
#ifndef MAGNUM_TARGET_GLES
glDeleteVertexArrays(1, &vao);
@ -81,10 +81,10 @@ void Mesh::finalize() {
CORRADE_ASSERT(_vertexCount, "Mesh: the mesh has zero vertex count!", )
/* Finalize attribute positions for every buffer */
for(auto& it: _buffers) {
for(auto it = _buffers.begin(); it != _buffers.end(); ++it) {
/* Avoid confustion */
bool interleaved = it.second.first == BufferType::Interleaved;
vector<Attribute>& attributes = it.second.second;
bool interleaved = it->second.first == BufferType::Interleaved;
vector<Attribute>& attributes = it->second.second;
/* Interleaved buffer, set stride and position of first attribute */
if(interleaved) {
@ -129,12 +129,12 @@ void Mesh::bindBuffers() {
for(set<GLuint>::const_iterator it = _attributes.begin(); it != _attributes.end(); ++it)
glEnableVertexAttribArray(*it);
for(auto& it: _buffers) {
for(auto it = _buffers.begin(); it != _buffers.end(); ++it) {
/* Avoid confusion */
vector<Attribute>& attributes = it.second.second;
vector<Attribute>& attributes = it->second.second;
/* Bind buffer */
it.first->bind();
it->first->bind();
/* Bind all attributes to this buffer */
for(vector<Attribute>::const_iterator ait = attributes.begin(); ait != attributes.end(); ++ait)

4
src/MeshTools/FlipNormals.cpp

@ -27,8 +27,8 @@ void flipFaceWinding(vector<unsigned int>& indices) {
}
void flipNormals(vector<Vector3>& normals) {
for(Vector3& normal: normals)
normal = -normal;
for(auto it = normals.begin(); it != normals.end(); ++it)
*it = -*it;
}
}}

4
src/MeshTools/Tipsify.cpp

@ -74,7 +74,9 @@ void Tipsify::operator()(size_t cacheSize) {
/* Go through candidates in 1-ring around fanning vertex */
int candidatePriority = -1;
for(unsigned int v: candidates) {
for(auto it = candidates.begin(); it != candidates.end(); ++it) {
unsigned int v = *it;
/* Skip if it doesn't have any live triangles */
if(!liveTriangleCount[v]) continue;

6
src/Trade/MeshData.cpp

@ -19,9 +19,9 @@ namespace Magnum { namespace Trade {
MeshData::~MeshData() {
delete _indices;
for(auto i: _vertices) delete i;
for(auto i: _normals) delete i;
for(auto i: _textureCoords2D) delete i;
for(auto it = _vertices.begin(); it != _vertices.end(); ++it) delete *it;
for(auto it = _normals.begin(); it != _normals.end(); ++it) delete *it;
for(auto it = _textureCoords2D.begin(); it != _textureCoords2D.end(); ++it) delete *it;
}
}}

Loading…
Cancel
Save