Commit 47b69164 authored by Maire Nicolas's avatar Maire Nicolas

Petites corrections dans clippingShader.

parent a23599e2
...@@ -91,7 +91,7 @@ int ClippingShader::addClipPlane() ...@@ -91,7 +91,7 @@ int ClippingShader::addClipPlane()
// Resize planes arrays to the right size // Resize planes arrays to the right size
m_clipPlanes.resize((size_t)(previousPlanesCount + 1)); m_clipPlanes.resize((size_t)(previousPlanesCount + 1));
m_clipPlanesIds.resize((size_t)newPlaneId); m_clipPlanesIds.resize((size_t)(newPlaneId + 1));
m_clipPlanesEquations.resize(4*(size_t)(previousPlanesCount + 1), 0.0); m_clipPlanesEquations.resize(4*(size_t)(previousPlanesCount + 1), 0.0);
// Set new plane id // Set new plane id
...@@ -115,7 +115,7 @@ void ClippingShader::deleteClipPlane(unsigned int id) ...@@ -115,7 +115,7 @@ void ClippingShader::deleteClipPlane(unsigned int id)
// Check if the given id is valid // Check if the given id is valid
if (errorRaiseWrongId(id > (m_clipPlanesIds.size()), "ClippingShader::deleteClipPlane")) if (errorRaiseWrongId(id > (m_clipPlanesIds.size()), "ClippingShader::deleteClipPlane"))
return; return;
if (errorRaiseWrongId(m_clipPlanesIds[id].used, "ClippingShader::deleteClipPlane")) if (errorRaiseWrongId(!m_clipPlanesIds[id].used, "ClippingShader::deleteClipPlane"))
return; return;
// Check if the clipping code has been inserted into shader // Check if the clipping code has been inserted into shader
...@@ -168,7 +168,7 @@ void ClippingShader::setClipPlaneParamsAll(unsigned int id, Geom::Vec3f vec1, Ge ...@@ -168,7 +168,7 @@ void ClippingShader::setClipPlaneParamsAll(unsigned int id, Geom::Vec3f vec1, Ge
// Check if the given id is valid // Check if the given id is valid
if (errorRaiseWrongId(id > (m_clipPlanesIds.size()), "ClippingShader::setClipPlaneParamsAll")) if (errorRaiseWrongId(id > (m_clipPlanesIds.size()), "ClippingShader::setClipPlaneParamsAll"))
return; return;
if (errorRaiseWrongId(m_clipPlanesIds[id].used, "ClippingShader::setClipPlaneParamsAll")) if (errorRaiseWrongId(!m_clipPlanesIds[id].used, "ClippingShader::setClipPlaneParamsAll"))
return; return;
// Get the corresponding plane index // Get the corresponding plane index
...@@ -202,7 +202,7 @@ void ClippingShader::setClipPlaneParamsFirstVec(unsigned int id, Geom::Vec3f vec ...@@ -202,7 +202,7 @@ void ClippingShader::setClipPlaneParamsFirstVec(unsigned int id, Geom::Vec3f vec
// Check if the given id is valid // Check if the given id is valid
if (errorRaiseWrongId(id > (m_clipPlanesIds.size()), "ClippingShader::setClipPlaneParamsFirstVec")) if (errorRaiseWrongId(id > (m_clipPlanesIds.size()), "ClippingShader::setClipPlaneParamsFirstVec"))
return; return;
if (errorRaiseWrongId(m_clipPlanesIds[id].used, "ClippingShader::setClipPlaneParamsFirstVec")) if (errorRaiseWrongId(!m_clipPlanesIds[id].used, "ClippingShader::setClipPlaneParamsFirstVec"))
return; return;
// Get the corresponding plane index // Get the corresponding plane index
...@@ -230,7 +230,7 @@ void ClippingShader::setClipPlaneParamsSecondVec(unsigned int id, Geom::Vec3f ve ...@@ -230,7 +230,7 @@ void ClippingShader::setClipPlaneParamsSecondVec(unsigned int id, Geom::Vec3f ve
// Check if the given id is valid // Check if the given id is valid
if (errorRaiseWrongId(id > (m_clipPlanesIds.size()), "ClippingShader::setClipPlaneParamsSecondVec")) if (errorRaiseWrongId(id > (m_clipPlanesIds.size()), "ClippingShader::setClipPlaneParamsSecondVec"))
return; return;
if (errorRaiseWrongId(m_clipPlanesIds[id].used, "ClippingShader::setClipPlaneParamsSecondVec")) if (errorRaiseWrongId(!m_clipPlanesIds[id].used, "ClippingShader::setClipPlaneParamsSecondVec"))
return; return;
// Get the corresponding plane index // Get the corresponding plane index
...@@ -258,7 +258,7 @@ void ClippingShader::setClipPlaneParamsOrigin(unsigned int id, Geom::Vec3f origi ...@@ -258,7 +258,7 @@ void ClippingShader::setClipPlaneParamsOrigin(unsigned int id, Geom::Vec3f origi
// Check if the given id is valid // Check if the given id is valid
if (errorRaiseWrongId(id > (m_clipPlanesIds.size()), "ClippingShader::setClipPlaneParamsOrigin")) if (errorRaiseWrongId(id > (m_clipPlanesIds.size()), "ClippingShader::setClipPlaneParamsOrigin"))
return; return;
if (errorRaiseWrongId(m_clipPlanesIds[id].used, "ClippingShader::setClipPlaneParamsOrigin")) if (errorRaiseWrongId(!m_clipPlanesIds[id].used, "ClippingShader::setClipPlaneParamsOrigin"))
return; return;
// Get the corresponding plane index // Get the corresponding plane index
...@@ -282,7 +282,7 @@ Geom::Vec3f ClippingShader::getClipPlaneParamsFirstVec(unsigned int id) ...@@ -282,7 +282,7 @@ Geom::Vec3f ClippingShader::getClipPlaneParamsFirstVec(unsigned int id)
// Check if the given id is valid // Check if the given id is valid
if (errorRaiseWrongId(id > (m_clipPlanesIds.size()), "ClippingShader::getClipPlaneParamsFirstVec")) if (errorRaiseWrongId(id > (m_clipPlanesIds.size()), "ClippingShader::getClipPlaneParamsFirstVec"))
return Geom::Vec3f(0.0, 0.0, 0.0); return Geom::Vec3f(0.0, 0.0, 0.0);
if (errorRaiseWrongId(m_clipPlanesIds[id].used, "ClippingShader::getClipPlaneParamsFirstVec")) if (errorRaiseWrongId(!m_clipPlanesIds[id].used, "ClippingShader::getClipPlaneParamsFirstVec"))
return Geom::Vec3f(0.0, 0.0, 0.0); return Geom::Vec3f(0.0, 0.0, 0.0);
// Get the corresponding plane index // Get the corresponding plane index
...@@ -297,7 +297,7 @@ Geom::Vec3f ClippingShader::getClipPlaneParamsSecondVec(unsigned int id) ...@@ -297,7 +297,7 @@ Geom::Vec3f ClippingShader::getClipPlaneParamsSecondVec(unsigned int id)
// Check if the given id is valid // Check if the given id is valid
if (errorRaiseWrongId(id > (m_clipPlanesIds.size()), "ClippingShader::getClipPlaneParamsSecondVec")) if (errorRaiseWrongId(id > (m_clipPlanesIds.size()), "ClippingShader::getClipPlaneParamsSecondVec"))
return Geom::Vec3f(0.0, 0.0, 0.0); return Geom::Vec3f(0.0, 0.0, 0.0);
if (errorRaiseWrongId(m_clipPlanesIds[id].used, "ClippingShader::getClipPlaneParamsSecondVec")) if (errorRaiseWrongId(!m_clipPlanesIds[id].used, "ClippingShader::getClipPlaneParamsSecondVec"))
return Geom::Vec3f(0.0, 0.0, 0.0); return Geom::Vec3f(0.0, 0.0, 0.0);
// Get the corresponding plane index // Get the corresponding plane index
...@@ -312,7 +312,7 @@ Geom::Vec3f ClippingShader::getClipPlaneParamsOrigin(unsigned int id) ...@@ -312,7 +312,7 @@ Geom::Vec3f ClippingShader::getClipPlaneParamsOrigin(unsigned int id)
// Check if the given id is valid // Check if the given id is valid
if (errorRaiseWrongId(id > (m_clipPlanesIds.size()), "ClippingShader::getClipPlaneParamsOrigin")) if (errorRaiseWrongId(id > (m_clipPlanesIds.size()), "ClippingShader::getClipPlaneParamsOrigin"))
return Geom::Vec3f(0.0, 0.0, 0.0); return Geom::Vec3f(0.0, 0.0, 0.0);
if (errorRaiseWrongId(m_clipPlanesIds[id].used, "ClippingShader::getClipPlaneParamsOrigin")) if (errorRaiseWrongId(!m_clipPlanesIds[id].used, "ClippingShader::getClipPlaneParamsOrigin"))
return Geom::Vec3f(0.0, 0.0, 0.0); return Geom::Vec3f(0.0, 0.0, 0.0);
// Get the corresponding plane index // Get the corresponding plane index
...@@ -343,7 +343,7 @@ void ClippingShader::updateClipPlaneUniformsArray(unsigned int id) ...@@ -343,7 +343,7 @@ void ClippingShader::updateClipPlaneUniformsArray(unsigned int id)
// Check if the given id is valid // Check if the given id is valid
if (errorRaiseWrongId(id > (m_clipPlanesIds.size()), "ClippingShader::updateClipPlaneUniformsArray")) if (errorRaiseWrongId(id > (m_clipPlanesIds.size()), "ClippingShader::updateClipPlaneUniformsArray"))
return; return;
if (errorRaiseWrongId(m_clipPlanesIds[id].used, "ClippingShader::updateClipPlaneUniformsArray")) if (errorRaiseWrongId(!m_clipPlanesIds[id].used, "ClippingShader::updateClipPlaneUniformsArray"))
return; return;
// Get the corresponding plane index // Get the corresponding plane index
...@@ -398,7 +398,7 @@ int ClippingShader::addClipSphere() ...@@ -398,7 +398,7 @@ int ClippingShader::addClipSphere()
// Resize spheres arrays to the right size // Resize spheres arrays to the right size
m_clipSpheres.resize((size_t)(previousSpheresCount + 1)); m_clipSpheres.resize((size_t)(previousSpheresCount + 1));
m_clipSpheresIds.resize((size_t)newSphereId); m_clipSpheresIds.resize((size_t)(newSphereId + 1));
m_clipSpheresCentersAndRadiuses.resize(4*(size_t)(previousSpheresCount + 1), 0.0); m_clipSpheresCentersAndRadiuses.resize(4*(size_t)(previousSpheresCount + 1), 0.0);
// Set new sphere id // Set new sphere id
...@@ -421,7 +421,7 @@ void ClippingShader::deleteClipSphere(unsigned int id) ...@@ -421,7 +421,7 @@ void ClippingShader::deleteClipSphere(unsigned int id)
// Check if the given id is valid // Check if the given id is valid
if (errorRaiseWrongId(id > (m_clipSpheresIds.size()), "ClippingShader::deleteClipSphere")) if (errorRaiseWrongId(id > (m_clipSpheresIds.size()), "ClippingShader::deleteClipSphere"))
return; return;
if (errorRaiseWrongId(m_clipSpheresIds[id].used, "ClippingShader::deleteClipSphere")) if (errorRaiseWrongId(!m_clipSpheresIds[id].used, "ClippingShader::deleteClipSphere"))
return; return;
// Check if the clipping code has been inserted into shader // Check if the clipping code has been inserted into shader
...@@ -474,7 +474,7 @@ void ClippingShader::setClipSphereParamsAll(unsigned int id, Geom::Vec3f center, ...@@ -474,7 +474,7 @@ void ClippingShader::setClipSphereParamsAll(unsigned int id, Geom::Vec3f center,
// Check if the given id is valid // Check if the given id is valid
if (errorRaiseWrongId(id > (m_clipSpheresIds.size()), "ClippingShader::setClipSphereParamsAll")) if (errorRaiseWrongId(id > (m_clipSpheresIds.size()), "ClippingShader::setClipSphereParamsAll"))
return; return;
if (errorRaiseWrongId(m_clipSpheresIds[id].used, "ClippingShader::setClipSphereParamsAll")) if (errorRaiseWrongId(!m_clipSpheresIds[id].used, "ClippingShader::setClipSphereParamsAll"))
return; return;
// Get the corresponding sphere index // Get the corresponding sphere index
...@@ -500,7 +500,7 @@ void ClippingShader::setClipSphereParamsCenter(unsigned int id, Geom::Vec3f cent ...@@ -500,7 +500,7 @@ void ClippingShader::setClipSphereParamsCenter(unsigned int id, Geom::Vec3f cent
// Check if the given id is valid // Check if the given id is valid
if (errorRaiseWrongId(id > (m_clipSpheresIds.size()), "ClippingShader::setClipSphereParamsCenter")) if (errorRaiseWrongId(id > (m_clipSpheresIds.size()), "ClippingShader::setClipSphereParamsCenter"))
return; return;
if (errorRaiseWrongId(m_clipSpheresIds[id].used, "ClippingShader::setClipSphereParamsCenter")) if (errorRaiseWrongId(!m_clipSpheresIds[id].used, "ClippingShader::setClipSphereParamsCenter"))
return; return;
// Get the corresponding sphere index // Get the corresponding sphere index
...@@ -524,7 +524,7 @@ void ClippingShader::setClipSphereParamsRadius(unsigned int id, float radius) ...@@ -524,7 +524,7 @@ void ClippingShader::setClipSphereParamsRadius(unsigned int id, float radius)
// Check if the given id is valid // Check if the given id is valid
if (errorRaiseWrongId(id > (m_clipSpheresIds.size()), "ClippingShader::setClipSphereParamsRadius")) if (errorRaiseWrongId(id > (m_clipSpheresIds.size()), "ClippingShader::setClipSphereParamsRadius"))
return; return;
if (errorRaiseWrongId(m_clipSpheresIds[id].used, "ClippingShader::setClipSphereParamsRadius")) if (errorRaiseWrongId(!m_clipSpheresIds[id].used, "ClippingShader::setClipSphereParamsRadius"))
return; return;
// Get the corresponding sphere index // Get the corresponding sphere index
...@@ -548,7 +548,7 @@ Geom::Vec3f ClippingShader::getClipSphereParamsCenter(unsigned int id) ...@@ -548,7 +548,7 @@ Geom::Vec3f ClippingShader::getClipSphereParamsCenter(unsigned int id)
// Check if the given id is valid // Check if the given id is valid
if (errorRaiseWrongId(id > (m_clipSpheresIds.size()), "ClippingShader::getClipSphereParamsCenter")) if (errorRaiseWrongId(id > (m_clipSpheresIds.size()), "ClippingShader::getClipSphereParamsCenter"))
return Geom::Vec3f(0.0, 0.0, 0.0); return Geom::Vec3f(0.0, 0.0, 0.0);
if (errorRaiseWrongId(m_clipSpheresIds[id].used, "ClippingShader::getClipSphereParamsCenter")) if (errorRaiseWrongId(!m_clipSpheresIds[id].used, "ClippingShader::getClipSphereParamsCenter"))
return Geom::Vec3f(0.0, 0.0, 0.0); return Geom::Vec3f(0.0, 0.0, 0.0);
// Get the corresponding sphere index // Get the corresponding sphere index
...@@ -563,7 +563,7 @@ float ClippingShader::getClipSphereParamsRadius(unsigned int id) ...@@ -563,7 +563,7 @@ float ClippingShader::getClipSphereParamsRadius(unsigned int id)
// Check if the given id is valid // Check if the given id is valid
if (errorRaiseWrongId(id > (m_clipSpheresIds.size()), "ClippingShader::getClipSphereParamsRadius")) if (errorRaiseWrongId(id > (m_clipSpheresIds.size()), "ClippingShader::getClipSphereParamsRadius"))
return 0.0; return 0.0;
if (errorRaiseWrongId(m_clipSpheresIds[id].used, "ClippingShader::getClipSphereParamsRadius")) if (errorRaiseWrongId(!m_clipSpheresIds[id].used, "ClippingShader::getClipSphereParamsRadius"))
return 0.0; return 0.0;
// Get the corresponding sphere index // Get the corresponding sphere index
...@@ -594,7 +594,7 @@ void ClippingShader::updateClipSphereUniformsArray(unsigned int id) ...@@ -594,7 +594,7 @@ void ClippingShader::updateClipSphereUniformsArray(unsigned int id)
// Check if the given id is valid // Check if the given id is valid
if (errorRaiseWrongId(id > (m_clipSpheresIds.size()), "ClippingShader::updateClipSphereUniformsArray")) if (errorRaiseWrongId(id > (m_clipSpheresIds.size()), "ClippingShader::updateClipSphereUniformsArray"))
return; return;
if (errorRaiseWrongId(m_clipSpheresIds[id].used, "ClippingShader::updateClipSphereUniformsArray")) if (errorRaiseWrongId(!m_clipSpheresIds[id].used, "ClippingShader::updateClipSphereUniformsArray"))
return; return;
// Get the corresponding sphere index // Get the corresponding sphere index
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment