Debian Codegraph @

utils/fgviewer/HLASceneObject.hxx

raw symbols SCIP
1 // Copyright (C) 2009 - 2012 Mathias Froehlich - [email protected]
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Library General Public
5 // License as published by the Free Software Foundation; either
6 // version 2 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Library General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with this program; if not, write to the Free Software
15 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 //
17
18 #ifndef HLASceneObject_hxx
19 #define HLASceneObject_hxx
20
21 #include <osg/Node>
22 #include <osg/PagedLOD>
23 #include <osg/ref_ptr>
24
25 #include <simgear/hla/HLAObjectClass.hxx>
26 #include <simgear/hla/HLALocation.hxx>
27
28 #include "HLAObjectReferenceData.hxx"
29
30 namespace fgviewer {
31
32 class HLASceneObjectClass;
33
34 class HLASceneObject : public simgear::HLAObjectInstance {
35 public:
36 HLASceneObject(HLASceneObjectClass* objectClass, const SGWeakPtr<simgear::HLAFederate>& federate);
37 virtual ~HLASceneObject();
38
39 virtual void createAttributeDataElements();
40
41 virtual void discoverInstance(const simgear::RTIData& tag);
42 virtual void removeInstance(const simgear::RTIData& tag);
43
44 virtual void registerInstance(simgear::HLAObjectClass* objectClass);
45 virtual void deleteInstance(const simgear::RTIData& tag);
46
47 const HLASceneObject* getSceneObject() const;
48 HLASceneObject* getSceneObject();
49 void setSceneObject(HLASceneObject* sceneObject);
50
51 virtual SGLocationd getLocation(const SGTimeStamp& timeStamp) const;
52
53 simgear::HLADataElement* getModelDataElement();
54
55 osg::Node* getNode();
56
57 protected:
58 SGLocationd _getRelativeLocation(const SGTimeStamp& timeStamp) const;
59 // Return the velocities of this current object without taking the referenced velocities into account
60 SGVec3d _getRelativeAngularVelocity() const;
61 SGVec3d _getRelativeLinearVelocity() const;
62
63 void _setModelFileName(const std::string& fileName);
64
65 private:
66 class _ModelDataElement;
67 class _Transform;
68
69 // Add the transform node to the scenegraph
70 void _addToSceneGraph();
71 // Remove the transform node from the scenegraph
72 void _removeFromSceneGraph();
73
74 // The location of this object
75 SGSharedPtr<simgear::HLAAbstractLocation> _location;
76 // If this object is living relative to an other one, this one is non zero
77 simgear::HLAObjectReferenceData<HLASceneObject> _sceneObject;
78
79 // The top level transform node for this scene object
80 osg::ref_ptr<_Transform> _transform;
81 osg::ref_ptr<osg::PagedLOD> _pagedLOD;
82 };
83
84 } // namespace fgviewer
85
86 #endif