Ogre 1.4.1

Discussion area about developing or extending OGRE, adding plugins for it or building applications on it. No newbie questions please, use the Help forum for that.
User avatar
syedhs
Silver Sponsor
Silver Sponsor
Posts: 2703
Joined: Mon Aug 29, 2005 3:24 pm
Location: Kuala Lumpur, Malaysia
x 51

Ogre 1.4.1

Post by syedhs »

I have noticed this since latest CVS download (2-3 days ago), but I didn't find them detailed down in the release note of Ogre 1.4.1.

1) MovableObject now has new pure virtual function (visitRenderables). All my movable objects need to declare/implement this virtual function. I just made the body empty ie

Code: Select all

	virtual void visitRenderables(Renderable::Visitor* visitor, 
		bool debugRenderables = false) {}
So I suppose that should be okay?

2) SceneNode no longer has getWorldPosition?
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 67

Post by sinbad »

1) visitRenderables didn't go into the 1.4 branch, it went into HEAD. The stable branch only gets bugfixes.

2) Ditto
User avatar
syedhs
Silver Sponsor
Silver Sponsor
Posts: 2703
Joined: Mon Aug 29, 2005 3:24 pm
Location: Kuala Lumpur, Malaysia
x 51

Post by syedhs »

Okay I should have realized I downloaded the HEAD :oops:
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 67

Post by sinbad »

No problem. :) I'm using HEAD myself for my own Ogre-based project too because I get to add stuff I need to it whenever I want :P
Chaster
OGRE Expert User
OGRE Expert User
Posts: 557
Joined: Wed May 05, 2004 3:19 pm
Location: Portland, OR, USA

Post by Chaster »

Whoah, no getWorldPosition in SceneNode? Are these changes destined for 1.6 or 2.0? I'm thinking that removal of getWorldPosition will break a LOT of code out there (especially mine...)

Chaster
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 67

Post by sinbad »

v1.6. And getWorldPosition should never have been used on SceneNode, it's an unintended effect of SceneNode inheriting Renderable for debug purposes - Renderable had it on the interface for shader position updates a while ago but they were removed so it was redundant.

Just use _getDerivedPosition instead which has been the correct one to use all along. The fact that people got confused and used getWorldPosition instead was the reason it had to go.
User avatar
syedhs
Silver Sponsor
Silver Sponsor
Posts: 2703
Joined: Mon Aug 29, 2005 3:24 pm
Location: Kuala Lumpur, Malaysia
x 51

Post by syedhs »

Okay, I think you should remove the underscore in the _getDerivedPosition - if I am not mistaken underscore prefix means lower level/hardcore (or something like that) functions :)
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 67

Post by sinbad »

It does - basically it means 'caution'. The issue here is that derived positions are lazy-updated for speed, not every time you make a change to nodes in the hierarchy. Thus the result may not be accurate unless SceneManager::updateSceneGraph has happened, or you force an update for a sub-branch of the tree. When you make a change to a parent node, the update flag is not propagated all the way down the tree (for the same efficiency reasons), it's just flagged as pending a cascade which is propagated later. Thus a node several children down may have no knowledge that it is currently out of date. Within 1 level of the tree it's ok, but beyond that it's not.

Without this lazy update approach, making lots of updates to scene objects in deep hierarchies becomes very slow. Thus we mark the _getDerived methods with an underscore because grabbing derived updates all the time can be both costly and /or inaccurate depending how you propagate changes. Scene managers can rely on them because updateSceneGraph has resolved all the changes.
User avatar
syedhs
Silver Sponsor
Silver Sponsor
Posts: 2703
Joined: Mon Aug 29, 2005 3:24 pm
Location: Kuala Lumpur, Malaysia
x 51

Post by syedhs »

Okay thanks for the explanation - make sense to me.

It is small matter but the reason I was asking that is because getWorldPosition() is the same as _getDerivedPosition() - and in this regard, one function has prefix _ and the other is not.
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 67

Post by sinbad »

Yes - the thing is, getWorldPosition was only intended as an internal method, since it was in the lower-level class Renderable. In SceneNode's case it delegated to _getDerievedPosition. This was another reason to get rid of it - it was a low-level method which ended up on people's auto-completes looking like a high-level method.
Chaster
OGRE Expert User
OGRE Expert User
Posts: 557
Joined: Wed May 05, 2004 3:19 pm
Location: Portland, OR, USA

Post by Chaster »

sinbad wrote:v1.6. And getWorldPosition should never have been used on SceneNode, it's an unintended effect of SceneNode inheriting Renderable for debug purposes - Renderable had it on the interface for shader position updates a while ago but they were removed so it was redundant.

Just use _getDerivedPosition instead which has been the correct one to use all along. The fact that people got confused and used getWorldPosition instead was the reason it had to go.
Ah, silly me - I was already using _getDerivedPosition() but I remember seeing getWorldPosition and wondering what the difference was... Never mind, all is good (at least, with my code)..

Chaster
User avatar
nebukadnezzar
Halfling
Posts: 93
Joined: Sun Jun 11, 2006 4:40 pm
Location: Germany
x 1

Post by nebukadnezzar »

does this also apply to getWorldOrientation() ?
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 67

Post by sinbad »

Yep.
User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7157
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia
x 538

Post by Kojack »

Hmm, I've always used the getWorld version, since the _getDerived versions always looked like "warning, don't touch" internal versions.

Especially since the C++ standard says in section 17.4.3.1.2:
Each name that begins with an underscore is reserved to the implementation for use as a name in the global namespace.
Edit: ok, some people say that it only is reserved WITHIN the global namespace (so ok for methods and stuff), whereas I read it as it's reserved FOR the global namespace, and shouldn't be used elsewhere.