mirror of
https://github.com/lucaspalomodevelop/meshlab.git
synced 2026-03-17 01:54:42 +00:00
- updated the plugins code using the new per mesh rendering system.
This code will be changed again as soon as possible in order to prevent any possible concurrent access to the mesh rendering map.
This commit is contained in:
parent
fae46d91ed
commit
93b65ec6df
@ -617,6 +617,8 @@ void DecorateRasterProjPlugin::decorateDoc( QAction *act,
|
||||
{
|
||||
case DP_PROJECT_RASTER:
|
||||
{
|
||||
if ((gla == NULL) || (gla->getCurrentRenderMode()))
|
||||
return;
|
||||
glPushAttrib( GL_ALL_ATTRIB_BITS );
|
||||
|
||||
updateCurrentMesh( m, *par );
|
||||
@ -624,7 +626,7 @@ void DecorateRasterProjPlugin::decorateDoc( QAction *act,
|
||||
|
||||
glEnable( GL_DEPTH_TEST );
|
||||
|
||||
RenderMode rm = gla->getCurrentRenderMode();
|
||||
RenderMode rm = *gla->getCurrentRenderMode();
|
||||
bool notDrawn = false;
|
||||
switch( rm.drawMode )
|
||||
{
|
||||
|
||||
@ -114,6 +114,8 @@ void ShadowMapping::renderingFromLightUnsetup(){
|
||||
void ShadowMapping::runShader(MeshDocument& md, GLArea* gla){
|
||||
GLfloat g_mModelView[16];
|
||||
GLfloat g_mProjection[16];
|
||||
if ((gla == NULL) || (gla->getCurrentRenderMode() == NULL))
|
||||
return;
|
||||
|
||||
this->renderingFromLightSetup(md, gla);
|
||||
|
||||
@ -133,7 +135,7 @@ void ShadowMapping::runShader(MeshDocument& md, GLArea* gla){
|
||||
//binding the FBO
|
||||
this->bind();
|
||||
|
||||
RenderMode rm = gla->getCurrentRenderMode();
|
||||
RenderMode rm = *gla->getCurrentRenderMode();
|
||||
foreach(MeshModel *m, md.meshList)
|
||||
if(m->visible)
|
||||
{
|
||||
|
||||
@ -113,9 +113,11 @@ void SSAO::runShader(MeshDocument& md, GLArea* gla){
|
||||
/***********************************************************/
|
||||
//NORMAL MAP and DEPTH MAP generation
|
||||
/***********************************************************/
|
||||
if ((gla == NULL) || (gla->getCurrentRenderMode() == NULL))
|
||||
return;
|
||||
this->bind();
|
||||
glUseProgram(this->_normalMapShaderProgram);
|
||||
RenderMode rm = gla->getCurrentRenderMode();
|
||||
RenderMode rm = *gla->getCurrentRenderMode();
|
||||
|
||||
vcg::Matrix44f mProj, mInverseProj;
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
|
||||
@ -70,6 +70,8 @@ bool VarianceShadowMapping::init()
|
||||
void VarianceShadowMapping::runShader(MeshDocument& md, GLArea* gla){
|
||||
GLfloat g_mModelView[16];
|
||||
GLfloat g_mProjection[16];
|
||||
if ((gla == NULL) || (gla->getCurrentRenderMode() == NULL))
|
||||
return;
|
||||
|
||||
this->renderingFromLightSetup(md, gla);
|
||||
|
||||
@ -87,7 +89,7 @@ void VarianceShadowMapping::runShader(MeshDocument& md, GLArea* gla){
|
||||
this->bind();
|
||||
|
||||
glUseProgram(this->_depthShaderProgram);
|
||||
RenderMode rm = gla->getCurrentRenderMode();
|
||||
RenderMode rm = *gla->getCurrentRenderMode();
|
||||
foreach(MeshModel *m, md.meshList)
|
||||
if(m->visible)
|
||||
{
|
||||
|
||||
@ -76,6 +76,8 @@ void VarianceShadowMappingBlur::runShader(MeshDocument& md, GLArea* gla){
|
||||
GLfloat g_mModelView[16];
|
||||
GLfloat g_mProjection[16];
|
||||
|
||||
if ((gla == NULL) || (gla->getCurrentRenderMode() == NULL))
|
||||
return;
|
||||
this->renderingFromLightSetup(md, gla);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glGetFloatv(GL_PROJECTION_MATRIX, g_mProjection);
|
||||
@ -89,7 +91,7 @@ void VarianceShadowMappingBlur::runShader(MeshDocument& md, GLArea* gla){
|
||||
|
||||
this->bind();
|
||||
glUseProgram(this->_depthShaderProgram);
|
||||
RenderMode rm = gla->getCurrentRenderMode();
|
||||
RenderMode rm = *gla->getCurrentRenderMode();
|
||||
glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
foreach(MeshModel *m, md.meshList)
|
||||
|
||||
@ -57,12 +57,15 @@ void EditAlignPlugin::Decorate(MeshModel &m, GLArea * gla)
|
||||
case ALIGN_MOVE:
|
||||
{
|
||||
// Draw the editing mesh
|
||||
gla->rm.colorMode=GLW::CMPerMesh;
|
||||
QMap<int,RenderMode>::iterator it = gla->rendermodemap.find(m.id());
|
||||
if (it == gla->rendermodemap.end())
|
||||
return;
|
||||
it.value().colorMode = GLW::CMPerMesh;
|
||||
m.visible=false;
|
||||
glPushMatrix();
|
||||
trackball.GetView();
|
||||
trackball.Apply();
|
||||
m.render(GLW::DMFlat,GLW::CMPerMesh,gla->rm.textureMode);
|
||||
m.render(GLW::DMFlat,GLW::CMPerMesh,it.value().textureMode);
|
||||
glPopMatrix();
|
||||
break;
|
||||
}
|
||||
@ -100,7 +103,8 @@ bool EditAlignPlugin::StartEdit(MeshDocument &_md, GLArea *_gla )
|
||||
mm->cm.C()=Color4b::Scatter(51, mm->id()%50, .2f, .7f);
|
||||
meshTree.nodeList.push_back(new MeshNode(mm));
|
||||
}
|
||||
gla->rm.colorMode=GLW::CMPerMesh;
|
||||
for(QMap<int,RenderMode>::iterator it = _gla->rendermodemap.begin();it != _gla->rendermodemap.end();++it)
|
||||
it.value().colorMode=GLW::CMPerMesh;
|
||||
|
||||
gla->setCursor(QCursor(QPixmap(":/images/cur_align.png"),1,1));
|
||||
if(alignDialog==0)
|
||||
@ -487,9 +491,12 @@ void EditAlignPlugin::DrawArc(vcg::AlignPair::Result *A )
|
||||
|
||||
void EditAlignPlugin::toggledColors(int colorstate)
|
||||
{
|
||||
if(colorstate == Qt::Checked)
|
||||
gla->rm.colorMode=GLW::CMPerMesh;
|
||||
else
|
||||
gla->rm.colorMode=GLW::CMPerVert;
|
||||
for(QMap<int,RenderMode>::iterator it = gla->rendermodemap.begin();it != gla->rendermodemap.end();++it)
|
||||
{
|
||||
if(colorstate == Qt::Checked)
|
||||
it.value().colorMode=GLW::CMPerMesh;
|
||||
else
|
||||
it.value().colorMode=GLW::CMPerVert;
|
||||
}
|
||||
gla->update();
|
||||
}
|
||||
|
||||
@ -139,6 +139,8 @@ This is the main function, which generates the final mesh (and the rasters) base
|
||||
|
||||
void EditArc3DPlugin::ExportPly()
|
||||
{
|
||||
if ((gla == NULL) || (gla->getCurrentRenderMode() == NULL))
|
||||
return;
|
||||
md->setBusy(true);
|
||||
md->addNewMesh("",er.name,true);
|
||||
MeshModel* m=md->mm();
|
||||
@ -244,7 +246,7 @@ void EditArc3DPlugin::ExportPly()
|
||||
|
||||
md->mm()->visible=true;
|
||||
md->setBusy(false);
|
||||
gla->rm.colorMode=GLW::CMPerVert;
|
||||
gla->getCurrentRenderMode()->colorMode=GLW::CMPerVert;
|
||||
emit this->resetTrackBall();
|
||||
gla->update();
|
||||
|
||||
|
||||
@ -68,8 +68,10 @@ bool EditPaintPlugin::StartEdit(MeshModel& m, GLArea * parent)
|
||||
}
|
||||
tri::InitFaceIMark(m.cm);
|
||||
tri::InitVertexIMark(m.cm);
|
||||
|
||||
parent->getCurrentRenderMode().colorMode=vcg::GLW::CMPerVert;
|
||||
QMap<int,RenderMode>::iterator it = parent->rendermodemap.find(m.id());
|
||||
if (it == parent->rendermodemap.end())
|
||||
return false;
|
||||
it.value().colorMode=vcg::GLW::CMPerVert;
|
||||
|
||||
QObject::connect(paintbox, SIGNAL(undo()), this, SLOT(update()));
|
||||
QObject::connect(paintbox, SIGNAL(redo()), this, SLOT(update()));
|
||||
@ -290,7 +292,10 @@ void EditPaintPlugin::Decorate(MeshModel &m, GLArea * gla)
|
||||
if (color_buffer != NULL) delete color_buffer;
|
||||
if (clone_zbuffer != NULL) delete clone_zbuffer;
|
||||
color_buffer = NULL, clone_zbuffer = NULL;
|
||||
glarea->getCurrentRenderMode().lighting = false;
|
||||
QMap<int,RenderMode>::iterator it = glarea->rendermodemap.find(m.id());
|
||||
if (it == glarea->rendermodemap.end())
|
||||
return;
|
||||
it.value().lighting = false;
|
||||
current_options &= ~EPP_DRAW_CURSOR;
|
||||
glarea->update();
|
||||
}
|
||||
@ -642,7 +647,9 @@ inline void EditPaintPlugin::capture()
|
||||
image.setPixel(x, glarea->height() - y -1, qRgba((int)color_buffer[index], (int)color_buffer[index + 1], (int)color_buffer[index + 2], (int)color_buffer[index + 3]));
|
||||
}
|
||||
}
|
||||
glarea->getCurrentRenderMode().lighting = true;
|
||||
if (glarea->getCurrentRenderMode() == NULL)
|
||||
return;
|
||||
glarea->getCurrentRenderMode()->lighting = true;
|
||||
current_options |= EPP_DRAW_CURSOR;
|
||||
paintbox->setClonePixmap(image);
|
||||
paintbox->setPixmapDelta(source_delta.x(), source_delta.y());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user