Make Ogre::Root.getTimer() and Ogre::Timer methods virtual

What it says on the tin: a place to discuss proposed new features.
Post Reply
phoenix_64
Gold Sponsor
Gold Sponsor
Posts: 34
Joined: Sat Nov 03, 2007 10:08 pm
x 4

Make Ogre::Root.getTimer() and Ogre::Timer methods virtual

Post by phoenix_64 »

Hi,

I currently have some timing issues.
Synchronizing times via Root::renderOneFrame(Real timeSinceLastFrame) and the resulting FrameEvent is possible, but I find one thing very inelegant: Timer::getMicroseconds() etc. doesn't deliver values matching to the manual render time.
E.g. I reset the timer and render 25 frames with a timeSinceLastFrame of 0.04 (exactly 25 fps). One would assume that Timer::getMicroseconds() delivers exactly 1000000 - but it doesn't. Instead, it delivers the "real" time.

In my opinion, a good way to synchronize all times would be to overload the Ogre timer.
To meet this, one would have to overload Root (which contains the timer) and the timer itself. This is a problem, since the timer's methods are not defined virtual, and also Root::getTimer() is not virtual. Making these virtual would not change anything in the Ogre structure, but would make it possible to overload it, if needed. I've tried it and it works fine.
User avatar
madmarx
OGRE Expert User
OGRE Expert User
Posts: 1671
Joined: Mon Jan 21, 2008 10:26 pm
x 50

Re: Make Ogre::Root.getTimer() and Ogre::Timer methods virtu

Post by madmarx »

It is simply that Ogre::Timer is not meant to do that :) .
There is no 'setTime' or no 'addTime' function in a Ogre::Timer.

Qt's QTime sounds more like what you are looking for.
If you want that badly to use Ogre3D to do synchro (with Ogre::Real), then you can create a fake animation, enabled in your scene, and query where it is (Real AnimationState::getTimePosition (void) const ).

But you can even go for :

Real ControllerManager::getElapsedTime (void) const
void ControllerManager::setElapsedTime (Real elapsedTime)

which is used to control synchro of every animated value (shaders, vertexanimations etc...) things.
Tutorials + Ogre searchable API + more for Ogre1.7 : http://sourceforge.net/projects/so3dtools/
Corresponding thread : http://www.ogre3d.org/forums/viewtopic. ... 93&start=0
Post Reply