Developer Documentation
VolumeMeshDrawModesContainer.hh
1 /*===========================================================================*\
2  * *
3  * OpenFlipper *
4  * Copyright (c) 2001-2015, RWTH-Aachen University *
5  * Department of Computer Graphics and Multimedia *
6  * All rights reserved. *
7  * www.openflipper.org *
8  * *
9  *---------------------------------------------------------------------------*
10  * This file is part of OpenFlipper. *
11  *---------------------------------------------------------------------------*
12  * *
13  * Redistribution and use in source and binary forms, with or without *
14  * modification, are permitted provided that the following conditions *
15  * are met: *
16  * *
17  * 1. Redistributions of source code must retain the above copyright notice, *
18  * this list of conditions and the following disclaimer. *
19  * *
20  * 2. Redistributions in binary form must reproduce the above copyright *
21  * notice, this list of conditions and the following disclaimer in the *
22  * documentation and/or other materials provided with the distribution. *
23  * *
24  * 3. Neither the name of the copyright holder nor the names of its *
25  * contributors may be used to endorse or promote products derived from *
26  * this software without specific prior written permission. *
27  * *
28  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39  * *
40 \*===========================================================================*/
41 
42 #pragma once
43 
44 #include <ACG/Scenegraph/DrawModes.hh>
45 
46 
51 {
52 public:
54  :
55  cellsFlatShaded(ACG::SceneGraph::DrawModes::addDrawMode("Cells (flat shaded)", true)),
56  cellsSmoothShaded(ACG::SceneGraph::DrawModes::addDrawMode("Cells (smooth shaded)")),
57  cellsPhongShaded(ACG::SceneGraph::DrawModes::addDrawMode("Cells (phong shaded)")),
58  cellsColoredPerCell(ACG::SceneGraph::DrawModes::addDrawMode("Cells (colored per cell)")),
59  cellsColoredPerFace(ACG::SceneGraph::DrawModes::addDrawMode("Cells (colored per face)")),
60  cellsColoredPerHalfface(ACG::SceneGraph::DrawModes::addDrawMode("Cells (colored per halfface)")),
61  cellsColoredPerVertex(ACG::SceneGraph::DrawModes::addDrawMode("Cells (colored per vertex)")),
62  cellsTransparent(ACG::SceneGraph::DrawModes::addDrawMode("Cells (transparent)")),
63 
64  facesFlatShaded(ACG::SceneGraph::DrawModes::addDrawMode("Faces (flat shaded)")),
65  facesSmoothShaded(ACG::SceneGraph::DrawModes::addDrawMode("Faces (smooth shaded)")),
66  facesPhongShaded(ACG::SceneGraph::DrawModes::addDrawMode("Faces (phong shaded)")),
67  facesColoredPerFace(ACG::SceneGraph::DrawModes::addDrawMode("Faces (colored per face)")),
68  facesColoredPerFaceFlatShaded(ACG::SceneGraph::DrawModes::addDrawMode("Faces (colored per face, flat shaded)")),
69  facesColoredPerVertex(ACG::SceneGraph::DrawModes::addDrawMode("Faces (colored per vertex)")),
70  facesTextured(ACG::SceneGraph::DrawModes::addDrawMode("Faces (textured)")),
71  facesTexturedShaded(ACG::SceneGraph::DrawModes::addDrawMode("Faces (textured and shaded)")),
72  facesOnCells(ACG::SceneGraph::DrawModes::addDrawMode("Faces (on cells)")),
73  hiddenLineBackgroundFaces(ACG::SceneGraph::DrawModes::addDrawMode("Hidden line (background colored faces)")),
74 
75  halffacesFlatShaded(ACG::SceneGraph::DrawModes::addDrawMode("Halffaces (flat shaded)")),
76  halffacesSmoothShaded(ACG::SceneGraph::DrawModes::addDrawMode("Halffaces (smooth shaded)")),
77  halffacesPhongShaded(ACG::SceneGraph::DrawModes::addDrawMode("Halffaces (phong shaded)")),
78  halffacesColoredPerHalfface(ACG::SceneGraph::DrawModes::addDrawMode("Halffaces (colored per halfface)")),
79  halffacesColoredPerVertex(ACG::SceneGraph::DrawModes::addDrawMode("Halffaces (colored per vertex)")),
80 
81  edgesWireframe(ACG::SceneGraph::DrawModes::addDrawMode("Edges (wireframe)")),
82  edgesHiddenLine(ACG::SceneGraph::DrawModes::addDrawMode("Edges (hidden line)")),
83  edgesColoredPerEdge(ACG::SceneGraph::DrawModes::addDrawMode("Edges (colored per edge)")),
84  edgesOnCells(ACG::SceneGraph::DrawModes::addDrawMode("Edges (on cells)")),
85 
86  halfedgesWireframe(ACG::SceneGraph::DrawModes::addDrawMode("Halfedges (wireframe)")),
87  halfedgesHiddenLine(ACG::SceneGraph::DrawModes::addDrawMode("Halfedges (hidden line)")),
88  halfedgesColoredPerHalfedge(ACG::SceneGraph::DrawModes::addDrawMode("Halfedges (colored per halfedge)")),
89 
90  verticesFlatShaded(ACG::SceneGraph::DrawModes::addDrawMode("Vertices")),
91  verticesColored(ACG::SceneGraph::DrawModes::addDrawMode("Vertices (colored)")),
92  verticesOnCells(ACG::SceneGraph::DrawModes::addDrawMode("Vertices (on Cells)")),
93 
94  irregularInnerEdges(ACG::SceneGraph::DrawModes::addDrawMode("Irregular edges")),
95  irregularOuterEdges(ACG::SceneGraph::DrawModes::addDrawMode("Irregular outer valence 2 edges")),
96 
97  cellBasedDrawModes(cellsFlatShaded | cellsSmoothShaded | cellsPhongShaded | cellsColoredPerCell | cellsColoredPerFace
98  | cellsColoredPerHalfface | cellsColoredPerVertex | cellsTransparent),
99  faceBasedDrawModes(facesFlatShaded | facesSmoothShaded | facesPhongShaded | facesColoredPerFace | facesColoredPerFaceFlatShaded |
100  facesColoredPerVertex | facesTextured | facesTexturedShaded | hiddenLineBackgroundFaces),
101  halffaceBasedDrawModes(halffacesFlatShaded | halffacesSmoothShaded | halffacesPhongShaded | halffacesColoredPerHalfface
102  | halffacesColoredPerVertex),
103  edgeBasedDrawModes(edgesWireframe | edgesHiddenLine | edgesColoredPerEdge | irregularInnerEdges | irregularOuterEdges | edgesOnCells),
104  halfedgeBasedDrawModes(halfedgesWireframe | halfedgesHiddenLine | halfedgesColoredPerHalfedge),
105  vertexBasedDrawModes(verticesFlatShaded | verticesColored)
106  {
107  }
108 
109 
110  ACG::SceneGraph::DrawModes::DrawMode cellsFlatShaded;
111  ACG::SceneGraph::DrawModes::DrawMode cellsSmoothShaded;
112  ACG::SceneGraph::DrawModes::DrawMode cellsPhongShaded;
113  ACG::SceneGraph::DrawModes::DrawMode cellsColoredPerCell;
114  ACG::SceneGraph::DrawModes::DrawMode cellsColoredPerFace;
115  ACG::SceneGraph::DrawModes::DrawMode cellsColoredPerHalfface;
116  ACG::SceneGraph::DrawModes::DrawMode cellsColoredPerVertex;
117  ACG::SceneGraph::DrawModes::DrawMode cellsTransparent;
118 
119  ACG::SceneGraph::DrawModes::DrawMode facesFlatShaded;
120  ACG::SceneGraph::DrawModes::DrawMode facesSmoothShaded;
121  ACG::SceneGraph::DrawModes::DrawMode facesPhongShaded;
122  ACG::SceneGraph::DrawModes::DrawMode facesColoredPerFace;
123  ACG::SceneGraph::DrawModes::DrawMode facesColoredPerFaceFlatShaded;
124  ACG::SceneGraph::DrawModes::DrawMode facesColoredPerVertex;
126  ACG::SceneGraph::DrawModes::DrawMode facesTexturedShaded;
128  ACG::SceneGraph::DrawModes::DrawMode hiddenLineBackgroundFaces;
129 
130  ACG::SceneGraph::DrawModes::DrawMode halffacesFlatShaded;
131  ACG::SceneGraph::DrawModes::DrawMode halffacesSmoothShaded;
132  ACG::SceneGraph::DrawModes::DrawMode halffacesPhongShaded;
133  ACG::SceneGraph::DrawModes::DrawMode halffacesColoredPerHalfface;
134  ACG::SceneGraph::DrawModes::DrawMode halffacesColoredPerVertex;
135 
137  ACG::SceneGraph::DrawModes::DrawMode edgesHiddenLine;
138  ACG::SceneGraph::DrawModes::DrawMode edgesColoredPerEdge;
140 
141  ACG::SceneGraph::DrawModes::DrawMode halfedgesWireframe;
142  ACG::SceneGraph::DrawModes::DrawMode halfedgesHiddenLine;
143  ACG::SceneGraph::DrawModes::DrawMode halfedgesColoredPerHalfedge;
144 
145  ACG::SceneGraph::DrawModes::DrawMode verticesFlatShaded;
146  ACG::SceneGraph::DrawModes::DrawMode verticesColored;
147  ACG::SceneGraph::DrawModes::DrawMode verticesOnCells;
148 
149  ACG::SceneGraph::DrawModes::DrawMode irregularInnerEdges;
150  ACG::SceneGraph::DrawModes::DrawMode irregularOuterEdges;
151 
152 
153  ACG::SceneGraph::DrawModes::DrawMode cellBasedDrawModes;
154  ACG::SceneGraph::DrawModes::DrawMode faceBasedDrawModes;
155  ACG::SceneGraph::DrawModes::DrawMode halffaceBasedDrawModes;
156  ACG::SceneGraph::DrawModes::DrawMode edgeBasedDrawModes;
157  ACG::SceneGraph::DrawModes::DrawMode halfedgeBasedDrawModes;
158  ACG::SceneGraph::DrawModes::DrawMode vertexBasedDrawModes;
159 
166  {
167  if (cellsFlatShaded & _drawMode) return cellsFlatShaded;
168  if (cellsSmoothShaded & _drawMode) return cellsSmoothShaded;
169  if (cellsPhongShaded & _drawMode) return cellsPhongShaded;
170  if (cellsColoredPerCell & _drawMode) return cellsColoredPerCell;
171  if (cellsColoredPerFace & _drawMode) return cellsColoredPerFace;
172  if (cellsColoredPerHalfface & _drawMode) return cellsColoredPerHalfface;
173  if (cellsColoredPerVertex & _drawMode) return cellsColoredPerVertex;
174  if (cellsTransparent & _drawMode) return cellsTransparent;
176  }
177 
184  {
185  if (facesFlatShaded & _drawMode) return facesFlatShaded;
186  if (facesSmoothShaded & _drawMode) return facesSmoothShaded;
187  if (facesPhongShaded & _drawMode) return facesPhongShaded;
188  if (facesColoredPerFace & _drawMode) return facesColoredPerFace;
189  if (facesColoredPerFaceFlatShaded & _drawMode) return facesColoredPerFaceFlatShaded;
190  if (facesColoredPerFace & _drawMode) return facesColoredPerFace;
191  if (facesColoredPerVertex & _drawMode) return facesColoredPerVertex;
192  if (facesTextured & _drawMode) return facesTextured;
193  if (facesTexturedShaded & _drawMode) return facesTexturedShaded;
194 
195  if (halffacesFlatShaded & _drawMode) return halffacesFlatShaded;
196  if (halffacesSmoothShaded & _drawMode) return halffacesSmoothShaded;
197  if (halffacesPhongShaded & _drawMode) return halffacesPhongShaded;
198  if (halffacesColoredPerHalfface & _drawMode) return halffacesColoredPerHalfface;
199  if (halffacesColoredPerVertex & _drawMode) return halffacesColoredPerVertex;
200 
201  if (hiddenLineBackgroundFaces & _drawMode) return hiddenLineBackgroundFaces;
202  if (edgesHiddenLine & _drawMode) return hiddenLineBackgroundFaces;
203  if (halfedgesHiddenLine & _drawMode) return hiddenLineBackgroundFaces;
205  }
206 
213  {
214  if (edgesWireframe & _drawMode) return edgesWireframe;
215  if (edgesColoredPerEdge & _drawMode) return edgesColoredPerEdge;
216 
217  if (halfedgesWireframe & _drawMode) return halfedgesWireframe;
218  if (halfedgesColoredPerHalfedge & _drawMode) return halfedgesColoredPerHalfedge;
219 
220  if (irregularInnerEdges & _drawMode) return irregularInnerEdges;
221  if (irregularOuterEdges & _drawMode) return irregularOuterEdges;
222 
223  if (edgesHiddenLine & _drawMode) return edgesHiddenLine;
224  if (halfedgesHiddenLine & _drawMode) return halfedgesHiddenLine;
225 
226  if (edgesOnCells & _drawMode) return edgesOnCells;
228  }
229 
236  {
237  if (verticesFlatShaded & _drawMode) return verticesFlatShaded;
238  if (verticesColored & _drawMode) return verticesColored;
239  if (verticesOnCells & _drawMode) return verticesOnCells;
241  }
242 
243 
244 };
ACG::SceneGraph::DrawModes::DrawMode getFirstFaceDrawMode(ACG::SceneGraph::DrawModes::DrawMode _drawMode)
Returns the first face or halfface based draw mode that is present in the given draw mode...
DrawMode NONE
not a valid draw mode
Definition: DrawModes.cc:71
const DrawMode & addDrawMode(const std::string &_name, bool _propertyBased)
Add a custom DrawMode.
Definition: DrawModes.cc:765
ACG::SceneGraph::DrawModes::DrawMode getFirstEdgeDrawMode(ACG::SceneGraph::DrawModes::DrawMode _drawMode)
Returns the first edge or halfedge based draw mode that is present in the given draw mode...
ACG::SceneGraph::DrawModes::DrawMode getFirstVertexDrawMode(ACG::SceneGraph::DrawModes::DrawMode _drawMode)
Returns the first vertex based draw mode that is present in the given draw mode.
This class provides easy access to DrawModes supported by OpenVolumeMesh.
ACG::SceneGraph::DrawModes::DrawMode getFirstCellDrawMode(ACG::SceneGraph::DrawModes::DrawMode _drawMode)
Returns the first cell based draw mode that is present in the given draw mode.