Page 1 of 1

actors and custom scene node

Posted: Sun Apr 10, 2022 11:20 am
by cosmo
Hi,
sorry if my question may sound conceptually a little strange. By the way I need some additional information about how to implement a custom scene node.
I red the tutorial n.3 in the documentation section, but I'm a little messed up.
I hope I could briefly explain what I'm trying to accomplish.
I'm attempting to define two basic kind of scene node: one for rendering static objects, one another for animated models. In these two classes, I will also implement specific methods for material shading and for physicalization purpose.
But I'm stuck.
In the example n.3, it's only explained how to render the verteces for a simple shape like a tetraeder. Instead, I need to implement a custom scene node with much more polygons like, for example, a sphere or a barrel or even a character, all of which loaded from B3D file.
Is it possible in Irrlicht?
Or is it necessary to reprocess every single vertices of the mesh inside the custom scene node constructor?
Thanks for your support, kindly regards.

Re: actors and custom scene node

Posted: Sun Apr 10, 2022 11:44 pm
by CuteAlien
Simplest is probably looking at how Irrlicht implements it's CMeshSceneNode (check the .cpp file by the same name in source/Irrlicht).
You likely just need the OnRegisterSceneNode() and render() functions - if you have any questions about them just ask again here.
But in short: Load geometry into a mesh (most examples do that). And in your SceneNode draw it with driver->drawMeshBuffer.

Animated meshes are more tricky as it can depend on the animation format. Thought checking CAnimatedMeshSceneNode.cpp is probably the best way to get started.

Alternatively you should consider if you really need an own SceneNode. Or if if you instead use one of the already implemented scenenodes of Irrlicht which also allow material shading.