Developer Documentation
 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 
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 ===============================================
99 
100 //== CLASS DEFINITION =========================================================
101 
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 
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 );
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 SeparatorNode
Seperator Node.
StencilRefNode * stencilRefNode_
Stencil reference node for the object.
PickTarget
What target to use for picking.
Definition: BaseNode.hh:99
Update type class.
Definition: UpdateType.hh:70
virtual void update(UpdateType _type=UPDATE_ALL)
This function is called to update the object.
Definition: BaseObject.cc:756
const UpdateType UPDATE_ALL(UpdateTypeSet(1))
Identifier for all updates.
ACG::SceneGraph::BoundingBoxNode BoundingBoxNode
Bounding box Node.
virtual bool visible()
return if object is visible
Definition: BaseObject.cc:350
Definition: Core.hh:139
SeparatorNode * separatorNode_
Separator at top of Scenegraph structure used for this Object.
virtual void cleanup()
Definition: BaseObject.cc:218
ACG::SceneGraph::StencilRefNode StencilRefNode
Stencil reference Node.
std::vector< std::pair< BaseNode *, QString > > additionalNodes_
bool manipPlaced_
rootNode of global Scenegraph structure
ACG::SceneGraph::QtTranslationManipulatorNode QtTranslationManipulatorNode
ManipulatorNode.
#define DLLEXPORT
ACG::SceneGraph::BaseNode BaseNode
Base Node.
QtTranslationManipulatorNode * manipulatorNode_
Manipulator used for this Object.
MaterialNode * materialNode_
Scenegraph Material Node for the object.
BoundingBoxNode * boundingBoxNode_
Bounding box node for the object.
virtual void setName(QString _name)
path to the file from which the object is loaded ( defaults to "." )
Definition: BaseObject.cc:734
ACG::SceneGraph::MaterialNode MaterialNode
Materialnode.
SeparatorNode * rootNode_
rootNode of global Scenegraph structure