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 /*===========================================================================*\
43 * *
44 * $Revision$ *
45 * $LastChangedBy$ *
46 * $Date$ *
47 * *
48 \*===========================================================================*/
49 
50 #ifndef VOLUMEMESHDRAWMODESCONTAINER_HH
51 #define VOLUMEMESHDRAWMODESCONTAINER_HH
52 
53 #include <ACG/Scenegraph/DrawModes.hh>
54 
55 
60 {
61 public:
63  :
64  cellsFlatShaded(ACG::SceneGraph::DrawModes::addDrawMode("Cells (flat shaded)", true)),
65  cellsSmoothShaded(ACG::SceneGraph::DrawModes::addDrawMode("Cells (smooth shaded)")),
66  cellsPhongShaded(ACG::SceneGraph::DrawModes::addDrawMode("Cells (phong shaded)")),
67  cellsColoredPerCell(ACG::SceneGraph::DrawModes::addDrawMode("Cells (colored per cell)")),
68  cellsColoredPerFace(ACG::SceneGraph::DrawModes::addDrawMode("Cells (colored per face)")),
69  cellsColoredPerHalfface(ACG::SceneGraph::DrawModes::addDrawMode("Cells (colored per halfface)")),
70  cellsColoredPerVertex(ACG::SceneGraph::DrawModes::addDrawMode("Cells (colored per vertex)")),
71  cellsTransparent(ACG::SceneGraph::DrawModes::addDrawMode("Cells (transparent)")),
72 
73  facesFlatShaded(ACG::SceneGraph::DrawModes::addDrawMode("Faces (flat shaded)")),
74  facesSmoothShaded(ACG::SceneGraph::DrawModes::addDrawMode("Faces (smooth shaded)")),
75  facesPhongShaded(ACG::SceneGraph::DrawModes::addDrawMode("Faces (phong shaded)")),
76  facesColoredPerFace(ACG::SceneGraph::DrawModes::addDrawMode("Faces (colored per face)")),
77  facesColoredPerVertex(ACG::SceneGraph::DrawModes::addDrawMode("Faces (colored per vertex)")),
78  facesTextured(ACG::SceneGraph::DrawModes::addDrawMode("Faces (textured)")),
79  facesTexturedShaded(ACG::SceneGraph::DrawModes::addDrawMode("Faces (textured and shaded)")),
80  facesOnCells(ACG::SceneGraph::DrawModes::addDrawMode("Faces (on cells)")),
81  hiddenLineBackgroundFaces(ACG::SceneGraph::DrawModes::addDrawMode("Hidden line (background colored faces)")),
82 
83  halffacesFlatShaded(ACG::SceneGraph::DrawModes::addDrawMode("Halffaces (flat shaded)")),
84  halffacesSmoothShaded(ACG::SceneGraph::DrawModes::addDrawMode("Halffaces (smooth shaded)")),
85  halffacesPhongShaded(ACG::SceneGraph::DrawModes::addDrawMode("Halffaces (phong shaded)")),
86  halffacesColoredPerHalfface(ACG::SceneGraph::DrawModes::addDrawMode("Halffaces (colored per halfface)")),
87  halffacesColoredPerVertex(ACG::SceneGraph::DrawModes::addDrawMode("Halffaces (colored per vertex)")),
88 
89  edgesWireframe(ACG::SceneGraph::DrawModes::addDrawMode("Edges (wireframe)")),
90  edgesHiddenLine(ACG::SceneGraph::DrawModes::addDrawMode("Edges (hidden line)")),
91  edgesColoredPerEdge(ACG::SceneGraph::DrawModes::addDrawMode("Edges (colored per edge)")),
92  edgesOnCells(ACG::SceneGraph::DrawModes::addDrawMode("Edges (on cells)")),
93 
94  halfedgesWireframe(ACG::SceneGraph::DrawModes::addDrawMode("Halfedges (wireframe)")),
95  halfedgesHiddenLine(ACG::SceneGraph::DrawModes::addDrawMode("Halfedges (hidden line)")),
96  halfedgesColoredPerHalfedge(ACG::SceneGraph::DrawModes::addDrawMode("Halfedges (colored per halfedge)")),
97 
98  verticesFlatShaded(ACG::SceneGraph::DrawModes::addDrawMode("Vertices")),
99  verticesColored(ACG::SceneGraph::DrawModes::addDrawMode("Vertices (colored)")),
100  verticesOnCells(ACG::SceneGraph::DrawModes::addDrawMode("Vertices (on Cells)")),
101 
102  irregularInnerEdges(ACG::SceneGraph::DrawModes::addDrawMode("Irregular edges")),
103  irregularOuterEdges(ACG::SceneGraph::DrawModes::addDrawMode("Irregular outer valence 2 edges")),
104 
105  cellBasedDrawModes(cellsFlatShaded | cellsSmoothShaded | cellsPhongShaded | cellsColoredPerCell | cellsColoredPerFace
106  | cellsColoredPerHalfface | cellsColoredPerVertex | cellsTransparent),
107  faceBasedDrawModes(facesFlatShaded | facesSmoothShaded | facesPhongShaded | facesColoredPerFace |
108  facesColoredPerVertex | facesTextured | facesTexturedShaded | hiddenLineBackgroundFaces),
109  halffaceBasedDrawModes(halffacesFlatShaded | halffacesSmoothShaded | halffacesPhongShaded | halffacesColoredPerHalfface
110  | halffacesColoredPerVertex),
111  edgeBasedDrawModes(edgesWireframe | edgesHiddenLine | edgesColoredPerEdge | irregularInnerEdges | irregularOuterEdges | edgesOnCells),
112  halfedgeBasedDrawModes(halfedgesWireframe | halfedgesHiddenLine | halfedgesColoredPerHalfedge),
113  vertexBasedDrawModes(verticesFlatShaded | verticesColored)
114  {
115  }
116 
117 
118  ACG::SceneGraph::DrawModes::DrawMode cellsFlatShaded;
119  ACG::SceneGraph::DrawModes::DrawMode cellsSmoothShaded;
120  ACG::SceneGraph::DrawModes::DrawMode cellsPhongShaded;
121  ACG::SceneGraph::DrawModes::DrawMode cellsColoredPerCell;
122  ACG::SceneGraph::DrawModes::DrawMode cellsColoredPerFace;
123  ACG::SceneGraph::DrawModes::DrawMode cellsColoredPerHalfface;
124  ACG::SceneGraph::DrawModes::DrawMode cellsColoredPerVertex;
125  ACG::SceneGraph::DrawModes::DrawMode cellsTransparent;
126 
127  ACG::SceneGraph::DrawModes::DrawMode facesFlatShaded;
128  ACG::SceneGraph::DrawModes::DrawMode facesSmoothShaded;
129  ACG::SceneGraph::DrawModes::DrawMode facesPhongShaded;
130  ACG::SceneGraph::DrawModes::DrawMode facesColoredPerFace;
131  ACG::SceneGraph::DrawModes::DrawMode facesColoredPerVertex;
133  ACG::SceneGraph::DrawModes::DrawMode facesTexturedShaded;
135  ACG::SceneGraph::DrawModes::DrawMode hiddenLineBackgroundFaces;
136 
137  ACG::SceneGraph::DrawModes::DrawMode halffacesFlatShaded;
138  ACG::SceneGraph::DrawModes::DrawMode halffacesSmoothShaded;
139  ACG::SceneGraph::DrawModes::DrawMode halffacesPhongShaded;
140  ACG::SceneGraph::DrawModes::DrawMode halffacesColoredPerHalfface;
141  ACG::SceneGraph::DrawModes::DrawMode halffacesColoredPerVertex;
142 
144  ACG::SceneGraph::DrawModes::DrawMode edgesHiddenLine;
145  ACG::SceneGraph::DrawModes::DrawMode edgesColoredPerEdge;
147 
148  ACG::SceneGraph::DrawModes::DrawMode halfedgesWireframe;
149  ACG::SceneGraph::DrawModes::DrawMode halfedgesHiddenLine;
150  ACG::SceneGraph::DrawModes::DrawMode halfedgesColoredPerHalfedge;
151 
152  ACG::SceneGraph::DrawModes::DrawMode verticesFlatShaded;
153  ACG::SceneGraph::DrawModes::DrawMode verticesColored;
154  ACG::SceneGraph::DrawModes::DrawMode verticesOnCells;
155 
156  ACG::SceneGraph::DrawModes::DrawMode irregularInnerEdges;
157  ACG::SceneGraph::DrawModes::DrawMode irregularOuterEdges;
158 
159 
160  ACG::SceneGraph::DrawModes::DrawMode cellBasedDrawModes;
161  ACG::SceneGraph::DrawModes::DrawMode faceBasedDrawModes;
162  ACG::SceneGraph::DrawModes::DrawMode halffaceBasedDrawModes;
163  ACG::SceneGraph::DrawModes::DrawMode edgeBasedDrawModes;
164  ACG::SceneGraph::DrawModes::DrawMode halfedgeBasedDrawModes;
165  ACG::SceneGraph::DrawModes::DrawMode vertexBasedDrawModes;
166 
173  {
174  if (cellsFlatShaded & _drawMode) return cellsFlatShaded;
175  if (cellsSmoothShaded & _drawMode) return cellsSmoothShaded;
176  if (cellsPhongShaded & _drawMode) return cellsPhongShaded;
177  if (cellsColoredPerCell & _drawMode) return cellsColoredPerCell;
178  if (cellsColoredPerFace & _drawMode) return cellsColoredPerFace;
179  if (cellsColoredPerHalfface & _drawMode) return cellsColoredPerHalfface;
180  if (cellsColoredPerVertex & _drawMode) return cellsColoredPerVertex;
181  if (cellsTransparent & _drawMode) return cellsTransparent;
183  }
184 
191  {
192  if (facesFlatShaded & _drawMode) return facesFlatShaded;
193  if (facesSmoothShaded & _drawMode) return facesSmoothShaded;
194  if (facesPhongShaded & _drawMode) return facesPhongShaded;
195  if (facesColoredPerFace & _drawMode) return facesColoredPerFace;
196  if (facesColoredPerFace & _drawMode) return facesColoredPerFace;
197  if (facesColoredPerVertex & _drawMode) return facesColoredPerVertex;
198  if (facesTextured & _drawMode) return facesTextured;
199  if (facesTexturedShaded & _drawMode) return facesTexturedShaded;
200 
201  if (halffacesFlatShaded & _drawMode) return halffacesFlatShaded;
202  if (halffacesSmoothShaded & _drawMode) return halffacesSmoothShaded;
203  if (halffacesPhongShaded & _drawMode) return halffacesPhongShaded;
204  if (halffacesColoredPerHalfface & _drawMode) return halffacesColoredPerHalfface;
205  if (halffacesColoredPerVertex & _drawMode) return halffacesColoredPerVertex;
206 
207  if (hiddenLineBackgroundFaces & _drawMode) return hiddenLineBackgroundFaces;
208  if (edgesHiddenLine & _drawMode) return hiddenLineBackgroundFaces;
209  if (halfedgesHiddenLine & _drawMode) return hiddenLineBackgroundFaces;
211  }
212 
219  {
220  if (edgesWireframe & _drawMode) return edgesWireframe;
221  if (edgesColoredPerEdge & _drawMode) return edgesColoredPerEdge;
222 
223  if (halfedgesWireframe & _drawMode) return halfedgesWireframe;
224  if (halfedgesColoredPerHalfedge & _drawMode) return halfedgesColoredPerHalfedge;
225 
226  if (irregularInnerEdges & _drawMode) return irregularInnerEdges;
227  if (irregularOuterEdges & _drawMode) return irregularOuterEdges;
228 
229  if (edgesHiddenLine & _drawMode) return edgesHiddenLine;
230  if (halfedgesHiddenLine & _drawMode) return halfedgesHiddenLine;
231 
232  if (edgesOnCells & _drawMode) return edgesOnCells;
234  }
235 
242  {
243  if (verticesFlatShaded & _drawMode) return verticesFlatShaded;
244  if (verticesColored & _drawMode) return verticesColored;
245  if (verticesOnCells & _drawMode) return verticesOnCells;
247  }
248 
249 
250 };
251 
252 #endif // VOLUMEMESHDRAWMODESCONTAINER_HH
This class provides easy access to DrawModes supported by OpenVolumeMesh.
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...
const DrawMode & addDrawMode(const std::string &_name, bool _propertyBased)
Add a custom DrawMode.
Definition: DrawModes.cc:771
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 getFirstCellDrawMode(ACG::SceneGraph::DrawModes::DrawMode _drawMode)
Returns the first cell based draw mode that is present in the given draw mode.
DrawMode NONE
not a valid draw mode
Definition: DrawModes.cc:77
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.