Developer Documentation
Loading...
Searching...
No Matches
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
62template<class MeshT>
63class OBJECTTYPEDLLEXPORTONLY VolumeMeshObject : public BaseObjectData {
64
65 friend class TypePolyhedralMeshPlugin;
66 friend class TypeHexahedralMeshPlugin;
67 friend class TypeTetrahedralMeshPlugin;
68
69public:
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 void recreateAttributes();
122
126 BaseObject* copy();
127
132
133 const StatusAttrib& status() const { return statusAttrib_; }
134 StatusAttrib& status() { return statusAttrib_; }
135
136 const ColorAttrib& colors() const { return colorAttrib_; }
137 ColorAttrib& colors() { return colorAttrib_; }
138
139 const NormalAttrib& normals() const { return normalAttrib_; }
140 NormalAttrib& normals() { return normalAttrib_; }
141
142 const TexCoordAttrib& texcoords() const { return texcoordAttrib_; }
143 TexCoordAttrib& texcoords() { return texcoordAttrib_; }
144
145 private:
146 ptr::shared_ptr<MeshT> mesh_;
147
149
151
153
155
158 //===========================================================================
165 //===========================================================================
166 protected:
167
169 virtual void update(UpdateType _type = UPDATE_ALL);
170
172 void updateSelection();
173
175 void updateGeometry();
176
178 void updateColor();
179
181 void updateTexture();
182
184 void updateTopology();
185
187 //===========================================================================
190 //===========================================================================
191
192 public:
193
195 ACG::SceneGraph::TextureNode* textureNode();
196
199
202
204 void boundingBox(ACG::Vec3d& _bbMin, typename ACG::Vec3d& _bbMax);
205
207
208 private:
209
212
215
218
221 //===========================================================================
224 //===========================================================================
225 public:
227 QString getObjectinfo();
228
231 //===========================================================================
234 //===========================================================================
235 public:
236
238 bool picked(unsigned int _node_idx);
239
241 void enablePicking(bool _enable);
242
244 bool pickingEnabled();
245
247};
248
249//=============================================================================
virtual void enablePicking(bool _enable)
virtual bool pickingEnabled()
virtual void setName(QString _name) override
path to the file from which the object is loaded ( defaults to "." )
virtual void update(UpdateType _type=UPDATE_ALL) override
This function is called to update the object.
virtual void cleanup() override
virtual ACG::SceneGraph::ShaderNode * shaderNode()
virtual BaseNode * primaryNode()
virtual bool picked(uint _node_idx)
detect if the node has been picked
virtual QString getObjectinfo()
Get all Info for the Object as a string.
virtual BaseObject * copy()
Returns a full copy of the object.
Predefined datatypes.
Definition DataTypes.hh:83
Update type class.
Definition UpdateType.hh:59
NormalAttrib normalAttrib_
return a pointer to the mesh
ACG::SceneGraph::TextureNode * textureNode_
Scenegraph Texture Node.
NormalAttrib & normals()
return a pointer to the mesh
TexCoordAttrib & texcoords()
return a pointer to the mesh
OpenVolumeMesh::NormalAttrib< MeshT > NormalAttrib
return a pointer to the mesh
ColorAttrib & colors()
return a pointer to the mesh
StatusAttrib & status()
return a pointer to the mesh
ColorAttrib colorAttrib_
return a pointer to the mesh
OpenVolumeMesh::ColorAttrib< ACG::Vec4f > ColorAttrib
return a pointer to the mesh
const TexCoordAttrib & texcoords() const
return a pointer to the mesh
ptr::shared_ptr< MeshT > mesh_
return a pointer to the mesh
const StatusAttrib & status() const
return a pointer to the mesh
OpenVolumeMesh::StatusAttrib StatusAttrib
return a pointer to the mesh
TexCoordAttrib texcoordAttrib_
return a pointer to the mesh
const NormalAttrib & normals() const
return a pointer to the mesh
const ColorAttrib & colors() const
return a pointer to the mesh
StatusAttrib statusAttrib_
return a pointer to the mesh
OpenVolumeMesh::TexCoordAttrib< ACG::Vec2f > TexCoordAttrib
return a pointer to the mesh
ACG::SceneGraph::ShaderNode * shaderNode_
Scenegraph Shader Node.
ACG::SceneGraph::VolumeMeshNodeT< MeshT > * meshNode_
Scenegraph Mesh Node.
const UpdateType UPDATE_ALL(UpdateTypeSet(1))
Identifier for all updates.