|
From: <de...@us...> - 2003-04-23 18:48:09
|
Update of /cvsroot/csp/APPLICATIONS/CSPSim/Source
In directory sc8-pr-cvs1:/tmp/cvs-serv4233
Modified Files:
ScreenInfoManager.cpp ScreenInfo.cpp
Log Message:
no message
Index: ScreenInfoManager.cpp
===================================================================
RCS file: /cvsroot/csp/APPLICATIONS/CSPSim/Source/ScreenInfoManager.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** ScreenInfoManager.cpp 23 Apr 2003 09:51:38 -0000 1.6
--- ScreenInfoManager.cpp 23 Apr 2003 18:48:00 -0000 1.7
***************
*** 31,37 ****
void set2dScene(osg::Group* rootNode, int ScreenWidth, int ScreenHeight)
{
! osg::ref_ptr<Framerate> framerate = new Framerate(11,ScreenHeight - 11);
! osg::ref_ptr<ScreenInfo> pause = new ScreenInfo(ScreenWidth - 5 * 8 - 11, ScreenHeight - 11,"PAUSE", "PAUSE");
! osg::ref_ptr<GeneralStats> generalStats = new GeneralStats(11, ScreenHeight / 3);
rootNode->addChild(framerate.get());
--- 31,38 ----
void set2dScene(osg::Group* rootNode, int ScreenWidth, int ScreenHeight)
{
! const unsigned short offsetpos = 11;
! osg::ref_ptr<Framerate> framerate = new Framerate(offsetpos,ScreenHeight - offsetpos);
! osg::ref_ptr<ScreenInfo> pause = new ScreenInfo(ScreenWidth-5*offsetpos,ScreenHeight-offsetpos,"PAUSE", "PAUSE");
! osg::ref_ptr<GeneralStats> generalStats = new GeneralStats(offsetpos, ScreenHeight / 3);
rootNode->addChild(framerate.get());
***************
*** 63,67 ****
if (os)
m_modelview_abs->removeChild(os);
! osg::ref_ptr<ObjectStats> objectStats = new ObjectStats(11, 2 * ScreenHeight / 3,vehicle);
m_modelview_abs->addChild(objectStats.get());
}
--- 64,68 ----
if (os)
m_modelview_abs->removeChild(os);
! osg::ref_ptr<ObjectStats> objectStats = new ObjectStats(12, 2 * ScreenHeight / 3,vehicle);
m_modelview_abs->addChild(objectStats.get());
}
Index: ScreenInfo.cpp
===================================================================
RCS file: /cvsroot/csp/APPLICATIONS/CSPSim/Source/ScreenInfo.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** ScreenInfo.cpp 23 Apr 2003 09:51:38 -0000 1.10
--- ScreenInfo.cpp 23 Apr 2003 18:48:00 -0000 1.11
***************
*** 61,72 ****
ScreenInfo::ScreenInfo(int posx,int posy, std::string const & name, std::string const & text):
! m_TTFPath("ltype.ttf"),m_FontSize(11),
! m_Text(new osgText::Text)
{
- int heightFont = m_FontSize;
m_Text->setFont(m_TTFPath);
m_Text->setFontSize(m_FontSize, m_FontSize);
! m_Text->setCharacterSize(m_FontSize, 1.0);
! m_Text->setPosition(osg::Vec3(posx,posy - heightFont,0));
setUpdateCallback(new UpdateCallback());
m_Text->setText(text);
--- 61,70 ----
ScreenInfo::ScreenInfo(int posx,int posy, std::string const & name, std::string const & text):
! m_TTFPath("ltype.ttf"),m_CharacterSize(11),m_FontSize(15), m_Text(new osgText::Text)
{
m_Text->setFont(m_TTFPath);
m_Text->setFontSize(m_FontSize, m_FontSize);
! m_Text->setCharacterSize(m_CharacterSize, 1.0);
! m_Text->setPosition(osg::Vec3(posx, posy - m_CharacterSize, 0));
setUpdateCallback(new UpdateCallback());
m_Text->setText(text);
***************
*** 76,86 ****
}
! Framerate::Framerate(int posx, int posy): ScreenInfo(posx, posy, "FRAMERATE"), m_minFps(60), m_maxFps(25)
{
m_Date = new osgText::Text();
m_Date->setFont(m_TTFPath);
m_Date->setFontSize(m_FontSize, m_FontSize);
! m_Date->setCharacterSize(m_FontSize, 1.0);
! m_Date->setPosition(osg::Vec3(posx,posy - 2 * m_FontSize,0));
addDrawable(m_Date);
}
--- 74,84 ----
}
! Framerate::Framerate(int posx, int posy): ScreenInfo(posx, posy, "FRAMERATE"), m_minFps(60), m_maxFps(25), m_cumul(0.0)
{
m_Date = new osgText::Text();
m_Date->setFont(m_TTFPath);
m_Date->setFontSize(m_FontSize, m_FontSize);
! m_Date->setCharacterSize(m_CharacterSize, 1.0);
! m_Date->setPosition(osg::Vec3(posx, posy - 2 * m_CharacterSize, 0));
addDrawable(m_Date);
}
***************
*** 88,102 ****
void Framerate::update()
{
float fps = CSPSim::theSim->getFrameRate();
! static int i = 0;
! if (i++ >= 1000) { // reset occasionally
m_minFps = 100.0;
m_maxFps = 0.0;
- i = 0;
}
m_minFps = min(m_minFps,fps);
m_maxFps = max(m_maxFps,fps);
std::ostringstream osstr;
! osstr << setprecision(1) << setw(5) << fixed << fps << " FPS min: " << m_minFps << " max: " << m_maxFps;
m_Text->setText(osstr.str());
--- 86,102 ----
void Framerate::update()
{
+ static unsigned long count = 0;
float fps = CSPSim::theSim->getFrameRate();
!
! if ((count++)%1000 == 0) { // reset occasionally
m_minFps = 100.0;
m_maxFps = 0.0;
}
m_minFps = min(m_minFps,fps);
m_maxFps = max(m_maxFps,fps);
+ m_cumul += fps;
std::ostringstream osstr;
! osstr << setprecision(1) << setw(5) << fixed << fps << " FPS min: " << m_minFps << " max: " << m_maxFps << " av:"
! << m_cumul / count;
m_Text->setText(osstr.str());
***************
*** 108,135 ****
GeneralStats::GeneralStats(int posx,int posy):ScreenInfo(posx,posy,"GENERAL STATS")
{
! unsigned int yOffset;
!
! yOffset = 50 - m_FontSize;
m_LocalPosition = new osgText::Text();
m_LocalPosition->setFont(m_TTFPath);
m_LocalPosition->setFontSize(m_FontSize, m_FontSize);
! m_LocalPosition->setCharacterSize(m_FontSize, 1.0);
! m_LocalPosition->setPosition(osg::Vec3(0, yOffset, 0));
addDrawable(m_LocalPosition);
! yOffset -= m_FontSize;
m_GlobalPosition = new osgText::Text();
m_GlobalPosition->setFont(m_TTFPath);
m_GlobalPosition->setFontSize(m_FontSize, m_FontSize);
! m_GlobalPosition->setCharacterSize(m_FontSize, 1.0);
! m_GlobalPosition->setPosition(osg::Vec3(0, yOffset, 0));
addDrawable(m_GlobalPosition);
! yOffset -= m_FontSize;
m_Velocity = new osgText::Text();
m_Velocity->setFont(m_TTFPath);
m_Velocity->setFontSize(m_FontSize, m_FontSize);
! m_Velocity->setCharacterSize(m_FontSize, 1.0);
! m_Velocity->setPosition(osg::Vec3(0, yOffset, 0));
addDrawable(m_Velocity);
}
--- 108,133 ----
GeneralStats::GeneralStats(int posx,int posy):ScreenInfo(posx,posy,"GENERAL STATS")
{
! float yOffset = 50.0 - m_CharacterSize;
m_LocalPosition = new osgText::Text();
m_LocalPosition->setFont(m_TTFPath);
m_LocalPosition->setFontSize(m_FontSize, m_FontSize);
! m_LocalPosition->setCharacterSize(m_CharacterSize, 1.0);
! m_LocalPosition->setPosition(osg::Vec3(m_CharacterSize, yOffset, 0));
addDrawable(m_LocalPosition);
! yOffset -= m_CharacterSize;
m_GlobalPosition = new osgText::Text();
m_GlobalPosition->setFont(m_TTFPath);
m_GlobalPosition->setFontSize(m_FontSize, m_FontSize);
! m_GlobalPosition->setCharacterSize(m_CharacterSize, 1.0);
! m_GlobalPosition->setPosition(osg::Vec3(m_CharacterSize, yOffset, 0));
addDrawable(m_GlobalPosition);
! yOffset -= m_CharacterSize;
m_Velocity = new osgText::Text();
m_Velocity->setFont(m_TTFPath);
m_Velocity->setFontSize(m_FontSize, m_FontSize);
! m_Velocity->setCharacterSize(m_CharacterSize, 1.0);
! m_Velocity->setPosition(osg::Vec3(m_CharacterSize, yOffset, 0));
addDrawable(m_Velocity);
}
***************
*** 176,183 ****
short n = stringStats.size();
for (;n-->0;) {
! posy -= m_FontSize;
osgText::Text* aStat = new osgText::Text();
aStat->setFont(m_TTFPath);
! aStat->setCharacterSize(m_FontSize, 1.0);
aStat->setPosition(osg::Vec3(posx, posy, 0));
m_ObjectStats.push_back(aStat);
--- 174,181 ----
short n = stringStats.size();
for (;n-->0;) {
! posy -= m_CharacterSize;
osgText::Text* aStat = new osgText::Text();
aStat->setFont(m_TTFPath);
! aStat->setCharacterSize(m_CharacterSize, 1.0);
aStat->setPosition(osg::Vec3(posx, posy, 0));
m_ObjectStats.push_back(aStat);
***************
*** 198,206 ****
short m = stringStats.size();
if (m < n) n = m;
! for (;--n>=0;) {
m_ObjectStats[n]->setText(stringStats[n]);
- // std::cout << stringStats[n] << std::endl;
- }
- // std::cout << stringStats.size() << std::endl;
}
}
--- 196,201 ----
short m = stringStats.size();
if (m < n) n = m;
! for (;--n>=0;)
m_ObjectStats[n]->setText(stringStats[n]);
}
}
|