- push all OSGDEBUGHUD in Option now (desactivate by default)

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@7245 30fe4595-0a0c-4342-8851-515496e4dcbd
This commit is contained in:
torcs-ng 2020-12-31 01:00:49 +00:00
parent f4c196ceb4
commit 17933ac935
8 changed files with 577 additions and 55 deletions

View File

@ -2,7 +2,7 @@
#
# file : options.cmake
# copyright : (C) 2008 by Mart Kelder, 2010 by J.-P. Meuret
# web : www.speed-dreams.org
# web : www.speed-dreams.org
# version : $Id$
#
############################################################################
@ -71,15 +71,17 @@ MACRO(ADD_SD_COMPILE_OPTIONS)
SET(OPTION_TRACE_LEVEL "5" CACHE STRING "Trace level integer threshold, only if OPTION_TRACE (traces with higher level are not logged ; 0=Fatal, 1=Error, 2=Warning, 3=Info, 4=Trace, 5=Debug, ...)")
SET(OPTION_PROFILER false CACHE BOOL "Enable profiler")
SET(OPTION_SCHEDULE_SPY false CACHE BOOL "Enable fine grained scheduling spy")
SET(OPTION_3RDPARTY_EXPAT true CACHE BOOL "Use 3rd party Expat library rather than bundled TXML")
SET(OPTION_3RDPARTY_SQLITE3 false CACHE BOOL "Use SQLite3 as database for record/replay")
SET(OPTION_OSGGRAPH true CACHE BOOL "Build OpenScenGraph-based WIP osggraph graphics module")
SET(OPTION_HUDDEBUG false CACHE BOOL "Build with HUD Debug in OsgGraph")
SET(OPTION_SDL2 true CACHE BOOL "Build with SDL2 instead of SDL 1.2")
SET(OPTION_SDL_JOYSTICK true CACHE BOOL "Use SDL for Joystick instead of PLIB")
CMAKE_DEPENDENT_OPTION(OPTION_SDL_FORCEFEEDBACK "Use SDL2 Haptics" true "OPTION_SDL_JOYSTICK;OPTION_SDL2" false)
@ -106,12 +108,12 @@ MACRO(ADD_SD_COMPILE_OPTIONS)
SET(OPTION_3RDPARTY_SOLID ${_OPTION_3RDPARTY_SOLID} CACHE BOOL "Use 3rd party SOLID library rather than simu-bundled one")
IF(UNIX)
SET(OPTION_XRANDR true CACHE BOOL "XrandR")
SET(OPTION_XRANDR true CACHE BOOL "XrandR")
SET(OPTION_GLEXTPROTOTYPES true CACHE BOOL "Enable prototypes in glext.h")
SET(OPTION_UNLOAD_SSGGRAPH true CACHE BOOL "If false, never unload ssggraph module (useful on some Linuxes to avoid XOrg crashes)")
SET(OPTION_UNLOAD_SSGGRAPH true CACHE BOOL "If false, never unload ssggraph module (useful on some Linuxes to avoid XOrg crashes)")
ENDIF(UNIX)
IF(OPTION_USE_MACPORTS)
SET(CMAKE_MACOSX_RPATH TRUE)
#SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
@ -121,9 +123,9 @@ MACRO(ADD_SD_COMPILE_OPTIONS)
MESSAGE(STATUS "Remove the line below to true when OSG works on MacPorts")
SET(OPTION_OSGGRAPH false CACHE BOOL "Build OpenScenGraph-based WIP osggraph graphics module")
ENDIF(OPTION_USE_MACPORTS)
SET(OPTION_AUTOVERSION true CACHE BOOL "Enable automatic computation of the version from SVN source tree")
# Custom 3rdParty location for some Windows builds (standard CMake Find<package> macros
# can't find it, so we needed another solution : see FindCustom3rdParty.cmake).
IF(MSVC)
@ -146,11 +148,11 @@ MACRO(ADD_SD_COMPILE_OPTIONS)
ADD_DEFINITIONS(-D_DEFAULT_SOURCE -DSHM)
IF(MSVC)
# Inhibit definition of Macros min(a,b) and max(a,b) for Windows MSVC builds,
# as the names conflict with the template functions from standard template library
ADD_DEFINITIONS(-DNOMINMAX)
ENDIF(MSVC)
IF(OPTION_FORCE_DEBUG)
@ -176,7 +178,7 @@ MACRO(ADD_SD_COMPILE_OPTIONS)
IF(OPTION_SCHEDULE_SPY)
ADD_DEFINITIONS(-DSCHEDULE_SPY)
ENDIF(OPTION_SCHEDULE_SPY)
IF(OPTION_3RDPARTY_EXPAT)
ADD_DEFINITIONS(-DTHIRD_PARTY_EXPAT)
ENDIF(OPTION_3RDPARTY_EXPAT)
@ -188,7 +190,7 @@ MACRO(ADD_SD_COMPILE_OPTIONS)
IF(OPTION_3RDPARTY_SOLID)
ADD_DEFINITIONS(-DTHIRD_PARTY_SOLID)
ENDIF(OPTION_3RDPARTY_SOLID)
IF(OPTION_GLEXTPROTOTYPES)
ADD_DEFINITIONS(-DGL_GLEXT_PROTOTYPES)
ENDIF(OPTION_GLEXTPROTOTYPES)
@ -209,6 +211,10 @@ MACRO(ADD_SD_COMPILE_OPTIONS)
ADD_DEFINITIONS(-DWEBSERVER)
ENDIF(OPTION_WEBSERVER)
IF(OPTION_HUDDEBUG)
ADD_DEFINITIONS(-DHUDDEBUG)
ENDIF(OPTION_HUDDEBUG)
IF(OPTION_CLIENT_SERVER)
ADD_DEFINITIONS(-DCLIENT_SERVER)
ENDIF(OPTION_CLIENT_SERVER)
@ -219,7 +225,7 @@ MACRO(ADD_SD_COMPILE_OPTIONS)
# Define for code that needs Torcs backward compatibility
ADD_DEFINITIONS(-DSPEED_DREAMS)
ENDIF(NOT _ALREADY_DONE)
# Compile options
@ -251,9 +257,9 @@ MACRO(ADD_SD_COMPILE_OPTIONS)
SET(_SD_WOPTS "${_SD_WOPTS} /wd4706") # assignment within conditional expression
# Other useless warnings.
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE
-D_CRT_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS)
# That's all.
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_SD_WOPTS}")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_SD_WOPTS}")

