vrecko
virtual reality framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
OrdinaryAttractor.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "Attractor.h"
4 #include "ComputeStrategy.h"
5 #include "Utils.h"
6 #include "ComputeThread.h"
7 
8 namespace APDYNAMICART
9 {
10 
12 {
13  IComputeStrategyPtr _strategy;
14  int _settleIterations;
15  Limits _lim;
16  int _iterationCount;
17  AttractorRenderingType _renderingType;
18  ComputeThreadPtr _thread;
19  GeometryPtr _geometry;
20  GeodePtr _bbGeode;
21  int _interpolationSteps;
22  bool _randomRun;
23  osg::Vec4 _color;
24  osg::ref_ptr<osg::Material> _material;
25 
26 public:
27 
29  OrdinaryAttractor(IComputeStrategyPtr computeStrategy, IParametersPtr parameters, Controller* controller);
30 
31  bool colorChanged( const char* sliderID, float sliderPos );
32 
33  virtual void compute();
34 
35  virtual void createMenuStructure( osg::ref_ptr<vreckoUtils::MenuBase> parentMenu ) const;
36 
37  int getIterationCount();
38 
39  virtual void GUIItemClicked( const char* itemID );
40 
41  virtual void GUISliderChanged( const char* sliderID, float sliderPos );
42 
43  virtual void init();
44 
45  virtual int load( XERCES_CPP_NAMESPACE_QUALIFIER DOMNode* PoANode );
46 
47  virtual void save( XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument* Document, XERCES_CPP_NAMESPACE_QUALIFIER DOMNode* poaNode );
48 
49  virtual void update();
50 
51 
52 
53 private:
55  void updateGeometry();
56  void switchTransparency();
57  void switchUpdating();
58  void setRenderingType( AttractorRenderingType renderingType );
59  void setTransparency(osg::StateSet* stateSet, bool enable);
60  void createDrawableObject();
61  //void drawSpheres();
62  void createOrUpdateBoundingBox( const Limits& lim );
63  osg::PrimitiveSet* createPrimitiveSet( int size );
64  IMenuComponentPtr createViewSubMenu() const;
65  IMenuComponentPtr createIterationSubMenu() const;
66  IMenuComponentPtr createColorSubMenu() const;
67 };
68 
69 inline void OrdinaryAttractor::setRenderingType( AttractorRenderingType renderingType )
70 {
71  _renderingType = renderingType;
72  generate();
73 }
74 
76 {
77  return _iterationCount;
78 }
79 
80 }