Developer Documentation
 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>
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 
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 
201 
204 
206  void boundingBox(ACG::Vec3d& _bbMin, typename ACG::Vec3d& _bbMax);
207 
209 
210  private:
211 
214 
217 
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
StatusAttrib statusAttrib_
return a pointer to the mesh
TexCoordAttrib & texcoords()
return a pointer to the mesh
ColorAttrib & colors()
return a pointer to the mesh
NormalAttrib normalAttrib_
return a pointer to the mesh
virtual QString getObjectinfo()
Get all Info for the Object as a string.
Definition: BaseObject.cc:255
ptr::shared_ptr< MeshT > mesh_
return a pointer to the mesh
Update type class.
Definition: UpdateType.hh:70
const UpdateType UPDATE_ALL(UpdateTypeSet(1))
Identifier for all updates.
virtual void setName(QString _name)
path to the file from which the object is loaded ( defaults to "." )
ACG::SceneGraph::VolumeMeshNodeT< MeshT > * meshNode_
Scenegraph Mesh Node.
virtual bool pickingEnabled()
OpenVolumeMesh::StatusAttrib StatusAttrib
return a pointer to the mesh
OpenVolumeMesh::ColorAttrib< ACG::Vec4f > ColorAttrib
return a pointer to the mesh
virtual void cleanup()
ColorAttrib colorAttrib_
return a pointer to the mesh
const ColorAttrib & colors() const
return a pointer to the mesh
virtual BaseNode * primaryNode()
const TexCoordAttrib & texcoords() const
return a pointer to the mesh
OpenVolumeMesh::NormalAttrib< MeshT > NormalAttrib
return a pointer to the mesh
virtual void enablePicking(bool _enable)
virtual ACG::SceneGraph::ShaderNode * shaderNode()
ACG::SceneGraph::TextureNode * textureNode_
Scenegraph Texture Node.
const StatusAttrib & status() const
return a pointer to the mesh
virtual void update(UpdateType _type=UPDATE_ALL)
This function is called to update the object.
NormalAttrib & normals()
return a pointer to the mesh
StatusAttrib & status()
return a pointer to the mesh
OpenVolumeMesh::TexCoordAttrib< ACG::Vec2f > TexCoordAttrib
return a pointer to the mesh
ACG::SceneGraph::ShaderNode * shaderNode_
Scenegraph Shader Node.
const NormalAttrib & normals() const
return a pointer to the mesh
TexCoordAttrib texcoordAttrib_
return a pointer to the mesh
virtual BaseObject * copy()
Returns a full copy of the object.
Definition: BaseObject.cc:780
Predefined datatypes.
Definition: DataTypes.hh:96
virtual bool picked(uint _node_idx)
detect if the node has been picked