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 #pragma once
43 
44 // Includes
45 #include <ACG/Utils/SmartPointer.hh>
46 
47 #include <ACG/Math/VectorT.hh>
48 #include <ACG/Scenegraph/SeparatorNode.hh>
49 #include <ACG/Scenegraph/StatusNodesT.hh>
50 #include <ACG/Scenegraph/ShaderNode.hh>
51 #include <ACG/Scenegraph/TextureNode.hh>
54 #include <ObjectTypes/VolumeMeshObject/VolumeMeshNode.hh>
55 
56 #include <OpenVolumeMesh/Attribs/StatusAttrib.hh>
57 #include <OpenVolumeMesh/Attribs/ColorAttrib.hh>
58 #include <OpenVolumeMesh/Attribs/NormalAttrib.hh>
59 #include <OpenVolumeMesh/Attribs/TexCoordAttrib.hh>
60 
61 
62 template<class MeshT>
63 class OBJECTTYPEDLLEXPORTONLY VolumeMeshObject : public BaseObjectData {
64 
65  friend class TypePolyhedralMeshPlugin;
66  friend class TypeHexahedralMeshPlugin;
67  friend class TypeTetrahedralMeshPlugin;
68 
69 public:
70 
75  VolumeMeshObject(const VolumeMeshObject& _object);
76 
84  explicit VolumeMeshObject(DataType _typeId);
85 
87  virtual ~VolumeMeshObject();
88 
90  virtual void cleanup();
91 
92  protected:
93 
95  virtual void init();
96 
97  //===========================================================================
100  //===========================================================================
101  public:
102 
104  void setName( QString _name );
105 
108  //===========================================================================
111  //===========================================================================
112 
113  public:
115  MeshT* mesh();
116  const MeshT* mesh() const;
117 
121  BaseObject* copy();
122 
127 
128  const StatusAttrib& status() const { return statusAttrib_; }
129  StatusAttrib& status() { return statusAttrib_; }
130 
131  const ColorAttrib& colors() const { return colorAttrib_; }
132  ColorAttrib& colors() { return colorAttrib_; }
133 
134  const NormalAttrib& normals() const { return normalAttrib_; }
135  NormalAttrib& normals() { return normalAttrib_; }
136 
137  const TexCoordAttrib& texcoords() const { return texcoordAttrib_; }
138  TexCoordAttrib& texcoords() { return texcoordAttrib_; }
139 
140  private:
141  ptr::shared_ptr<MeshT> mesh_;
142 
143  StatusAttrib statusAttrib_;
144 
145  ColorAttrib colorAttrib_;
146 
147  NormalAttrib normalAttrib_;
148 
149  TexCoordAttrib texcoordAttrib_;
150 
153  //===========================================================================
160  //===========================================================================
161  protected:
162 
164  virtual void update(UpdateType _type = UPDATE_ALL);
165 
167  void updateSelection();
168 
170  void updateGeometry();
171 
173  void updateColor();
174 
176  void updateTexture();
177 
179  void updateTopology();
180 
182  //===========================================================================
185  //===========================================================================
186 
187  public:
188 
190  ACG::SceneGraph::TextureNode* textureNode();
191 
194 
197 
199  void boundingBox(ACG::Vec3d& _bbMin, typename ACG::Vec3d& _bbMax);
200 
202 
203  private:
204 
207 
210 
213 
216  //===========================================================================
219  //===========================================================================
220  public:
222  QString getObjectinfo();
223 
226  //===========================================================================
229  //===========================================================================
230  public:
231 
233  bool picked(unsigned int _node_idx);
234 
236  void enablePicking(bool _enable);
237 
239  bool pickingEnabled();
240 
242 };
243 
244 //=============================================================================
Update type class.
Definition: UpdateType.hh:60
virtual QString getObjectinfo()
Get all Info for the Object as a string.
Definition: BaseObject.cc:244
const UpdateType UPDATE_ALL(UpdateTypeSet(1))
Identifier for all updates.
virtual void update(UpdateType _type=UPDATE_ALL)
This function is called to update the object.
ACG::SceneGraph::VolumeMeshNodeT< MeshT > * meshNode_
Scenegraph Mesh Node.
virtual BaseNode * primaryNode()
NormalAttrib & normals()
return a pointer to the mesh
const TexCoordAttrib & texcoords() const
return a pointer to the mesh
NormalAttrib normalAttrib_
return a pointer to the mesh
TexCoordAttrib texcoordAttrib_
return a pointer to the mesh
StatusAttrib statusAttrib_
return a pointer to the mesh
virtual void cleanup()
const StatusAttrib & status() const
return a pointer to the mesh
virtual bool pickingEnabled()
OpenVolumeMesh::TexCoordAttrib< ACG::Vec2f > TexCoordAttrib
return a pointer to the mesh
OpenVolumeMesh::StatusAttrib StatusAttrib
return a pointer to the mesh
StatusAttrib & status()
return a pointer to the mesh
TexCoordAttrib & texcoords()
return a pointer to the mesh
ACG::SceneGraph::ShaderNode * shaderNode_
Scenegraph Shader Node.
virtual void setName(QString _name)
path to the file from which the object is loaded ( defaults to "." )
ColorAttrib colorAttrib_
return a pointer to the mesh
const NormalAttrib & normals() const
return a pointer to the mesh
ColorAttrib & colors()
return a pointer to the mesh
OpenVolumeMesh::ColorAttrib< ACG::Vec4f > ColorAttrib
return a pointer to the mesh
OpenVolumeMesh::NormalAttrib< MeshT > NormalAttrib
return a pointer to the mesh
virtual void enablePicking(bool _enable)
ptr::shared_ptr< MeshT > mesh_
return a pointer to the mesh
Predefined datatypes.
Definition: DataTypes.hh:83
const ColorAttrib & colors() const
return a pointer to the mesh
virtual BaseObject * copy()
Returns a full copy of the object.
Definition: BaseObject.cc:769
virtual bool picked(uint _node_idx)
detect if the node has been picked
ACG::SceneGraph::TextureNode * textureNode_
Scenegraph Texture Node.
virtual ACG::SceneGraph::ShaderNode * shaderNode()