vrecko
virtual reality framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Ctrl_FreeHandPainting.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "Controller.h"
4 #include "BrushStroke.h"
5 
6 #include "ToolBrush.h"
7 #include "ToolTongs.h"
8 #include "ToolEraser.h"
9 #include "Brush.h"
10 
11 #include "..\GUI\Slider.h"
12 #include "..\GUI\Icon.h"
13 
14 using namespace vrecko;
15 
16 namespace APDYNAMICART
17 {
18 
19 #define PLAYBACK_LAG_DURATION 0.5;
20 
21  typedef enum PlaybackType {
24  //FHP__FIXED
25  };
26 
28 
38 {
39 public:
40 
42  Ctrl_FreeHandPainting(const char* abName, const char* contextName, PoAType type);
44 
45  void activateTool();
46 
47  void clear();
48 
49  void createMenuStructure( osg::ref_ptr<vreckoUtils::MenuBase> parentMenu ) const;
50 
52 
57  osg::ref_ptr<PoA> createPoA();
58 
59  void deactivateTool();
60 
61  void debugKeyPressed();
62 
63  DAToolType getNextToolType();
64 
66 
72  double getPaintingDuration();
73 
74  void guiItemClicked(const char* itemID);
75 
76  void guiSliderChanged(const char* sliderID, float sliderPos);
77 
79  /*
80  * Called from DAEnvironment, where some other items are loaded from same file.
81  * \param fileName file to import
82  * \return code error. 0 means everything went good
83  */
84  int importScene( const string& fileName );
85 
86  void initialize(DAEnvironment* p_dae, XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *parameters = NULL);
87 
88  void load(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *parametersNode, XERCES_CPP_NAMESPACE_QUALIFIER DOMNodeList* poaNodeList);
89 
90  void processEvent(const std::string &input_name, void *value);
91 
92  void save(XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument* Document, XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *controllerNode);
93 
94  void setColour( osg::Vec4 newColour );
95 
96  void switchGUIVisibility();
97 
98  void switchTools(DAToolType newType);
99 
100  void turnOn();
101 
102  void turnOff();
103 
104  void update();
105 
106 
107 
108 
109 
110 protected:
111 
114 
116  // when new stroke is created, copy of brush is created and associated to stroke
118 
121 
122  //Tools
123  // osg::ref_ptr<ToolBrush> can NOT be used here, because of VRECKO
124  // VRECKO memory management collides with osg ref-pointers memory management
125  // particularly in deleting abilities.
127 
130 
133 
134  //Time-line
137 
140 
143 
146 
147  time_t _nowTime;
148 
152 
153 
154  //Menu
156 
157  inline std::string getShowControlPointsString() const;
158 
159  bool loadXMLParameters(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *parametersNode);
160 
161  void preInitialize();
162 
163  void postInitialize();
164  void playback( double _playbackTime );
165  string getPlaybackTimeText();
166  void recomputeStrokesTimes();
167 };
168 
169 }