diff --git a/changes.txt b/changes.txt index 543d2bde..4c2016bc 100644 --- a/changes.txt +++ b/changes.txt @@ -1,5 +1,6 @@ -------------------------- 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 - 10 year anniversary update - Lighting model reworked. moved to eyespace like openGL. [Specular Highlights, Fog, Sphere/Reflection Map] diff --git a/include/ISceneManager.h b/include/ISceneManager.h index 29b4b878..65e81c3d 100644 --- a/include/ISceneManager.h +++ b/include/ISceneManager.h @@ -52,7 +52,9 @@ namespace scene { //! Enumeration for render passes. /** 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 { //! No pass currently active @@ -92,7 +94,11 @@ namespace scene ESNRP_TRANSPARENT_EFFECT =32, //! 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; @@ -1122,6 +1128,8 @@ namespace scene \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 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 ) */ virtual u32 registerNodeForRendering(ISceneNode* node, E_SCENE_NODE_RENDER_PASS pass = ESNRP_AUTOMATIC) = 0; diff --git a/source/Irrlicht/CSceneManager.cpp b/source/Irrlicht/CSceneManager.cpp index 0d1f7c9d..e49e0a93 100644 --- a/source/Irrlicht/CSceneManager.cpp +++ b/source/Irrlicht/CSceneManager.cpp @@ -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_TRANSPARENT, L"transp.nodes", 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"); } ) @@ -1403,6 +1404,13 @@ u32 CSceneManager::registerNodeForRendering(ISceneNode* node, E_SCENE_NODE_RENDE } break; + case ESNRP_GUI: + if (!isCulled(node)) + { + GuiNodeList.push_back(node); + taken = 1; + } + case ESNRP_NONE: // ignore this one break; } @@ -1430,6 +1438,7 @@ void CSceneManager::clearAllRegisteredNodesForRendering() TransparentNodeList.clear(); TransparentEffectNodeList.clear(); ShadowNodeList.clear(); + GuiNodeList.clear(); } //! This method is called just before the rendering process of the whole scene. @@ -1711,6 +1720,36 @@ void CSceneManager::drawAll() 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; iOnNodePreRender(node); + node->render(); + LightManager->OnNodePostRender(node); + } + } + else + { + for (i=0; irender(); + } +#ifdef _IRR_SCENEMANAGER_DEBUG + Parameters->setAttribute("drawn_gui_nodes", (s32) GuiNodeList.size()); +#endif + GuiNodeList.set_used(0); + } + + if (LightManager) LightManager->OnPostRender(); diff --git a/source/Irrlicht/CSceneManager.h b/source/Irrlicht/CSceneManager.h index a83ab48b..7340c954 100644 --- a/source/Irrlicht/CSceneManager.h +++ b/source/Irrlicht/CSceneManager.h @@ -632,6 +632,7 @@ namespace scene core::array SolidNodeList; core::array TransparentNodeList; core::array TransparentEffectNodeList; + core::array GuiNodeList; core::array MeshLoaderList; core::array SceneLoaderList;