openscenegraph
osgViewer/ViewerEventHandlers
Go to the documentation of this file.
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2*
3* This library is open source and may be redistributed and/or modified under
4* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5* (at your option) any later version. The full license is in LICENSE file
6* included with this distribution, and on the openscenegraph.org website.
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
11* OpenSceneGraph Public License for more details.
12*/
13
14#ifndef OSGVIEWER_VIEWEREVENTHANDLERS
15#define OSGVIEWER_VIEWEREVENTHANDLERS 1
16
17#include <osg/AnimationPath>
18#include <osgText/Text>
19#include <osgGA/GUIEventHandler>
21
23#include <osgViewer/Viewer>
24
25#include <osgDB/fstream>
26
27namespace osgViewer {
28
31{
32 public:
33
35
36 void setApplicationUsage(osg::ApplicationUsage* au) { _applicationUsage = au; }
37 osg::ApplicationUsage* getApplicationUsage() { return _applicationUsage.get(); }
38 const osg::ApplicationUsage* getApplicationUsage() const { return _applicationUsage.get(); }
39
40 void setKeyEventTogglesOnScreenHelp(int key) { _keyEventTogglesOnScreenHelp = key; }
41 int getKeyEventTogglesOnScreenHelp() const { return _keyEventTogglesOnScreenHelp; }
42
43 void reset();
44
45 osg::Camera* getCamera() { return _camera.get(); }
46 const osg::Camera* getCamera() const { return _camera.get(); }
47
49
51 virtual void getUsage(osg::ApplicationUsage& usage) const;
52
53 protected:
54
56
58
60
62
64
68
69};
70
75{
76 public:
77
79
81 {
82 NO_STATS = 0,
83 FRAME_RATE = 1,
84 VIEWER_STATS = 2,
85 CAMERA_SCENE_STATS = 3,
86 VIEWER_SCENE_STATS = 4,
87 LAST = 5
88 };
89
90 void setKeyEventTogglesOnScreenStats(int key) { _keyEventTogglesOnScreenStats = key; }
91 int getKeyEventTogglesOnScreenStats() const { return _keyEventTogglesOnScreenStats; }
92
93 void setKeyEventPrintsOutStats(int key) { _keyEventPrintsOutStats = key; }
94 int getKeyEventPrintsOutStats() const { return _keyEventPrintsOutStats; }
95
96 double getBlockMultiplier() const { return _blockMultiplier; }
97
98 void reset();
99
100 osg::Camera* getCamera() { return _camera.get(); }
101 const osg::Camera* getCamera() const { return _camera.get(); }
102
104
106
108 virtual void getUsage(osg::ApplicationUsage& usage) const;
109
142 void addUserStatsLine(const std::string& label, const osg::Vec4& textColor, const osg::Vec4& barColor,
143 const std::string& timeTakenName, float multiplier, bool average, bool averageInInverseSpace,
144 const std::string& beginTimeName, const std::string& endTimeName, float maxValue);
145
146 void removeUserStatsLine(const std::string& label);
147
148protected:
149
151 void setWindowSize(int width, int height);
152
153 osg::Geometry* createBackgroundRectangle(const osg::Vec3& pos, const float width, const float height, osg::Vec4& color);
154
155 osg::Geometry* createGeometry(const osg::Vec3& pos, float height, const osg::Vec4& colour, unsigned int numBlocks);
156
157 osg::Geometry* createFrameMarkers(const osg::Vec3& pos, float height, const osg::Vec4& colour, unsigned int numBlocks);
158
159 osg::Geometry* createTick(const osg::Vec3& pos, float height, const osg::Vec4& colour, unsigned int numTicks);
160
161 void createTimeStatsLine(const std::string& lineLabel, osg::Vec3 pos,
162 const osg::Vec4& textColor, const osg::Vec4& barColor, osg::Stats* viewerStats, osg::Stats* stats,
163 const std::string& timeTakenName, float multiplier, bool average, bool averageInInverseSpace,
164 const std::string& beginTimeName, const std::string& endTimeName);
165
166 void createCameraTimeStats(osg::Vec3& pos, bool acquireGPUStats, osg::Stats* viewerStats, osg::Camera* camera);
167
169
171
174
176
179
181
183
186
187 unsigned int _frameRateChildNum;
188 unsigned int _viewerChildNum;
191 unsigned int _numBlocks;
193
196
197 std::string _font;
199 float _leftPos;
202
204 {
205 std::string label;
208 std::string timeTakenName;
212 std::string beginTimeName;
213 std::string endTimeName;
214 float maxValue;
215
216 UserStatsLine(const std::string& label_, const osg::Vec4& textColor_, const osg::Vec4& barColor_,
217 const std::string& timeTakenName_, float multiplier_, bool average_, bool averageInInverseSpace_,
218 const std::string& beginTimeName_, const std::string& endTimeName_, float maxValue_)
219 : label(label_), textColor(textColor_), barColor(barColor_),
220 timeTakenName(timeTakenName_), multiplier(multiplier_), average(average_), averageInInverseSpace(averageInInverseSpace_),
221 beginTimeName(beginTimeName_), endTimeName(endTimeName_), maxValue(maxValue_)
222 {
223 }
224 };
225
226 typedef std::vector<UserStatsLine> UserStatsLines;
228
229};
230
233{
234public:
235
237
239 virtual void getUsage(osg::ApplicationUsage &usage) const;
240
241 void setKeyEventToggleFullscreen(int key) { _keyEventToggleFullscreen = key; }
242 int getKeyEventToggleFullscreen() const { return _keyEventToggleFullscreen; }
243
244 void setToggleFullscreen(bool flag) { _toggleFullscreen = flag; }
245 bool getToggleFullscreen() const { return _toggleFullscreen; }
246
247 void setKeyEventWindowedResolutionUp(int key) { _keyEventWindowedResolutionUp = key; }
248 int getKeyEventWindowedResolutionUp() const { return _keyEventWindowedResolutionUp; }
249 void setKeyEventWindowedResolutionDown(int key) { _keyEventWindowedResolutionDown = key; }
250 int getKeyEventWindowedResolutionDown() const { return _keyEventWindowedResolutionDown; }
251
252 void setChangeWindowedResolution(bool flag) { _changeWindowedResolution = flag; }
253 bool getChangeWindowedResolution() const { return _changeWindowedResolution; }
254
256
257protected:
258
261
262 unsigned int getNearestResolution(int screenWidth, int screenHeight, int width, int height) const;
263
266
270 std::vector<osg::Vec2> _resolutionList;
272};
273
276{
277public:
278
280
282 virtual void getUsage(osg::ApplicationUsage &usage) const;
283
284 void setKeyEventChangeThreadingModel(int key) { _keyEventChangeThreadingModel = key; }
285 int getKeyEventChangeThreadingModel() const { return _keyEventChangeThreadingModel; }
286
287 void setChangeThreadingModel(bool flag) { _changeThreadingModel = flag; }
288 bool getChangeThreadingModel() const { return _changeThreadingModel; }
289
290 void setKeyEventChangeEndBarrierPosition(int key) { _keyEventChangeEndBarrierPosition = key; }
291 int getKeyEventChangeEndBarrierPosition() const { return _keyEventChangeEndBarrierPosition; }
292
293 void setChangeEndBarrierPosition(bool flag) { _changeEndBarrierPosition = flag; }
294 bool getChangeEndBarrierPosition() const { return _changeEndBarrierPosition; }
295
297
298protected:
299
302
305
307};
308
317{
318public:
319
320 RecordCameraPathHandler(const std::string &filename = "saved_animation.path", float fps = 25.0f);
321
322 void setKeyEventToggleRecord(int key) { _keyEventToggleRecord = key; }
323 int getKeyEventToggleRecord() const { return _keyEventToggleRecord; }
324
325 void setKeyEventTogglePlayback(int key) { _keyEventTogglePlayback = key; }
326 int getKeyEventTogglePlayback() const { return _keyEventTogglePlayback; }
327
328 void setAutoIncrementFilename( bool autoinc = true ) { _autoinc = autoinc?0:-1; }
329
330 virtual void getUsage(osg::ApplicationUsage &usage) const;
331
333
334protected:
335
336 std::string _filename;
339
342
343
346 double _interval;
347 double _delta;
353};
354
357{
358 public:
359
361
362 void setKeyEventIncreaseLODScale(int key) { _keyEventIncreaseLODScale = key; }
363 int getKeyEventIncreaseLODScale() const { return _keyEventIncreaseLODScale; }
364
365 void setKeyEventDecreaseLODScale(int key) { _keyEventDecreaseLODScale = key; }
366 int getKeyEventDecreaseLODScale() const { return _keyEventDecreaseLODScale; }
367
369
371 virtual void getUsage(osg::ApplicationUsage& usage) const;
372
373 protected:
374
375
378
379
380};
381
384{
385 public:
386
388
389 void setKeyEventToggleSyncToVBlankHandler(int key) { _keyEventToggleSyncToVBlank = key; }
390 int getKeyEventToggleSyncToVBlankHandler() const { return _keyEventToggleSyncToVBlank; }
391
393
395 virtual void getUsage(osg::ApplicationUsage& usage) const;
396
397 protected:
398
399
401
402
403};
404
405
408{
409 public:
410
413 {
414 public:
415 virtual void operator()(const osg::Image& image, const unsigned int context_id) = 0;
416 };
417
420 {
421 public:
423 {
425 SEQUENTIAL_NUMBER
426 // ... any others?
427 };
428
429 WriteToFile(const std::string& filename, const std::string& extension, SavePolicy savePolicy = SEQUENTIAL_NUMBER);
430
431 virtual void operator()(const osg::Image& image, const unsigned int context_id);
432
433 void setSavePolicy(SavePolicy savePolicy) { _savePolicy = savePolicy; }
434 SavePolicy getSavePolicy() const { return _savePolicy; }
435
436 protected:
437
438 WriteToFile& operator = (const WriteToFile&) { return *this; }
439
440 const std::string _filename;
441 const std::string _extension;
442
444
445 std::vector<unsigned int> _contextSaveCounter;
446 };
447
450 ScreenCaptureHandler(CaptureOperation* defaultOperation = 0, int numFrames = 1);
451
452 void setKeyEventTakeScreenShot(int key) { _keyEventTakeScreenShot = key; }
453 int getKeyEventTakeScreenShot() const { return _keyEventTakeScreenShot; }
454
455 void setKeyEventToggleContinuousCapture(int key) { _keyEventToggleContinuousCapture = key; }
456 int getKeyEventToggleContinuousCapture() const { return _keyEventToggleContinuousCapture; }
457
460
461 // aa will point to an osgViewer::View, so we will take a screenshot
462 // of that view's graphics contexts.
464
467
470 void setFramesToCapture(int numFrames);
471
474
478
481
483 virtual void getUsage(osg::ApplicationUsage& usage) const;
484
485 protected:
488
491 // there could be a key to start taking screenshots every new frame
492
495
499};
500
505{
506public:
507
512
514
515 virtual NodeCallback* asNodeCallback() { return osg::NodeCallback::asNodeCallback(); }
516 virtual const NodeCallback* asNodeCallback() const { return osg::NodeCallback::asNodeCallback(); }
517
519 virtual const DrawableEventCallback* asDrawableEventCallback() const { return osg::DrawableEventCallback::asDrawableEventCallback(); }
520
522 virtual const DrawableCullCallback* asDrawableCullCallback() const { return osg::DrawableCullCallback::asDrawableCullCallback(); }
523
526
527 // use the osgGA::GUIEventHandler implementation of run.
528 virtual bool run(osg::Object* object, osg::Object* data) { return osgGA::GUIEventHandler::run(object, data); }
529
531
532 virtual bool cull(osg::NodeVisitor* nv, osg::Drawable* drawable, osg::RenderInfo* renderInfo) const;
533
534protected:
535
537
539 _fullscreen(false) {}
540
542 osg::Object(), osg::Callback(), osgGA::GUIEventHandler(), osg::DrawableCullCallback(), _fullscreen(false) {}
543
544 bool mousePosition(osgViewer::View* view, osg::NodeVisitor* nv, const osgGA::GUIEventAdapter& ea, int& x, int &y) const;
545
546 void resize(int width, int height);
547
550
553
554};
555
556}
557
558#endif
Definition fstream:47
Definition EventHandler:34
virtual EventHandler * asEventHandler()
Definition EventHandler:52
Definition GUIActionAdapter:62
Definition GUIEventAdapter:82
Definition GUIEventHandler:50
Definition GraphicsWindow:43
Definition osgViewer/ViewerEventHandlers:31
const osg::Camera * getCamera() const
Definition osgViewer/ViewerEventHandlers:46
void setUpHUDCamera(osgViewer::ViewerBase *viewer)
void setUpScene(osgViewer::ViewerBase *viewer)
const osg::ApplicationUsage * getApplicationUsage() const
Definition osgViewer/ViewerEventHandlers:38
bool _helpEnabled
Definition osgViewer/ViewerEventHandlers:63
osg::ref_ptr< osg::ApplicationUsage > _applicationUsage
Definition osgViewer/ViewerEventHandlers:59
virtual void getUsage(osg::ApplicationUsage &usage) const
void setApplicationUsage(osg::ApplicationUsage *au)
Definition osgViewer/ViewerEventHandlers:36
void setKeyEventTogglesOnScreenHelp(int key)
Definition osgViewer/ViewerEventHandlers:40
osg::ref_ptr< osg::Camera > _camera
Definition osgViewer/ViewerEventHandlers:66
HelpHandler(osg::ApplicationUsage *au=0)
osg::ApplicationUsage * getApplicationUsage()
Definition osgViewer/ViewerEventHandlers:37
bool _initialized
Definition osgViewer/ViewerEventHandlers:65
osg::ref_ptr< osg::Switch > _switch
Definition osgViewer/ViewerEventHandlers:67
osg::Camera * getCamera()
Definition osgViewer/ViewerEventHandlers:45
bool handle(const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa)
int getKeyEventTogglesOnScreenHelp() const
Definition osgViewer/ViewerEventHandlers:41
int _keyEventTogglesOnScreenHelp
Definition osgViewer/ViewerEventHandlers:61
Definition osgViewer/ViewerEventHandlers:505
virtual const NodeCallback * asNodeCallback() const
Definition osgViewer/ViewerEventHandlers:516
InteractiveImageHandler(osg::Image *image)
Constructor to use when the InteractiveImage is in the 3D scene (i.e. not in a fullscreen HUD overlay...
bool mousePosition(osgViewer::View *view, osg::NodeVisitor *nv, const osgGA::GUIEventAdapter &ea, int &x, int &y) const
virtual const osgGA::EventHandler * asEventHandler() const
Definition osgViewer/ViewerEventHandlers:525
virtual bool cull(osg::NodeVisitor *nv, osg::Drawable *drawable, osg::RenderInfo *renderInfo) const
virtual const DrawableCullCallback * asDrawableCullCallback() const
Definition osgViewer/ViewerEventHandlers:522
osg::observer_ptr< osg::Camera > _camera
Definition osgViewer/ViewerEventHandlers:552
InteractiveImageHandler()
Definition osgViewer/ViewerEventHandlers:538
InteractiveImageHandler(osg::Image *image, osg::Texture2D *texture, osg::Camera *camera)
Constructor to use when the InteractiveImage is in a fullscreen HUD overlay.
virtual DrawableEventCallback * asDrawableEventCallback()
Definition osgViewer/ViewerEventHandlers:518
virtual bool run(osg::Object *object, osg::Object *data)
Definition osgViewer/ViewerEventHandlers:528
virtual const DrawableEventCallback * asDrawableEventCallback() const
Definition osgViewer/ViewerEventHandlers:519
virtual bool handle(const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa, osg::Object *, osg::NodeVisitor *nv)
osg::observer_ptr< osg::Texture2D > _texture
Definition osgViewer/ViewerEventHandlers:549
META_Object(osgViewer, InteractiveImageHandler)
virtual DrawableCullCallback * asDrawableCullCallback()
Definition osgViewer/ViewerEventHandlers:521
virtual ~InteractiveImageHandler()
Definition osgViewer/ViewerEventHandlers:536
InteractiveImageHandler(const InteractiveImageHandler &, const osg::CopyOp &=osg::CopyOp::SHALLOW_COPY)
Definition osgViewer/ViewerEventHandlers:541
void resize(int width, int height)
virtual osgGA::EventHandler * asEventHandler()
Definition osgViewer/ViewerEventHandlers:524
osg::observer_ptr< osg::Image > _image
Definition osgViewer/ViewerEventHandlers:548
bool _fullscreen
Definition osgViewer/ViewerEventHandlers:551
virtual NodeCallback * asNodeCallback()
Definition osgViewer/ViewerEventHandlers:515
Definition osgViewer/ViewerEventHandlers:357
int _keyEventIncreaseLODScale
Definition osgViewer/ViewerEventHandlers:376
void setKeyEventDecreaseLODScale(int key)
Definition osgViewer/ViewerEventHandlers:365
int _keyEventDecreaseLODScale
Definition osgViewer/ViewerEventHandlers:377
virtual void getUsage(osg::ApplicationUsage &usage) const
bool handle(const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa)
int getKeyEventDecreaseLODScale() const
Definition osgViewer/ViewerEventHandlers:366
int getKeyEventIncreaseLODScale() const
Definition osgViewer/ViewerEventHandlers:363
void setKeyEventIncreaseLODScale(int key)
Definition osgViewer/ViewerEventHandlers:362
Definition osgViewer/ViewerEventHandlers:317
double _interval
Definition osgViewer/ViewerEventHandlers:346
bool _currentlyPlaying
Definition osgViewer/ViewerEventHandlers:345
int _keyEventToggleRecord
Definition osgViewer/ViewerEventHandlers:340
int _autoinc
Definition osgViewer/ViewerEventHandlers:337
int getKeyEventToggleRecord() const
Definition osgViewer/ViewerEventHandlers:323
osgDB::ofstream _fout
Definition osgViewer/ViewerEventHandlers:338
void setKeyEventToggleRecord(int key)
Definition osgViewer/ViewerEventHandlers:322
bool _currentlyRecording
Definition osgViewer/ViewerEventHandlers:344
osg::Timer_t _lastFrameTime
Definition osgViewer/ViewerEventHandlers:349
osg::ref_ptr< osgGA::AnimationPathManipulator > _animPathManipulator
Definition osgViewer/ViewerEventHandlers:351
void setKeyEventTogglePlayback(int key)
Definition osgViewer/ViewerEventHandlers:325
std::string _filename
Definition osgViewer/ViewerEventHandlers:336
int _keyEventTogglePlayback
Definition osgViewer/ViewerEventHandlers:341
double _delta
Definition osgViewer/ViewerEventHandlers:347
osg::ref_ptr< osgGA::CameraManipulator > _oldManipulator
Definition osgViewer/ViewerEventHandlers:352
bool handle(const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa)
RecordCameraPathHandler(const std::string &filename="saved_animation.path", float fps=25.0f)
osg::ref_ptr< osg::AnimationPath > _animPath
Definition osgViewer/ViewerEventHandlers:350
virtual void getUsage(osg::ApplicationUsage &usage) const
void setAutoIncrementFilename(bool autoinc=true)
Definition osgViewer/ViewerEventHandlers:328
int getKeyEventTogglePlayback() const
Definition osgViewer/ViewerEventHandlers:326
osg::Timer_t _animStartTime
Definition osgViewer/ViewerEventHandlers:348
Definition osgViewer/ViewerEventHandlers:413
virtual void operator()(const osg::Image &image, const unsigned int context_id)=0
Definition osgViewer/ViewerEventHandlers:420
SavePolicy
Definition osgViewer/ViewerEventHandlers:423
@ OVERWRITE
Definition osgViewer/ViewerEventHandlers:424
SavePolicy getSavePolicy() const
Definition osgViewer/ViewerEventHandlers:434
const std::string _extension
Definition osgViewer/ViewerEventHandlers:441
SavePolicy _savePolicy
Definition osgViewer/ViewerEventHandlers:443
std::vector< unsigned int > _contextSaveCounter
Definition osgViewer/ViewerEventHandlers:445
virtual void operator()(const osg::Image &image, const unsigned int context_id)
const std::string _filename
Definition osgViewer/ViewerEventHandlers:440
WriteToFile(const std::string &filename, const std::string &extension, SavePolicy savePolicy=SEQUENTIAL_NUMBER)
void setSavePolicy(SavePolicy savePolicy)
Definition osgViewer/ViewerEventHandlers:433
Definition osgViewer/ViewerEventHandlers:408
bool _startCapture
Definition osgViewer/ViewerEventHandlers:486
int getKeyEventToggleContinuousCapture() const
Definition osgViewer/ViewerEventHandlers:456
osg::ref_ptr< CaptureOperation > _operation
Definition osgViewer/ViewerEventHandlers:493
void setKeyEventToggleContinuousCapture(int key)
Definition osgViewer/ViewerEventHandlers:455
virtual void captureNextFrame(osgViewer::ViewerBase &viewer)
osg::Camera * findAppropriateCameraForCallback(osgViewer::ViewerBase &viewer)
ScreenCaptureHandler(CaptureOperation *defaultOperation=0, int numFrames=1)
void setFramesToCapture(int numFrames)
void setCaptureOperation(CaptureOperation *operation)
void setKeyEventTakeScreenShot(int key)
Definition osgViewer/ViewerEventHandlers:452
bool _stopCapture
Definition osgViewer/ViewerEventHandlers:487
void removeCallbackFromViewer(osgViewer::ViewerBase &viewer)
int _keyEventTakeScreenShot
Definition osgViewer/ViewerEventHandlers:489
virtual bool handle(const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa)
int getKeyEventTakeScreenShot() const
Definition osgViewer/ViewerEventHandlers:453
void addCallbackToViewer(osgViewer::ViewerBase &viewer)
int _keyEventToggleContinuousCapture
Definition osgViewer/ViewerEventHandlers:490
osg::ref_ptr< osg::Camera::DrawCallback > _callback
Definition osgViewer/ViewerEventHandlers:494
CaptureOperation * getCaptureOperation() const
virtual void getUsage(osg::ApplicationUsage &usage) const
Definition osgViewer/ViewerEventHandlers:75
void addUserStatsLine(const std::string &label, const osg::Vec4 &textColor, const osg::Vec4 &barColor, const std::string &timeTakenName, float multiplier, bool average, bool averageInInverseSpace, const std::string &beginTimeName, const std::string &endTimeName, float maxValue)
virtual void getUsage(osg::ApplicationUsage &usage) const
void createTimeStatsLine(const std::string &lineLabel, osg::Vec3 pos, const osg::Vec4 &textColor, const osg::Vec4 &barColor, osg::Stats *viewerStats, osg::Stats *stats, const std::string &timeTakenName, float multiplier, bool average, bool averageInInverseSpace, const std::string &beginTimeName, const std::string &endTimeName)
ViewerBase::ThreadingModel _threadingModel
Definition osgViewer/ViewerEventHandlers:184
void setUpScene(osgViewer::ViewerBase *viewer)
osg::Geometry * createGeometry(const osg::Vec3 &pos, float height, const osg::Vec4 &colour, unsigned int numBlocks)
std::vector< UserStatsLine > UserStatsLines
Definition osgViewer/ViewerEventHandlers:226
UserStatsLines _userStatsLines
Definition osgViewer/ViewerEventHandlers:227
void setWindowSize(int width, int height)
osg::ref_ptr< osgText::Text > _threadingModelText
Definition osgViewer/ViewerEventHandlers:185
int getKeyEventTogglesOnScreenStats() const
Definition osgViewer/ViewerEventHandlers:91
osg::Geometry * createFrameMarkers(const osg::Vec3 &pos, float height, const osg::Vec4 &colour, unsigned int numBlocks)
unsigned int _frameRateChildNum
Definition osgViewer/ViewerEventHandlers:187
osg::ref_ptr< osg::Switch > _switch
Definition osgViewer/ViewerEventHandlers:180
virtual bool handle(const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa)
osg::Geometry * createTick(const osg::Vec3 &pos, float height, const osg::Vec4 &colour, unsigned int numTicks)
void setKeyEventTogglesOnScreenStats(int key)
Definition osgViewer/ViewerEventHandlers:90
osg::Camera * getCamera()
Definition osgViewer/ViewerEventHandlers:100
void setUpHUDCamera(osgViewer::ViewerBase *viewer)
const osg::Camera * getCamera() const
Definition osgViewer/ViewerEventHandlers:101
osg::ref_ptr< osg::Geode > _statsGeode
Definition osgViewer/ViewerEventHandlers:182
int _keyEventPrintsOutStats
Definition osgViewer/ViewerEventHandlers:173
int _statsType
Definition osgViewer/ViewerEventHandlers:175
float _statsWidth
Definition osgViewer/ViewerEventHandlers:194
double _blockMultiplier
Definition osgViewer/ViewerEventHandlers:192
double getBlockMultiplier() const
Definition osgViewer/ViewerEventHandlers:96
float _leftPos
Definition osgViewer/ViewerEventHandlers:199
float _characterSize
Definition osgViewer/ViewerEventHandlers:200
unsigned int _viewerSceneChildNum
Definition osgViewer/ViewerEventHandlers:190
std::string _font
Definition osgViewer/ViewerEventHandlers:197
StatsType
Definition osgViewer/ViewerEventHandlers:81
osg::Geometry * createBackgroundRectangle(const osg::Vec3 &pos, const float width, const float height, osg::Vec4 &color)
void createCameraTimeStats(osg::Vec3 &pos, bool acquireGPUStats, osg::Stats *viewerStats, osg::Camera *camera)
float _statsHeight
Definition osgViewer/ViewerEventHandlers:195
void removeUserStatsLine(const std::string &label)
void setKeyEventPrintsOutStats(int key)
Definition osgViewer/ViewerEventHandlers:93
unsigned int _numBlocks
Definition osgViewer/ViewerEventHandlers:191
bool _initialized
Definition osgViewer/ViewerEventHandlers:177
float _startBlocks
Definition osgViewer/ViewerEventHandlers:198
virtual void collectWhichCamerasToRenderStatsFor(osgViewer::ViewerBase *viewer, osgViewer::ViewerBase::Cameras &cameras)
int _keyEventTogglesOnScreenStats
Definition osgViewer/ViewerEventHandlers:172
unsigned int _cameraSceneChildNum
Definition osgViewer/ViewerEventHandlers:189
unsigned int _viewerChildNum
Definition osgViewer/ViewerEventHandlers:188
int getKeyEventPrintsOutStats() const
Definition osgViewer/ViewerEventHandlers:94
osg::ref_ptr< osg::Camera > _camera
Definition osgViewer/ViewerEventHandlers:178
float _lineHeight
Definition osgViewer/ViewerEventHandlers:201
Definition osgViewer/ViewerEventHandlers:276
void setChangeEndBarrierPosition(bool flag)
Definition osgViewer/ViewerEventHandlers:293
bool _changeEndBarrierPosition
Definition osgViewer/ViewerEventHandlers:304
int getKeyEventChangeThreadingModel() const
Definition osgViewer/ViewerEventHandlers:285
virtual void getUsage(osg::ApplicationUsage &usage) const
void setChangeThreadingModel(bool flag)
Definition osgViewer/ViewerEventHandlers:287
bool _changeThreadingModel
Definition osgViewer/ViewerEventHandlers:301
bool getChangeThreadingModel() const
Definition osgViewer/ViewerEventHandlers:288
bool getChangeEndBarrierPosition() const
Definition osgViewer/ViewerEventHandlers:294
osg::Timer_t _tickOrLastKeyPress
Definition osgViewer/ViewerEventHandlers:306
int _keyEventChangeThreadingModel
Definition osgViewer/ViewerEventHandlers:300
int _keyEventChangeEndBarrierPosition
Definition osgViewer/ViewerEventHandlers:303
void setKeyEventChangeThreadingModel(int key)
Definition osgViewer/ViewerEventHandlers:284
bool handle(const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa)
int getKeyEventChangeEndBarrierPosition() const
Definition osgViewer/ViewerEventHandlers:291
void setKeyEventChangeEndBarrierPosition(int key)
Definition osgViewer/ViewerEventHandlers:290
Definition osgViewer/ViewerEventHandlers:384
virtual void getUsage(osg::ApplicationUsage &usage) const
void setKeyEventToggleSyncToVBlankHandler(int key)
Definition osgViewer/ViewerEventHandlers:389
int _keyEventToggleSyncToVBlank
Definition osgViewer/ViewerEventHandlers:400
bool handle(const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa)
int getKeyEventToggleSyncToVBlankHandler() const
Definition osgViewer/ViewerEventHandlers:390
Definition osgViewer/View:76
Definition ViewerBase:36
ThreadingModel
Definition ViewerBase:78
std::vector< osg::Camera * > Cameras
Definition ViewerBase:263
Definition osgViewer/ViewerEventHandlers:233
void setKeyEventWindowedResolutionUp(int key)
Definition osgViewer/ViewerEventHandlers:247
int getKeyEventToggleFullscreen() const
Definition osgViewer/ViewerEventHandlers:242
int _keyEventWindowedResolutionDown
Definition osgViewer/ViewerEventHandlers:268
void setToggleFullscreen(bool flag)
Definition osgViewer/ViewerEventHandlers:244
unsigned int getNearestResolution(int screenWidth, int screenHeight, int width, int height) const
int _keyEventWindowedResolutionUp
Definition osgViewer/ViewerEventHandlers:267
void setKeyEventToggleFullscreen(int key)
Definition osgViewer/ViewerEventHandlers:241
int _keyEventToggleFullscreen
Definition osgViewer/ViewerEventHandlers:264
void toggleFullscreen(osgViewer::GraphicsWindow *window)
virtual bool handle(const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa)
int getKeyEventWindowedResolutionDown() const
Definition osgViewer/ViewerEventHandlers:250
bool _toggleFullscreen
Definition osgViewer/ViewerEventHandlers:265
bool getChangeWindowedResolution() const
Definition osgViewer/ViewerEventHandlers:253
bool _changeWindowedResolution
Definition osgViewer/ViewerEventHandlers:269
std::vector< osg::Vec2 > _resolutionList
Definition osgViewer/ViewerEventHandlers:270
void setKeyEventWindowedResolutionDown(int key)
Definition osgViewer/ViewerEventHandlers:249
virtual void getUsage(osg::ApplicationUsage &usage) const
int getKeyEventWindowedResolutionUp() const
Definition osgViewer/ViewerEventHandlers:248
void setChangeWindowedResolution(bool flag)
Definition osgViewer/ViewerEventHandlers:252
void changeWindowedResolution(osgViewer::GraphicsWindow *window, bool increase)
int _currentResolutionIndex
Definition osgViewer/ViewerEventHandlers:271
bool getToggleFullscreen() const
Definition osgViewer/ViewerEventHandlers:245
Definition ApplicationUsage:26
virtual bool run(osg::Object *object, osg::Object *data)
Definition Callback:80
Definition Camera:45
Definition CopyOp:41
@ SHALLOW_COPY
Definition CopyOp:47
Definition Callback:341
virtual DrawableCullCallback * asDrawableCullCallback()
Definition Callback:351
virtual DrawableEventCallback * asDrawableEventCallback()
Definition Callback:330
Definition Drawable:89
Definition Geometry:31
Definition Image:179
virtual NodeCallback * asNodeCallback()
Definition Callback:227
Definition NodeVisitor:82
Definition Object:61
Definition Referenced:44
Definition RenderInfo:28
Definition Stats:29
Definition Texture2D:25
Definition Vec3f:29
Definition Vec4f:28
Definition observer_ptr:39
Definition ref_ptr:32
Definition Callback:21
author: Julien Valentin 2017 (mp3butcher@hotmail.com)
Definition AlphaFunc:19
unsigned long long Timer_t
Definition Timer:24
#define OSGVIEWER_EXPORT
Definition osgViewer/Export:40
Definition osgViewer/ViewerEventHandlers:204
osg::Vec4 barColor
Definition osgViewer/ViewerEventHandlers:207
std::string timeTakenName
Definition osgViewer/ViewerEventHandlers:208
osg::Vec4 textColor
Definition osgViewer/ViewerEventHandlers:206
bool averageInInverseSpace
Definition osgViewer/ViewerEventHandlers:211
bool average
Definition osgViewer/ViewerEventHandlers:210
std::string endTimeName
Definition osgViewer/ViewerEventHandlers:213
std::string beginTimeName
Definition osgViewer/ViewerEventHandlers:212
UserStatsLine(const std::string &label_, const osg::Vec4 &textColor_, const osg::Vec4 &barColor_, const std::string &timeTakenName_, float multiplier_, bool average_, bool averageInInverseSpace_, const std::string &beginTimeName_, const std::string &endTimeName_, float maxValue_)
Definition osgViewer/ViewerEventHandlers:216
float maxValue
Definition osgViewer/ViewerEventHandlers:214
std::string label
Definition osgViewer/ViewerEventHandlers:205
float multiplier
Definition osgViewer/ViewerEventHandlers:209