Commit 2fb1071e authored by Martin Heistermann's avatar Martin Heistermann

hide all entity types according to their 'hidden' status

parent 87d84b72
......@@ -316,6 +316,11 @@ private:
/// Calculates for all cells whether they are inside w.r.t. all cut planes
void calculateCellInsideness();
bool should_render(const VertexHandle& _vh);
bool should_render(const HalfEdgeHandle& _heh);
bool should_render(const EdgeHandle& _eh);
bool should_render(const HalfFaceHandle& _hfh);
bool should_render(const FaceHandle& _fh);
bool should_render(const CellHandle& _ch);
......
......@@ -587,9 +587,46 @@ bool VolumeMeshBufferManager<VolumeMesh>::is_inside(const CellHandle& _ch)
return mCellInsideness[_ch.idx()];
}
/**
* @brief Tests whether the given cell should be rendererd.
*/
template <class VolumeMesh>
bool VolumeMeshBufferManager<VolumeMesh>::should_render(const VertexHandle& _vh)
{
if (mStatusAttrib[_vh].hidden())
return false;
return is_inside(_vh);
}
template <class VolumeMesh>
bool VolumeMeshBufferManager<VolumeMesh>::should_render(const HalfEdgeHandle& _heh)
{
if (mStatusAttrib[_heh].hidden())
return false;
return is_inside(_heh);
}
template <class VolumeMesh>
bool VolumeMeshBufferManager<VolumeMesh>::should_render(const EdgeHandle& _eh)
{
if (mStatusAttrib[_eh].hidden())
return false;
return is_inside(_eh);
}
template <class VolumeMesh>
bool VolumeMeshBufferManager<VolumeMesh>::should_render(const HalfFaceHandle& _hfh)
{
if (mStatusAttrib[_hfh].hidden())
return false;
return is_inside(_hfh);
}
template <class VolumeMesh>
bool VolumeMeshBufferManager<VolumeMesh>::should_render(const FaceHandle& _fh)
{
if (mStatusAttrib[_fh].hidden())
return false;
return is_inside(_fh);
}
template <class VolumeMesh>
bool VolumeMeshBufferManager<VolumeMesh>::should_render(const CellHandle& _ch)
{
......@@ -731,7 +768,7 @@ void VolumeMeshBufferManager<VolumeMesh>::countNumOfVertices()
{
OpenVolumeMesh::FaceIter f_begin(mMesh.faces_begin()), f_end(mMesh.faces_end());
for (OpenVolumeMesh::FaceIter f_it = f_begin; f_it != f_end; ++f_it)
if (mStatusAttrib[*f_it].selected() && is_inside(*f_it) && (!mBoundaryOnly || mMesh.is_boundary(*f_it)))
if (mStatusAttrib[*f_it].selected() && should_render(*f_it) && (!mBoundaryOnly || mMesh.is_boundary(*f_it)))
numOfVertices += ((mMesh.valence(*f_it))-2)*3; //additional vertices are added for faces with more than 3 adjacent vertices
}
else if (mPrimitiveMode == PM_FACES_ON_CELLS)
......@@ -745,14 +782,14 @@ void VolumeMeshBufferManager<VolumeMesh>::countNumOfVertices()
{
OpenVolumeMesh::HalfFaceIter hf_begin(mMesh.halffaces_begin()), hf_end(mMesh.halffaces_end());
for (OpenVolumeMesh::HalfFaceIter hf_it = hf_begin; hf_it != hf_end; ++hf_it)
if (mStatusAttrib[*hf_it].selected() && is_inside(*hf_it) && (!mBoundaryOnly || mMesh.is_boundary(*hf_it)))
if (mStatusAttrib[*hf_it].selected() && should_render(*hf_it) && (!mBoundaryOnly || mMesh.is_boundary(*hf_it)))
numOfVertices += ((mMesh.valence(mMesh.face_handle(*hf_it)))-2)*3; //additional vertices are added for faces with more than 3 adjacent vertices
}
else if (mPrimitiveMode == PM_EDGES)
{
OpenVolumeMesh::EdgeIter e_begin(mMesh.edges_begin()), e_end(mMesh.edges_end());
for (OpenVolumeMesh::EdgeIter e_it = e_begin; e_it != e_end; ++e_it)
if (mStatusAttrib[*e_it].selected() && is_inside(*e_it) && (!mBoundaryOnly || mMesh.is_boundary(*e_it)))
if (mStatusAttrib[*e_it].selected() && should_render(*e_it) && (!mBoundaryOnly || mMesh.is_boundary(*e_it)))
numOfVertices += 2;
}
else if (mPrimitiveMode == PM_EDGES_ON_CELLS)
......@@ -766,14 +803,14 @@ void VolumeMeshBufferManager<VolumeMesh>::countNumOfVertices()
{
OpenVolumeMesh::HalfEdgeIter he_begin(mMesh.halfedges_begin()), he_end(mMesh.halfedges_end());
for (OpenVolumeMesh::HalfEdgeIter he_it = he_begin; he_it != he_end; ++he_it)
if (mStatusAttrib[*he_it].selected() && is_inside(*he_it) && (!mBoundaryOnly || mMesh.is_boundary(*he_it)))
if (mStatusAttrib[*he_it].selected() && should_render(*he_it) && (!mBoundaryOnly || mMesh.is_boundary(*he_it)))
numOfVertices += 2;
}
else if (mPrimitiveMode == PM_VERTICES)
{
OpenVolumeMesh::VertexIter v_begin(mMesh.vertices_begin()), v_end(mMesh.vertices_end());
for (OpenVolumeMesh::VertexIter v_it = v_begin; v_it != v_end; ++v_it)
if (mStatusAttrib[*v_it].selected() && is_inside(*v_it) && (!mBoundaryOnly || mMesh.is_boundary(*v_it)))
if (mStatusAttrib[*v_it].selected() && should_render(*v_it) && (!mBoundaryOnly || mMesh.is_boundary(*v_it)))
numOfVertices += 1;
}
else if (mPrimitiveMode == PM_VERTICES_ON_CELLS)
......@@ -794,14 +831,14 @@ void VolumeMeshBufferManager<VolumeMesh>::countNumOfVertices()
else if (mPrimitiveMode == PM_VERTICES)
{
for (unsigned int i = 0; i < mMesh.n_vertices(); i++)
if (is_inside(VertexHandle(i)) && (!mBoundaryOnly || mMesh.is_boundary(VertexHandle(i))))
if (should_render(VertexHandle(i)) && (!mBoundaryOnly || mMesh.is_boundary(VertexHandle(i))))
numOfVertices += 1;
}
else if (mPrimitiveMode == PM_FACES)
{
OpenVolumeMesh::FaceIter f_begin(mMesh.faces_begin()), f_end(mMesh.faces_end());
for (OpenVolumeMesh::FaceIter f_it = f_begin; f_it != f_end; ++f_it)
if (is_inside(*f_it) && (!mBoundaryOnly || mMesh.is_boundary(*f_it)))
if (should_render(*f_it) && (!mBoundaryOnly || mMesh.is_boundary(*f_it)))
numOfVertices += ((mMesh.valence(*f_it))-2)*3; //additional vertices are added for faces with more than 3 adjacent vertices
}
else if (mPrimitiveMode == PM_FACES_ON_CELLS)
......@@ -814,7 +851,7 @@ void VolumeMeshBufferManager<VolumeMesh>::countNumOfVertices()
{
OpenVolumeMesh::HalfFaceIter hf_begin(mMesh.halffaces_begin()), hf_end(mMesh.halffaces_end());
for (OpenVolumeMesh::HalfFaceIter hf_it = hf_begin; hf_it != hf_end; ++hf_it)
if (is_inside(*hf_it) && (!mBoundaryOnly || mMesh.is_boundary(*hf_it)))
if (should_render(*hf_it) && (!mBoundaryOnly || mMesh.is_boundary(*hf_it)))
numOfVertices += ((mMesh.valence(mMesh.face_handle(*hf_it)))-2)*3; //additional vertices are added for faces with more than 3 adjacent vertices
}
else if (mPrimitiveMode == PM_CELLS)
......@@ -838,13 +875,13 @@ void VolumeMeshBufferManager<VolumeMesh>::countNumOfVertices()
else if ( mPrimitiveMode == PM_EDGES ) //all edges are drawn, so irregular ones are already included
{
for (OpenVolumeMesh::EdgeIter e_it = mMesh.edges_begin(); e_it != mMesh.edges_end(); ++e_it)
if (is_inside(*e_it) && (!mBoundaryOnly || mMesh.is_boundary(*e_it)))
if (should_render(*e_it) && (!mBoundaryOnly || mMesh.is_boundary(*e_it)))
numOfVertices += 2;
}
else if ( mPrimitiveMode == PM_IRREGULAR_EDGES )
{
for (OpenVolumeMesh::EdgeIter e_it = mMesh.edges_begin(); e_it != mMesh.edges_end(); ++e_it)
if (is_inside(*e_it) && (!mBoundaryOnly || mMesh.is_boundary(*e_it)))
if (should_render(*e_it) && (!mBoundaryOnly || mMesh.is_boundary(*e_it)))
{
bool boundary = mMesh.is_boundary(*e_it);
unsigned int valence = mMesh.valence(*e_it);
......@@ -864,7 +901,7 @@ void VolumeMeshBufferManager<VolumeMesh>::countNumOfVertices()
else if ( mPrimitiveMode == PM_HALFEDGES )
{
for (OpenVolumeMesh::HalfEdgeIter he_it = mMesh.halfedges_begin(); he_it != mMesh.halfedges_end(); ++he_it)
if (is_inside(*he_it) && (!mBoundaryOnly || mMesh.is_boundary(*he_it)))
if (should_render(*he_it) && (!mBoundaryOnly || mMesh.is_boundary(*he_it)))
numOfVertices += 2;
}
else /*if ( mPrimitiveMode == PM_NONE)*/
......@@ -1062,7 +1099,7 @@ void VolumeMeshBufferManager<VolumeMesh>::buildVertexBuffer(unsigned char* _buff
{
for (unsigned int i = 0; i < mMesh.n_vertices(); ++i) {
if (mSkipUnselected && !mStatusAttrib[VertexHandle(i)].selected()) continue;
if (!is_inside(VertexHandle(i))) continue;
if (!should_render(VertexHandle(i))) continue;
if (mBoundaryOnly && !mMesh.is_boundary(VertexHandle(i))) continue;
ACG::Vec3d p = mMesh.vertex(VertexHandle(i));
addPositionToBuffer(p, _buffer, pos++);
......@@ -1090,7 +1127,7 @@ void VolumeMeshBufferManager<VolumeMesh>::buildVertexBuffer(unsigned char* _buff
{
if (mSkipUnselected && !mStatusAttrib[*f_it].selected()) continue;
if (mBoundaryOnly && !mMesh.is_boundary(*f_it)) continue;
if (!is_inside(*f_it)) continue;
if (!should_render(*f_it)) continue;
vertices.clear();
for (OpenVolumeMesh::HalfFaceVertexIter hfv_it = mMesh.hfv_iter(mMesh.halfface_handle(*f_it,0)); hfv_it; ++hfv_it)
vertices.push_back(mMesh.vertex(*hfv_it));
......@@ -1141,7 +1178,7 @@ void VolumeMeshBufferManager<VolumeMesh>::buildVertexBuffer(unsigned char* _buff
{
if (mSkipUnselected && !mStatusAttrib[*hf_it].selected()) continue;
if (mBoundaryOnly && !mMesh.is_boundary(*hf_it)) continue;
if (!is_inside(*hf_it)) continue;
if (!should_render(*hf_it)) continue;
vertices.clear();
for (OpenVolumeMesh::HalfFaceVertexIter hfv_it = mMesh.hfv_iter(*hf_it); hfv_it; ++hfv_it)
vertices.push_back(mMesh.vertex(*hfv_it));
......@@ -1187,7 +1224,7 @@ void VolumeMeshBufferManager<VolumeMesh>::buildVertexBuffer(unsigned char* _buff
{
if (mSkipUnselected && !mStatusAttrib[*e_it].selected()) continue;
if (mBoundaryOnly && !mMesh.is_boundary(*e_it)) continue;
if (!is_inside(*e_it)) continue;
if (!should_render(*e_it)) continue;
Edge e(mMesh.edge(*e_it));
addPositionToBuffer(mMesh.vertex(e.from_vertex()), _buffer, pos++);
......@@ -1222,7 +1259,7 @@ void VolumeMeshBufferManager<VolumeMesh>::buildVertexBuffer(unsigned char* _buff
{
if (mSkipUnselected && !mStatusAttrib[*e_it].selected()) continue;
if (mBoundaryOnly && !mMesh.is_boundary(*e_it)) continue;
if (!is_inside(*e_it)) continue;
if (!should_render(*e_it)) continue;
bool boundary = mMesh.is_boundary(*e_it);
unsigned int valence = mMesh.valence(*e_it);
......@@ -1248,7 +1285,7 @@ void VolumeMeshBufferManager<VolumeMesh>::buildVertexBuffer(unsigned char* _buff
{
if (mSkipUnselected && !mStatusAttrib[*he_it].selected()) continue;
if (mBoundaryOnly && !mMesh.is_boundary(*he_it)) continue;
if (!is_inside(*he_it)) continue;
if (!should_render(*he_it)) continue;
double lambda = 0.4;
Edge e(mMesh.halfedge(*he_it));
......@@ -1280,7 +1317,7 @@ void VolumeMeshBufferManager<VolumeMesh>::buildNormalBuffer(unsigned char* _buff
for (OpenVolumeMesh::FaceIter f_it = f_begin; f_it != f_end; ++f_it)
{
if (mBoundaryOnly && !mMesh.is_boundary(*f_it)) continue;
if (!is_inside(*f_it)) continue;
if (!should_render(*f_it)) continue;
ACG::Vec3d normal = mNormalAttrib[*f_it];
unsigned int numOfVerticesInFace = mMesh.valence(*f_it);
......@@ -1299,7 +1336,7 @@ void VolumeMeshBufferManager<VolumeMesh>::buildNormalBuffer(unsigned char* _buff
for (OpenVolumeMesh::FaceIter f_it = f_begin; f_it != f_end; ++f_it)
{
if (mBoundaryOnly && !mMesh.is_boundary(*f_it)) continue;
if (!is_inside(*f_it)) continue;
if (!should_render(*f_it)) continue;
normals.clear();
for (OpenVolumeMesh::HalfFaceVertexIter hfv_it = mMesh.hfv_iter(mMesh.halfface_handle(*f_it,0)); hfv_it; ++hfv_it)
normals.push_back(mNormalAttrib[*hfv_it]);
......@@ -1318,7 +1355,7 @@ void VolumeMeshBufferManager<VolumeMesh>::buildNormalBuffer(unsigned char* _buff
for (OpenVolumeMesh::HalfFaceIter hf_it = hf_begin; hf_it != hf_end; ++hf_it)
{
if (mBoundaryOnly && !mMesh.is_boundary(*hf_it)) continue;
if (!is_inside(*hf_it)) continue;
if (!should_render(*hf_it)) continue;
ACG::Vec3d normal = mNormalAttrib[*hf_it];
unsigned int numOfVerticesInCell = 0;
for (OpenVolumeMesh::HalfFaceVertexIter hfv_it = mMesh.hfv_iter(*hf_it); hfv_it; ++hfv_it)
......@@ -1339,7 +1376,7 @@ void VolumeMeshBufferManager<VolumeMesh>::buildNormalBuffer(unsigned char* _buff
for (OpenVolumeMesh::HalfFaceIter hf_it = hf_begin; hf_it != hf_end; ++hf_it)
{
if (mBoundaryOnly && !mMesh.is_boundary(*hf_it)) continue;
if (!is_inside(*hf_it)) continue;
if (!should_render(*hf_it)) continue;
normals.clear();
for (OpenVolumeMesh::HalfFaceVertexIter hfv_it = mMesh.hfv_iter(*hf_it); hfv_it; ++hfv_it)
normals.push_back(mNormalAttrib[*hfv_it]);
......@@ -1415,7 +1452,7 @@ void VolumeMeshBufferManager<VolumeMesh>::buildColorBuffer(unsigned char* _buffe
for (unsigned int i = 0; i < mMesh.n_vertices(); ++i)
{
if (mBoundaryOnly && !mMesh.is_boundary(VertexHandle(i))) continue;
if (!is_inside(VertexHandle(i))) continue;
if (!should_render(VertexHandle(i))) continue;
ACG::Vec4f color = mColorAttrib[VertexHandle(i)];
addColorToBuffer(color, _buffer, pos++);
}
......@@ -1427,7 +1464,7 @@ void VolumeMeshBufferManager<VolumeMesh>::buildColorBuffer(unsigned char* _buffe
for (OpenVolumeMesh::FaceIter f_it = f_begin; f_it != f_end; ++f_it)
{
if (mBoundaryOnly && !mMesh.is_boundary(*f_it)) continue;
if (!is_inside(*f_it)) continue;
if (!should_render(*f_it)) continue;
colors.clear();
for (OpenVolumeMesh::HalfFaceVertexIter hfv_it = mMesh.hfv_iter(mMesh.halfface_handle(*f_it,0)); hfv_it; ++hfv_it)
......@@ -1447,7 +1484,7 @@ void VolumeMeshBufferManager<VolumeMesh>::buildColorBuffer(unsigned char* _buffe
for (OpenVolumeMesh::FaceIter f_it = f_begin; f_it != f_end; ++f_it)
{
if (mBoundaryOnly && !mMesh.is_boundary(*f_it)) continue;
if (!is_inside(*f_it)) continue;
if (!should_render(*f_it)) continue;
ACG::Vec4f color = mColorAttrib[*f_it];
unsigned int numOfVerticesInFace = mMesh.valence(*f_it);
......@@ -1463,7 +1500,7 @@ void VolumeMeshBufferManager<VolumeMesh>::buildColorBuffer(unsigned char* _buffe
for (OpenVolumeMesh::HalfFaceIter hf_it = hf_begin; hf_it != hf_end; ++hf_it)
{
if (mBoundaryOnly && !mMesh.is_boundary(*hf_it)) continue;
if (!is_inside(*hf_it)) continue;
if (!should_render(*hf_it)) continue;
ACG::Vec4f color = mColorAttrib[*hf_it];
unsigned int numOfVerticesInFace = mMesh.valence(mMesh.face_handle(*hf_it));
......@@ -1480,7 +1517,7 @@ void VolumeMeshBufferManager<VolumeMesh>::buildColorBuffer(unsigned char* _buffe
for (OpenVolumeMesh::HalfFaceIter hf_it = hf_begin; hf_it != hf_end; ++hf_it)
{
if (mBoundaryOnly && !mMesh.is_boundary(*hf_it)) continue;
if (!is_inside(*hf_it)) continue;
if (!should_render(*hf_it)) continue;
colors.clear();
for (OpenVolumeMesh::HalfFaceVertexIter hfv_it = mMesh.hfv_iter(*hf_it); hfv_it; ++hfv_it)
......@@ -1583,7 +1620,7 @@ void VolumeMeshBufferManager<VolumeMesh>::buildColorBuffer(unsigned char* _buffe
for (OpenVolumeMesh::EdgeIter e_it = e_begin; e_it != e_end; ++e_it)
{
if (mBoundaryOnly && !mMesh.is_boundary(*e_it)) continue;
if (!is_inside(*e_it)) continue;
if (!should_render(*e_it)) continue;
ACG::Vec4f color = mColorAttrib[*e_it];
addColorToBuffer(color, _buffer, pos++);
addColorToBuffer(color, _buffer, pos++);
......@@ -1595,7 +1632,7 @@ void VolumeMeshBufferManager<VolumeMesh>::buildColorBuffer(unsigned char* _buffe
for (OpenVolumeMesh::EdgeIter e_it = e_begin; e_it != e_end; ++e_it)
{
if (mBoundaryOnly && !mMesh.is_boundary(*e_it)) continue;
if (!is_inside(*e_it)) continue;
if (!should_render(*e_it)) continue;
bool boundary = mMesh.is_boundary(*e_it);
unsigned int valence = mMesh.valence(*e_it);
......@@ -1622,7 +1659,7 @@ void VolumeMeshBufferManager<VolumeMesh>::buildColorBuffer(unsigned char* _buffe
for (OpenVolumeMesh::EdgeIter e_it = e_begin; e_it != e_end; ++e_it)
{
if (mBoundaryOnly && !mMesh.is_boundary(*e_it)) continue;
if (!is_inside(*e_it)) continue;
if (!should_render(*e_it)) continue;
bool boundary = mMesh.is_boundary(*e_it);
unsigned int valence = mMesh.valence(*e_it);
......@@ -1654,7 +1691,7 @@ void VolumeMeshBufferManager<VolumeMesh>::buildColorBuffer(unsigned char* _buffe
for (OpenVolumeMesh::HalfEdgeIter he_it = he_begin; he_it != he_end; ++he_it)
{
if (mBoundaryOnly && !mMesh.is_boundary(*he_it)) continue;
if (!is_inside(*he_it)) continue;
if (!should_render(*he_it)) continue;
ACG::Vec4f color = mColorAttrib[*he_it];
addColorToBuffer(color, _buffer, pos++);
......@@ -1685,7 +1722,7 @@ void VolumeMeshBufferManager<VolumeMesh>::buildTexCoordBuffer(unsigned char* _bu
for (OpenVolumeMesh::FaceIter f_it = f_begin; f_it != f_end; ++f_it)
{
if (mBoundaryOnly && !mMesh.is_boundary(*f_it)) continue;
if (!is_inside(*f_it)) continue;
if (!should_render(*f_it)) continue;
texCoords.clear();
for (OpenVolumeMesh::HalfFaceVertexIter hfv_it = mMesh.hfv_iter(mMesh.halfface_handle(*f_it,0)); hfv_it; ++hfv_it)
......@@ -1706,7 +1743,7 @@ void VolumeMeshBufferManager<VolumeMesh>::buildTexCoordBuffer(unsigned char* _bu
for (OpenVolumeMesh::HalfFaceIter hf_it = hf_begin; hf_it != hf_end; ++hf_it)
{
if (mBoundaryOnly && !mMesh.is_boundary(*hf_it)) continue;
if (!is_inside(*hf_it)) continue;
if (!should_render(*hf_it)) continue;
texCoords.clear();
for (OpenVolumeMesh::HalfFaceVertexIter hfv_it = mMesh.hfv_iter(*hf_it); hfv_it; ++hfv_it)
......@@ -1741,7 +1778,7 @@ void VolumeMeshBufferManager<VolumeMesh>::buildPickColorBuffer(ACG::GLState& _st
for (unsigned int i = 0; i < mMesh.n_vertices(); ++i)
{
if (mBoundaryOnly && !mMesh.is_boundary(VertexHandle(i))) continue;
if (!is_inside(VertexHandle(i))) continue;
if (!should_render(VertexHandle(i))) continue;
ACG::Vec4uc color = _state.pick_get_name_color(VertexHandle(i).idx() + _offset);
addColorToBuffer(color, _buffer, pos++);
}
......@@ -1761,7 +1798,7 @@ void VolumeMeshBufferManager<VolumeMesh>::buildPickColorBuffer(ACG::GLState& _st
for (OpenVolumeMesh::EdgeIter e_it = e_begin; e_it != e_end; ++e_it)
{
if (mBoundaryOnly && !mMesh.is_boundary(*e_it)) continue;
if (!is_inside(*e_it)) continue;
if (!should_render(*e_it)) continue;
ACG::Vec4uc color = _state.pick_get_name_color(e_it->idx()+_offset);
addColorToBuffer(color, _buffer, pos++);
addColorToBuffer(color, _buffer, pos++);
......@@ -1784,7 +1821,7 @@ void VolumeMeshBufferManager<VolumeMesh>::buildPickColorBuffer(ACG::GLState& _st
for (OpenVolumeMesh::FaceIter f_it = f_begin; f_it != f_end; ++f_it)
{
if (mBoundaryOnly && !mMesh.is_boundary(*f_it)) continue;
if (!is_inside(*f_it)) continue;
if (!should_render(*f_it)) continue;
ACG::Vec4uc color = _state.pick_get_name_color(f_it->idx());
unsigned int numOfVertices = 0;
......
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