osggraph: add osg stats using ? key
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@9428 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: 19ff7a06be63a287b82647600d6384fde32cb55a Former-commit-id: 9bfd9aed69cba598b1f878164a6c4ef83d4529dd
This commit is contained in:
parent
adfefc1101
commit
7375c14241
3 changed files with 18 additions and 2 deletions
|
@ -220,7 +220,10 @@ void SDMoveSeatForwardBackward(void *move)
|
||||||
tCarElt* curCar = screens->getActiveView()->getCurrentCar();
|
tCarElt* curCar = screens->getActiveView()->getCurrentCar();
|
||||||
curCar->_drvPos_x+=movement;
|
curCar->_drvPos_x+=movement;
|
||||||
}
|
}
|
||||||
|
void SDToggleStats(void *vp)
|
||||||
|
{
|
||||||
|
screens->toggleStats();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int initView(int x, int y, int width, int height, int /* flag */, void *screen)
|
int initView(int x, int y, int width, int height, int /* flag */, void *screen)
|
||||||
|
@ -262,6 +265,8 @@ int initView(int x, int y, int width, int height, int /* flag */, void *screen)
|
||||||
GfuiAddKey(screen, GFUIK_F10, "Follow Car Zoomed", (void*)8, SDSelectCamera, NULL);
|
GfuiAddKey(screen, GFUIK_F10, "Follow Car Zoomed", (void*)8, SDSelectCamera, NULL);
|
||||||
GfuiAddKey(screen, GFUIK_F11, "TV Director View", (void*)9, SDSelectCamera, NULL);
|
GfuiAddKey(screen, GFUIK_F11, "TV Director View", (void*)9, SDSelectCamera, NULL);
|
||||||
|
|
||||||
|
GfuiAddKey(screen, '?', "Toggle OSG Stats", (void *)0, SDToggleStats, NULL);
|
||||||
|
|
||||||
GfuiAddKey(screen, '1', "Toggle HUD laptimeWidget", (void*)"laptimeWidget", SDToggleHUDwidget, NULL);
|
GfuiAddKey(screen, '1', "Toggle HUD laptimeWidget", (void*)"laptimeWidget", SDToggleHUDwidget, NULL);
|
||||||
GfuiAddKey(screen, '2', "Toggle HUD carinfoWidget", (void*)"carinfoWidget,carstatusWidget", SDToggleHUDwidgets, NULL);
|
GfuiAddKey(screen, '2', "Toggle HUD carinfoWidget", (void*)"carinfoWidget,carstatusWidget", SDToggleHUDwidgets, NULL);
|
||||||
GfuiAddKey(screen, '3', "Toggle HUD boardWidget", (void*)"boardWidget", SDToggleHUDwidget, NULL);
|
GfuiAddKey(screen, '3', "Toggle HUD boardWidget", (void*)"boardWidget", SDToggleHUDwidget, NULL);
|
||||||
|
|
|
@ -23,9 +23,11 @@
|
||||||
|
|
||||||
#include <osgViewer/Viewer>
|
#include <osgViewer/Viewer>
|
||||||
#include <osgViewer/GraphicsWindow>
|
#include <osgViewer/GraphicsWindow>
|
||||||
|
#include <osgViewer/ViewerEventHandlers>
|
||||||
#include <osg/GraphicsContext>
|
#include <osg/GraphicsContext>
|
||||||
#include <osg/ValueObject>
|
#include <osg/ValueObject>
|
||||||
#include <osg/FrontFace>
|
#include <osg/FrontFace>
|
||||||
|
#include <osgGA/EventQueue>
|
||||||
|
|
||||||
#include "OsgScreens.h"
|
#include "OsgScreens.h"
|
||||||
#if SDL_MAJOR_VERSION >= 2
|
#if SDL_MAJOR_VERSION >= 2
|
||||||
|
@ -52,7 +54,7 @@ SDScreens::SDScreens() :
|
||||||
debugHUD = new SDDebugHUD();
|
debugHUD = new SDDebugHUD();
|
||||||
}
|
}
|
||||||
|
|
||||||
extern SDHUD hud;
|
extern SDHUD hud;
|
||||||
|
|
||||||
class CameraDrawnCallback : public osg::Camera::DrawCallback
|
class CameraDrawnCallback : public osg::Camera::DrawCallback
|
||||||
{
|
{
|
||||||
|
@ -68,6 +70,9 @@ void SDScreens::Init(int x,int y, int width, int height, osg::ref_ptr<osg::Node>
|
||||||
//intialising main screen
|
//intialising main screen
|
||||||
|
|
||||||
viewer = new osgViewer::Viewer;
|
viewer = new osgViewer::Viewer;
|
||||||
|
osgViewer::StatsHandler *statsHandler = new osgViewer::StatsHandler();
|
||||||
|
statsHandler->setKeyEventTogglesOnScreenStats('?');
|
||||||
|
viewer->addEventHandler(statsHandler);
|
||||||
viewer->setLightingMode( osg::View::NO_LIGHT );
|
viewer->setLightingMode( osg::View::NO_LIGHT );
|
||||||
viewer->setThreadingModel( osgViewer::Viewer::CullThreadPerCameraDrawThreadPerContext );
|
viewer->setThreadingModel( osgViewer::Viewer::CullThreadPerCameraDrawThreadPerContext );
|
||||||
#if 1 //SDL_MAJOR_VERSION < 2
|
#if 1 //SDL_MAJOR_VERSION < 2
|
||||||
|
@ -293,6 +298,11 @@ void SDScreens::toggleHUDeditmode()
|
||||||
hud.ToggleHUDeditmode();
|
hud.ToggleHUDeditmode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SDScreens::toggleStats()
|
||||||
|
{
|
||||||
|
viewer->getEventQueue()->keyPress(osgGA::GUIEventAdapter::KeySymbol('?'));
|
||||||
|
}
|
||||||
|
|
||||||
void SDScreens::registerViewDependantPreRenderNode(osg::ref_ptr<osg::Node> node)
|
void SDScreens::registerViewDependantPreRenderNode(osg::ref_ptr<osg::Node> node)
|
||||||
{
|
{
|
||||||
//TODO : multi-screen support of this feature
|
//TODO : multi-screen support of this feature
|
||||||
|
|
|
@ -64,6 +64,7 @@ public:
|
||||||
|
|
||||||
void toggleHUDdriverinput();
|
void toggleHUDdriverinput();
|
||||||
void toggleHUDeditmode();
|
void toggleHUDeditmode();
|
||||||
|
void toggleStats();
|
||||||
|
|
||||||
inline SDView * getActiveView(){return Screens[m_CurrentScreenIndex];}
|
inline SDView * getActiveView(){return Screens[m_CurrentScreenIndex];}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue