Developer Documentation
Loading...
Searching...
No Matches
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//
45// Types
46//
47//=============================================================================
48
55#pragma once
56
57
58//== INCLUDES =================================================================
59
62#include <vector>
63#include <ACG/Scenegraph/PickTarget.hh>
64#include <ACG/Scenegraph/DrawModes.hh>
65
66//== FORWARD Declarations to avoid gl qt collisions =================================================================
67
68namespace ACG {
69namespace SceneGraph {
70
71class MaterialNode;
73class SeparatorNode;
74class BaseNode;
75class BoundingBoxNode;
76class StencilRefNode;
77class ShaderNode;
78
79}
80}
81
82
83//== TYPEDEFS FOR SCENEGRAPH ===============================================
96
97//== CLASS DEFINITION =========================================================
98
103{
104
105 friend class Core;
106
107 Q_OBJECT
108
109 public:
110
115 BaseObjectData(const BaseObjectData& _object);
116
119
121 virtual ~BaseObjectData();
122
123 private:
125 void initializeScenegraphNodes();
126
129 //===========================================================================
132 //===========================================================================
133
134 public:
138 virtual void cleanup() override;
139
140
143 virtual void setName(QString _name ) override;
144
145 //===========================================================================
148 //===========================================================================
149
150 public :
152 virtual void show();
153
155 virtual void hide();
156
158 virtual bool visible() override;
159
161 virtual void visible(bool _visible) override;
162
166 SeparatorNode* baseNode();
167
173 virtual bool hasNode(BaseNode* _node);
174
177 virtual BaseNode* primaryNode();
178
182 QtTranslationManipulatorNode* manipulatorNode();
183
189 virtual ACG::SceneGraph::ShaderNode* shaderNode();
190
192 MaterialNode* materialNode();
193
195 const MaterialNode* materialNode() const;
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) const;
211
216 void setObjectDrawMode(const ACG::SceneGraph::DrawModes::DrawMode& _mode, const bool& _force = false);
217
218 private :
219
220
222
225
228
231
234
237
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 ) override;
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(const QString &_pluginName, const 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_impl.hh"
387#endif
388
ACG::SceneGraph::MaterialNode MaterialNode
Materialnode.
ACG::SceneGraph::BoundingBoxNode BoundingBoxNode
Bounding box Node.
ACG::SceneGraph::BaseNode BaseNode
Base Node.
ACG::SceneGraph::SeparatorNode SeparatorNode
Seperator Node.
ACG::SceneGraph::StencilRefNode StencilRefNode
Stencil reference Node.
ACG::SceneGraph::QtTranslationManipulatorNode QtTranslationManipulatorNode
ManipulatorNode.
#define DLLEXPORT
bool manipPlaced_
rootNode of global Scenegraph structure
SeparatorNode * rootNode_
rootNode of global Scenegraph structure
MaterialNode * materialNode_
Scenegraph Material Node for the object.
QtTranslationManipulatorNode * manipulatorNode_
Manipulator used for this Object.
StencilRefNode * stencilRefNode_
Stencil reference node for the object.
SeparatorNode * separatorNode_
Separator at top of Scenegraph structure used for this Object.
BoundingBoxNode * boundingBoxNode_
Bounding box node for the object.
std::vector< std::pair< BaseNode *, QString > > additionalNodes_
virtual void update(UpdateType _type=UPDATE_ALL)
This function is called to update the object.
virtual void setName(QString _name)
path to the file from which the object is loaded ( defaults to "." )
virtual void cleanup()
virtual bool visible()
return if object is visible
Definition Core.hh:133
Update type class.
Definition UpdateType.hh:59
const UpdateType UPDATE_ALL(UpdateTypeSet(1))
Identifier for all updates.
PickTarget
What target to use for picking.
Definition PickTarget.hh:74
Namespace providing different geometric functions concerning angles.