View File

@ -5,7 +5,7 @@ SET(_RACE_FILES practice.xml quickrace.xml
singleevent-challenge.xml singleevent-endurance.xml
singleevent-ls-gt1.xml singleevent-mp5.xml singleevent-mpa1.xml
championship.xml championship-24h.xml championship-supercars.xml championship-trb1.xml
championship-36gp.xml championship-67gp.xml championship-ls-gt1.xml championship-mp5.xml
championship-36gp.xml championship-67gp.xml championship-ls-gt1.xml championship-mp1.xml championship-mp5.xml
networkrace.xml championship-mpa1.xml championship-mpa11.xml career-36GP.xml career-supercars.xml
career_36GP.xmls career_MPA1.xmls
career_supercars.xmls career_ls1.xmls)

View File

@ -0,0 +1,458 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE params SYSTEM "params.dtd">
<params name="MP1 Championship" version="1.0">
<section name="Header">
<attstr name="name" val="MP1 Championship"/>
<attstr name="type" val="Championship"/>
<attstr name="subtype" val="MP1"/>
<attstr name="description" val="MP1 Championship"/>
<attnum name="priority" val="62"/>
<attstr name="menu image" val="data/img/splash-champ.jpg"/>
<attstr name="run image" val="data/img/splash-run-practice.jpg"/>
<attstr name="start image" val="data/img/splash-champstart.jpg"/>
</section>
<section name="Tracks">
<attnum name="maximum number" val="16"/>
<section name="1">
<attstr name="name" val="peters"/>
<attstr name="category" val="road"/>
</section>
<section name="2">
<attstr name="name" val="espie"/>
<attstr name="category" val="circuit"/>
</section>
<section name="3">
<attstr name="name" val="brondehach"/>
<attstr name="category" val="circuit"/>
</section>
<section name="4">
<attstr name="name" val="chemisay"/>
<attstr name="category" val="circuit"/>
</section>
<section name="5">
<attstr name="name" val="migrants"/>
<attstr name="category" val="circuit"/>
</section>
<section name="6">
<attstr name="name" val="corkscrew"/>
<attstr name="category" val="circuit"/>
</section>
<section name="7">
<attstr name="name" val="forza"/>
<attstr name="category" val="circuit"/>
</section>
<section name="8">
<attstr name="name" val="pinabashi"/>
<attstr name="category" val="road"/>
</section>
<section name="9">
<attstr name="name" val="karwada"/>
<attstr name="category" val="circuit"/>
</section>
<section name="10">
<attstr name="name" val="hidden-valley"/>
<attstr name="category" val="circuit"/>
</section>
<section name="11">
<attstr name="name" val="alicante"/>
<attstr name="category" val="road"/>
</section>
<section name="12">
<attstr name="name" val="street-1"/>
<attstr name="category" val="road"/>
</section>
<section name="13">
<attstr name="name" val="prenzlau"/>
<attstr name="category" val="road"/>
</section>
<section name="14">
<attstr name="name" val="auriac"/>
<attstr name="category" val="road"/>
</section>
<section name="15">
<attstr name="name" val="salty"/>
<attstr name="category" val="road"/>
</section>
<section name="16">
<attstr name="name" val="newton"/>
<attstr name="category" val="speedway"/>
</section>
</section>
<section name="Races">
<section name="1">
<attstr name="name" val="Free Practice"/>
</section>
<section name="2">
<attstr name="name" val="Qualifying"/>
</section>
<section name="3">
<attstr name="name" val="Warm-up"/>
</section>
<section name="4">
<attstr name="name" val="Race"/>
</section>
</section>
<section name="All Sessions">
<attstr name="rain" val="random"/>
<attstr name="clouds" val="random"/>
<attstr name="weather" val="real"/>
</section>
<section name="Free Practice">
<attnum name="sessiontime" unit="s" val="3600"/>
<attnum name="laps" val="0"/>
<attnum name="distance" unit="km" val="160"/>
<attstr name="type" val="practice"/>
<attstr name="starting order" val="drivers list"/>
<attstr name="display mode" val="results only"/>
<attstr name="restart" val="no"/>
<attstr name="display results" val="yes"/>
<attstr name="must complete" val="no"/>
<attstr name="time of day" val="morning"/>
<attstr name="rain" val="random"/>
<attstr name="clouds" val="random"/>
<section name="Starting Grid">
<attnum name="rows" val="1"/>
<attnum name="distance to start" val="100"/>
<attnum name="distance between columns" val="20"/>
<attnum name="offset within a column" val="10"/>
<attnum name="initial speed" val="0"/>
<attnum name="initial height" val="0.2"/>
</section>
</section>
<section name="Qualifying">
<attnum name="laps" val="3"/>
<attstr name="type" val="qualifications"/>
<attstr name="starting order" val="drivers list"/>
<attstr name="display mode" val="results only"/>
<attstr name="restart" val="no"/>
<attstr name="display results" val="yes"/>
<attstr name="must complete" val="yes"/>
<attnum name="maximum drivers" val="24"/>
<attstr name="time of day" val="morning"/>
<attstr name="rain" val="random"/>
<attstr name="clouds" val="random"/>
<attnum name="distance" unit="km" val="0"/>
<section name="Starting Grid">
<attnum name="rows" val="1"/>
<attnum name="distance to start" val="100"/>
<attnum name="distance between columns" val="100"/>
<attnum name="offset within a column" val="10"/>
<attnum name="initial speed" val="0"/>
<attnum name="initial height" val="0.2"/>
</section>
<section name="Points">
<section name="1">
<attnum name="points" val="1"/>
</section>
</section>
</section>
<section name="Warm-up">
<attnum name="sessiontime" unit="s" val="1800"/>
<attnum name="laps" val="0"/>
<attnum name="distance" unit="km" val="50"/>
<attstr name="type" val="practice"/>
<attstr name="starting order" val="Qualifying"/>
<attstr name="display mode" val="results only"/>
<attstr name="restart" val="no"/>
<attnum name="maximum drivers" val="24"/>
<attstr name="display results" val="yes"/>
<attstr name="must complete" val="no"/>
<attstr name="time of day" val="afternoon"/>
<attstr name="rain" val="random"/>
<attstr name="clouds" val="random"/>
<section name="Starting Grid">
<attnum name="rows" val="1"/>
<attnum name="distance to start" val="100"/>
<attnum name="distance between columns" val="100"/>
<attnum name="offset within a column" val="10"/>
<attnum name="initial speed" val="0"/>
<attnum name="initial height" val="0.2"/>
</section>
</section>
<section name="Race">
<attnum name="distance" unit="km" val="306"/>
<attstr name="type" val="race"/>
<attstr name="starting order" val="Qualifying"/>
<attstr name="restart" val="no"/>
<attnum name="maximum drivers" val="24"/>
<attstr name="splash menu" val="yes"/>
<attstr name="must complete" val="no"/>
<attstr name="time of day" val="afternoon"/>
<attstr name="rain" val="random"/>
<attstr name="clouds" val="random"/>
<attnum name="laps" val="0"/>
<section name="Starting Grid">
<attnum name="rows" val="2"/>
<attnum name="distance to start" val="1"/>
<attnum name="distance between columns" val="16"/>
<attnum name="offset within a column" val="8"/>
<attnum name="initial speed" val="0"/>
<attnum name="initial height" val="0.2"/>
</section>
<section name="Points">
<section name="1">
<attnum name="points" val="10"/>
</section>
<section name="2">
<attnum name="points" val="8"/>
</section>
<section name="3">
<attnum name="points" val="6"/>
</section>
<section name="4">
<attnum name="points" val="4"/>
</section>
<section name="5">
<attnum name="points" val="3"/>
</section>
<section name="6">
<attnum name="points" val="2"/>
</section>
<section name="7">
<attnum name="points" val="1"/>
</section>
<section name="8">
<attnum name="points" val="5"/>
</section>
</section>
</section>
<section name="Drivers">
<attnum name="maximum number" val="24"/>
<attnum name="focused idx" val="0"/>
<attstr name="focused module" val="shadow_mp1"/>
<attstr name="rejected types" val="networkhuman"/>
<attstr name="accepted categories" val="MP1"/>
<section name="1">
<attnum name="idx" val="0"/>
<attstr name="module" val="shadow_mp1"/>
<attnum name="extended" val="0"/>
<attnum name="skin targets" val="1"/>
</section>
<section name="2">
<attnum name="idx" val="1"/>
<attstr name="module" val="shadow_mp1"/>
<attnum name="extended" val="0"/>
<attnum name="skin targets" val="0"/>
</section>
<section name="3">
<attnum name="idx" val="2"/>
<attstr name="module" val="shadow_mp1"/>
<attnum name="extended" val="0"/>
<attnum name="skin targets" val="0"/>
</section>
<section name="4">
<attnum name="idx" val="3"/>
<attstr name="module" val="shadow_mp1"/>
<attnum name="extended" val="0"/>
<attnum name="skin targets" val="0"/>
</section>
<section name="5">
<attnum name="idx" val="4"/>
<attstr name="module" val="shadow_mp1"/>
<attnum name="extended" val="0"/>
<attnum name="skin targets" val="0"/>
</section>
<section name="6">
<attnum name="idx" val="5"/>
<attstr name="module" val="shadow_mp1"/>
<attnum name="extended" val="0"/>
<attnum name="skin targets" val="0"/>
</section>
<section name="7">
<attnum name="idx" val="6"/>
<attstr name="module" val="shadow_mp1"/>
<attnum name="extended" val="0"/>
<attnum name="skin targets" val="0"/>
</section>
<section name="8">
<attnum name="idx" val="7"/>
<attstr name="module" val="shadow_mp1"/>
<attnum name="extended" val="0"/>
<attnum name="skin targets" val="0"/>
</section>
<section name="9">
<attnum name="idx" val="8"/>
<attstr name="module" val="shadow_mp1"/>
<attnum name="extended" val="0"/>
<attnum name="skin targets" val="0"/>
</section>
<section name="10">
<attnum name="idx" val="9"/>
<attstr name="module" val="shadow_mp1"/>
<attnum name="extended" val="0"/>
<attnum name="skin targets" val="1"/>
</section>
<section name="11">
<attnum name="idx" val="10"/>
<attstr name="module" val="shadow_mp1"/>
<attnum name="extended" val="0"/>
<attnum name="skin targets" val="0"/>
</section>
<section name="12">
<attnum name="idx" val="11"/>
<attstr name="module" val="shadow_mp1"/>
<attnum name="extended" val="0"/>
<attnum name="skin targets" val="0"/>
</section>
<section name="13">
<attnum name="idx" val="12"/>
<attstr name="module" val="shadow_mp1"/>
<attnum name="extended" val="0"/>
<attnum name="skin targets" val="1"/>
</section>
<section name="14">
<attnum name="idx" val="13"/>
<attstr name="module" val="shadow_mp1"/>
<attnum name="extended" val="0"/>
<attnum name="skin targets" val="1"/>
</section>
</section>
<section name="Configuration">
<attnum name="current configuration" val="6"/>
<section name="1">
<attstr name="type" val="drivers select"/>
</section>
<section name="2">
<attstr name="type" val="race config"/>
<attstr name="race" val="Free Practice"/>
<section name="Options">
<section name="1">
<attstr name="type" val="race length"/>
</section>
<section name="2">
<attstr name="type" val="cloud cover"/>
</section>
<section name="3">
<attstr name="type" val="rain fall"/>
</section>
</section>
</section>
<section name="3">
<attstr name="type" val="race config"/>
<attstr name="race" val="Qualifying"/>
<section name="Options">
<section name="1">
<attstr name="type" val="race length"/>
</section>
<section name="2">
<attstr name="type" val="cloud cover"/>
</section>
<section name="3">
<attstr name="type" val="rain fall"/>
</section>
</section>
</section>
<section name="4">
<attstr name="type" val="race config"/>
<attstr name="race" val="Warm-up"/>
<section name="Options">
<section name="1">
<attstr name="type" val="race length"/>
</section>
<section name="2">
<attstr name="type" val="cloud cover"/>
</section>
<section name="3">
<attstr name="type" val="rain fall"/>
</section>
</section>
</section>
<section name="5">
<attstr name="type" val="race config"/>
<attstr name="race" val="Race"/>
<section name="Options">
<section name="1">
<attstr name="type" val="race length"/>
</section>
<section name="2">
<attstr name="type" val="cloud cover"/>
</section>
<section name="3">
<attstr name="type" val="rain fall"/>
</section>
</section>
</section>
</section>
</params>

