Page 1 of 1

question about animatedmesh and billboard

Posted: Tue May 05, 2009 7:13 pm
by moekkog
i have an array of animated mesh to control then but i want to know if i can do some kind of cast or something to put a billboard into the array for example

array[0] = IAnimatedMeshSceneNode
array[1] = IBillBoardSceneNode

is there any way to do that

Posted: Tue May 05, 2009 8:07 pm
by hybrid
Just use core::array<scene::ISceneNode*> to store the objects. You need a cast when accessing special functions of the scene node types, though. Otherwise you can only use the basic ISceneNode methods.

thanks

Posted: Tue May 05, 2009 8:44 pm
by moekkog
thats will be helpful but can you give me an example of a cast that you toldme

Posted: Tue May 05, 2009 8:48 pm
by Jookia
I'm stupid, but I'd say one of these..

static_cast<specialclassname>(object)
dynamic_cast<specialclassname>(object)
reinterpret_cast<specialclassname>(object)

Posted: Tue May 05, 2009 8:58 pm
by moekkog
whats the different between all of them

Posted: Tue May 05, 2009 10:26 pm
by Jookia
/shrug

I don't know, all I know is that that may work or it may not.

Posted: Tue May 05, 2009 10:59 pm
by hybrid
static_cast will work in most cases. If you have RTTI enabled you can use dynamic_cast instead, in order to have safe casts (will return 0 if you cast to the wrong types). Moreover, dynamic_cast is also necessary when upcasting from multi-inherited classes. reinterpret_cast is only necessary when casting structures without changing the underlying bit-level content. Mostly necessary for byte streams and C-style arrays.

XDD

Posted: Tue May 05, 2009 11:00 pm
by moekkog
well i did it in other way taking what you say as base first a declare a ISceneNode* array[64];

Posted: Tue May 05, 2009 11:46 pm
by hybrid
Oh, I said it that way. But you should better get used to core::array (or std::vector) very soon. Will make your life easier.