forked from Mirrorlandia_minetest/irrlicht
Add another render pass ESNRP_GUI which is drawn last and is p.E. useful for rendering gui nodes in the scenemanager.
UI and scenenodes are often connected. And while it was possible to work around this already by using custom draw functions or deriving from gui and scene-nodes at the same time, it did already lead a few times to uglier code for me. So I guess adding one more pass to the engine has it's uses. git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6107 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
parent
bca8023261
commit
a67b616fc9
@ -1,5 +1,6 @@
|
|||||||
--------------------------
|
--------------------------
|
||||||
Changes in 1.9 (not yet released)
|
Changes in 1.9 (not yet released)
|
||||||
|
- Add another render pass ESNRP_GUI which is drawn last and is p.E. useful for rendering gui nodes in the scenemanager.
|
||||||
- BurningVideo: 0.51
|
- BurningVideo: 0.51
|
||||||
- 10 year anniversary update
|
- 10 year anniversary update
|
||||||
- Lighting model reworked. moved to eyespace like openGL. [Specular Highlights, Fog, Sphere/Reflection Map]
|
- Lighting model reworked. moved to eyespace like openGL. [Specular Highlights, Fog, Sphere/Reflection Map]
|
||||||
|
@ -52,7 +52,9 @@ namespace scene
|
|||||||
{
|
{
|
||||||
//! Enumeration for render passes.
|
//! Enumeration for render passes.
|
||||||
/** A parameter passed to the registerNodeForRendering() method of the ISceneManager,
|
/** A parameter passed to the registerNodeForRendering() method of the ISceneManager,
|
||||||
specifying when the node wants to be drawn in relation to the other nodes. */
|
specifying when the node wants to be drawn in relation to the other nodes.
|
||||||
|
Note: Despite the numbering this is not used as bit-field.
|
||||||
|
*/
|
||||||
enum E_SCENE_NODE_RENDER_PASS
|
enum E_SCENE_NODE_RENDER_PASS
|
||||||
{
|
{
|
||||||
//! No pass currently active
|
//! No pass currently active
|
||||||
@ -92,7 +94,11 @@ namespace scene
|
|||||||
ESNRP_TRANSPARENT_EFFECT =32,
|
ESNRP_TRANSPARENT_EFFECT =32,
|
||||||
|
|
||||||
//! Drawn after the solid nodes, before the transparent nodes, the time for drawing shadow volumes
|
//! Drawn after the solid nodes, before the transparent nodes, the time for drawing shadow volumes
|
||||||
ESNRP_SHADOW =64
|
ESNRP_SHADOW =64,
|
||||||
|
|
||||||
|
//! Drawn after transparent effect nodes. For custom gui's. Unsorted (in order nodes registered themselves).
|
||||||
|
ESNRP_GUI = 128
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class IAnimatedMesh;
|
class IAnimatedMesh;
|
||||||
@ -1122,6 +1128,8 @@ namespace scene
|
|||||||
\param pass: Specifies when the node wants to be drawn in relation to the other nodes.
|
\param pass: Specifies when the node wants to be drawn in relation to the other nodes.
|
||||||
For example, if the node is a shadow, it usually wants to be drawn after all other nodes
|
For example, if the node is a shadow, it usually wants to be drawn after all other nodes
|
||||||
and will use ESNRP_SHADOW for this. See scene::E_SCENE_NODE_RENDER_PASS for details.
|
and will use ESNRP_SHADOW for this. See scene::E_SCENE_NODE_RENDER_PASS for details.
|
||||||
|
Note: This is _not_ a bitfield. If you want to register a note for several render passes, then
|
||||||
|
call this function once for each pass.
|
||||||
\return scene will be rendered ( passed culling ) */
|
\return scene will be rendered ( passed culling ) */
|
||||||
virtual u32 registerNodeForRendering(ISceneNode* node,
|
virtual u32 registerNodeForRendering(ISceneNode* node,
|
||||||
E_SCENE_NODE_RENDER_PASS pass = ESNRP_AUTOMATIC) = 0;
|
E_SCENE_NODE_RENDER_PASS pass = ESNRP_AUTOMATIC) = 0;
|
||||||
|
@ -357,6 +357,7 @@ CSceneManager::CSceneManager(video::IVideoDriver* driver, io::IFileSystem* fs,
|
|||||||
getProfiler().add(EPID_SM_RENDER_SHADOWS, L"shadows", L"Irrlicht scene");
|
getProfiler().add(EPID_SM_RENDER_SHADOWS, L"shadows", L"Irrlicht scene");
|
||||||
getProfiler().add(EPID_SM_RENDER_TRANSPARENT, L"transp.nodes", L"Irrlicht scene");
|
getProfiler().add(EPID_SM_RENDER_TRANSPARENT, L"transp.nodes", L"Irrlicht scene");
|
||||||
getProfiler().add(EPID_SM_RENDER_EFFECT, L"effectnodes", L"Irrlicht scene");
|
getProfiler().add(EPID_SM_RENDER_EFFECT, L"effectnodes", L"Irrlicht scene");
|
||||||
|
getProfiler().add(EPID_SM_RENDER_GUI_NODES, L"guinodes", L"Irrlicht scene");
|
||||||
getProfiler().add(EPID_SM_REGISTER, L"reg.render.node", L"Irrlicht scene");
|
getProfiler().add(EPID_SM_REGISTER, L"reg.render.node", L"Irrlicht scene");
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@ -1403,6 +1404,13 @@ u32 CSceneManager::registerNodeForRendering(ISceneNode* node, E_SCENE_NODE_RENDE
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case ESNRP_GUI:
|
||||||
|
if (!isCulled(node))
|
||||||
|
{
|
||||||
|
GuiNodeList.push_back(node);
|
||||||
|
taken = 1;
|
||||||
|
}
|
||||||
|
|
||||||
case ESNRP_NONE: // ignore this one
|
case ESNRP_NONE: // ignore this one
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1430,6 +1438,7 @@ void CSceneManager::clearAllRegisteredNodesForRendering()
|
|||||||
TransparentNodeList.clear();
|
TransparentNodeList.clear();
|
||||||
TransparentEffectNodeList.clear();
|
TransparentEffectNodeList.clear();
|
||||||
ShadowNodeList.clear();
|
ShadowNodeList.clear();
|
||||||
|
GuiNodeList.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
//! This method is called just before the rendering process of the whole scene.
|
//! This method is called just before the rendering process of the whole scene.
|
||||||
@ -1711,6 +1720,36 @@ void CSceneManager::drawAll()
|
|||||||
TransparentEffectNodeList.set_used(0);
|
TransparentEffectNodeList.set_used(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// render custom gui nodes
|
||||||
|
{
|
||||||
|
IRR_PROFILE(CProfileScope psEffect(EPID_SM_RENDER_GUI_NODES);)
|
||||||
|
CurrentRenderPass = ESNRP_GUI;
|
||||||
|
Driver->getOverrideMaterial().Enabled = ((Driver->getOverrideMaterial().EnablePasses & CurrentRenderPass) != 0);
|
||||||
|
|
||||||
|
if (LightManager)
|
||||||
|
{
|
||||||
|
LightManager->OnRenderPassPreRender(CurrentRenderPass);
|
||||||
|
|
||||||
|
for (i=0; i<GuiNodeList.size(); ++i)
|
||||||
|
{
|
||||||
|
ISceneNode* node = GuiNodeList[i];
|
||||||
|
LightManager->OnNodePreRender(node);
|
||||||
|
node->render();
|
||||||
|
LightManager->OnNodePostRender(node);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (i=0; i<GuiNodeList.size(); ++i)
|
||||||
|
GuiNodeList[i]->render();
|
||||||
|
}
|
||||||
|
#ifdef _IRR_SCENEMANAGER_DEBUG
|
||||||
|
Parameters->setAttribute("drawn_gui_nodes", (s32) GuiNodeList.size());
|
||||||
|
#endif
|
||||||
|
GuiNodeList.set_used(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (LightManager)
|
if (LightManager)
|
||||||
LightManager->OnPostRender();
|
LightManager->OnPostRender();
|
||||||
|
|
||||||
|
@ -632,6 +632,7 @@ namespace scene
|
|||||||
core::array<DefaultNodeEntry> SolidNodeList;
|
core::array<DefaultNodeEntry> SolidNodeList;
|
||||||
core::array<TransparentNodeEntry> TransparentNodeList;
|
core::array<TransparentNodeEntry> TransparentNodeList;
|
||||||
core::array<TransparentNodeEntry> TransparentEffectNodeList;
|
core::array<TransparentNodeEntry> TransparentEffectNodeList;
|
||||||
|
core::array<ISceneNode*> GuiNodeList;
|
||||||
|
|
||||||
core::array<IMeshLoader*> MeshLoaderList;
|
core::array<IMeshLoader*> MeshLoaderList;
|
||||||
core::array<ISceneLoader*> SceneLoaderList;
|
core::array<ISceneLoader*> SceneLoaderList;
|
||||||
|
Loading…
Reference in New Issue
Block a user