View File

@ -32,7 +32,6 @@ SET(OSGGRAPH_HEADERS Utils/OsgVectorArrayAdapter.h
Viewer/OsgScreens.h
Viewer/OsgCamera.h
Viewer/OsgHUD.h
Viewer/OsgDebugHUD.h
Car/OsgCar.h
Car/OsgCarLight.h
@ -41,13 +40,16 @@ SET(OSGGRAPH_HEADERS Utils/OsgVectorArrayAdapter.h
Car/OsgCarShadow.h
OsgGraph.h
OsgMain.h
)
OsgMain.h)
IF(OPTION_SDL2)
SET(OSGGRAPH_HEADERS ${OSGGRAPH_HEADERS} Viewer/OsgGraphicsWindow.h)
ENDIF(OPTION_SDL2)
IF(OPTION_HUDDEBUG)
SET(OSGGRAPH_HEADERS ${OSGGRAPH_HEADERS} Viewer/OsgDebugHUD.h)
ENDIF(OPTION_HUDDEBUG)
SET(OSGGRAPH_SOURCES Utils/OsgMath.cpp
Utils/OsgLightTransform.cpp
#Utils/OsgPrecipitation.cpp
@ -79,7 +81,6 @@ SET(OSGGRAPH_SOURCES Utils/OsgMath.cpp
Viewer/OsgScreens.cpp
Viewer/OsgCamera.cpp
Viewer/OsgHUD.cpp
Viewer/OsgDebugHUD.cpp
Car/OsgCar.cpp
Car/OsgCarLight.cpp
@ -88,13 +89,16 @@ SET(OSGGRAPH_SOURCES Utils/OsgMath.cpp
Car/OsgCarShadow.cpp
OsgGraph.cpp
OsgMain.cpp
)
OsgMain.cpp)
IF(OPTION_SDL2)
SET(OSGGRAPH_SOURCES ${OSGGRAPH_SOURCES} Viewer/OsgGraphicsWindow.cpp)
ENDIF(OPTION_SDL2)
IF(OPTION_HUDDEBUG)
SET(OSGGRAPH_SOURCES ${OSGGRAPH_SOURCES} Viewer/OsgDebugHUD.cpp)
ENDIF(OPTION_HUDDEBUG)
INCLUDE_DIRECTORIES(Utils Sky Loader Scenery Render Viewer Car .)
ADD_INTERFACE_INCLUDEDIR()

View File

@ -143,7 +143,8 @@ float verticalModifier, float horizontalModifier){
return position;
}
/*OSGPLOT::OSGPLOT( float positionX,
#ifdef HUDDEBUG
OSGPLOT::OSGPLOT( float positionX,
float positionY,
float width,
float height,
@ -194,7 +195,7 @@ float verticalModifier, float horizontalModifier){
this->osgReferencePlotLineGeometry->setDataVariance(osg::Object::DYNAMIC); /*?needed?*/
// set the same color for the reference plot line
/* osg::Vec4Array* plotColors = new osg::Vec4Array;
osg::Vec4Array* plotColors = new osg::Vec4Array;
plotColors->push_back(osg::Vec4(1.0f,0.0f,0.0f,1.0f));
this->osgReferencePlotLineGeometry->setColorArray(plotColors, osg::Array::BIND_OVERALL);
@ -225,7 +226,7 @@ float verticalModifier, float horizontalModifier){
this->osgMainPlotLineGeometry->setVertexArray(this->osgMainPlotLineVertices);
this->osgMainPlotLineGeometry->setDataVariance(osg::Object::DYNAMIC); /*?needed?*/
/* this->osgMainPlotLineGeometry->setUseDisplayList (false);
this->osgMainPlotLineGeometry->setUseDisplayList (false);
// set the same color for the whole plot line
osg::Vec4Array* plotColors = new osg::Vec4Array;
@ -250,6 +251,7 @@ float verticalModifier, float horizontalModifier){
geode->addDrawable(this->osgMainPlotLineGeometry);
this->osgGroup->addChild(geode);
}
//prepare the geode for the title
{
osg::Geode* geode = new osg::Geode;
@ -258,14 +260,12 @@ float verticalModifier, float horizontalModifier){
osg::Vec4 color = osg::Vec4(0.0f,0.0f,0.0f,0.9f);
osgTitle->setColor(color);
std::string fontFileUrl = "/vera/Vera.ttf";
std::string fontsMainDirectory = GetDataDir();
fontsMainDirectory = fontsMainDirectory+"data/fonts";
fontFileUrl = fontsMainDirectory+fontFileUrl;
osgTitle->setFont(fontFileUrl);
//font resolution
osgTitle->setFontResolution(200,200);
@ -287,10 +287,8 @@ float verticalModifier, float horizontalModifier){
}
}
OSGPLOT::~OSGPLOT()
{
}
osg::ref_ptr <osg::Group> OSGPLOT::getGroup()
@ -320,12 +318,13 @@ void OSGPLOT::update(tSituation *s, const SDFrameInfo* frameInfo,
//redraw
this->recalculateDrawnPoint();
}
void OSGPLOT::appendDataPoint(float x, float y, float z)
{
//add the new element (as last of our vector)
this->dataPoints->push_back(osg::Vec3(x, y, z));
}
void OSGPLOT::recalculateDrawnPoint()
{
//recalculate main plot line
@ -334,7 +333,7 @@ void OSGPLOT::recalculateDrawnPoint()
//find max and min values for our plot
//just draw point that are in our range of time
for(osg::Vec3Array::iterator it = this->dataPoints->begin(); it != this->dataPoints->end();)
/* {
{
if((*it).x() <= (GfTimeClock() - this->timeFrame) || (*it).x() <= 0)
{
it = this->dataPoints->erase(it);
@ -442,6 +441,46 @@ void OSGPLOT::drawBackground()
* 1_______2
* x
* */
osg::Vec3 myCoords[] =
{
osg::Vec3(this->positionX, this->positionY, 0.0f),
osg::Vec3(this->positionX + this->width, this->positionY, 0.0f),
osg::Vec3(this->positionX + this->width, this->positionY + this->height, 0.0f),
osg::Vec3(this->positionX, this->positionY+this->height, 0.0f),
};
int numCoords = sizeof(myCoords)/sizeof(osg::Vec3);
osg::Vec3Array* vertices = new osg::Vec3Array(numCoords,myCoords);
// pass the created vertex array to the points geometry object.
bgGeometry->setVertexArray(vertices);
// apply the same color to the whole geometry
osg::Vec4Array* colors = new osg::Vec4Array;
colors->push_back(osg::Vec4(1.0f,1.0f,1.0f,0.5f));
bgGeometry->setColorArray(colors, osg::Array::BIND_OVERALL);
// setup normals
osg::Vec3Array* normals = new osg::Vec3Array;
normals->push_back(osg::Vec3(0.0f,-1.0f,0.0f));
bgGeometry->setNormalArray(normals, osg::Array::BIND_OVERALL);
// tell osg to draw this geometry as quads
bgGeometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,numCoords));
// disable lighting (light is always on) and enable transparency
osg::StateSet* stateset = bgGeometry->getOrCreateStateSet();
stateset->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
stateset->setMode(GL_BLEND,osg::StateAttribute::ON);
stateset->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
// add the points geometry to the geode.
geode->addDrawable(bgGeometry);
// add the geode to the graph group
this->osgGroup->addChild(geode);
}
#endif
// TODO[START]: move this to utils? /src/modules/graphic/osggraph/Utils
void split(const std::string &s, char delim, std::vector<std::string> &elems)
@ -688,6 +727,18 @@ void SDHUD::Refresh(tSituation *s, const SDFrameInfo* frameInfo,
lastCar = currCar;
}
#ifdef HUDDEBUG
//update all the graphs
typedef std::map<std::string,OSGPLOT* >::iterator it_type;
for(it_type iterator = this->plotElements.begin(); iterator != this->plotElements.end(); ++iterator)
{
//iterator->first = key
//iterator->second = value
iterator->second->update(s,frameInfo,currCar);
}
#endif
//board
tCarElt *firstAheadCar;
tCarElt *secondAheadCar;

