::ConstIterator and ::Iterator access

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
aheymann
Posts: 153
Joined: Wed Aug 22, 2007 12:25 pm
Location: England

::ConstIterator and ::Iterator access

Post by aheymann »

I am restarting a thread that is currently embedded within another thread to see if I can get some answers to my problem. I have a ILightSceneNode, which has attached with it a IBillboardSceneNode (as a child node). I am using the SVN trunk. In 1.4.2 it all works fine, but due to changes in 1.5 with the declaration of ISceneNode as a virtual class problems happen.

This is what I am trying to do :

Code: Select all

   core::list<ISceneNode *>::ConstIterator it;

:
:
      pLight = Light->pIRRLight;
      
      it = pLight->getChildren().begin();
      if (*it)
			((IBillboardSceneNode *) *it)->setSize(Size * pLight->getPosition().getDistanceFrom(pos) * A1_SIZE);
pLight is a ILightSceneNode

my compiler gives the following errors :

1>c:\msdev\onyx\src\commonstuff\Drawing3D.cpp(355) : error C2635: cannot convert a 'irr::scene::ISceneNode*' to a 'irr::scene::IBillboardSceneNode*'; conversion from a virtual base class is implied
1> c:\msdev\onyx\src\trunk\include\ISceneNode.h(35) : see declaration of 'irr::scene::ISceneNode'
1> c:\msdev\onyx\src\trunk\include\IBillboardSceneNode.h(20) : see declaration of 'irr::scene::IBillboardSceneNode'
1>c:\msdev\onyx\src\commonstuff\Drawing3D.cpp(355) : error C2039: 'setSize' : is not a member of 'irr::scene::ISceneNode'
1> c:\msdev\onyx\src\trunk\include\ISceneNode.h(35) : see declaration of 'irr::scene::ISceneNode'


I have tried <dynamic_cast> - runtime error.

Please, please I need to get this resolved.

Thanks

Anton
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

Oops. I hope I'm wrong, but I'm not sure that there is a solution to that, other than turning on RTTI and using dynamic_cast<>. You can't even brute force (void*) your way around it.

You might want to take this up directly with hybrid, since he virtualised IBillboardSceneNode back in February.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

I already concluded the other thread with reverting these changes, because of the cast problems we would face wiht the current solution. Since we don't want RTTI and dynamic_cast in Irrlicht we will go for the duplication solution.
aheymann
Posts: 153
Joined: Wed Aug 22, 2007 12:25 pm
Location: England

Post by aheymann »

Hybrid

Are there not other classes that are derived from ISceneNode that are virtual as well e.g. ITextSceneNode etc. e.g. this might resolve this particular issue with billboards, but is this going to be a robust general solution. Anyway thanks for the efforts:)

Anton
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

No, these are the only two/three: The ITextSceneNode and IBillboardSceneNode, which are both inherited by CBillboardTextSceneNode...
Post Reply