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
VolumeMeshObject.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 VOLUME_MESH_OBJECT_HH
51 #define VOLUME_MESH_OBJECT_HH
52
53 // Includes
54 #include <ACG/Utils/SmartPointer.hh>
55
56 #include <ACG/Math/VectorT.hh>
57 #include <ACG/Scenegraph/SeparatorNode.hh>
58 #include <ACG/Scenegraph/StatusNodesT.hh>
59 #include <ACG/Scenegraph/ShaderNode.hh>
60 #include <ACG/Scenegraph/TextureNode.hh>
61 #include <OpenFlipper/common/GlobalDefines.hh>
62 #include <OpenFlipper/common/BaseObjectData.hh>
63 #include <ObjectTypes/VolumeMeshObject/VolumeMeshNode.hh>
64
65 #include <OpenVolumeMesh/Attribs/StatusAttrib.hh>
66 #include <OpenVolumeMesh/Attribs/ColorAttrib.hh>
67 #include <OpenVolumeMesh/Attribs/NormalAttrib.hh>
68 #include <OpenVolumeMesh/Attribs/TexCoordAttrib.hh>
69
70
71 template<class MeshT>
72 class DLLEXPORTONLY VolumeMeshObject : public BaseObjectData {
73
74 friend class TypePolyhedralMeshPlugin;
75 friend class TypeHexahedralMeshPlugin;
76
77 public:
78
83 VolumeMeshObject(const VolumeMeshObject& _object);
84
92 VolumeMeshObject(DataType _typeId);
93
95 virtual ~VolumeMeshObject();
96
98 virtual void cleanup();
99
100 protected:
101
103 virtual void init();
104
105 //===========================================================================
108 //===========================================================================
109 public:
110
112 void setName( QString _name );
113
116 //===========================================================================
119 //===========================================================================
120
121 public:
123 MeshT* mesh();
124
128 BaseObject* copy();
129
130 typedef OpenVolumeMesh::ColorAttrib<ACG::Vec4f> ColorAttrib;
131 typedef OpenVolumeMesh::NormalAttrib<MeshT> NormalAttrib;
132 typedef OpenVolumeMesh::StatusAttrib StatusAttrib;
133 typedef OpenVolumeMesh::TexCoordAttrib<ACG::Vec2f> TexCoordAttrib;
134
135 const StatusAttrib& status() const { return statusAttrib_; }
136 StatusAttrib& status() { return statusAttrib_; }
137
138 const ColorAttrib& colors() const { return colorAttrib_; }
139 ColorAttrib& colors() { return colorAttrib_; }
140
141 const NormalAttrib& normals() const { return normalAttrib_; }
142 NormalAttrib& normals() { return normalAttrib_; }
143
144 const TexCoordAttrib& texcoords() const { return texcoordAttrib_; }
145 TexCoordAttrib& texcoords() { return texcoordAttrib_; }
146
147 private:
148 ptr::shared_ptr<MeshT> mesh_;
149
150 StatusAttrib statusAttrib_;
151
152 ColorAttrib colorAttrib_;
153
154 NormalAttrib normalAttrib_;
155
156 TexCoordAttrib texcoordAttrib_;
157
160 //===========================================================================
167 //===========================================================================
168 protected:
169
171 virtual void update(UpdateType _type = UPDATE_ALL);
172
174 void updateSelection();
175
177 void updateGeometry();
178
180 void updateColor();
181
183 void updateTexture();
184
186 void updateTopology();
187
189 //===========================================================================
192 //===========================================================================
193
194 public:
195
197 ACG::SceneGraph::TextureNode* textureNode();
198
200 ACG::SceneGraph::ShaderNode* shaderNode();
201
203 ACG::SceneGraph::VolumeMeshNodeT<MeshT>* meshNode();
204
206 void boundingBox(ACG::Vec3d& _bbMin, typename ACG::Vec3d& _bbMax);
207
208 BaseNode* primaryNode();
209
210 private:
211
213 ACG::SceneGraph::VolumeMeshNodeT<MeshT>* meshNode_;
214
216 ACG::SceneGraph::ShaderNode* shaderNode_;
217
219 ACG::SceneGraph::TextureNode* textureNode_;
220
223 //===========================================================================
226 //===========================================================================
227 public:
229 QString getObjectinfo();
230
233 //===========================================================================
236 //===========================================================================
237 public:
238
240 bool picked(unsigned int _node_idx);
241
243 void enablePicking(bool _enable);
244
246 bool pickingEnabled();
247
249 };
250
251 //=============================================================================
252
253 #if defined(INCLUDE_TEMPLATES) && !defined(VOLUMEMESHOBJECTT_CC)
254 #define VOLUMEMESHOBJECT_TEMPLATES
255 #include "VolumeMeshObjectT.cc"
256 #endif
257 #endif
TypeHexahedralMeshPlugin
Definition: TypeHexahedralMesh.hh:64
OpenVolumeMesh::ColorAttrib< ACG::Vec4f >
VolumeMeshObject::statusAttrib_
StatusAttrib statusAttrib_
return a pointer to the mesh
Definition: VolumeMeshObject.hh:150
VolumeMeshObject::texcoords
TexCoordAttrib & texcoords()
return a pointer to the mesh
Definition: VolumeMeshObject.hh:145
VolumeMeshObject::colors
ColorAttrib & colors()
return a pointer to the mesh
Definition: VolumeMeshObject.hh:139
ACG::SceneGraph::BaseNode
Definition: BaseNode.hh:135
VolumeMeshObject::normalAttrib_
NormalAttrib normalAttrib_
return a pointer to the mesh
Definition: VolumeMeshObject.hh:154
OpenVolumeMesh::StatusAttrib
Definition: StatusAttrib.hh:57
BaseObject::getObjectinfo
virtual QString getObjectinfo()
Get all Info for the Object as a string.
Definition: BaseObject.cc:255
BaseObjectData
Definition: BaseObjectData.hh:105
VolumeMeshObject::mesh_
ptr::shared_ptr< MeshT > mesh_
return a pointer to the mesh
Definition: VolumeMeshObject.hh:148
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
VolumeMeshObject::meshNode_
ACG::SceneGraph::VolumeMeshNodeT< MeshT > * meshNode_
Scenegraph Mesh Node.
Definition: VolumeMeshObject.hh:213
BaseObjectData::pickingEnabled
virtual bool pickingEnabled()
Definition: BaseObjectData.cc:320
VolumeMeshObject::StatusAttrib
OpenVolumeMesh::StatusAttrib StatusAttrib
return a pointer to the mesh
Definition: VolumeMeshObject.hh:132
VolumeMeshObject::ColorAttrib
OpenVolumeMesh::ColorAttrib< ACG::Vec4f > ColorAttrib
return a pointer to the mesh
Definition: VolumeMeshObject.hh:130
BaseObjectData::cleanup
virtual void cleanup()
Definition: BaseObjectData.cc:108
VolumeMeshObject::colorAttrib_
ColorAttrib colorAttrib_
return a pointer to the mesh
Definition: VolumeMeshObject.hh:152
VolumeMeshObject
Definition: VolumeMeshObject.hh:72
VolumeMeshObject::colors
const ColorAttrib & colors() const
return a pointer to the mesh
Definition: VolumeMeshObject.hh:138
BaseObjectData::primaryNode
virtual BaseNode * primaryNode()
Definition: BaseObjectData.cc:257
VolumeMeshObject::texcoords
const TexCoordAttrib & texcoords() const
return a pointer to the mesh
Definition: VolumeMeshObject.hh:144
VolumeMeshObject::NormalAttrib
OpenVolumeMesh::NormalAttrib< MeshT > NormalAttrib
return a pointer to the mesh
Definition: VolumeMeshObject.hh:131
BaseObjectData::enablePicking
virtual void enablePicking(bool _enable)
Definition: BaseObjectData.cc:317
BaseObject
Definition: BaseObject.hh:94
BaseObjectData::shaderNode
virtual ACG::SceneGraph::ShaderNode * shaderNode()
Definition: BaseObjectData.cc:265
OpenVolumeMesh::TexCoordAttrib< ACG::Vec2f >
VolumeMeshObject::textureNode_
ACG::SceneGraph::TextureNode * textureNode_
Scenegraph Texture Node.
Definition: VolumeMeshObject.hh:219
VolumeMeshObject::status
const StatusAttrib & status() const
return a pointer to the mesh
Definition: VolumeMeshObject.hh:135
TypePolyhedralMeshPlugin
Definition: TypePolyhedralMesh.hh:65
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
VolumeMeshObject::normals
NormalAttrib & normals()
return a pointer to the mesh
Definition: VolumeMeshObject.hh:142
VolumeMeshObject::status
StatusAttrib & status()
return a pointer to the mesh
Definition: VolumeMeshObject.hh:136
ACG::SceneGraph::TextureNode
Definition: TextureNode.hh:93
VolumeMeshObject::TexCoordAttrib
OpenVolumeMesh::TexCoordAttrib< ACG::Vec2f > TexCoordAttrib
return a pointer to the mesh
Definition: VolumeMeshObject.hh:133
VolumeMeshObject::shaderNode_
ACG::SceneGraph::ShaderNode * shaderNode_
Scenegraph Shader Node.
Definition: VolumeMeshObject.hh:216
VolumeMeshObject::normals
const NormalAttrib & normals() const
return a pointer to the mesh
Definition: VolumeMeshObject.hh:141
ACG::SceneGraph::VolumeMeshNodeT< MeshT >
ACG::SceneGraph::ShaderNode
Definition: ShaderNode.hh:87
VolumeMeshObject::texcoordAttrib_
TexCoordAttrib texcoordAttrib_
return a pointer to the mesh
Definition: VolumeMeshObject.hh:156
BaseObject::copy
virtual BaseObject * copy()
Returns a full copy of the object.
Definition: BaseObject.cc:780
DataType
Predefined datatypes.
Definition: DataTypes.hh:96
BaseObjectData.hh
OpenVolumeMesh::NormalAttrib< MeshT >
BaseObjectData::picked
virtual bool picked(uint _node_idx)
detect if the node has been picked
Definition: BaseObjectData.cc:313