View File

@ -27,7 +27,8 @@
class SDFrameInfo;
/*class OSGPLOT
#ifdef HUDDEBUG
class OSGPLOT
{
private:
@ -78,7 +79,8 @@ class SDFrameInfo;
void drawBackground();
void update(tSituation *s, const SDFrameInfo* frameInfo,const tCarElt *currCar);
};*/
};
#endif
class SDHUD
{
@ -127,13 +129,12 @@ class SDHUD
float hudScale;
//
//std::map<std::string,osgText::Text* > hudTextElements;
std::map<std::string,osg::Geometry* > hudImgElements;
std::map<std::string,osg::ref_ptr <osg::Group> > hudGraphElements;
//std::map<std::string,OSGPLOT* > plotElements;
#ifdef HUDDEBUG
std::map<std::string,OSGPLOT* > plotElements;
#endif
public:
SDHUD();
@ -153,7 +154,7 @@ class SDHUD
void CreateHUD( int scrH, int scrW);
void DispDebug(const tSituation *s, const SDFrameInfo* frame);
void Refresh(tSituation *s, const SDFrameInfo* frameInfo, const tCarElt *currCar);
//osg::ref_ptr <osg::Geode> generateHudFromXmlFile( int scrH, int scrW);
osg::ref_ptr <osg::Group> generateHudFromXmlFile( int scrH, int scrW);
inline osg::ref_ptr<osg::Camera> getRootCamera()
@ -162,6 +163,4 @@ class SDHUD
}
};
#endif //_OSGHUD_H_

