Is it possible to draw the whole scene with a wireframe overlay without duplicating every single scenenode with material set to wireframe?
thanks
Draw whole scene with wireframe overlay
-
- Posts: 69
- Joined: Sun Oct 12, 2003 3:42 pm
- Location: Germany
I haven't tried this...but i do know u can render the scene manager more than once. Loop through all nodes and turn their materials to wireframe, and then call the render function. The only problem is, this is effectively creating 2 scenes and putting them together so instead of having one scene 'overlay' the other...the two become part of each other, and the 3d objects overlay in 3d space...so the result is the wireframe can be hidden both other things in the foreground ( often a desired effect ). You can of course fix this by using the setmaterialflag command and turning off the zbuffer for the materials...just remember to turn the option back on afterwards.
hmm like cell shading...
a way to draw outlines is to hold your nodes in a container
or they names or any identifier to get a scene node
and switch all them to wired or not before u call the draw() function
or code a shader
but there i cant help
a way to draw outlines is to hold your nodes in a container
or they names or any identifier to get a scene node
and switch all them to wired or not before u call the draw() function
Code: Select all
//i assume u use an array with scene nodes
switchToWired(bool _wired)
{
size_t idx;
for(idx=0; idx < array.size(); ++idx)
{
ISceneNode *l_node = (ISceneNode *)array[idx];
l_node->setMaterialFlag(video:EMF_WIREFRAME, _wired);
}
}
loopCall()
{
driver->beginScene(true, true, video::SColor(255,0,0,255));
manager->draw();
switchToWired(true);
manager->draw();
driver->endScene();
switchToWired(false);
}
but there i cant help
-
- Posts: 69
- Joined: Sun Oct 12, 2003 3:42 pm
- Location: Germany
If you want the entire scene to be rendered wireframe, it seems wasteful [and error prone] to hold a copy of all node pointers. You could easily traverse the scene graph enabling/disabling wireframe...
But at that point, maybe it is better to just add an override flag to the video driver...
Code: Select all
void enableWireframeMode(bool enable, scene::ISceneNode* node, bool recurse)
{
node->setMaterialFlag(video::EMF_WIREFRAME, enable);
if (recurse)
{
core::list<scene::ISceneNode*>::Iterator head = node->getChildren().begin();
core::list<scene::ISceneNode*>::Iterator tail = node->getChildren().end();
for (; head != tail; ++head)
enableWireframeMode(enable, (*head), true);
}
}
void enableWireframeMode(scene::ISceneManager* scene, bool enable)
{
enableWireframeMode(enable, scene->getRootSceneNode(), true);
}
Code: Select all
// declare new interface in IVideoDriver.h
virtual void enableOverrideWire(bool enable) = 0;
//! implement in each driver
void COpenGLDriver::enableOverrideWire(bool enable)
{
OverrideWireframeEnabled = enable;
}
// use override flag in derived drivers
void COpenGLDriver::setMaterial(const SMaterial& material)
{
Material = material;
if (OverrideWireframeEnabled)
Material.Wireframe = true;
setTexture(0, Material.Texture1);
setTexture(1, Material.Texture2);
}
hey vitek whats up...
for the second solution im not with u because if we change the source of irrlicht we must rebuild the engine. and i think a wireframe mode is not necessary/important for everyone so let it as flag
remember your words:
and to the first solution
linear access against recursion
whats the better solution a reference to all nodes to access there linear or a recursion with a slow app stack? ...
time is money or a frame =)
for 10 nodes no prob, but for 1000
i think many people holds an extra array with infos/properties about there nodes (id´s or names or what ever) why not a reference to the scenenode ?
now i shut up thats better for me
for the second solution im not with u because if we change the source of irrlicht we must rebuild the engine. and i think a wireframe mode is not necessary/important for everyone so let it as flag
remember your words:
Again, as I mentioned in another topic post, my solution does the same thing as yours. The advantages are that it does not require rebuilding the library, and it makes it possible for the user to change the rotation on the fly.
and to the first solution
linear access against recursion
whats the better solution a reference to all nodes to access there linear or a recursion with a slow app stack? ...
time is money or a frame =)
for 10 nodes no prob, but for 1000
i think many people holds an extra array with infos/properties about there nodes (id´s or names or what ever) why not a reference to the scenenode ?
now i shut up thats better for me
Yeah, I agree. I don't like changing the engine either. Unfortunately I found a few bugs and ended up making changes against my will. :) If you are going to be turning wireframe on/off every render, then it is a bad idea to be iterating through a deep tree to toggle the flag. I don't imagine that the scene graphs are extremely deep. If they are not there would be little recursion and just iterating over the scene node lists.
My thought was that it would be used for debugging purposes only and you would only want to render with wireframe on or off for all nodes [press F12 to toggle wireframe mode].
Travis
My thought was that it would be used for debugging purposes only and you would only want to render with wireframe on or off for all nodes [press F12 to toggle wireframe mode].
Travis