Support for Custom Scene Nodes

What it says on the tin: a place to discuss proposed new features.
Post Reply
User avatar
Posts: 638
Joined: Mon Dec 15, 2008 6:14 pm
Location: Istanbul, Turkey
x 42

Support for Custom Scene Nodes

Post by stealth977 »

Well, this time no whining, just a little idea:

Currently Scene Nodes can only be created by Scene Managers, i see that they have virtual functions to override, but all are useless since subclassing the scene nodes is not usable without sublassing the scene manager too...

How this idea came out:
1 - In Ogitor, I am using PLACE HOLDER entities for non-visual objects like Cameras and Lights

2 - The hoders need to be adjusted according to its encapsulated object, so the Camera's place holder must show where camera is etc.

3 - In order to do that, i create a node with a place holder attached to it and then attach this node to Camera's parent node, later i update the placeholder's node's position according to camera, i also set setInheritScale(false) for the holder node, so that the place holders always stay at the same size. (actually setInheritScale(false) should affect how the nodes derived position is calculated, if its false, the parent's derived scale shouldnt be integrated into calculation (just an idea))

4 - Now, the problem is, the place holder node's world position and camera's world position is not the same although their positions are same, because when calculating a node's position, the position is scaled by the derived scale of parent node, where when calculating camera's / light's world position, the parent node's scale has no effect!!!

So, to solve this problem, there were two possible theories:
Theory 1 - To update the holdernode's position with a calculation that t the end both camera and node's world position would be same (in this case their positions are not same, but their world positions are same)

Theory 2 - Subclass SceneNode, and override updateFromParentImpl(), so that thisnew class does not get affected by its parent's derived scale while calculating world position.

Of course Theory 2 doesnt work, because you cant create a custom scene node using the usual functions, it must be created by the scene manager itself (even node->createChildSceneNode() internally uses scenemanager to create the node)
So I created a subclass of SceneManager too, adding functionality to create my custom node, but 2 problems:

1 - Objects attached to this new node doesnt show up, but objects attached to this node's child nodes do show up
2 - On "delete OgreRoot", it causes an exception (Ogre somehow cant free the object created by custom scene manager, I mean when new is used in my application and delete is used in OgreMain, it gives exception)

So, It would be great if the SceneNode could be subclassed and used with a SceneManager, some functionality to create custom subclassed scenenodes would be great....

Ismail TARIM
Ogitor - Ogre Scene Editor

User avatar
Posts: 677
Joined: Tue Sep 19, 2006 6:09 pm
x 3

Re: Support for Custom Scene Nodes

Post by _tommo_ »

Yes, this would be good, but in fact i think the Ogre Team is already working on this :D
I read that the position system has to be "refactored" so that you can put anything in the node hierarchy... useful for custom position sources (physics engines) and for cases like yours.
I'm afraid anyway that this feature is for Ogre 2.0...
OverMindGames Blog Il nuovo portale italiano su Game Dev & Indie Games

Post Reply