mirror of
https://github.com/lucaspalomodevelop/meshlab.git
synced 2026-03-16 01:24:36 +00:00
- fixed small bug
This commit is contained in:
parent
a213b67109
commit
024098ac8a
@ -475,7 +475,51 @@ void MLSceneGLSharedDataContext::doneCurrentGLContext( QGLContext* oldone /*= NU
|
||||
oldone->makeCurrent();
|
||||
}
|
||||
|
||||
void MLPoliciesStandAloneFunctions::computeRequestedRenderingDataCompatibleWithMeshSameGLOpts(MeshModel* meshmodel, const MLRenderingData& inputdt, MLRenderingData& outputdt)
|
||||
{
|
||||
if (meshmodel == NULL)
|
||||
return;
|
||||
CMeshO& mesh = meshmodel->cm;
|
||||
if (mesh.VN() == 0)
|
||||
{
|
||||
outputdt.reset(false);
|
||||
return;
|
||||
}
|
||||
bool validfaces = (mesh.FN() > 0);
|
||||
|
||||
MLRenderingData::PRIMITIVE_MODALITY_MASK tmpoutputpm = inputdt.getPrimitiveModalityMask();
|
||||
for (size_t pmind = 0; pmind < size_t(MLRenderingData::PR_ARITY); ++pmind)
|
||||
{
|
||||
MLRenderingData::PRIMITIVE_MODALITY pmc = MLRenderingData::PRIMITIVE_MODALITY(pmind);
|
||||
|
||||
|
||||
MLRenderingData::RendAtts tmpoutputatts;
|
||||
if (inputdt.get(MLRenderingData::PRIMITIVE_MODALITY(pmind), tmpoutputatts))
|
||||
{
|
||||
tmpoutputatts[MLRenderingData::ATT_NAMES::ATT_VERTPOSITION] &= meshmodel->hasDataMask(MeshModel::MM_VERTCOORD);
|
||||
tmpoutputatts[MLRenderingData::ATT_NAMES::ATT_VERTNORMAL] &= meshmodel->hasDataMask(MeshModel::MM_VERTNORMAL);
|
||||
tmpoutputatts[MLRenderingData::ATT_NAMES::ATT_FACENORMAL] &= validfaces && meshmodel->hasDataMask(MeshModel::MM_FACENORMAL);
|
||||
tmpoutputatts[MLRenderingData::ATT_NAMES::ATT_VERTCOLOR] &= meshmodel->hasDataMask(MeshModel::MM_VERTCOLOR);
|
||||
tmpoutputatts[MLRenderingData::ATT_NAMES::ATT_FACECOLOR] &= validfaces && meshmodel->hasDataMask(MeshModel::MM_FACECOLOR);
|
||||
|
||||
//horrible trick caused by MeshLab GUI. In MeshLab exists just a button turning on/off the texture visualization.
|
||||
//Unfortunately the RenderMode::textureMode member field is not just a boolean value but and enum one.
|
||||
//The enum-value depends from the enabled attributes of input mesh.
|
||||
bool wedgetexture = meshmodel->hasDataMask(MeshModel::MM_WEDGTEXCOORD);
|
||||
tmpoutputatts[MLRenderingData::ATT_NAMES::ATT_VERTTEXTURE] &= (meshmodel->hasDataMask(MeshModel::MM_VERTTEXCOORD) && (!wedgetexture));
|
||||
tmpoutputatts[MLRenderingData::ATT_NAMES::ATT_WEDGETEXTURE] &= validfaces && wedgetexture;
|
||||
if (MLPoliciesStandAloneFunctions::isPrimitiveModalityCompatibleWithMesh(meshmodel, pmc))
|
||||
outputdt.set(pmc, tmpoutputatts);
|
||||
}
|
||||
else
|
||||
throw MLException(QString("MLPoliciesStandAloneFunctions: trying to access to a non defined PRIMITIVE_MODALITY!"));
|
||||
|
||||
|
||||
}
|
||||
MLPerViewGLOptions opts;
|
||||
inputdt.get(opts);
|
||||
outputdt.set(opts);
|
||||
}
|
||||
|
||||
void MLPoliciesStandAloneFunctions::computeRequestedRenderingDataCompatibleWithMesh( MeshModel* meshmodel,const MLRenderingData& inputdt,MLRenderingData& outputdt)
|
||||
{
|
||||
|
||||
@ -180,7 +180,10 @@ public:
|
||||
|
||||
struct MLPoliciesStandAloneFunctions
|
||||
{
|
||||
static void computeRequestedRenderingDataCompatibleWithMesh( MeshModel* meshmodel,const MLRenderingData& inputdt,MLRenderingData& outputdt);
|
||||
/*WARNING!!!!! TEMPORARY!!! TO BE DELETED*/
|
||||
static void computeRequestedRenderingDataCompatibleWithMeshSameGLOpts(MeshModel * meshmodel, const MLRenderingData & inputdt, MLRenderingData & outputdt);
|
||||
|
||||
static void computeRequestedRenderingDataCompatibleWithMesh( MeshModel* meshmodel,const MLRenderingData& inputdt,MLRenderingData& outputdt);
|
||||
|
||||
static void fromMeshModelMaskToMLRenderingAtts(int meshmodelmask,MLRenderingData::RendAtts& atts);
|
||||
|
||||
|
||||
@ -3467,7 +3467,7 @@ void MainWindow::updateRenderingDataAccordingToActionsCommonCode(int meshid, con
|
||||
}
|
||||
MeshModel* mm = meshDoc()->getMesh(meshid);
|
||||
if (mm != NULL)
|
||||
MLPoliciesStandAloneFunctions::computeRequestedRenderingDataCompatibleWithMesh(mm, dt, dt);
|
||||
MLPoliciesStandAloneFunctions::computeRequestedRenderingDataCompatibleWithMeshSameGLOpts(mm, dt, dt);
|
||||
setRenderingData(meshid, dt);
|
||||
|
||||
/*if (meshid == -1)
|
||||
@ -3507,37 +3507,32 @@ void MainWindow::updateRenderingDataAccordingToActions(int meshid, MLRenderingAc
|
||||
if ((meshDoc() == NULL) || (act == NULL))
|
||||
return;
|
||||
|
||||
if (meshid != -1)
|
||||
updateRenderingDataAccordingToActionsCommonCode(meshid, acts);
|
||||
else
|
||||
QList<MLRenderingAction*> tmpacts;
|
||||
for (int ii = 0; ii < acts.size(); ++ii)
|
||||
{
|
||||
QList<MLRenderingAction*> tmpacts;
|
||||
for (int ii = 0; ii < acts.size(); ++ii)
|
||||
if (acts[ii] != NULL)
|
||||
{
|
||||
if (acts[ii] != NULL)
|
||||
{
|
||||
MLRenderingAction* sisteract = NULL;
|
||||
acts[ii]->createSisterAction(sisteract, NULL);
|
||||
sisteract->setChecked(acts[ii] == act);
|
||||
tmpacts.push_back(sisteract);
|
||||
}
|
||||
MLRenderingAction* sisteract = NULL;
|
||||
acts[ii]->createSisterAction(sisteract, NULL);
|
||||
sisteract->setChecked(acts[ii] == act);
|
||||
tmpacts.push_back(sisteract);
|
||||
}
|
||||
|
||||
for (int hh = 0; hh < meshDoc()->meshList.size(); ++hh)
|
||||
{
|
||||
if (meshDoc()->meshList[hh] != NULL)
|
||||
updateRenderingDataAccordingToActionsCommonCode(meshDoc()->meshList[hh]->id(), tmpacts);
|
||||
}
|
||||
|
||||
for (int ii = 0; ii < tmpacts.size(); ++ii)
|
||||
delete tmpacts[ii];
|
||||
tmpacts.clear();
|
||||
}
|
||||
|
||||
for (int hh = 0; hh < meshDoc()->meshList.size(); ++hh)
|
||||
{
|
||||
if (meshDoc()->meshList[hh] != NULL)
|
||||
updateRenderingDataAccordingToActionsCommonCode(meshDoc()->meshList[hh]->id(), tmpacts);
|
||||
}
|
||||
|
||||
for (int ii = 0; ii < tmpacts.size(); ++ii)
|
||||
delete tmpacts[ii];
|
||||
tmpacts.clear();
|
||||
|
||||
if (GLA() != NULL)
|
||||
GLA()->update();
|
||||
|
||||
if (meshid == -1)
|
||||
updateLayerDialog();
|
||||
updateLayerDialog();
|
||||
}
|
||||
|
||||
|
||||
@ -3554,7 +3549,7 @@ void MainWindow::updateRenderingDataAccordingToActionCommonCode(int meshid, MLRe
|
||||
act->updateRenderingData(dt);
|
||||
MeshModel* mm = meshDoc()->getMesh(meshid);
|
||||
if (mm != NULL)
|
||||
MLPoliciesStandAloneFunctions::computeRequestedRenderingDataCompatibleWithMesh(mm, dt, dt);
|
||||
MLPoliciesStandAloneFunctions::computeRequestedRenderingDataCompatibleWithMeshSameGLOpts(mm, dt, dt);
|
||||
setRenderingData(meshid, dt);
|
||||
if (mm != NULL)
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user