24 #ifndef OPENSUBDIV3_VTR_SPARSE_SELECTOR_H 25 #define OPENSUBDIV3_VTR_SPARSE_SELECTOR_H 27 #include "../version.h" 29 #include "../vtr/types.h" 30 #include "../vtr/refinement.h" 35 namespace OPENSUBDIV_VERSION {
57 class SparseSelector {
60 SparseSelector(Refinement& refine) : _refine(&refine), _selected(false) { }
63 void setRefinement(Refinement& refine) { _refine = &refine; }
64 Refinement& getRefinement()
const {
return *_refine; }
66 bool isSelectionEmpty()
const {
return !_selected; }
72 void selectVertex(
Index pVertex);
73 void selectEdge(
Index pEdge);
74 void selectFace(
Index pFace);
77 SparseSelector() : _refine(0), _selected(false) { }
79 bool wasVertexSelected(
Index pVertex)
const {
return _refine->getParentVertexSparseTag(pVertex)._selected; }
80 bool wasEdgeSelected(
Index pEdge)
const {
return _refine->getParentEdgeSparseTag(pEdge)._selected; }
81 bool wasFaceSelected(
Index pFace)
const {
return _refine->getParentFaceSparseTag(pFace)._selected; }
83 void markVertexSelected(
Index pVertex)
const { _refine->getParentVertexSparseTag(pVertex)._selected =
true; }
84 void markEdgeSelected(
Index pEdge)
const { _refine->getParentEdgeSparseTag(pEdge)._selected =
true; }
85 void markFaceSelected(
Index pFace)
const { _refine->getParentFaceSparseTag(pFace)._selected =
true; }
87 void initializeSelection();
98 using namespace OPENSUBDIV_VERSION;