1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-03-03 15:09:39 +00:00

optimise chunk drawing order (#3116)

* material.cpp

* material.cpp
This commit is contained in:
Bo Svensson 2021-09-21 20:41:07 +00:00 committed by GitHub
parent b22fb7a7bf
commit d38c8c6dcb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -199,7 +199,6 @@ namespace Terrain
std::vector<osg::ref_ptr<osg::StateSet> > passes; std::vector<osg::ref_ptr<osg::StateSet> > passes;
unsigned int blendmapIndex = 0; unsigned int blendmapIndex = 0;
unsigned int passIndex = 0;
for (std::vector<TextureLayer>::const_iterator it = layers.begin(); it != layers.end(); ++it) for (std::vector<TextureLayer>::const_iterator it = layers.begin(); it != layers.end(); ++it)
{ {
bool firstLayer = (it == layers.begin()); bool firstLayer = (it == layers.begin());
@ -209,7 +208,7 @@ namespace Terrain
if (!blendmaps.empty()) if (!blendmaps.empty())
{ {
stateset->setMode(GL_BLEND, osg::StateAttribute::ON); stateset->setMode(GL_BLEND, osg::StateAttribute::ON);
stateset->setRenderBinDetails(passIndex++, "RenderBin"); stateset->setRenderBinDetails(firstLayer ? 0 : 1, "RenderBin");
if (!firstLayer) if (!firstLayer)
{ {
stateset->setAttributeAndModes(BlendFunc::value(), osg::StateAttribute::ON); stateset->setAttributeAndModes(BlendFunc::value(), osg::StateAttribute::ON);