mirror of
https://github.com/lucaspalomodevelop/meshlab.git
synced 2026-03-16 17:44:36 +00:00
- Huge Commit! added per mesh rendering mode system!
Warning! there is a major drawback with the MeshRenderingInterface plugins. It will be fixed as soon as possible.
This commit is contained in:
parent
e212352d45
commit
a5d5d5eb56
@ -182,7 +182,7 @@ MeshModel * MeshDocument::addNewMesh(QString fullPath, QString label, bool setAs
|
||||
MeshModel *newMesh = new MeshModel(this,qPrintable(fullPath),newlabel);
|
||||
meshList.push_back(newMesh);
|
||||
emit meshSetChanged();
|
||||
|
||||
emit meshAdded(newMesh->id());
|
||||
if(setAsCurrent)
|
||||
this->setCurrentMesh(newMesh->id());
|
||||
return newMesh;
|
||||
@ -197,9 +197,11 @@ bool MeshDocument::delMesh(MeshModel *mmToDel)
|
||||
else if (meshList.size() == 0)
|
||||
setCurrentMesh(-1);
|
||||
|
||||
int index = mmToDel->id();
|
||||
delete mmToDel;
|
||||
|
||||
emit meshSetChanged();
|
||||
emit meshRemoved(index);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -711,16 +713,20 @@ bool MeshLabRenderMesh::render(vcg::GLW::DrawMode dm,vcg::GLW::ColorMode colm,vc
|
||||
{
|
||||
if (glw.m != NULL)
|
||||
{
|
||||
glPushAttrib(GL_ALL_ATTRIB_BITS);
|
||||
glPushMatrix();
|
||||
glMultMatrix(glw.m->Tr);
|
||||
if( (colm == vcg::GLW::CMPerFace) && (!vcg::tri::HasPerFaceColor(*glw.m)) )
|
||||
colm=vcg::GLW::CMNone;
|
||||
if( (tm == vcg::GLW::TMPerWedge )&& (!vcg::tri::HasPerWedgeTexCoord(*glw.m)) )
|
||||
tm=vcg::GLW::TMNone;
|
||||
if( (tm == vcg::GLW::TMPerWedgeMulti )&& (!vcg::tri::HasPerWedgeTexCoord(*glw.m)) )
|
||||
if( (tm == vcg::GLW::TMPerWedgeMulti )&& (!vcg::tri::HasPerWedgeTexCoord(*glw.m)))
|
||||
tm=vcg::GLW::TMNone;
|
||||
if( (tm == vcg::GLW::TMPerVert )&& (!vcg::tri::HasPerVertexTexCoord(*glw.m)))
|
||||
tm=vcg::GLW::TMNone;
|
||||
glw.Draw(dm,colm,tm);
|
||||
glPopMatrix();
|
||||
glPopAttrib();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -1006,7 +1012,9 @@ void MeshLabRenderState::copyBack( const int /*id*/,CMeshO& /*mm*/ ) const
|
||||
void MeshLabRenderState::render( const int id,vcg::GLW::DrawMode dm,vcg::GLW::ColorMode cm,vcg::GLW::TextureMode tm )
|
||||
{
|
||||
lockRenderState(MESH,READ);
|
||||
_meshmap[id]->render(dm,cm,tm);
|
||||
QMap<int,MeshLabRenderMesh*>::const_iterator it = _meshmap.find(id);
|
||||
if (it != _meshmap.end())
|
||||
it.value()->render(dm,cm,tm);
|
||||
unlockRenderState(MESH);
|
||||
}
|
||||
|
||||
|
||||
@ -142,6 +142,7 @@ public:
|
||||
|
||||
vcg::GlTrimesh<CMeshO> glw;
|
||||
CMeshO cm;
|
||||
//RenderMode rm;
|
||||
};
|
||||
|
||||
/*
|
||||
@ -424,6 +425,50 @@ public:
|
||||
selectedVert=false;
|
||||
}
|
||||
|
||||
inline void setDrawMode(const vcg::GLW::DrawMode dm)
|
||||
{
|
||||
drawMode = dm;
|
||||
}
|
||||
|
||||
inline void setColorMode(const vcg::GLW::ColorMode cm)
|
||||
{
|
||||
colorMode = cm;
|
||||
}
|
||||
|
||||
inline void setTextureMode(const vcg::GLW::TextureMode tm)
|
||||
{
|
||||
textureMode = tm;
|
||||
}
|
||||
|
||||
inline void setLighting(const bool ison)
|
||||
{
|
||||
lighting = ison;
|
||||
}
|
||||
|
||||
inline void setBackFaceCull(const bool ison)
|
||||
{
|
||||
backFaceCull = ison;
|
||||
}
|
||||
|
||||
inline void setDoubleFaceLighting(const bool ison)
|
||||
{
|
||||
doubleSideLighting = ison;
|
||||
}
|
||||
|
||||
inline void setFancyLighting(const bool ison)
|
||||
{
|
||||
fancyLighting = ison;
|
||||
}
|
||||
|
||||
inline void setSelectedFaceRendering(const bool ison)
|
||||
{
|
||||
selectedFace = ison;
|
||||
}
|
||||
|
||||
inline void setSelectedVertRendering(const bool ison)
|
||||
{
|
||||
selectedVert = ison;
|
||||
}
|
||||
}; // end class RenderMode
|
||||
|
||||
class MeshLabRenderState //: public QObject
|
||||
@ -632,6 +677,8 @@ private:
|
||||
//the current raster model
|
||||
RasterModel* currentRaster;
|
||||
|
||||
|
||||
|
||||
signals:
|
||||
///whenever the current mesh is changed (e.g. the user click on a different mesh)
|
||||
// this signal will send out with the index of the newest mesh
|
||||
@ -642,6 +689,8 @@ signals:
|
||||
|
||||
///whenever the meshList is changed
|
||||
void meshSetChanged();
|
||||
void meshAdded(int index);
|
||||
void meshRemoved(int index);
|
||||
|
||||
///whenever the rasterList is changed
|
||||
void rasterSetChanged();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user