Commit b458a5ee authored by Maire Nicolas's avatar Maire Nicolas

Suppression de la partie affichage dans clippingShader.

parent e616076c
...@@ -167,21 +167,9 @@ void StageShaderReloaded::slot_doubleSpinBox_PlaneOrigin(double c) ...@@ -167,21 +167,9 @@ void StageShaderReloaded::slot_doubleSpinBox_PlaneOrigin(double c)
} }
} }
void StageShaderReloaded::slot_doubleSpinBox_GridDisplaySize(double c) void StageShaderReloaded::slot_spinBox_GridResolution(int i)
{ {
m_shader->setClipPlanesDisplaySize((float)c); m_planeDrawable->updatePrecisionDrawing(i);
updateGL();
}
void StageShaderReloaded::slot_spinBox_GridResolutionX(int i)
{
m_shader->setClipPlanesDisplayXRes((size_t)i);
updateGL();
}
void StageShaderReloaded::slot_spinBox_GridResolutionY(int i)
{
m_shader->setClipPlanesDisplayYRes((size_t)i);
updateGL(); updateGL();
} }
...@@ -191,7 +179,7 @@ void StageShaderReloaded::slot_doubleSpinBox_GridColor(double c) ...@@ -191,7 +179,7 @@ void StageShaderReloaded::slot_doubleSpinBox_GridColor(double c)
float g = dynamic_cast<Utils::QT::uiDockInterface*>(dockWidget())->doubleSpinBox_GridColorG->value(); float g = dynamic_cast<Utils::QT::uiDockInterface*>(dockWidget())->doubleSpinBox_GridColorG->value();
float b = dynamic_cast<Utils::QT::uiDockInterface*>(dockWidget())->doubleSpinBox_GridColorB->value(); float b = dynamic_cast<Utils::QT::uiDockInterface*>(dockWidget())->doubleSpinBox_GridColorB->value();
m_shader->setClipPlanesDisplayColor(Geom::Vec3f(r, g, b)); m_planeDrawable->setColor(Geom::Vec4f(r, g, b, 1.0));
updateGL(); updateGL();
} }
...@@ -267,15 +255,9 @@ void StageShaderReloaded::slot_doubleSpinBox_SphereRadius(double c) ...@@ -267,15 +255,9 @@ void StageShaderReloaded::slot_doubleSpinBox_SphereRadius(double c)
} }
} }
void StageShaderReloaded::slot_spinBox_SphereGridResolutionX(int i) void StageShaderReloaded::slot_spinBox_SphereResolution(int i)
{ {
m_shader->setClipSpheresDisplayXRes((size_t)i); m_sphereDrawable->updatePrecisionDrawing(i);
updateGL();
}
void StageShaderReloaded::slot_spinBox_SphereGridResolutionY(int i)
{
m_shader->setClipSpheresDisplayYRes((size_t)i);
updateGL(); updateGL();
} }
...@@ -285,7 +267,7 @@ void StageShaderReloaded::slot_doubleSpinBox_SphereGridColor(double c) ...@@ -285,7 +267,7 @@ void StageShaderReloaded::slot_doubleSpinBox_SphereGridColor(double c)
float g = dynamic_cast<Utils::QT::uiDockInterface*>(dockWidget())->doubleSpinBox_SphereGridColorG->value(); float g = dynamic_cast<Utils::QT::uiDockInterface*>(dockWidget())->doubleSpinBox_SphereGridColorG->value();
float b = dynamic_cast<Utils::QT::uiDockInterface*>(dockWidget())->doubleSpinBox_SphereGridColorB->value(); float b = dynamic_cast<Utils::QT::uiDockInterface*>(dockWidget())->doubleSpinBox_SphereGridColorB->value();
m_shader->setClipSpheresDisplayColor(Geom::Vec3f(r, g, b)); m_sphereDrawable->setColor(Geom::Vec4f(r, g, b, 1.0));
updateGL(); updateGL();
} }
...@@ -372,9 +354,7 @@ void StageShaderReloaded::initGUI() ...@@ -372,9 +354,7 @@ void StageShaderReloaded::initGUI()
setCallBack(dock.doubleSpinBox_PlaneOriginy, SIGNAL(valueChanged(double)), SLOT(slot_doubleSpinBox_PlaneOrigin(double))); setCallBack(dock.doubleSpinBox_PlaneOriginy, SIGNAL(valueChanged(double)), SLOT(slot_doubleSpinBox_PlaneOrigin(double)));
setCallBack(dock.doubleSpinBox_PlaneOriginz, SIGNAL(valueChanged(double)), SLOT(slot_doubleSpinBox_PlaneOrigin(double))); setCallBack(dock.doubleSpinBox_PlaneOriginz, SIGNAL(valueChanged(double)), SLOT(slot_doubleSpinBox_PlaneOrigin(double)));
setCallBack(dock.doubleSpinBox_GridDisplaySize, SIGNAL(valueChanged(double)), SLOT(slot_doubleSpinBox_GridDisplaySize(double))); setCallBack(dock.spinBox_GridResolution, SIGNAL(valueChanged(int)), SLOT(slot_spinBox_GridResolution(int)));
setCallBack(dock.spinBox_GridResolutionX, SIGNAL(valueChanged(int)), SLOT(slot_spinBox_GridResolutionX(int)));
setCallBack(dock.spinBox_GridResolutionY, SIGNAL(valueChanged(int)), SLOT(slot_spinBox_GridResolutionY(int)));
setCallBack(dock.doubleSpinBox_GridColorR, SIGNAL(valueChanged(double)), SLOT(slot_doubleSpinBox_GridColor(double))); setCallBack(dock.doubleSpinBox_GridColorR, SIGNAL(valueChanged(double)), SLOT(slot_doubleSpinBox_GridColor(double)));
setCallBack(dock.doubleSpinBox_GridColorG, SIGNAL(valueChanged(double)), SLOT(slot_doubleSpinBox_GridColor(double))); setCallBack(dock.doubleSpinBox_GridColorG, SIGNAL(valueChanged(double)), SLOT(slot_doubleSpinBox_GridColor(double)));
setCallBack(dock.doubleSpinBox_GridColorB, SIGNAL(valueChanged(double)), SLOT(slot_doubleSpinBox_GridColor(double))); setCallBack(dock.doubleSpinBox_GridColorB, SIGNAL(valueChanged(double)), SLOT(slot_doubleSpinBox_GridColor(double)));
...@@ -384,10 +364,8 @@ void StageShaderReloaded::initGUI() ...@@ -384,10 +364,8 @@ void StageShaderReloaded::initGUI()
dock.vertexEdit->setPlainText(QString(m_shader->getVertexShaderSrc())); dock.vertexEdit->setPlainText(QString(m_shader->getVertexShaderSrc()));
dock.fragmentEdit->setPlainText(QString(m_shader->getFragmentShaderSrc())); dock.fragmentEdit->setPlainText(QString(m_shader->getFragmentShaderSrc()));
dock.doubleSpinBox_GridDisplaySize->setValue(m_shader->getClipPlanesDisplaySize()); dock.spinBox_GridResolution->setValue(5); // TODO : Utiliser un getteur
dock.spinBox_GridResolutionX->setValue(m_shader->getClipPlanesDisplayXRes()); Geom::Vec3f planesCol = Geom::Vec3f(1.0, 0.0, 0.0); // TODO : utiliser un getteur
dock.spinBox_GridResolutionY->setValue(m_shader->getClipPlanesDisplayYRes());
Geom::Vec3f planesCol = m_shader->getClipPlanesDisplayColor();
dock.doubleSpinBox_GridColorR->setValue(planesCol[0]); dock.doubleSpinBox_GridColorR->setValue(planesCol[0]);
dock.doubleSpinBox_GridColorG->setValue(planesCol[1]); dock.doubleSpinBox_GridColorG->setValue(planesCol[1]);
dock.doubleSpinBox_GridColorB->setValue(planesCol[2]); dock.doubleSpinBox_GridColorB->setValue(planesCol[2]);
...@@ -405,15 +383,13 @@ void StageShaderReloaded::initGUI() ...@@ -405,15 +383,13 @@ void StageShaderReloaded::initGUI()
setCallBack(dock.doubleSpinBox_SphereRadius, SIGNAL(valueChanged(double)), SLOT(slot_doubleSpinBox_SphereRadius(double))); setCallBack(dock.doubleSpinBox_SphereRadius, SIGNAL(valueChanged(double)), SLOT(slot_doubleSpinBox_SphereRadius(double)));
setCallBack(dock.spinBox_SphereGridResolutionX, SIGNAL(valueChanged(int)), SLOT(slot_spinBox_SphereGridResolutionX(int))); setCallBack(dock.spinBox_SphereResolution, SIGNAL(valueChanged(int)), SLOT(slot_spinBox_SphereResolution(int)));
setCallBack(dock.spinBox_SphereGridResolutionY, SIGNAL(valueChanged(int)), SLOT(slot_spinBox_SphereGridResolutionY(int)));
setCallBack(dock.doubleSpinBox_SphereGridColorR, SIGNAL(valueChanged(double)), SLOT(slot_doubleSpinBox_SphereGridColor(double))); setCallBack(dock.doubleSpinBox_SphereGridColorR, SIGNAL(valueChanged(double)), SLOT(slot_doubleSpinBox_SphereGridColor(double)));
setCallBack(dock.doubleSpinBox_SphereGridColorG, SIGNAL(valueChanged(double)), SLOT(slot_doubleSpinBox_SphereGridColor(double))); setCallBack(dock.doubleSpinBox_SphereGridColorG, SIGNAL(valueChanged(double)), SLOT(slot_doubleSpinBox_SphereGridColor(double)));
setCallBack(dock.doubleSpinBox_SphereGridColorB, SIGNAL(valueChanged(double)), SLOT(slot_doubleSpinBox_SphereGridColor(double))); setCallBack(dock.doubleSpinBox_SphereGridColorB, SIGNAL(valueChanged(double)), SLOT(slot_doubleSpinBox_SphereGridColor(double)));
dock.spinBox_SphereGridResolutionX->setValue(m_shader->getClipSpheresDisplayXRes()); dock.spinBox_SphereResolution->setValue(3); // TODO : utiliser un getteur
dock.spinBox_SphereGridResolutionY->setValue(m_shader->getClipSpheresDisplayYRes()); Geom::Vec3f spheresCol = Geom::Vec3f(0.0, 0.4, 1.0); // TODO : utiliser un getteur
Geom::Vec3f spheresCol = m_shader->getClipSpheresDisplayColor();
dock.doubleSpinBox_SphereGridColorR->setValue(spheresCol[0]); dock.doubleSpinBox_SphereGridColorR->setValue(spheresCol[0]);
dock.doubleSpinBox_SphereGridColorG->setValue(spheresCol[1]); dock.doubleSpinBox_SphereGridColorG->setValue(spheresCol[1]);
dock.doubleSpinBox_SphereGridColorB->setValue(spheresCol[2]); dock.doubleSpinBox_SphereGridColorB->setValue(spheresCol[2]);
...@@ -487,9 +463,7 @@ void StageShaderReloaded::importMesh(std::string& filename) ...@@ -487,9 +463,7 @@ void StageShaderReloaded::importMesh(std::string& filename)
setParamObject(gWidthObj, gPosObj.data()) ; setParamObject(gWidthObj, gPosObj.data()) ;
updateGLMatrices() ; updateGLMatrices();
m_shader->setClipPlanesDisplaySize((m_bb.maxSize())*1.2f);
} }
/******************************************************************************* /*******************************************************************************
...@@ -517,21 +491,18 @@ void StageShaderReloaded::cb_initGL() ...@@ -517,21 +491,18 @@ void StageShaderReloaded::cb_initGL()
// setup clipping // setup clipping
m_shader->insertClippingCode(); m_shader->insertClippingCode();
m_shader->setClipPlanesDisplayColor(Geom::Vec3f (1.0, 0.0, 0.0));
m_shader->setClipPlanesDisplayXRes(10);
m_shader->setClipPlanesDisplayYRes(5);
m_shader->setClipSpheresDisplayColor(Geom::Vec3f(0.0, 0.4, 1.0));
m_shader->setClipSpheresDisplayXRes(20);
m_shader->setClipSpheresDisplayYRes(15);
// setup clipping shapes // setup clipping shapes
m_planeDrawable = new Utils::Grid; m_planeDrawable = new Utils::Grid;
m_planeDrawable->setColor(Geom::Vec4f(1.0, 0.0, 0.0, 1.0)); m_planeDrawable->setColor(Geom::Vec4f(1.0, 0.0, 0.0, 1.0));
m_sphereDrawable = new Utils::IcoSphere(20); m_planeDrawable->updatePrecisionDrawing(5);
m_sphereDrawable = new Utils::IcoSphere;
m_sphereDrawable->setColor(Geom::Vec4f(0.0, 0.4, 1.0, 1.0)); m_sphereDrawable->setColor(Geom::Vec4f(0.0, 0.4, 1.0, 1.0));
m_sphereDrawable->updatePrecisionDrawing(3);
// setup clipping picking frame // setup clipping picking frame
m_frameManipulator = new Utils::FrameManipulator(); m_frameManipulator = new Utils::FrameManipulator();
m_lastPickedObject = NULL;
} }
void StageShaderReloaded::updateVBOprimitives(int upType) void StageShaderReloaded::updateVBOprimitives(int upType)
...@@ -582,11 +553,13 @@ void StageShaderReloaded::cb_redraw() ...@@ -582,11 +553,13 @@ void StageShaderReloaded::cb_redraw()
m_render_topo->drawTopo(); m_render_topo->drawTopo();
// Display clipping shapes // Display clipping shapes
m_shader->displayClipPlanes();
m_shader->displayClipSpheres();
for (size_t i = 0; i < m_pickables.size(); i++) for (size_t i = 0; i < m_pickables.size(); i++)
m_pickables[i]->draw(); m_pickables[i]->draw();
// Display picking frame
if (m_lastPickedObject)
m_frameManipulator->draw();
} }
void StageShaderReloaded::cb_keyPress(int code) void StageShaderReloaded::cb_keyPress(int code)
...@@ -605,16 +578,16 @@ void StageShaderReloaded::cb_mousePress(int button, int x, int y) ...@@ -605,16 +578,16 @@ void StageShaderReloaded::cb_mousePress(int button, int x, int y)
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
QApplication app(argc, argv) ; QApplication app(argc, argv);
StageShaderReloaded sqt ; StageShaderReloaded sqt;
sqt.setGeometry(0, 0, 1000, 800) ; sqt.setGeometry(0, 0, 1000, 800);
sqt.show() ; sqt.show();
if(argc == 2) if(argc == 2)
{ {
std::string filename(argv[1]) ; std::string filename(argv[1]);
sqt.importMesh(filename) ; sqt.importMesh(filename);
} }
else else
{ {
...@@ -624,7 +597,7 @@ int main(int argc, char** argv) ...@@ -624,7 +597,7 @@ int main(int argc, char** argv)
prim.embedHexaGrid(1.0f,1.0f,1.0f); prim.embedHexaGrid(1.0f,1.0f,1.0f);
} }
sqt.initGUI() ; sqt.initGUI();
return app.exec() ; return app.exec();
} }
...@@ -110,6 +110,7 @@ public: ...@@ -110,6 +110,7 @@ public:
Utils::LineDrawable* m_sphereDrawable; Utils::LineDrawable* m_sphereDrawable;
Utils::FrameManipulator* m_frameManipulator; Utils::FrameManipulator* m_frameManipulator;
std::vector<Utils::Pickable*> m_pickables; std::vector<Utils::Pickable*> m_pickables;
Utils::Pickable* m_lastPickedObject;
StageShaderReloaded(); StageShaderReloaded();
...@@ -141,9 +142,7 @@ public slots: ...@@ -141,9 +142,7 @@ public slots:
void slot_doubleSpinBox_PlaneVec2(double c); void slot_doubleSpinBox_PlaneVec2(double c);
void slot_doubleSpinBox_PlaneOrigin(double c); void slot_doubleSpinBox_PlaneOrigin(double c);
void slot_doubleSpinBox_GridDisplaySize(double c); void slot_spinBox_GridResolution(int i);
void slot_spinBox_GridResolutionX(int i);
void slot_spinBox_GridResolutionY(int i);
void slot_doubleSpinBox_GridColor(double c); void slot_doubleSpinBox_GridColor(double c);
void slot_pushButton_addSphere(); void slot_pushButton_addSphere();
...@@ -154,8 +153,7 @@ public slots: ...@@ -154,8 +153,7 @@ public slots:
void slot_doubleSpinBox_SphereCenter(double c); void slot_doubleSpinBox_SphereCenter(double c);
void slot_doubleSpinBox_SphereRadius(double c); void slot_doubleSpinBox_SphereRadius(double c);
void slot_spinBox_SphereGridResolutionX(int i); void slot_spinBox_SphereResolution(int i);
void slot_spinBox_SphereGridResolutionY(int i);
void slot_doubleSpinBox_SphereGridColor(double c); void slot_doubleSpinBox_SphereGridColor(double c);
void slot_doubleSpinBox_ColorAttenuationFactor(double c); void slot_doubleSpinBox_ColorAttenuationFactor(double c);
......
...@@ -208,7 +208,7 @@ ...@@ -208,7 +208,7 @@
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="1" column="1">
<widget class="QSpinBox" name="spinBox_GridResolutionX"> <widget class="QSpinBox" name="spinBox_GridResolution">
<property name="maximum"> <property name="maximum">
<number>200</number> <number>200</number>
</property> </property>
...@@ -255,13 +255,6 @@ ...@@ -255,13 +255,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="2">
<widget class="QSpinBox" name="spinBox_GridResolutionY">
<property name="maximum">
<number>200</number>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
</layout> </layout>
...@@ -506,14 +499,14 @@ ...@@ -506,14 +499,14 @@
</widget> </widget>
</item> </item>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="label_SphereGridResolution"> <widget class="QLabel" name="label_SphereResolution">
<property name="text"> <property name="text">
<string>Res.</string> <string>Res.</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="0" column="1">
<widget class="QSpinBox" name="spinBox_SphereGridResolutionX"> <widget class="QSpinBox" name="spinBox_SphereResolution">
<property name="maximum"> <property name="maximum">
<number>200</number> <number>200</number>
</property> </property>
...@@ -546,13 +539,6 @@ ...@@ -546,13 +539,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="2">
<widget class="QSpinBox" name="spinBox_SphereGridResolutionY">
<property name="maximum">
<number>200</number>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
</layout> </layout>
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#include "Geometry/vector_gen.h" #include "Geometry/vector_gen.h"
#include "Utils/cgognStream.h" #include "Utils/cgognStream.h"
#include "Utils/shaderMutator.h" #include "Utils/shaderMutator.h"
#include "Utils/drawer.h"
#include <string> #include <string>
#include <sstream> #include <sstream>
#include <vector> #include <vector>
...@@ -56,9 +55,6 @@ public : ...@@ -56,9 +55,6 @@ public :
/// constructor /// constructor
ClippingShader(); ClippingShader();
/// destructor
~ClippingShader();
/*********************************************** /***********************************************
* *
...@@ -156,84 +152,10 @@ private: ...@@ -156,84 +152,10 @@ private:
*/ */
std::vector<float> m_clipPlanesEquations; std::vector<float> m_clipPlanesEquations;
/// clip planes equations vector uniform id /// clip planes equations array uniform id
GLint m_unif_clipPlanesEquations; GLint m_unif_clipPlanesEquations;
/***********************************************
*
* Plane Clipping Display
*
***********************************************/
public:
/// display all clipping planes
void displayClipPlanes();
/**
* set the planes display color
* @param color the new color
*/
void setClipPlanesDisplayColor(Geom::Vec3f color);
/// get the planes display color
Geom::Vec3f getClipPlanesDisplayColor();
/**
* set the planes display grid x resolution
* @param res the new resolution
*/
void setClipPlanesDisplayXRes(size_t res);
/// get the planes display grid x resolution
size_t getClipPlanesDisplayXRes();
/**
* set the planes display grid y resolution
* @param res the new resolution
*/
void setClipPlanesDisplayYRes(size_t res);
/// get the planes display grid y resolution
size_t getClipPlanesDisplayYRes();
/**
* set the planes display size
* @param size the new size
*/
void setClipPlanesDisplaySize(float size);
/// get the planes display size
float getClipPlanesDisplaySize();
private:
/**
* update VBO for one plane
* @param planeIndex index of the plane
*/
void updateClipPlaneVBO(int planeIndex);
/// update VBOs for all planes
void updateClipPlanesVBOs();
/// clip planes drawers array
std::vector<Drawer*> m_clipPlanesDrawers;
/// clip planes display color
Geom::Vec3f m_clipPlanesDisplayColor;
/// clip planes x grid display resolution
size_t m_clipPlanesDisplayXRes;
/// clip planes y grid display resolution
size_t m_clipPlanesDisplayYRes;
/// clip planes display size
float m_clipPlanesDisplaySize;
/*********************************************** /***********************************************
* *
* Sphere Clipping * Sphere Clipping
...@@ -319,68 +241,6 @@ private: ...@@ -319,68 +241,6 @@ private:
GLint m_unif_clipSpheresCentersAndRadiuses; GLint m_unif_clipSpheresCentersAndRadiuses;
/***********************************************
*
* Sphere Clipping Display
*
***********************************************/
public:
/// display all clipping spheres
void displayClipSpheres();
/**
* set the spheres display color
* @param color the new color
*/
void setClipSpheresDisplayColor(Geom::Vec3f color);
/// get the spheres display color
Geom::Vec3f getClipSpheresDisplayColor();
/**
* set the spheres display grid x resolution
* @param res the new resolution
*/
void setClipSpheresDisplayXRes(size_t res);
/// get the spheres display grid x resolution
size_t getClipSpheresDisplayXRes();
/**
* set the spheres display grid y resolution
* @param res the new resolution
*/
void setClipSpheresDisplayYRes(size_t res);
/// get the spheres display grid y resolution
size_t getClipSpheresDisplayYRes();
private:
/**
* update VBO for one sphere
* @param sphereIndex index of the sphere
*/
void updateClipSphereVBO(int sphereIndex);
/// update VBOs for all spheres
void updateClipSpheresVBOs();
/// clip spheres drawers array
std::vector<Drawer*> m_clipSpheresDrawers;
/// clip spheres display color
Geom::Vec3f m_clipSpheresDisplayColor;
/// clip spheres x grid display resolution
size_t m_clipSpheresDisplayXRes;
/// clip spheres y grid display resolution
size_t m_clipSpheresDisplayYRes;
/*********************************************** /***********************************************
* *
* Global Clipping Stuff * Global Clipping Stuff
......
...@@ -45,29 +45,12 @@ ClippingShader::ClippingShader() ...@@ -45,29 +45,12 @@ ClippingShader::ClippingShader()
m_unif_clipSpheresCentersAndRadiuses = 0; m_unif_clipSpheresCentersAndRadiuses = 0;
m_unif_clipColorAttenuationFactor = 0; m_unif_clipColorAttenuationFactor = 0;
// Initialize default display variables
m_clipPlanesDisplayColor = Geom::Vec3f (1.0, 0.6, 0.0);
m_clipPlanesDisplayXRes = 2;
m_clipPlanesDisplayYRes = 2;
m_clipPlanesDisplaySize = 10.0;
m_clipSpheresDisplayColor = Geom::Vec3f (0.0, 0.4, 1.0);
m_clipSpheresDisplayXRes = 15;
m_clipSpheresDisplayYRes = 10;
// Initialize default global clipping variables // Initialize default global clipping variables
m_hasClippingCodeBeenInserted = false; m_hasClippingCodeBeenInserted = false;
m_clipColorAttenuationFactor = 1.0; m_clipColorAttenuationFactor = 1.0;
m_clipMode = CLIPPING_MODE_AND; m_clipMode = CLIPPING_MODE_AND;
} }
ClippingShader::~ClippingShader()
{
// Destroy remaining clip planes drawers
size_t i;
for (i = 0; i < m_clipPlanesDrawers.size(); i++)
delete m_clipPlanesDrawers[i];
}
/*********************************************** /***********************************************
* *
...@@ -110,20 +93,6 @@ void ClippingShader::setClipPlanesCount(int planesCount) ...@@ -110,20 +93,6 @@ void ClippingShader::setClipPlanesCount(int planesCount)
m_clipPlanes.resize((size_t)planesCount); m_clipPlanes.resize((size_t)planesCount);
m_clipPlanesEquations.resize(4*(size_t)planesCount, 0.0); m_clipPlanesEquations.resize(4*(size_t)planesCount, 0.0);
// Resize the planes drawers array to the right size, and create/destroy objects
if (planesCount > previousPlanesCount)
{
m_clipPlanesDrawers.resize((size_t)planesCount, NULL);
for (int i = previousPlanesCount; i < planesCount; i++)
m_clipPlanesDrawers[i] = new Drawer;
}
else
{
for (int i = planesCount; i < previousPlanesCount; i++)
delete m_clipPlanesDrawers[i]; // TODO : Bug dans drawer, crash le prochain affichage
m_clipPlanesDrawers.resize((size_t)planesCount);
}
// Set default parameters values for new planes // Set default parameters values for new planes
if (planesCount > previousPlanesCount) if (planesCount > previousPlanesCount)
{ {
...@@ -171,9 +140,6 @@ void ClippingShader::setClipPlaneParamsAll(Geom::Vec3f vec1, Geom::Vec3f vec2, G ...@@ -171,9 +140,6 @@ void ClippingShader::setClipPlaneParamsAll(Geom::Vec3f vec1, Geom::Vec3f vec2, G
// Send again the whole planes equations array to shader // Send again the whole planes equations array to shader
sendClipPlanesEquationsUniform(); sendClipPlanesEquationsUniform();
// Update plane VBO
updateClipPlaneVBO(planeIndex);
}