I need a sort of top-most 3d layer

Discussion about everything. New games, 3d math, development tips...
Post Reply
MyGrandmaWheels
Posts: 20
Joined: Thu May 07, 2015 9:05 am

I need a sort of top-most 3d layer

Post by MyGrandmaWheels »

Hello to everyone.
Maybe I'm about to ask a silly question; in this case, excuse me, I'm just a Irrlicht newbie.

I'm implementing a simple CAM utility, something to generate CNC toolpath from 3d meshes.
I'm using some custom scene node and a mesh node, they all are children of the root scene node, and so far so good.

Now I need to render another scene node that must always totally be visible, I mean even if is totally or partially occluded by my other nodes that could be ahead.
This node would be a sort of wireframe placed somehow in a top-most layer; I hope to have explained quite clearly.

Have you suggestions?
Seven
Posts: 1030
Joined: Mon Nov 14, 2005 2:03 pm

Re: I need a sort of top-most 3d layer

Post by Seven »

if you keep your own pointer to the node in question, you can just draw it last.

begin frame

specialnode->setVisible(false);
smgr->drawAll();
specialnode->setVisible(true);
specialnode->draw();

end frame
MyGrandmaWheels
Posts: 20
Joined: Thu May 07, 2015 9:05 am

Re: I need a sort of top-most 3d layer

Post by MyGrandmaWheels »

A piece of cake, it seems!
Many thanks!
MyGrandmaWheels
Posts: 20
Joined: Thu May 07, 2015 9:05 am

Re: I need a sort of top-most 3d layer

Post by MyGrandmaWheels »

Maybe I'm doing something wrong, but it doesn't work, it seems..
the special node is as usual occluded by eventual nodes ahead.
A little note: I used the render() method, because draw() doesn't exist. I don't know if it's an outstanding topic..
CuteAlien
Admin
Posts: 9628
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: I need a sort of top-most 3d layer

Post by CuteAlien »

The render function is correct. You have to clear the zbuffer (IVideoDriver::clearZBuffer) before drawing that node. If you have more than one node you can also put them in an own scenemanger (ISceneManager::createNewSceneManager) which you render later. That also needs a clear of the zbuffer in between.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: I need a sort of top-most 3d layer

Post by hendu »

Depending on the type of node, before render() you need to set the scene manager's pass.
MyGrandmaWheels
Posts: 20
Joined: Thu May 07, 2015 9:05 am

Re: I need a sort of top-most 3d layer

Post by MyGrandmaWheels »

CuteAlien wrote:The render function is correct. You have to clear the zbuffer (IVideoDriver::clearZBuffer) before drawing that node. If you have more than one node you can also put them in an own scenemanger (ISceneManager::createNewSceneManager) which you render later. That also needs a clear of the zbuffer in between.
this is the outstanding element: it works perfectly!
There's no need to make the special node invisible and, after rendered, visible.

Code: Select all

 
device->getVideoDriver()->beginScene(true, true, SColor(255, 50, 50, 50));
 
device->getSceneManager()->drawAll(); // "normal" rendered nodes
 
device->getVideoDriver()->clearZBuffer();
wrkTP->render();  // top-most node
 
device->getVideoDriver()->endScene();
The only smear is that the clearBuffer method is marked as deprecated, rising a compiler warning; not a problem at all, anyway!

Many many thanks to everyone!
CuteAlien
Admin
Posts: 9628
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: I need a sort of top-most 3d layer

Post by CuteAlien »

Ah yes, if you are using newest svn trunk it's deprecated. But will still work for a long time. And the function replacing it might get another change shortly (enum instead of bools).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply