Document RenderBin numbers in a common header to keep them organised

sceneinput
scrawl 9 years ago
parent d191a52847
commit 89d9323c2b

@ -23,6 +23,7 @@ add_openmw_dir (mwrender
actors objects renderingmanager animation rotatecontroller sky npcanimation vismask actors objects renderingmanager animation rotatecontroller sky npcanimation vismask
creatureanimation effectmanager util renderinginterface pathgrid rendermode weaponanimation creatureanimation effectmanager util renderinginterface pathgrid rendermode weaponanimation
bulletdebugdraw globalmap characterpreview camera localmap water terrainstorage ripplesimulation bulletdebugdraw globalmap characterpreview camera localmap water terrainstorage ripplesimulation
renderbin
) )
add_openmw_dir (mwinput add_openmw_dir (mwinput

@ -0,0 +1,20 @@
#ifndef OPENMW_MWRENDER_RENDERBIN_H
#define OPENMW_MWRENDER_RENDERBIN_H
namespace MWRender
{
/// Defines the render bin numbers used in the OpenMW scene graph. The bin with the lowest number is rendered first.
/// Beware of RenderBin nesting, in most cases you will want to use setNestRenderBins(false).
enum RenderBins
{
RenderBin_Sky = -1,
RenderBin_Default = 0,
RenderBin_Water = 9,
RenderBin_OcclusionQuery = 10,
RenderBin_SunGlare = 11
};
}
#endif

@ -41,6 +41,7 @@
#include "../mwworld/fallback.hpp" #include "../mwworld/fallback.hpp"
#include "vismask.hpp" #include "vismask.hpp"
#include "renderbin.hpp"
namespace namespace
{ {
@ -376,7 +377,7 @@ public:
osg::ref_ptr<osg::PositionAttitudeTransform> queryTransform (new osg::PositionAttitudeTransform); osg::ref_ptr<osg::PositionAttitudeTransform> queryTransform (new osg::PositionAttitudeTransform);
queryTransform->setScale(osg::Vec3f(0.5f, 0.5f, 0.5f)); queryTransform->setScale(osg::Vec3f(0.5f, 0.5f, 0.5f));
// Need to render after the world geometry so we can correctly test for occlusions // Need to render after the world geometry so we can correctly test for occlusions
queryTransform->getOrCreateStateSet()->setRenderBinDetails(10, "RenderBin"); queryTransform->getOrCreateStateSet()->setRenderBinDetails(RenderBin_OcclusionQuery, "RenderBin");
queryTransform->getOrCreateStateSet()->setNestRenderBins(false); queryTransform->getOrCreateStateSet()->setNestRenderBins(false);
mTransform->addChild(queryTransform); mTransform->addChild(queryTransform);
@ -680,7 +681,7 @@ SkyManager::SkyManager(osg::Group* parentNode, Resource::SceneManager* sceneMana
mRootNode = skyroot; mRootNode = skyroot;
// By default render before the world is rendered // By default render before the world is rendered
mRootNode->getOrCreateStateSet()->setRenderBinDetails(-1, "RenderBin"); mRootNode->getOrCreateStateSet()->setRenderBinDetails(RenderBin_Sky, "RenderBin");
} }
void SkyManager::create() void SkyManager::create()

@ -21,6 +21,7 @@
#include "vismask.hpp" #include "vismask.hpp"
#include "ripplesimulation.hpp" #include "ripplesimulation.hpp"
#include "renderbin.hpp"
namespace namespace
{ {
@ -86,7 +87,7 @@ namespace
depth->setWriteMask(false); depth->setWriteMask(false);
stateset->setAttributeAndModes(depth, osg::StateAttribute::ON); stateset->setAttributeAndModes(depth, osg::StateAttribute::ON);
stateset->setRenderBinDetails(9, "RenderBin"); stateset->setRenderBinDetails(MWRender::RenderBin_Water, "RenderBin");
std::vector<osg::ref_ptr<osg::Texture2D> > textures; std::vector<osg::ref_ptr<osg::Texture2D> > textures;
for (int i=0; i<32; ++i) for (int i=0; i<32; ++i)

Loading…
Cancel
Save