Generic Scene Manager Listener System

What it says on the tin: a place to discuss proposed new features.
Post Reply
User avatar
tuan kuranes
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 2653
Joined: Wed Sep 24, 2003 8:07 am
Location: Haute Garonne, France
x 4
Contact:

Generic Scene Manager Listener System

Post by tuan kuranes »

Plsm2 and TSM have their own listeners but they need explicit lib linking to make it work, as generic scene manager does'nt have one.

Perhaps we should have a generic listener implementation.

I don't know exactly how to achieve this properly... (all that I can think of results in a big ugly switch in a generic event listening in sm and client side...)
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 66
Contact:

Post by sinbad »

I personally think that if you're listening to SM-specific events then it makes more sense to link directly. The non-SM-portable dependency is still there anyway if this was made generic.
lgoss007
Halfling
Posts: 81
Joined: Sat Mar 29, 2003 7:29 pm
Location: Florida, USA
Contact:

Post by lgoss007 »

Hmm, I want to look into this. The current solution forces me to put the lib files in the /usr/local/lib directory and then create a symlink in the plugins folder since it is run as a plugin. Does this sound like the correct solution? Alternatively I could add the /usr/local/lib/OGRE directory to the path, though I don't like that any better. Maybe there is something that can be done on the paging landscape side to make this solution better, guess I'll have to get familiar with the code...
User avatar
:wumpus:
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 3067
Joined: Tue Feb 10, 2004 12:53 pm
Location: The Netherlands
x 1

Post by :wumpus: »

lgoss007 wrote:Hmm, I want to look into this. The current solution forces me to put the lib files in the /usr/local/lib directory and then create a symlink in the plugins folder since it is run as a plugin. Does this sound like the correct solution? Alternatively I could add the /usr/local/lib/OGRE directory to the path, though I don't like that any better. Maybe there is something that can be done on the paging landscape side to make this solution better, guess I'll have to get familiar with the code...
I suggest adding a virtual function to the LandscapeSceneManager class, which returns a pure virtual interface you can use for "landscape specific" things like registering listeners.

This still needs a static cast, but is most portable and prevents linking against any plugins directly.
ie,

Code: Select all

ApplicationInterface *ai = static_cast<LandscapeSceneManager*>(mSceneMgr)->getApplicationInterface();
ai->registerLandscapeListener(myfunnyclass);
ai->setSomeParameter(42);
Vector3 *loc = ai->getInitialSpawnPoint("evilrobot");
...
If you make the Listener interface completely virtual as well it shouldn't need any functions from the library when implementing it, right? Or does it always need an actual destructor?
User avatar
tuan kuranes
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 2653
Joined: Wed Sep 24, 2003 8:07 am
Location: Haute Garonne, France
x 4
Contact:

Post by tuan kuranes »

Doesn't work here, still need to link to abstract class constructor.
lgoss007
Halfling
Posts: 81
Joined: Sat Mar 29, 2003 7:29 pm
Location: Florida, USA
Contact:

Post by lgoss007 »

Should this be a library instead of a Plugin then? A plugin suggests that it can be implemented without linking directly because it uses the interfaces of the base. If there isn't sufficient interfaces from OGRE then shouldn't this be implemented as a library like CEGUI?
Post Reply