Developer Documentation

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
MeshObjectT.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
51
52
53 //=============================================================================
54 //
55 // Types
56 //
57 //=============================================================================
58
65 #ifndef MESHOBJECT_HH
66 #define MESHOBJECT_HH
67
68 //== INCLUDES =================================================================
69
70 // -------------------- OpenMesh
71 #include <OpenMesh/Core/IO/MeshIO.hh>
72
73 #include <ACG/Scenegraph/SeparatorNode.hh>
74 #include <ACG/Scenegraph/EnvMapNode.hh>
75 #include <ACG/Scenegraph/ShaderNode.hh>
76 #include <ACG/Scenegraph/StatusNodesT.hh>
77
78 #include <OpenFlipper/common/GlobalDefines.hh>
79
80 #include <ObjectTypes/MeshObject/StatusNodeMods.hh>
81 #include <ObjectTypes/MeshObject/StatusViewNodeT.hh>
82 #include <OpenFlipper/common/BaseObjectData.hh>
83
84 // -------------------- BSP
85 #include <ACG/Geometry/bsp/TriangleBSPT.hh>
86
87
88 #include <OpenFlipper/common/BaseObjectData.hh>
89 #include <ACG/Scenegraph/MeshNode2T.hh>
90
91
92
93 //== TYPEDEFS =================================================================
94
96 typedef ACG::SceneGraph::TextureNode TextureNode;
97
98 //== CLASS DEFINITION =========================================================
99
102 template < class MeshT >
103 class DLLEXPORTONLY MeshObject : public BaseObjectData {
104
105 friend class TypePolyMeshPlugin;
106 friend class TypeTriangleMeshPlugin;
107
108 public:
109
114 MeshObject(const MeshObject& _object);
115
123 MeshObject(DataType _typeId);
124
126 virtual ~MeshObject();
127
129 virtual void cleanup();
130
131 protected:
132
134 virtual void init( MeshT* _mesh = 0);
135
136 //===========================================================================
139 //===========================================================================
140 public:
141
143 void setName( QString _name );
144
145
146 //===========================================================================
149 //===========================================================================
150
151 public:
153 MeshT* mesh();
154
155 private:
157 MeshT* mesh_;
158
161 //===========================================================================
168 //===========================================================================
169
170 protected:
171
173 virtual void update(UpdateType _type = UPDATE_ALL);
174
176 void updateSelection();
177
179 void updateModelingRegions();
180
182 void updateFeatures();
183
185 void updateGeometry();
186
188 void updateColor();
189
191 void updateTopology();
192
194 void updateTexture();
195
196
199 //===========================================================================
202 //===========================================================================
203
204 public:
205
207 ACG::SceneGraph::EnvMapNode* textureNode();
208
210 ACG::SceneGraph::ShaderNode* shaderNode();
211
213 void hideSelection( bool _hide );
214
216 bool selectionVisible();
217
219 void hideFeatures( bool _hide );
220
222 bool featuresVisible( );
223
225 void hideArea( StatusBits _bit, bool _hide );
226
235 bool areaVisible( StatusBits _bit );
236
238 ACG::SceneGraph::MeshNodeT<MeshT>* meshNode();
239
241 void boundingBox( ACG::Vec3d& _bbMin , typename ACG::Vec3d& _bbMax );
242
243 BaseNode* primaryNode();
244
246 void setSelectionColor(const ACG::Vec4f& _color);
248 ACG::Vec4f selectionColor() const;
249
251 void setAreaColor(const ACG::Vec4f& _color);
253 ACG::Vec4f areaColor() const;
254
256 void setFeatureColor(const ACG::Vec4f& _color);
258 ACG::Vec4f featureColor() const;
259
261 void setHandleColor(const ACG::Vec4f& _color);
263 ACG::Vec4f handleColor() const;
264
267 ACG::SceneGraph::SelectionNodeT<MeshT> *
268 statusNode() { return statusNode_; }
269
271 ACG::SceneGraph::StatusNodeT<MeshT, AreaNodeMod<MeshT> > *
272 areaNode() { return areaNode_; }
273
275 ACG::SceneGraph::StatusNodeT<MeshT, HandleNodeMod<MeshT> > *
276 handleNode() { return handleNode_; }
277
279 ACG::SceneGraph::StatusNodeT<MeshT, FeatureNodeMod<MeshT> > *
280 featureNode() { return featureNode_; }
281
282 private :
284 ACG::SceneGraph::SelectionNodeT<MeshT>* statusNode_;
285
287 ACG::SceneGraph::StatusNodeT<MeshT, AreaNodeMod<MeshT> > * areaNode_;
288
290 ACG::SceneGraph::StatusNodeT<MeshT, HandleNodeMod<MeshT> > * handleNode_;
291
293 ACG::SceneGraph::StatusNodeT<MeshT, FeatureNodeMod<MeshT> > *featureNode_;
294
296 ACG::SceneGraph::MeshNodeT<MeshT>* meshNode_;
297
299 ACG::SceneGraph::EnvMapNode* textureNode_;
300
302 ACG::SceneGraph::ShaderNode* shaderNode_;
303
305 ACG::SceneGraph::StatusViewNodeT<MeshT>* statusView_;
306
309 //===========================================================================
312 //===========================================================================
313
314 public:
315
317 bool loadMesh(QString _filename);
318
321 //===========================================================================
324 //===========================================================================
325 public:
327 QString getObjectinfo();
328
332 //===========================================================================
335 //===========================================================================
336 public:
338 bool picked( uint _node_idx );
339
341 void enablePicking( bool _enable );
342
344 bool pickingEnabled();
345
348 //===========================================================================
351 //===========================================================================
352 public:
353
354 typedef OpenMeshTriangleBSPT< MeshT > OMTriangleBSP;
355
361 OMTriangleBSP* requestTriangleBsp();
362
369 void invalidateTriangleBsp();
370
371
377 OMTriangleBSP* resetTriangleBsp();
378
387 bool hasBsp() const;
388
389
390 private :
392 OMTriangleBSP* triangle_bsp_;
393
395 };
396
397 //=============================================================================
398
399 #if defined(INCLUDE_TEMPLATES) && !defined(MESHOBJECT_C)
400 #define MESHOBJECT_TEMPLATES
401 #include "MeshObjectT.cc"
402 #endif
403
404
405 //=============================================================================
406 #endif // MESHOBJECT_HH defined
407 //=============================================================================
MeshObject::shaderNode_
ACG::SceneGraph::ShaderNode * shaderNode_
Scenegraph ShaderNode.
Definition: MeshObjectT.hh:302
MeshObject::textureNode_
ACG::SceneGraph::EnvMapNode * textureNode_
Scenegraph TextureNode.
Definition: MeshObjectT.hh:299
ACG::SceneGraph::BaseNode
Definition: BaseNode.hh:135
BaseObject::getObjectinfo
virtual QString getObjectinfo()
Get all Info for the Object as a string.
Definition: BaseObject.cc:255
ACG::SceneGraph::EnvMapNode
Definition: EnvMapNode.hh:83
MeshObject::meshNode_
ACG::SceneGraph::MeshNodeT< MeshT > * meshNode_
Scenegraph Mesh Node.
Definition: MeshObjectT.hh:296
BaseObjectData
Definition: BaseObjectData.hh:105
ACG::SceneGraph::MeshNodeT< MeshT >
UpdateType
Update type class.
Definition: UpdateType.hh:70
UPDATE_ALL
const UpdateType UPDATE_ALL(UpdateTypeSet(1))
Identifier for all updates.
GlobalDefines.hh
BaseObjectData::setName
virtual void setName(QString _name)
path to the file from which the object is loaded ( defaults to "." )
Definition: BaseObjectData.cc:357
BaseObjectData::pickingEnabled
virtual bool pickingEnabled()
Definition: BaseObjectData.cc:320
MeshObject::OMTriangleBSP
OpenMeshTriangleBSPT< MeshT > OMTriangleBSP
If requested a bsp is created for this object.
Definition: MeshObjectT.hh:354
ACG::SceneGraph::StatusViewNodeT
Definition: StatusViewNodeT.hh:77
BaseObjectData::cleanup
virtual void cleanup()
Definition: BaseObjectData.cc:108
MeshObject::statusNode_
ACG::SceneGraph::SelectionNodeT< MeshT > * statusNode_
Status Node for a mesh, visualizing the selection state of a mesh.
Definition: MeshObjectT.hh:284
BaseObjectData::primaryNode
virtual BaseNode * primaryNode()
Definition: BaseObjectData.cc:257
BaseObjectData::enablePicking
virtual void enablePicking(bool _enable)
Definition: BaseObjectData.cc:317
MeshObject::areaNode_
ACG::SceneGraph::StatusNodeT< MeshT, AreaNodeMod< MeshT > > * areaNode_
Area selection Vis.
Definition: MeshObjectT.hh:287
BaseObjectData::shaderNode
virtual ACG::SceneGraph::ShaderNode * shaderNode()
Definition: BaseObjectData.cc:265
OpenMesh::VectorT
Definition: Vector11T.hh:83
BaseObjectData::update
virtual void update(UpdateType _type=UPDATE_ALL)
This function is called to update the object.
Definition: BaseObjectData.cc:331
MeshObject::handleNode
ACG::SceneGraph::StatusNodeT< MeshT, HandleNodeMod< MeshT > > * handleNode()
Returns the handle selection node if available, nullptr otherwise.
Definition: MeshObjectT.hh:276
MeshObject::featureNode_
ACG::SceneGraph::StatusNodeT< MeshT, FeatureNodeMod< MeshT > > * featureNode_
Feature selection Vis.
Definition: MeshObjectT.hh:293
ACG::SceneGraph::TextureNode
Definition: TextureNode.hh:93
MeshObject::statusView_
ACG::SceneGraph::StatusViewNodeT< MeshT > * statusView_
Scenegraph StatusNodeView.
Definition: MeshObjectT.hh:305
ACG::SceneGraph::SelectionNodeT< MeshT >
OpenMeshTriangleBSPT
Definition: TriangleBSPT.hh:206
ACG::SceneGraph::ShaderNode
Definition: ShaderNode.hh:87
MeshObject::handleNode_
ACG::SceneGraph::StatusNodeT< MeshT, HandleNodeMod< MeshT > > * handleNode_
Handle selection Vis.
Definition: MeshObjectT.hh:290
MeshObject::triangle_bsp_
OMTriangleBSP * triangle_bsp_
If requested a bsp is created for this object.
Definition: MeshObjectT.hh:392
MeshObject
Definition: MeshObjectT.hh:103
MeshObject::statusNode
ACG::SceneGraph::SelectionNodeT< MeshT > * statusNode()
Definition: MeshObjectT.hh:268
DataType
Predefined datatypes.
Definition: DataTypes.hh:96
MeshObject::mesh_
MeshT * mesh_
pointer to the mesh
Definition: MeshObjectT.hh:157
BaseObjectData.hh
ACG::SceneGraph::StatusNodeT
Definition: StatusNodesT.hh:183
TypeTriangleMeshPlugin
Definition: TypeTriangleMesh.hh:66
MeshObject::areaNode
ACG::SceneGraph::StatusNodeT< MeshT, AreaNodeMod< MeshT > > * areaNode()
Returns the area selection node if available, nullptr otherwise.
Definition: MeshObjectT.hh:272
MeshObject::featureNode
ACG::SceneGraph::StatusNodeT< MeshT, FeatureNodeMod< MeshT > > * featureNode()
Returns the feature selection node if available, nullptr otherwise.
Definition: MeshObjectT.hh:280
TypePolyMeshPlugin
Definition: TypePolyMesh.hh:66
BaseObjectData::picked
virtual bool picked(uint _node_idx)
detect if the node has been picked
Definition: BaseObjectData.cc:313