View File

@ -44,7 +44,9 @@ SDScreens::SDScreens() :
m_CurrentScreenIndex(0)
{
//debugHUD = new SDDebugHUD();
#ifdef HUDDEBUG
debugHUD = new SDDebugHUD();
#endif
}
extern SDHUD hud;
@ -127,10 +129,6 @@ void SDScreens::Init(int x,int y, int width, int height, osg::ref_ptr<osg::Node>
root->getOrCreateStateSet()->setMode( GL_CULL_FACE, osg::StateAttribute::ON );
//debugHUD->setTexture(reflectionMapping->getMap());
// debugHUD->setTexture(reflectionMapping->getReflectionMap());
//root->addChild(debugHUD->getRootCamera());
//create the hud and its own camera and add it to the viewer
hud.CreateHUD(height, width);
hud.camera->setGraphicsContext(gw);
@ -197,7 +195,10 @@ void SDScreens::update(tSituation * s, SDFrameInfo* fi)
SDCars * cars = (SDCars *)getCars();
tCarElt * c = this->getActiveView()->getCurrentCar();
//this->debugHUD->setTexture(cars->getCar(c)->getReflectionMap()->getReflectionMap());
#ifdef HUDDEBUG
this->debugHUD->setTexture(cars->getCar(c)->getReflectionMap()->getReflectionMap());
#endif
if (!viewer->done())
viewer->frame();
@ -223,7 +224,9 @@ void SDScreens::changeCamera(long p)
void SDScreens::toggleDebugHUD()
{
//debugHUD->toggleHUD();
#ifdef HUDDEBUG
debugHUD->toggleHUD();
#endif
}
void SDScreens::registerViewDependantPreRenderNode(osg::ref_ptr<osg::Node> node)
@ -243,10 +246,7 @@ SDScreens::~SDScreens()
delete Screens[i];
}
//viewer->setSceneData(new osg::Group());
//delete viewer;
//delete debugHUD;
//viewer = NULL;
#ifdef HUDDEBUG
delete debugHUD;
#endif
}

View File

@ -26,7 +26,9 @@
#include "OsgView.h"
//class SDDebugHUD;
#ifdef HUDDEBUG
class SDDebugHUD;
#endif
class SDReflectionMapping;
class SDScreens
@ -36,7 +38,9 @@ protected:
std::vector<SDView *> Screens;
osg::ref_ptr<osg::Group> root;
osg::ref_ptr<osg::Group> prerenderRoot;
//SDDebugHUD * debugHUD;
#ifdef HUDDEBUG
SDDebugHUD * debugHUD;
#endif
int m_Winx;
int m_Winy;