Revision: 2392 http://rigsofrods.svn.sourceforge.net/rigsofrods/?rev=2392&view=rev Author: rorthomas Date: 2012-01-30 22:37:09 +0000 (Mon, 30 Jan 2012) Log Message: ----------- removed old ogre line overlay widget
Modified Paths: -------------- trunk/source/main/gui/OverlayWrapper.cpp trunk/source/main/gui/OverlayWrapper.h trunk/source/main/gui/TruckHUD.h Removed Paths: ------------- trunk/source/main/gui/OgreLineStreamOverlayElement.cpp trunk/source/main/gui/OgreLineStreamOverlayElement.h Deleted: trunk/source/main/gui/OgreLineStreamOverlayElement.cpp =================================================================== --- trunk/source/main/gui/OgreLineStreamOverlayElement.cpp 2012-01-30 21:41:28 UTC (rev 2391) +++ trunk/source/main/gui/OgreLineStreamOverlayElement.cpp 2012-01-30 22:37:09 UTC (rev 2392) @@ -1,424 +0,0 @@ -/* -This source file is part of Rigs of Rods -Copyright 2005-2012 Pierre-Michel Ricordel -Copyright 2007-2012 Thomas Fischer - -For more information, see http://www.rigsofrods.com/ - -Rigs of Rods is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License version 3, as -published by the Free Software Foundation. - -Rigs of Rods is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Rigs of Rods. If not, see <http://www.gnu.org/licenses/>. -*/ -/* ------------------------------------------------------------------------------ -This source file is part of OGRE - (Object-oriented Graphics Rendering Engine) -For the latest info, see http://www.ogre3d.org/ - -Copyright 2000-2005 The OGRE Team -Also see acknowledgements in Readme.html - -This program is free software; you can redistribute it and/or modify it under -the terms of the GNU Lesser General Public License as published by the Free Software -Foundation; either version 2 of the License, or (at your option) any later -version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public License along with -this program; if not, write to the Free Software Foundation, Inc., 59 Temple -Place - Suite 330, Boston, MA 02111-1307, USA, or go to -http://www.gnu.org/copyleft/lesser.txt. - -You may alternatively use this source under the terms of a specific version of -the OGRE Unrestricted License provided you have obtained such a license from -Torus Knot Software Ltd. ------------------------------------------------------------------------------ -*/ -#include "OgreStableHeaders.h" - -#include "OgreLineStreamOverlayElement.h" -#include "OgreOverlayManager.h" -#include "OgreLogManager.h" -#include "OgreMaterial.h" -#include "OgreTechnique.h" -#include "OgrePass.h" -#include "OgreStringConverter.h" -#include "OgreHardwareBufferManager.h" -#include "OgreRoot.h" -#include "OgreRenderSystem.h" - -namespace Ogre { - //--------------------------------------------------------------------- - String LineStreamOverlayElement::msTypeName = "LineStream"; - //--------------------------------------------------------------------- - LineStreamOverlayElement::LineStreamOverlayElement(const String& name) - : OverlayContainer(name), - mNumberOfTraces(1), - mNumberOfSamplesForTrace(100), - mPosInStream(0), - myTitle(" "), - titleColour(ColourValue::Black), - mDataChanged(false), - moveMode(1), - legendTop(0), - legendBottom(0) - { - // Setup render op in advance - mRenderOp.vertexData = new VertexData(); - mRenderOp.vertexData->vertexCount = 0; - } - //--------------------------------------------------------------------- - LineStreamOverlayElement::~LineStreamOverlayElement() - { - delete mRenderOp.vertexData; - } - //--------------------------------------------------------------------- - void LineStreamOverlayElement::initialise(void) - { - bool init = !mInitialised; - - OverlayContainer::initialise(); - if (init) - { - mInitialised = true; - } - } - - //--------------------------------------------------------------------- - void LineStreamOverlayElement::defaultStyle(void) - { - } - - //--------------------------------------------------------------------- - const String& LineStreamOverlayElement::getTypeName(void) const - { - return msTypeName; - } - //--------------------------------------------------------------------- - void LineStreamOverlayElement::getRenderOperation(RenderOperation& op) - { - updateVtxBuffer(); - op = mRenderOp; - } - //--------------------------------------------------------------------- - void LineStreamOverlayElement::setMaterialName(const String& matName) - { - OverlayContainer::setMaterialName(matName); - } - //--------------------------------------------------------------------- - void LineStreamOverlayElement::_updateRenderQueue(RenderQueue* queue) - { - if (mVisible) - { - - if (!mpMaterial.isNull()) - { - OverlayContainer::_updateRenderQueue(queue); - } - - // Also add children - ChildIterator it = getChildIterator(); - while (it.hasMoreElements()) - { - // Give children ZOrder 1 higher than this - it.getNext()->_updateRenderQueue(queue); - } - } - } - //--------------------------------------------------------------------- - void LineStreamOverlayElement::updatePositionGeometry(void) - { - mDataChanged = true; - updateVtxBuffer(); - } - //--------------------------------------------------------------------- - void LineStreamOverlayElement::updateTextureGeometry( void ) - { - } - //--------------------------------------------------------------------- - uint32 LineStreamOverlayElement::getNumberOfTraces() const - { - return mNumberOfTraces; - } - //--------------------------------------------------------------------- - void LineStreamOverlayElement::setNumberOfTraces( const uint32 val ) - { - mNumberOfTraces = val; - } - //--------------------------------------------------------------------- - uint32 LineStreamOverlayElement::getNumberOfSamplesForTrace() const - { - return mNumberOfSamplesForTrace; - } - //--------------------------------------------------------------------- - void LineStreamOverlayElement::setNumberOfSamplesForTrace( const uint32 val ) - { - mNumberOfSamplesForTrace = val; - } - //--------------------------------------------------------------------- - void LineStreamOverlayElement::createVertexBuffer() - { - - uint32 numberOfVertexs = mNumberOfTraces * mNumberOfSamplesForTrace * 2; - if (numberOfVertexs != mRenderOp.vertexData->vertexCount) - { - // Vertex declaration: 1 position, add texcoords later depending on #layers - // Create as separate buffers so we can lock & discard separately - VertexDeclaration* decl = mRenderOp.vertexData->vertexDeclaration; - size_t offset = 0; - offset += decl->addElement(0, 0, VET_FLOAT3, VES_POSITION).getSize(); - offset += decl->addElement(0, offset, VET_COLOUR_ARGB, VES_DIFFUSE).getSize(); - - // Basic vertex data - mRenderOp.vertexData->vertexStart = 0; - // No indexes & issue as a strip - mRenderOp.useIndexes = false; - mRenderOp.operationType = RenderOperation::OT_LINE_LIST; - - - mTraceSamples.resize(numberOfVertexs / 2); - mTraceInfo.resize(mNumberOfTraces); - - mRenderOp.vertexData->vertexCount = numberOfVertexs; - - // Vertex buffer #1 - mCurrentVtxBuffer = - HardwareBufferManager::getSingleton().createVertexBuffer( - decl->getVertexSize(0), mRenderOp.vertexData->vertexCount, - HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY// mostly static except during resizing - ); - // Bind buffer - mRenderOp.vertexData->vertexBufferBinding->setBinding(0, mCurrentVtxBuffer); - - // clear buffer - memset(mCurrentVtxBuffer->lock(HardwareBuffer::HBL_DISCARD), 0, decl->getVertexSize(0) * mRenderOp.vertexData->vertexCount); - memset(&mTraceSamples[0], 0, sizeof(Real) * mTraceSamples.size()); - mCurrentVtxBuffer->unlock(); - - mPosInStream = 0; - } - } - void LineStreamOverlayElement::setMoveMode(int value) - { - moveMode=value; - } - int LineStreamOverlayElement::getMoveMode() - { - return moveMode; - } - - //--------------------------------------------------------------------- - void LineStreamOverlayElement::updateVtxBuffer() - { - - if (!mDataChanged) - { - return; - } - mDataChanged = false; - - struct fTraceVertex - { - Vector3 pos; - ARGB color; - }; - - - - - - // Use the furthest away depth value, since materials should have depth-check off - // This initialised the depth buffer for any 3D objects in front - Real zValue = Root::getSingleton().getRenderSystem()->getMaximumDepthInputValue(); - - //find max value - Real maxValue = 0.0f; - for (uint32 trace = 0 ; trace < mNumberOfTraces ; trace++) - { - for (uint32 sample = 0 ; sample < mNumberOfSamplesForTrace ; sample++) - { - Real curSample = mTraceSamples[trace * mNumberOfSamplesForTrace + sample]; - if (maxValue < curSample) - { - maxValue = curSample; - } - - } - } - - if (fabs(maxValue) < 0.000001f) - { - return; - } - - Real left, right, top, bottom, gHeight; - left = _getDerivedLeft() * 2 - 1; - right = left + (mWidth * 2); - gHeight = mHeight * 0.6f; - top = -((_getDerivedTop() * 2) - 1) - mHeight * 0.4f; // this creates a border at the top and bottom - bottom = top - (gHeight * 2); - - fTraceVertex * currentVtxBufferData = - static_cast<fTraceVertex *>(mCurrentVtxBuffer->lock(HardwareBuffer::HBL_DISCARD)); - - // write vertexes - for (uint32 trace = 0 ; trace < mNumberOfTraces ; trace++) - { - for (uint32 sample = 1 ; sample < mNumberOfSamplesForTrace ; sample++) - { - fTraceVertex & lineStartVtx = currentVtxBufferData[(trace * mNumberOfSamplesForTrace + sample) * 2]; - lineStartVtx.pos.x = left + (mWidth * 2) * ( (Real)sample / ((Real)mNumberOfSamplesForTrace + 1) ); - Real startSampleQunt = ( mTraceSamples[trace * mNumberOfSamplesForTrace + (sample + mPosInStream) % mNumberOfSamplesForTrace] / maxValue ); - lineStartVtx.pos.y = bottom + (gHeight * 2) * startSampleQunt; - lineStartVtx.pos.z = zValue; - - - fTraceVertex & lineEndVtx = currentVtxBufferData[(trace * mNumberOfSamplesForTrace + sample) * 2 + 1]; - lineEndVtx.pos.x = left + (mWidth * 2) * (Real)(sample + 1) / (Real)(mNumberOfSamplesForTrace + 1) ; - Real EndSampleQunt = ( mTraceSamples[trace * mNumberOfSamplesForTrace + (sample + mPosInStream + 1) % mNumberOfSamplesForTrace] / maxValue ); - lineEndVtx.pos.y = bottom +(gHeight * 2) * EndSampleQunt; - lineEndVtx.pos.z = zValue; - - lineStartVtx.color = mTraceInfo[trace].colour.getAsARGB(); - lineEndVtx.color = mTraceInfo[trace].colour.getAsARGB(); - } - - } - mCurrentVtxBuffer->unlock(); - - if(legendTop) legendTop->setCaption(TOSTRING((int)maxValue)); - - if(moveMode==1) - mPosInStream++; - } - //--------------------------------------------------------------------- - void LineStreamOverlayElement::setExactValue( const uint32 traceIndex, const uint32 fieldIndex, const Real traceValue ) - { - mTraceSamples[traceIndex * mNumberOfSamplesForTrace + fieldIndex % mNumberOfSamplesForTrace] = traceValue; - mDataChanged = true; - } - - //--------------------------------------------------------------------- - void LineStreamOverlayElement::moveForward() - { - mPosInStream++; - } - - //--------------------------------------------------------------------- - void LineStreamOverlayElement::setTraceValue( const uint32 traceIndex, const Real traceValue ) - { - mTraceSamples[traceIndex * mNumberOfSamplesForTrace + mPosInStream % mNumberOfSamplesForTrace] = traceValue; - if(moveMode==2) - mPosInStream++; - mDataChanged = true; - - } - //--------------------------------------------------------------------- - void LineStreamOverlayElement::setTitle(ColourValue c, String title) - { - myTitle = title; - titleColour = c; - } - //--------------------------------------------------------------------- - void LineStreamOverlayElement::setTraceInfo( const uint32 traceIndex, const ColourValue & traceColour, const String &name ) - { - String elName = "StreamTraceInfo"+mName+TOSTRING(traceIndex); - bool existing = false; - try - { - OverlayManager::getSingleton().getOverlayElement(elName); - existing = true; - } catch(...) - { - existing = false; - } - if(!existing) - { - // create - mTraceInfo[traceIndex].legendText = (TextAreaOverlayElement*)OverlayManager::getSingleton().createOverlayElement("TextArea", elName); - mTraceInfo[traceIndex].legendText->setMetricsMode(GMM_RELATIVE); - mTraceInfo[traceIndex].legendText->setPosition(0.04f + (this->getWidth()/(float)mNumberOfTraces) * traceIndex, 0); - mTraceInfo[traceIndex].legendText->setFontName("VeraMono"); - mTraceInfo[traceIndex].legendText->setDimensions(this->getWidth(), 0.02f); - mTraceInfo[traceIndex].legendText->setCharHeight(0.02f); - mTraceInfo[traceIndex].legendText->show(); - this->addChild(mTraceInfo[traceIndex].legendText); - } - mTraceInfo[traceIndex].legendText->setCaption(name); - mTraceInfo[traceIndex].legendText->setColour(traceColour); - mTraceInfo[traceIndex].colour = traceColour; - mTraceInfo[traceIndex].name = name; - - if(!legendTop && !legendBottom) - { - legendTop = (TextAreaOverlayElement*)OverlayManager::getSingleton().createOverlayElement("TextArea", elName+"Top"); - legendTop->setMetricsMode(GMM_RELATIVE); - legendTop->setPosition(0, 0); - legendTop->setFontName("VeraMono"); - legendTop->setDimensions(0.06f, 0.02f); - legendTop->setColour(ColourValue::Black); - legendTop->setCharHeight(0.02f); - legendTop->show(); - legendTop->setCaption("0"); - this->addChild(legendTop); - - // todo: fix top of the bottom element! - legendBottom = (TextAreaOverlayElement*)OverlayManager::getSingleton().createOverlayElement("TextArea", elName+"Bottom"); - legendBottom->setMetricsMode(GMM_RELATIVE); - legendBottom->setPosition(0, this->getHeight()-0.02f); - legendBottom->setFontName("VeraMono"); - legendBottom->setDimensions(0.06f, 0.02f); - legendBottom->setColour(ColourValue::Black); - legendBottom->setCharHeight(0.02f); - legendBottom->setCaption("0"); - legendBottom->show(); - this->addChild(legendBottom); - - // todo: fix top of the bottom element! - title = (TextAreaOverlayElement*)OverlayManager::getSingleton().createOverlayElement("TextArea", elName+"Title"); - title->setMetricsMode(GMM_RELATIVE); - title->setPosition(this->getWidth()*0.4f, this->getHeight()-0.02f); - title->setFontName("VeraMono"); - title->setDimensions(0.06f, 0.02f); - title->setColour(titleColour); - title->setCharHeight(0.02f); - title->setCaption(myTitle); - title->show(); - this->addChild(title); - } - - } - //--------------------------------------------------------------------- - //--------------------------------------------------------------------- - //--------------------------------------------------------------------- - //--------------------------------------------------------------------- - const String& LineStreamOverlayElementFactory::getTypeName( void ) const - { - static String name = "LineStream"; - return name; - } - //--------------------------------------------------------------------- - OverlayElement* LineStreamOverlayElementFactory::createOverlayElement( const String& instanceName ) - { - return new LineStreamOverlayElement(instanceName); - } - //--------------------------------------------------------------------- - void LineStreamOverlayElementFactory::destroyOverlayElement( OverlayElement* pElement ) - { - delete pElement; - } -} - - - Deleted: trunk/source/main/gui/OgreLineStreamOverlayElement.h =================================================================== --- trunk/source/main/gui/OgreLineStreamOverlayElement.h 2012-01-30 21:41:28 UTC (rev 2391) +++ trunk/source/main/gui/OgreLineStreamOverlayElement.h 2012-01-30 22:37:09 UTC (rev 2392) @@ -1,140 +0,0 @@ -/* -This source file is part of Rigs of Rods -Copyright 2005-2012 Pierre-Michel Ricordel -Copyright 2007-2012 Thomas Fischer - -For more information, see http://www.rigsofrods.com/ - -Rigs of Rods is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License version 3, as -published by the Free Software Foundation. - -Rigs of Rods is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Rigs of Rods. If not, see <http://www.gnu.org/licenses/>. -*/ - -#ifndef __LineStreamOverlayElement_H__ -#define __LineStreamOverlayElement_H__ - -#include "RoRPrerequisites.h" - -#include "OgreOverlayContainer.h" -#include "OgreOverlayElementFactory.h" - -namespace Ogre { - - - /** OverlayElement representing a flat, single-material (or transparent) panel which can contain other elements. - @remarks - This class subclasses OverlayContainer because it can contain other elements. Like other - containers, if hidden it's contents are also hidden, if moved it's contents also move etc. - The panel itself is a 2D rectangle which is either completely transparent, or is rendered - with a single material. The texture(s) on the panel can be tiled depending on your requirements. - @par - This component is suitable for backgrounds and grouping other elements. Note that because - it has a single repeating material it cannot have a discrete border (unless the texture has one and - the texture is tiled only once). For a bordered panel, see it's subclass BorderLineStreamOverlayElement. - @par - Note that the material can have all the usual effects applied to it like multiple texture - layers, scrolling / animated textures etc. For multiple texture layers, you have to set - the tiling level for each layer. - */ - class LineStreamOverlayElement : public OverlayContainer - { - public: - /** Constructor. */ - LineStreamOverlayElement(const String& name); - virtual ~LineStreamOverlayElement(); - - /** Initialise */ - virtual void initialise(void); - - /** See OverlayElement. */ - virtual const String& getTypeName(void) const; - /** See Renderable. */ - void getRenderOperation(RenderOperation& op); - /** Overridden from OverlayElement */ - void setMaterialName(const String& matName); - /** Overridden from OverlayContainer */ - void _updateRenderQueue(RenderQueue* queue); - - void defaultStyle(); - - // data members set\get - uint32 getNumberOfTraces() const; - void setNumberOfTraces(const uint32 val); - uint32 getNumberOfSamplesForTrace() const; - void setNumberOfSamplesForTrace(const uint32 val); - - void setTraceValue(const uint32 traceIndex, const Real traceValue); - void setExactValue(const uint32 traceIndex, const uint32 fieldIndex, const Real traceValue); - void setTraceInfo(const uint32 traceIndex, const ColourValue & traceValue, const String &name); - void updateVtxBuffer(); - void moveForward(); - void createVertexBuffer(); - - void setMoveMode(int value); - int getMoveMode(); - void setTitle(ColourValue colour, String title); - protected: - - typedef struct trace_info - { - ColourValue colour; - String name; - TextAreaOverlayElement *legendText; - } trace_info_t; - - RenderOperation mRenderOp; - - /// internal method for setting up geometry, called by OverlayElement::update - virtual void updatePositionGeometry(void); - - // Internal method which is triggered when the UVs of the element get updated - virtual void updateTextureGeometry(void); - - static String msTypeName; - - int moveMode; - - uint32 mNumberOfTraces; - uint32 mNumberOfSamplesForTrace; - - uint32 mPosInStream; - Ogre::String myTitle; - Ogre::ColourValue titleColour; - TextAreaOverlayElement *legendTop, *legendBottom, *title; - - - std::vector<Real> mTraceSamples; - std::vector<trace_info_t> mTraceInfo; - - HardwareVertexBufferSharedPtr mCurrentVtxBuffer; - bool mDataChanged; - - - - }; - - /** Factory for creating LineStreamOverlayElementFactory instances. */ - class LineStreamOverlayElementFactory: public OverlayElementFactory - { - public: - /** See OverlayElementFactory */ - OverlayElement* createOverlayElement(const String& instanceName); - - virtual void destroyOverlayElement(OverlayElement* pElement);; - - /** See OverlayElementFactory */ - const String& getTypeName(void) const; - }; - - -} - -#endif Modified: trunk/source/main/gui/OverlayWrapper.cpp =================================================================== --- trunk/source/main/gui/OverlayWrapper.cpp 2012-01-30 21:41:28 UTC (rev 2391) +++ trunk/source/main/gui/OverlayWrapper.cpp 2012-01-30 22:37:09 UTC (rev 2392) @@ -125,7 +125,6 @@ int OverlayWrapper::init() { - fpsLineStream = netLineStream = netlagLineStream = 0; directionOverlay = loadOverlay("tracks/DirectionArrow", false); try @@ -632,170 +631,6 @@ OverlayElement* memorySumDbg = OverlayManager::getSingleton().getOverlayElement("Core/CurrMemory"); memorySumDbg->setCaption(sumMemoryText); - - if(detailed) - { - static int framecounter = 0; - static int fpscount=0; - static ColourValue cr = ColourValue(0.3f,0.3f,1.0f); - static ColourValue cg = ColourValue(0.3f,1.0f,0.3f); - static ColourValue gr = ColourValue(0.8f,0.8f,0.8f); - // we view the extended stats, so draw the FPS graph :) - if(!fpsLineStream) - { - float graphHeight = 0.1f; - float border = graphHeight * 0.1f; - float posY = 0; - MaterialPtr backMat = MaterialManager::getSingleton().create("linestream_white", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME); - TextureUnitState *t = backMat->getTechnique(0)->getPass(0)->createTextureUnitState(); - t->setColourOperationEx(Ogre::LBX_SOURCE1, Ogre::LBS_MANUAL, Ogre::LBS_CURRENT, ColourValue::White); - t->setAlphaOperation(Ogre::LBX_SOURCE1, Ogre::LBS_MANUAL, Ogre::LBS_CURRENT, 0.3); - backMat->getTechnique(0)->getPass(0)->setSceneBlending(SBT_TRANSPARENT_ALPHA); - - backMat = MaterialManager::getSingleton().create("linestream_lines", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME); - t = backMat->getTechnique(0)->getPass(0)->createTextureUnitState(); - - fpsLineStream = dynamic_cast<Ogre::LineStreamOverlayElement *>(OverlayManager::getSingleton().createOverlayElement("LineStream", "FPSCurveLineStream")); - fpsLineStream->_setPosition(0.7f, posY); - fpsLineStream->_setDimensions(0.3f, graphHeight); - fpsLineStream->setMaterialName("linestream_lines"); - fpsLineStream->setNumberOfSamplesForTrace(400); - fpsLineStream->setNumberOfTraces(2); - fpsLineStream->setTitle(gr, "Frame stats"); - - fpsLineStream->setMoveMode(0); - fpsLineStream->createVertexBuffer(); - mDebugOverlay->add2D(fpsLineStream); - OverlayContainer *debugLineStreamPanel = (OverlayContainer *) (OverlayManager::getSingleton().createOverlayElement("Panel","debugLineStreamPanel")); - debugLineStreamPanel->_setPosition(0.7f, posY); - debugLineStreamPanel->_setDimensions(0.4f, graphHeight); - debugLineStreamPanel->setMaterialName("linestream_white"); - mDebugOverlay->add2D(debugLineStreamPanel); - posY += graphHeight + border; - - fpsLineStream->setTraceInfo(0, cr, "FPS"); - fpsLineStream->setTraceInfo(1, cg, "Physic Frames"); - - // TODO: TOFIX - /* - if(netmode) - { - // net traffic - netLineStream = dynamic_cast<Ogre::LineStreamOverlayElement *>(OverlayManager::getSingleton().createOverlayElement("LineStream", "NETCurveLineStream")); - netLineStream->_setPosition(0.7f, posY); - netLineStream->_setDimensions(0.3f, graphHeight); - netLineStream->setMaterialName("linestream_lines"); - netLineStream->setNumberOfSamplesForTrace(400); - netLineStream->setNumberOfTraces(2); - netLineStream->setMoveMode(0); - netLineStream->createVertexBuffer(); - netLineStream->setTitle(gr, "Network Traffic"); - mDebugOverlay->add2D(netLineStream); - OverlayContainer *debugLineStreamPanel = (OverlayContainer *) (OverlayManager::getSingleton().createOverlayElement("Panel","debugLineStreamPanel2")); - debugLineStreamPanel->_setPosition(0.7f, posY); - debugLineStreamPanel->_setDimensions(0.4f, graphHeight); - debugLineStreamPanel->setMaterialName("linestream_white"); - mDebugOverlay->add2D(debugLineStreamPanel); - posY += graphHeight + border; - - // net lag - netlagLineStream = dynamic_cast<Ogre::LineStreamOverlayElement *>(OverlayManager::getSingleton().createOverlayElement("LineStream", "NETLAGCurveLineStream")); - netlagLineStream->_setPosition(0.7f, posY); - netlagLineStream->_setDimensions(0.3f, graphHeight); - netlagLineStream->setMaterialName("linestream_lines"); - netlagLineStream->setNumberOfSamplesForTrace(400); - netlagLineStream->setNumberOfTraces(10); - netlagLineStream->setMoveMode(0); - netlagLineStream->createVertexBuffer(); - netlagLineStream->setTitle(gr, "Network Lag"); - mDebugOverlay->add2D(netlagLineStream); - debugLineStreamPanel = (OverlayContainer *) (OverlayManager::getSingleton().createOverlayElement("Panel","debugLineStreamPanel3")); - debugLineStreamPanel->_setPosition(0.7f, posY); - debugLineStreamPanel->_setDimensions(0.4f, graphHeight); - debugLineStreamPanel->setMaterialName("linestream_white"); - mDebugOverlay->add2D(debugLineStreamPanel); - } - - if(netmode && netLineStream) - { - netLineStream->setTraceInfo(0, cr, "Traffic Up"); - netLineStream->setTraceInfo(1, cg, "Traffic Down"); - netlagLineStream->setTraceInfo(0, cr, "Average"); - for(int i=1;i<10;i++) - netlagLineStream->setTraceInfo(i, ColourValue(0.8f,0.8f,0.8f), ""); - } - */ - - } - if(!fpsLineStream) - return; - if(framecounter > 5) - { - char tmp[10]=""; - float fps = fpscount/6.0f; - sprintf(tmp, "%0.0f", fps); - - fpsLineStream->setTraceInfo(0, cr, "FPS: " + String(tmp)); - //fpsLineStream->setTraceInfo(1, cg, "Physic Lag: " + TOSTRING(truckSteps)); - - fpsLineStream->setTraceValue(0, fpscount/6.0f); - //fpsLineStream->setTraceValue(1, truckSteps); -#ifdef USE_SOCKETW - // TODO: TOFIX - /* - if(netmode && net && netLineStream) - { - // in kB/s not B/s - memset(tmp, 0, 10); - float speedUp = net->getSpeedUp()/1024.0f; - sprintf(tmp, "%0.1fkB/s", speedUp); - netLineStream->setTraceValue(0, speedUp); - - netLineStream->setTraceInfo(0, cr, "Traffic Up: "+String(tmp)); - - float speedDown = net->getSpeedDown()/1024.0f; - memset(tmp, 0, 10); - sprintf(tmp, "%0.1fkB/s", speedDown); - netLineStream->setTraceValue(1, speedDown); - netLineStream->setTraceInfo(1, cg, "Traffic Down: "+String(tmp)); - - netLineStream->moveForward(); - -#if 0 - // TODO: fix lag data - std::map<int, float> &lag = net->getLagData(); - int c=0; - float sum=0; - for(std::map<int, float>::iterator it = lag.begin(); it!= lag.end(); it++) - { - int n = it->first; - float lag = fabs(it->second); - //LOG("lag("+TOSTRING(c)+")="+TOSTRING(lag)); - sum += lag; - c++; - netlagLineStream->setTraceValue(c, lag); - } - - float av = sum / (float)(c); - netlagLineStream->setTraceValue(0, av); - memset(tmp, 0, 10); - sprintf(tmp, "%0.0fms", av); - - netlagLineStream->setTraceInfo(0, cr, "Average:" + String(tmp)); - netlagLineStream->moveForward(); -#endif //0 - } - */ -#endif //SOCKETW - fpsLineStream->moveForward(); - fpscount = 0; - framecounter = 0; - } else - { - fpscount += stats.lastFPS; - framecounter++; - } - } } catch(...) { Modified: trunk/source/main/gui/OverlayWrapper.h =================================================================== --- trunk/source/main/gui/OverlayWrapper.h 2012-01-30 21:41:28 UTC (rev 2391) +++ trunk/source/main/gui/OverlayWrapper.h 2012-01-30 22:37:09 UTC (rev 2392) @@ -31,7 +31,6 @@ #include <OgreOverlay.h> #include "OgreTextAreaOverlayElement.h" -#include "OgreLineStreamOverlayElement.h" #include <OgrePanelOverlayElement.h> #include <OgreSingleton.h> @@ -145,8 +144,6 @@ Ogre::TextAreaOverlayElement* alt_value_taoe; Ogre::TextAreaOverlayElement* boat_depth_value_taoe; - Ogre::LineStreamOverlayElement *fpsLineStream, *netLineStream, *netlagLineStream; - Ogre::TextureUnitState *adibugstexture; Ogre::TextureUnitState *aditapetexture; Ogre::TextureUnitState *hsirosetexture; Modified: trunk/source/main/gui/TruckHUD.h =================================================================== --- trunk/source/main/gui/TruckHUD.h 2012-01-30 21:41:28 UTC (rev 2391) +++ trunk/source/main/gui/TruckHUD.h 2012-01-30 22:37:09 UTC (rev 2392) @@ -25,7 +25,6 @@ #define COMMANDS_VISIBLE 25 #include "Beam.h" -#include "OgreLineStreamOverlayElement.h" class TruckHUD { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Try before you buy = See our experts in action! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-dev2 _______________________________________________ Rigsofrods-devel mailing list Rigsofrods-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rigsofrods-devel