Littles fixes

-Light Manager: I prefer iterators
-OpenGL: The UV problem is solved, but you forget to change the cubemaps
-Texture: GetSize() could return a int instead a NzVector2ui
-Algorithm: Simplification
-Utility: Couldn't compile

Former-commit-id: db890711b451d03427871fb997549a1b13c7d80a
This commit is contained in:
Gawaboumga 2014-08-27 14:34:35 +02:00
parent 18cf235172
commit fc4d84f206
5 changed files with 9 additions and 11 deletions

View File

@ -37,10 +37,10 @@ unsigned int NzLightManager::ComputeClosestLights(const NzVector3f& position, fl
light.score = std::numeric_limits<unsigned int>::max(); // Nous jouons au Golf light.score = std::numeric_limits<unsigned int>::max(); // Nous jouons au Golf
} }
for (unsigned int i = 0; i < m_lights.size(); ++i) for (auto it = m_lights.begin(); it != m_lights.end(); ++it)
{ {
const NzLight** lights = m_lights[i].first; const NzLight** lights = it->first;
unsigned int lightCount = m_lights[i].second; unsigned int lightCount = it->second;
for (unsigned int j = 0; j < lightCount; ++j) for (unsigned int j = 0; j < lightCount; ++j)
{ {

View File

@ -1941,8 +1941,8 @@ GLenum NzOpenGL::CubemapFace[] =
{ {
GL_TEXTURE_CUBE_MAP_POSITIVE_X, // nzCubemapFace_PositiveX GL_TEXTURE_CUBE_MAP_POSITIVE_X, // nzCubemapFace_PositiveX
GL_TEXTURE_CUBE_MAP_NEGATIVE_X, // nzCubemapFace_NegativeX GL_TEXTURE_CUBE_MAP_NEGATIVE_X, // nzCubemapFace_NegativeX
GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, // nzCubemapFace_PositiveY (Inversion pour les standards OpenGL) GL_TEXTURE_CUBE_MAP_POSITIVE_Y, // nzCubemapFace_PositiveY
GL_TEXTURE_CUBE_MAP_POSITIVE_Y, // nzCubemapFace_NegativeY (Inversion pour les standards OpenGL) GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, // nzCubemapFace_NegativeY
GL_TEXTURE_CUBE_MAP_POSITIVE_Z, // nzCubemapFace_PositiveZ GL_TEXTURE_CUBE_MAP_POSITIVE_Z, // nzCubemapFace_PositiveZ
GL_TEXTURE_CUBE_MAP_NEGATIVE_Z // nzCubemapFace_NegativeZ GL_TEXTURE_CUBE_MAP_NEGATIVE_Z // nzCubemapFace_NegativeZ
}; };

View File

@ -468,7 +468,7 @@ NzVector2ui NzTexture::GetSize() const
if (!m_impl) if (!m_impl)
{ {
NazaraError("Texture must be valid"); NazaraError("Texture must be valid");
return 0; return NzVector2ui(0, 0);
} }
#endif #endif

View File

@ -189,11 +189,9 @@ namespace
void MoveTriangleToEnd(int tri) void MoveTriangleToEnd(int tri)
{ {
auto it = std::find(tri_indices.begin(), tri_indices.end(), tri); auto it = std::find(tri_indices.begin(), tri_indices.end(), tri);
int t_ind = (it != tri_indices.end()) ? std::distance(tri_indices.begin(), it) : -1; NazaraAssert(it != tri_indices.end(), "Triangle not found");
NazaraAssert(t_ind >= 0, "Triangle not found"); tri_indices.erase(it);
tri_indices.erase(tri_indices.begin() + t_ind, tri_indices.begin() + t_ind + 1);
tri_indices.push_back(tri); tri_indices.push_back(tri);
} }
}; };

View File

@ -146,7 +146,7 @@ unsigned int NzUtility::ComponentCount[nzComponentType_Max+1] =
static_assert(nzComponentType_Max+1 == 14, "Component count array is incomplete"); static_assert(nzComponentType_Max+1 == 14, "Component count array is incomplete");
unsigned int NzUtility::ComponentStride[nzComponentType_Max+1] = std::size_t NzUtility::ComponentStride[nzComponentType_Max+1] =
{ {
4*sizeof(nzUInt8), // nzComponentType_Color 4*sizeof(nzUInt8), // nzComponentType_Color
1*sizeof(double), // nzComponentType_Double1 1*sizeof(double), // nzComponentType_Double1