vrecko
virtual reality framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Hoop.h
Go to the documentation of this file.
1 
8 #pragma once
9 
10 #include "poa.h"
11 #include "SweepSurface.h"
12 #include "SectorColorGen.h"
13 #include "ConstantDiameterGen.h"
14 #include "HoopShape.h"
15 #include <NxActor.h>
17 
18 namespace APDYNAMICART
19 {
20 
21 class Hoop : public PoA, public Stroke
22 {
23 public:
24  Hoop(Controller* controller, HoopShapePtr shape);
25 
27  virtual void createMenuStructure( osg::ref_ptr<vreckoUtils::MenuBase> parentMenu ) const;
28  virtual int load( XERCES_CPP_NAMESPACE_QUALIFIER DOMNode* PoANode );
29  virtual void save( XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument* Document, XERCES_CPP_NAMESPACE_QUALIFIER DOMNode* poaNode );
30  virtual void GUIItemClicked( const char* itemID );
31  virtual void GUISliderChanged( const char* sliderID, float sliderPos );
32  virtual void pointed( bool pointed ) { _highlight->setHighlighting(pointed); }
33  virtual void setColor( osg::Vec4 newColour );
34  virtual void update();
35 
38  osg::Vec4 getColor();
39 
42  ColorGenPtr getCachedColorGenerator() const { return _colorGen; }
43 
44  double getDiameter() const { return _diameterGenerator->getDiameterValue(); }
45  void setDiameter(double val) { _diameterGenerator->setDiameterValue(val); }
46 
47  HoopShapePtr getShape() const { return _shape; }
48  void setShape(HoopShapePtr val) { _shape = val; _sweepSurface->setLeadingSpline(_shape->getLeadingSpline()); }
49 
50  NxActor* getActor() const { return _actor; }
51  void setActor(NxActor* val) { _actor = val; }
52 
54  void showAxis() { _axis->setAllChildrenOn(); }
55  void hideAxis() { _axis->setAllChildrenOff(); }
56 
58  virtual Vec3ArrayPtr getPositionSamples() const;
59  virtual Vec4ArrayPtr getOrientationSamples() const;
60  virtual osg::ref_ptr<osg::DoubleArray> getTimeStamps() const;
61  virtual SplinePtr getLeadingSpline() const;
62 
64  void createActor();
65  void deleteActor();
66  void updateActor();
67 
68 protected:
71  NxActor* _actor;
72  osg::Matrix _currentRotation;
73  osg::Vec3 _currentTransform;
75 
78  osg::ref_ptr<osg::Switch> _axis;
79 
81  ColorGenPtr _colorGen;
82  osg::ref_ptr<ConstantDiameterGen> _diameterGenerator;
83 
84  osg::ref_ptr<vreckoUtils::HighlightCallback> _highlight;
85 
86  //Stroke variables
89  DoubleArrayPtr _timeStamps;
90 
91  //For changing hoop's color
92  DECLARE_REQUEST_OUTPUT(EvokeHSLColorPicker, MessageString, MessageBool);
93  DECLARE_INPUT(Colour, MessageVec4);
94 
95 };
96 
97 typedef osg::ref_ptr<Hoop> HoopPtr;
98 
99 }