Developer Documentation
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  friend class TypeTetrahedralMeshPlugin;
77 
78 public:
79 
84  VolumeMeshObject(const VolumeMeshObject& _object);
85 
93  VolumeMeshObject(DataType _typeId);
94 
96  virtual ~VolumeMeshObject();
97 
99  virtual void cleanup();
100 
101  protected:
102 
104  virtual void init();
105 
106  //===========================================================================
109  //===========================================================================
110  public:
111 
113  void setName( QString _name );
114 
117  //===========================================================================
120  //===========================================================================
121 
122  public:
124  MeshT* mesh();
125 
129  BaseObject* copy();
130 
135 
136  const StatusAttrib& status() const { return statusAttrib_; }
137  StatusAttrib& status() { return statusAttrib_; }
138 
139  const ColorAttrib& colors() const { return colorAttrib_; }
140  ColorAttrib& colors() { return colorAttrib_; }
141 
142  const NormalAttrib& normals() const { return normalAttrib_; }
143  NormalAttrib& normals() { return normalAttrib_; }
144 
145  const TexCoordAttrib& texcoords() const { return texcoordAttrib_; }
146  TexCoordAttrib& texcoords() { return texcoordAttrib_; }
147 
148  private:
149  ptr::shared_ptr<MeshT> mesh_;
150 
151  StatusAttrib statusAttrib_;
152 
153  ColorAttrib colorAttrib_;
154 
155  NormalAttrib normalAttrib_;
156 
157  TexCoordAttrib texcoordAttrib_;
158 
161  //===========================================================================
168  //===========================================================================
169  protected:
170 
172  virtual void update(UpdateType _type = UPDATE_ALL);
173 
175  void updateSelection();
176 
178  void updateGeometry();
179 
181  void updateColor();
182 
184  void updateTexture();
185 
187  void updateTopology();
188 
190  //===========================================================================
193  //===========================================================================
194 
195  public:
196 
198  ACG::SceneGraph::TextureNode* textureNode();
199 
202 
205 
207  void boundingBox(ACG::Vec3d& _bbMin, typename ACG::Vec3d& _bbMax);
208 
210 
211  private:
212 
215 
218 
221 
224  //===========================================================================
227  //===========================================================================
228  public:
230  QString getObjectinfo();
231 
234  //===========================================================================
237  //===========================================================================
238  public:
239 
241  bool picked(unsigned int _node_idx);
242 
244  void enablePicking(bool _enable);
245 
247  bool pickingEnabled();
248 
250 };
251 
252 //=============================================================================
253 
254 #if defined(INCLUDE_TEMPLATES) && !defined(VOLUMEMESHOBJECTT_CC)
255 #define VOLUMEMESHOBJECT_TEMPLATES
256 #include "VolumeMeshObjectT.cc"
257 #endif
258 #endif
ACG::SceneGraph::ShaderNode * shaderNode_
Scenegraph Shader Node.
const ColorAttrib & colors() const
return a pointer to the mesh
Predefined datatypes.
Definition: DataTypes.hh:96
const StatusAttrib & status() const
return a pointer to the mesh
NormalAttrib & normals()
return a pointer to the mesh
virtual void cleanup()
ColorAttrib colorAttrib_
return a pointer to the mesh
OpenVolumeMesh::StatusAttrib StatusAttrib
return a pointer to the mesh
ACG::SceneGraph::VolumeMeshNodeT< MeshT > * meshNode_
Scenegraph Mesh Node.
StatusAttrib & status()
return a pointer to the mesh
OpenVolumeMesh::TexCoordAttrib< ACG::Vec2f > TexCoordAttrib
return a pointer to the mesh
virtual BaseNode * primaryNode()
virtual bool picked(uint _node_idx)
detect if the node has been picked
Update type class.
Definition: UpdateType.hh:70
ACG::SceneGraph::TextureNode * textureNode_
Scenegraph Texture Node.
virtual bool pickingEnabled()
const NormalAttrib & normals() const
return a pointer to the mesh
NormalAttrib normalAttrib_
return a pointer to the mesh
virtual void setName(QString _name)
path to the file from which the object is loaded ( defaults to "." )
virtual void update(UpdateType _type=UPDATE_ALL)
This function is called to update the object.
OpenVolumeMesh::NormalAttrib< MeshT > NormalAttrib
return a pointer to the mesh
TexCoordAttrib & texcoords()
return a pointer to the mesh
virtual BaseObject * copy()
Returns a full copy of the object.
Definition: BaseObject.cc:780
ColorAttrib & colors()
return a pointer to the mesh
virtual void enablePicking(bool _enable)
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
OpenVolumeMesh::ColorAttrib< ACG::Vec4f > ColorAttrib
return a pointer to the mesh
const UpdateType UPDATE_ALL(UpdateTypeSet(1))
Identifier for all updates.
TexCoordAttrib texcoordAttrib_
return a pointer to the mesh
virtual ACG::SceneGraph::ShaderNode * shaderNode()
StatusAttrib statusAttrib_
return a pointer to the mesh
const TexCoordAttrib & texcoords() const
return a pointer to the mesh