Nasty Little Bug (Again)

stealth977

25-01-2009 15:20:57

Err, Umm, Yep I know I complain A LOT!!
But here is another little but a nasty crasher bug which you may never realise unless Hydrax is used in an editor and instantiated more then once during the lifetime of the application....

You remember a line in Hydrax::create() as:

(Line 142, Hydrax.cpp)
Ogre::Root::getSingleton().getRenderSystem()->addListener(&mDeviceRestoredListener);


Umm, where is the corresponding:

Ogre::Root::getSingleton().getRenderSystem()->removeListener(&mDeviceRestoredListener);


in Hydrax::remove?????

since the listener stays active, when i terminate the scene and reload another scene with a Hydrax object in it, RenderSytem still tries to inform the old and deleted hydrax object...and bang, crash....

I fixed it by adding a corresponding removeListener() in Hydrax::remove(), I suggest you do the same :)

Keep up the good work...

Stealth,

Xavyiy

25-01-2009 22:00:09

Good catch!
Thanks :)

P.D.: I'm going to download the latest version of your editor and trying to understand the because of the reflection problem(I think I know what's happend, a problem with a parameter in RttManager due to the world scale differences).

Xavi

stealth977

25-01-2009 22:13:25

BTW I made a little test, drag and drop the TreeNode to under SceneManager node, which puts the tree completely in the water (it'll disappear from your view but just select tree entity under treenode and press "F" to focus on it) and all transparent leaves are now not so transparent a pic below:



I hope you can find a solution to it too :)

Stealth,

Xavyiy

25-01-2009 22:26:57

Custom hydrax depth maps based on textures(for transluscent objects inside the water) is a feature planned for the 0.5 version, but probably will be aplaced to 0.6, because is a little complex and, before that, I want to change the underwater depth calculation approach.(And doing it like crysis approach)

With this feature, you're going to be able to do something like:
Hydrax::MaterialManager::addHydraxTextureDepthTechnique(const Ogre::String& texName, Ogre::Technique* tech)

I'll add some examples of how to create the hydrax deph textures for the objects, so.. don't worry!

stealth977

05-02-2009 08:14:10

Hi Xavyiy,

Found another little bug, same category. You should probably check your source and update it so that ALL LISTENERS MUST BE REMOVED WHEN THE LISTENING CLASS DESTROYED :)

Ok, this time it is RttManager, in initialize() it installs a Reflection Listener as following:

if (!mPlanesSceneNode)
{
mPlanesSceneNode = mHydrax->getSceneManager()->getRootSceneNode()->createChildSceneNode();
mHydrax->getSceneManager()->addRenderQueueListener(&mReflectionListener.mCReflectionQueueListener);
}


now, when the user wants to remove hydrax and delete it, boom a crash traced back to :

bool SceneManager::fireRenderQueueStarted(uint8 id, const String& invocation)

where the RenderQueueListeners are called (of course this time with a <Bad Ptr> since its deleted).

so, fix is (I may be doing wrong so correct me): (in void RttManager::removeAll())

if (mPlanesSceneNode)
{
mPlanesSceneNode->detachAllObjects();
mPlanesSceneNode->getParentSceneNode()->removeAndDestroyChild(mPlanesSceneNode->getName());
mPlanesSceneNode = 0;
mHydrax->getSceneManager()->removeRenderQueueListener(&mReflectionListener.mCReflectionQueueListener);
}


Stealth, :D

Xavyiy

05-02-2009 14:42:25

Fixed ;)

Thanks!