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
BaseObjectData.hh
Go to the documentation of this file.
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
51
52
53 //=============================================================================
54 //
55 // Types
56 //
57 //=============================================================================
58
66 #ifndef BASEOBJECTDATA_HH
67 #define BASEOBJECTDATA_HH
68
69
70 //== INCLUDES =================================================================
71
72 #include <OpenFlipper/common/GlobalDefines.hh>
73 #include <OpenFlipper/common/BaseObject.hh>
74 #include <QObject>
75 #include <vector>
76 #include <ACG/Scenegraph/MaterialNode.hh>
77 #include <ACG/Scenegraph/SeparatorNode.hh>
78 #include <ACG/Scenegraph/ShaderNode.hh>
79 #include <ACG/Scenegraph/BaseNode.hh>
80 #include <ACG/Scenegraph/BoundingBoxNode.hh>
81 #include <ACG/Scenegraph/StencilRefNode.hh>
82 #include <ACG/QtScenegraph/QtTranslationManipulatorNode.hh>
83
84 //== TYPEDEFS =================================================================
85
86 //== TYPEDEFS FOR SCENEGRAPH ===============================================
88 typedef ACG::SceneGraph::MaterialNode MaterialNode;
90 typedef ACG::SceneGraph::QtTranslationManipulatorNode QtTranslationManipulatorNode;
92 typedef ACG::SceneGraph::SeparatorNode SeparatorNode;
94 typedef ACG::SceneGraph::BaseNode BaseNode;
96 typedef ACG::SceneGraph::BoundingBoxNode BoundingBoxNode;
98 typedef ACG::SceneGraph::StencilRefNode StencilRefNode;
99
100 //== CLASS DEFINITION =========================================================
101
105 class DLLEXPORT BaseObjectData : public BaseObject
106 {
107
108 friend class Core;
109
110 Q_OBJECT
111
112 public:
113
118 BaseObjectData(const BaseObjectData& _object);
119
121 BaseObjectData();
122
124 virtual ~BaseObjectData();
125
126 private:
128 void initializeScenegraphNodes();
129
132 //===========================================================================
135 //===========================================================================
136
137 public:
141 virtual void cleanup();
142
143
146 virtual void setName(QString _name );
147
148 //===========================================================================
151 //===========================================================================
152
153 public :
155 virtual void show();
156
158 virtual void hide();
159
161 virtual bool visible();
162
164 virtual void visible(bool _visible);
165
169 SeparatorNode* baseNode();
170
176 virtual bool hasNode(BaseNode* _node);
177
180 virtual BaseNode* primaryNode();
181
185 QtTranslationManipulatorNode* manipulatorNode();
186
192 virtual ACG::SceneGraph::ShaderNode* shaderNode();
193
195 MaterialNode* materialNode();
196
198 BoundingBoxNode* boundingBoxNode();
199
201 StencilRefNode* stencilRefNode();
202
204 bool manipPlaced();
205
207 void manipPlaced( bool _placed );
208
210 void getBoundingBox(ACG::Vec3d& bbmin, ACG::Vec3d& bbmax);
211
216 void setObjectDrawMode(const ACG::SceneGraph::DrawModes::DrawMode& _mode, const bool& _force = false);
217
218 private :
219
220
221 bool manipPlaced_;
222
224 SeparatorNode* rootNode_;
225
227 SeparatorNode* separatorNode_;
228
230 QtTranslationManipulatorNode* manipulatorNode_;
231
233 MaterialNode* materialNode_;
234
236 BoundingBoxNode * boundingBoxNode_;
237
239 StencilRefNode* stencilRefNode_;
240
244 //===========================================================================
247 //===========================================================================
248
249 public :
251 virtual bool picked( uint _node_idx );
252
257 virtual void enablePicking( bool _enable );
258
263 virtual bool pickingEnabled();
264
279 virtual ACG::Vec3d refinePick(ACG::SceneGraph::PickTarget _pickTarget,
280 const ACG::Vec3d _hitPoint,
281 const ACG::Vec3d _start ,
282 const ACG::Vec3d _dir,
283 const unsigned int _targetIdx );
284
287 //===========================================================================
290 //===========================================================================
291
292 protected:
301 virtual void update(UpdateType _type = UPDATE_ALL );
302
305 //===========================================================================
313 //===========================================================================
314 public:
329 template< typename NodeT >
330 bool addAdditionalNode(NodeT* _node , QString _pluginName, QString _nodeName , int _id = 0);
331
342 bool hasAdditionalNode(QString _pluginName, QString _nodeName , int _id = 0);
343
354 template< typename NodeT >
355 bool getAdditionalNode(NodeT*& _node , QString _pluginName, QString _nodeName , int _id = 0 );
356
369 template< typename NodeT >
370 bool removeAdditionalNode(NodeT*& _node, QString _pluginName, QString _nodeName , int _id = 0 );
371 private:
375 std::vector< std::pair <BaseNode*,QString> > additionalNodes_;
376
379 };
380
381
382 //=============================================================================
383
384 #if defined(INCLUDE_TEMPLATES) && !defined(BASEOBJECTDATA_C)
385 #define BASEOBJECT_TEMPLATES
386 #include "BaseObjectDataT.cc"
387 #endif
388
389 //=============================================================================
390 #endif // BASEOBJECTDATA_HH defined
391 //=============================================================================
ACG::SceneGraph::SeparatorNode
Definition: SeparatorNode.hh:84
SeparatorNode
ACG::SceneGraph::SeparatorNode SeparatorNode
Seperator Node.
Definition: BaseObjectData.hh:92
ACG::SceneGraph::BoundingBoxNode
Definition: BoundingBoxNode.hh:88
ACG::SceneGraph::BaseNode
Definition: BaseNode.hh:135
BaseObjectData::stencilRefNode_
StencilRefNode * stencilRefNode_
Stencil reference node for the object.
Definition: BaseObjectData.hh:239
ACG::SceneGraph::PickTarget
PickTarget
What target to use for picking.
Definition: BaseNode.hh:99
BaseObjectData
Definition: BaseObjectData.hh:105
UpdateType
Update type class.
Definition: UpdateType.hh:70
BaseObject::update
virtual void update(UpdateType _type=UPDATE_ALL)
This function is called to update the object.
Definition: BaseObject.cc:756
UPDATE_ALL
const UpdateType UPDATE_ALL(UpdateTypeSet(1))
Identifier for all updates.
BoundingBoxNode
ACG::SceneGraph::BoundingBoxNode BoundingBoxNode
Bounding box Node.
Definition: BaseObjectData.hh:96
GlobalDefines.hh
BaseObject::visible
virtual bool visible()
return if object is visible
Definition: BaseObject.cc:350
Core
Definition: Core.hh:139
BaseObjectData::separatorNode_
SeparatorNode * separatorNode_
Separator at top of Scenegraph structure used for this Object.
Definition: BaseObjectData.hh:227
ACG::SceneGraph::QtTranslationManipulatorNode
Definition: QtTranslationManipulatorNode.hh:87
ACG::SceneGraph::DrawModes::DrawMode
Specifies a DrawMode.
Definition: DrawModes.hh:294
BaseObject::cleanup
virtual void cleanup()
Definition: BaseObject.cc:218
BaseObject
Definition: BaseObject.hh:94
OpenMesh::VectorT
Definition: Vector11T.hh:83
StencilRefNode
ACG::SceneGraph::StencilRefNode StencilRefNode
Stencil reference Node.
Definition: BaseObjectData.hh:98
BaseObjectData::additionalNodes_
std::vector< std::pair< BaseNode *, QString > > additionalNodes_
Definition: BaseObjectData.hh:375
BaseObjectData::manipPlaced_
bool manipPlaced_
rootNode of global Scenegraph structure
Definition: BaseObjectData.hh:221
BaseObject.hh
QtTranslationManipulatorNode
ACG::SceneGraph::QtTranslationManipulatorNode QtTranslationManipulatorNode
ManipulatorNode.
Definition: BaseObjectData.hh:90
DLLEXPORT
#define DLLEXPORT
Definition: GlobalDefines.hh:107
BaseNode
ACG::SceneGraph::BaseNode BaseNode
Base Node.
Definition: BaseObjectData.hh:94
BaseObjectData::manipulatorNode_
QtTranslationManipulatorNode * manipulatorNode_
Manipulator used for this Object.
Definition: BaseObjectData.hh:230
ACG::SceneGraph::StencilRefNode
Definition: StencilRefNode.hh:83
ACG::SceneGraph::ShaderNode
Definition: ShaderNode.hh:87
BaseObjectData::materialNode_
MaterialNode * materialNode_
Scenegraph Material Node for the object.
Definition: BaseObjectData.hh:233
BaseObjectData::boundingBoxNode_
BoundingBoxNode * boundingBoxNode_
Bounding box node for the object.
Definition: BaseObjectData.hh:236
BaseObject::setName
virtual void setName(QString _name)
path to the file from which the object is loaded ( defaults to "." )
Definition: BaseObject.cc:734
MaterialNode
ACG::SceneGraph::MaterialNode MaterialNode
Materialnode.
Definition: BaseObjectData.hh:88
ACG::SceneGraph::MaterialNode
Definition: MaterialNode.hh:321
BaseObjectData::rootNode_
SeparatorNode * rootNode_
rootNode of global Scenegraph structure
Definition: BaseObjectData.hh:224