[GSoC 2013 - accepted] Ogre 2.0
-
- OGRE Team Member
- Posts: 5429
- Joined: Sat Jul 21, 2007 4:55 pm
- Location: Buenos Aires, Argentina
- x 1337
Re: [GSoC 2013 - accepted] Ogre 2.0
Check last push, has already been done
-
- Minaton
- Posts: 933
- Joined: Mon Mar 05, 2012 11:37 am
- Location: Germany
- x 110
Re: [GSoC 2013 - accepted] Ogre 2.0
I use my Multiscreen-Example and move the main camera node (m_pEgoSceneNode). I use a simple camera manager to move the node:dark_sylinc wrote:Hi, I just realized I talk about this assert issue in page 13 (point 2. of the manual. See if that helps (and I've also updated the manual today, so redownload).
Code: Select all
class OisNodeControl
{
private:
Ogre::SceneNode* m_pTarget;
Ogre::Real m_fTopSpeed;
Ogre::Vector3 m_vVelocity;
bool m_bGoingForward;
bool m_bGoingBack;
bool m_bGoingLeft;
bool m_bGoingRight;
bool m_bGoingUp;
bool m_bGoingDown;
bool m_bMouseLeft;
bool m_bMouseRight;
public:
OisNodeControl(void);
~OisNodeControl(void);
void setTarget(Ogre::SceneNode* target);
Ogre::SceneNode* getTarget();
void setTopSpeed(Ogre::Real topSpeed);
Ogre::Real getTopSpeed();
void manualStop();
void frameRenderingQueued(const Ogre::FrameEvent& evt);
void injectKeyDown(const OIS::KeyEvent& evt);
void injectKeyUp(const OIS::KeyEvent& evt);
void injectMouseMove(const OIS::MouseEvent& evt);
void injectMouseDown(const OIS::MouseEvent& evt, OIS::MouseButtonID id);
void injectMouseUp(const OIS::MouseEvent& evt, OIS::MouseButtonID id);
};
Code: Select all
#include "OisNodeControl.h"
OisNodeControl::OisNodeControl(void)
: m_pTarget(NULL)
, m_fTopSpeed(50.0f)
, m_vVelocity(Ogre::Vector3::ZERO)
, m_bGoingForward(false)
, m_bGoingBack(false)
, m_bGoingLeft(false)
, m_bGoingRight(false)
, m_bGoingUp(false)
, m_bGoingDown(false)
, m_bMouseLeft(false)
, m_bMouseRight(false)
{
}
OisNodeControl::~OisNodeControl(void)
{
}
void OisNodeControl::setTarget(Ogre::SceneNode* target)
{
m_pTarget = target;
}
Ogre::SceneNode* OisNodeControl::getTarget()
{
return m_pTarget;
}
void OisNodeControl::setTopSpeed(Ogre::Real topSpeed)
{
m_fTopSpeed = topSpeed;
}
Ogre::Real OisNodeControl::getTopSpeed()
{
return m_fTopSpeed;
}
void OisNodeControl::manualStop()
{
m_vVelocity = Ogre::Vector3::ZERO;
m_bGoingForward = false;
m_bGoingBack = false;
m_bGoingLeft = false;
m_bGoingRight = false;
m_bGoingUp = false;
m_bGoingDown = false;
m_bMouseLeft = false;
m_bMouseRight = false;
}
void OisNodeControl::frameRenderingQueued(const Ogre::FrameEvent& evt)
{
if(m_pTarget == NULL) return;
Ogre::Vector3 accel = Ogre::Vector3::ZERO;
Ogre::Vector3 Right = m_pTarget->getOrientation() * Ogre::Vector3::UNIT_Z;
Right.normalise();
Ogre::Vector3 Direction = Right.crossProduct(Ogre::Vector3::NEGATIVE_UNIT_Y);
Direction.normalise();
if (m_bGoingForward || m_bMouseLeft) accel += Direction;
if (m_bGoingBack || m_bMouseRight) accel -= Direction;
if (m_bGoingRight) accel += Right;
if (m_bGoingLeft) accel -= Right;
if (m_bGoingUp) accel += Ogre::Vector3::UNIT_Y;
if (m_bGoingDown) accel -= Ogre::Vector3::UNIT_Y;
if (accel.squaredLength() != 0)
{
accel.normalise();
m_vVelocity += accel * m_fTopSpeed * evt.timeSinceLastFrame * 10;
}
else m_vVelocity -= m_vVelocity * evt.timeSinceLastFrame * 10;
Ogre::Real tooSmall = std::numeric_limits<Ogre::Real>::epsilon();
if (m_vVelocity.squaredLength() > m_fTopSpeed * m_fTopSpeed)
{
m_vVelocity.normalise();
m_vVelocity *= m_fTopSpeed;
}
else if (m_vVelocity.squaredLength() < tooSmall * tooSmall)
m_vVelocity = Ogre::Vector3::ZERO;
if (m_vVelocity != Ogre::Vector3::ZERO)
{
m_pTarget->translate(m_vVelocity * evt.timeSinceLastFrame);
m_pTarget->_getDerivedPositionUpdated();
}
}
void OisNodeControl::injectKeyDown(const OIS::KeyEvent& evt)
{
if (evt.key == OIS::KC_W || evt.key == OIS::KC_UP) m_bGoingForward = true;
else if (evt.key == OIS::KC_S || evt.key == OIS::KC_DOWN) m_bGoingBack = true;
else if (evt.key == OIS::KC_A || evt.key == OIS::KC_LEFT) m_bGoingLeft = true;
else if (evt.key == OIS::KC_D || evt.key == OIS::KC_RIGHT) m_bGoingRight = true;
else if (evt.key == OIS::KC_PGUP) m_bGoingUp = true;
else if (evt.key == OIS::KC_PGDOWN) m_bGoingDown = true;
}
void OisNodeControl::injectKeyUp(const OIS::KeyEvent& evt)
{
if (evt.key == OIS::KC_W || evt.key == OIS::KC_UP) m_bGoingForward = false;
else if (evt.key == OIS::KC_S || evt.key == OIS::KC_DOWN) m_bGoingBack = false;
else if (evt.key == OIS::KC_A || evt.key == OIS::KC_LEFT) m_bGoingLeft = false;
else if (evt.key == OIS::KC_D || evt.key == OIS::KC_RIGHT) m_bGoingRight = false;
else if (evt.key == OIS::KC_PGUP) m_bGoingUp = false;
else if (evt.key == OIS::KC_PGDOWN) m_bGoingDown = false;
}
void OisNodeControl::injectMouseMove(const OIS::MouseEvent& evt)
{
m_pTarget->yaw(Ogre::Degree(-evt.state.X.rel * 0.15f));
//m_pTarget->roll(Ogre::Degree(-evt.state.Y.rel * 0.15f));
m_pTarget->_getDerivedOrientationUpdated();
m_fTopSpeed += evt.state.Z.rel * 0.01f;
if(m_fTopSpeed < 1.0f) m_fTopSpeed = 1.0f;
}
void OisNodeControl::injectMouseDown(const OIS::MouseEvent& evt, OIS::MouseButtonID id)
{
if(id == OIS::MB_Left) m_bMouseLeft = true;
else if(id == OIS::MB_Right) m_bMouseRight = true;
}
void OisNodeControl::injectMouseUp(const OIS::MouseEvent& evt, OIS::MouseButtonID id)
{
m_bMouseLeft = false;
m_bMouseRight = false;
}
-
- OGRE Team Member
- Posts: 5429
- Joined: Sat Jul 21, 2007 4:55 pm
- Location: Buenos Aires, Argentina
- x 1337
Re: [GSoC 2013 - accepted] Ogre 2.0
frameRenderingQueued happens after updateAllTransform which explains the problem. Put the code in a listener that comes before (admittedly I have yet to see what happens with each listeners, some are redundant now, while others are undocumented for stuff like this).
You can safely replace the dummy calls to _getDerivedOrientationUpdated for _getDerivedPositionUpdated() may(all *Updated functions will update all transforms, not just position)
Is it too much if you zip the other files as well?
You can safely replace the dummy calls to _getDerivedOrientationUpdated for _getDerivedPositionUpdated() may(all *Updated functions will update all transforms, not just position)
Is it too much if you zip the other files as well?
-
- OGRE Expert User
- Posts: 1119
- Joined: Sat Jan 01, 2011 7:57 pm
- x 216
Re: [GSoC 2013 - accepted] Ogre 2.0
Oh nice! The sample browser works again.
Performance for me is still unchanged though (significantly worse than 1.9)
Performance for me is still unchanged though (significantly worse than 1.9)
-
- OGRE Team Member
- Posts: 5429
- Joined: Sat Jul 21, 2007 4:55 pm
- Location: Buenos Aires, Argentina
- x 1337
Re: [GSoC 2013 - accepted] Ogre 2.0
Out of curiosity I ran Ogre 1.9 vs 2.0 in a new real Ubuntu 13.11 box (I've been using VirtualBoxes) and the performance was more or less the same (slightly lower for 2.0 though).
Few things of the top of my head that may affect your measurements:
Executing this test: http://www.advenage.com/topics/linux-ti ... quency.php returned me (not sure how accurate this test could be):
Few things of the top of my head that may affect your measurements:
- Kernel Tick Rate: We need to switch contexts far more often than 1.9 did, (even if numThreads = 1). Perhaps this can be improved in the future; but right now this means that if your kernel was compiled with a very low tick rate, you may get consistently lower framerates (however Ogre 2.0 will still scale much better when stressing/adding more objects). If this is the problem, power consumption is not affected because the lower framerate is caused by us sleeping.
- Graphics drivers: We changed the order of some API operations, which some GPU drivers may like more/less. Linux GPU drivers are always a hot topic.
Code: Select all
cat /boot/config-3.11.0-12-generic | grep HZCONFIG_NO_HZ_COMMON=y
# CONFIG_HZ_PERIODIC is not set
CONFIG_NO_HZ_IDLE=y
# CONFIG_NO_HZ_FULL is not set
CONFIG_NO_HZ=y
CONFIG_RCU_FAST_NO_HZ=y
# CONFIG_HZ_100 is not set
CONFIG_HZ_250=y
# CONFIG_HZ_300 is not set
# CONFIG_HZ_1000 is not set
CONFIG_HZ=250
CONFIG_MACHZ_WDT=m
kernel timer interrupt frequency is approx. 4016 Hz or higher
-
- OGRE Expert User
- Posts: 1119
- Joined: Sat Jan 01, 2011 7:57 pm
- x 216
Re: [GSoC 2013 - accepted] Ogre 2.0
The thing is, not even the scaling seems to be working properly for me.
I set the "new instancing" demo to 50x50 entities with No instancing, Linear Skinning, shadows off, Move & animate enabled.
Ogre 2.0 gives me 40 FPS. In 1.9 I have 50 FPS.
Or is this due to more bugs in the instancing demo? Should I write my own profiling test with just Entities?
I tried your commands, here is the output:
I set the "new instancing" demo to 50x50 entities with No instancing, Linear Skinning, shadows off, Move & animate enabled.
Ogre 2.0 gives me 40 FPS. In 1.9 I have 50 FPS.
Or is this due to more bugs in the instancing demo? Should I write my own profiling test with just Entities?
I tried your commands, here is the output:
Code: Select all
cat /boot/config-`uname -r` | grep HZ
CONFIG_RCU_FAST_NO_HZ=y
CONFIG_NO_HZ=y
# CONFIG_HZ_100 is not set
CONFIG_HZ_250=y
# CONFIG_HZ_300 is not set
# CONFIG_HZ_1000 is not set
CONFIG_HZ=250
CONFIG_MACHZ_WDT=m
Code: Select all
$ ./a.out
kernel timer interrupt frequency is approx. 4016 Hz or higher
-
- OGRE Team Member
- Posts: 5429
- Joined: Sat Jul 21, 2007 4:55 pm
- Location: Buenos Aires, Argentina
- x 1337
Re: [GSoC 2013 - accepted] Ogre 2.0
Most of the scaling is thrown out of the window when the entity has skeletal animation (for now), though every one else seems to have 2.0>1.9 by a small margin in that sample.
HWBasic is a good way to compare since skeletons are stripped, though I've had issue running the glsl code for Linux.
Since you're the only one having this odd behavior of 2.0<1.9, I'm affraid I can't do much w/out access to your machine/setup. Try debugging and profiling tools to get the culprit.
HWBasic is a good way to compare since skeletons are stripped, though I've had issue running the glsl code for Linux.
Since you're the only one having this odd behavior of 2.0<1.9, I'm affraid I can't do much w/out access to your machine/setup. Try debugging and profiling tools to get the culprit.
-
- Gnome
- Posts: 393
- Joined: Thu Dec 08, 2005 9:57 pm
- x 1
Re: [GSoC 2013 - accepted] Ogre 2.0
Hey,
just browsing through the commits - is this intentional?
https://bitbucket.org/sinbad/ogre/commi ... de/Grass.h
in think the vMax construction is wrong. Perhaps change:
to
just browsing through the commits - is this intentional?
https://bitbucket.org/sinbad/ogre/commi ... de/Grass.h
in think the vMax construction is wrong. Perhaps change:
Code: Select all
Vector3 vMax( -vMax );
Code: Select all
Vector3 vMax( -vMin );
-
- OGRE Team Member
- Posts: 5429
- Joined: Sat Jul 21, 2007 4:55 pm
- Location: Buenos Aires, Argentina
- x 1337
Re: [GSoC 2013 - accepted] Ogre 2.0
Fixed in the same day a 1:30hs latervolca wrote:Hey,
just browsing through the commits - is this intentional?
https://bitbucket.org/sinbad/ogre/commi ... de/Grass.h
in think the vMax construction is wrong. Perhaps change:
toCode: Select all
Vector3 vMax( -vMax );
Code: Select all
Vector3 vMax( -vMin );
Thanks for keeping an eye on my commits though.
-
- Beholder
- Posts: 1512
- Joined: Fri Feb 22, 2013 4:44 am
- Location: Deep behind enemy lines
- x 139
Re: [GSoC 2013 - accepted] Ogre 2.0
Alllllways watching ...
-
- Gnome
- Posts: 393
- Joined: Thu Dec 08, 2005 9:57 pm
- x 1
Re: [GSoC 2013 - accepted] Ogre 2.0
Okay, sorry for the false alarm I still find it alarming that the self-copy construction seems to be valid (g++ didn't even spit a warning when I tried it).
EDIT: At least clang identifies the problem:
EDIT: At least clang identifies the problem:
Code: Select all
a.cc:11:8: warning: variable 'a' is uninitialized when used within its own initialization [-Wuninitialized]
ynt a(a);
~ ^