Fix transparency sorting

actorid
scrawl 12 years ago
parent c9f7f1b994
commit 7f8d659f3c

@ -755,7 +755,8 @@ static Ogre::String getMaterial(const Nif::NiTriShape *shape, const Ogre::String
instance->setProperty("alpha_rejection", sh::makeProperty(new sh::StringValue(reject)));
}
instance->setProperty("transparent_sorting", sh::makeProperty(new sh::StringValue(!((alphaFlags>>13)&1) ? "on" : "off")));
// Ogre usually only sorts if depth write is disabled, so we want "force" instead of "on"
instance->setProperty("transparent_sorting", sh::makeProperty(new sh::StringValue(!((alphaFlags>>13)&1) ? "force" : "off")));
instance->setProperty("depth_check", sh::makeProperty(new sh::StringValue((depthFlags&1) ? "on" : "off")));
instance->setProperty("depth_write", sh::makeProperty(new sh::StringValue(((depthFlags>>1)&1) ? "on" : "off")));

@ -1,5 +1,7 @@
#include "OgreMaterialSerializer.hpp"
#include <OgrePass.h>
namespace sh
{
void OgreMaterialSerializer::reset()
@ -19,6 +21,13 @@ namespace sh
bool OgreMaterialSerializer::setPassProperty (const std::string& param, std::string value, Ogre::Pass* pass)
{
// workaround https://ogre3d.atlassian.net/browse/OGRE-158
if (param == "transparent_sorting" && value == "force")
{
pass->setTransparentSortingForced(true);
return true;
}
reset();
mScriptContext.section = Ogre::MSS_PASS;

@ -50,13 +50,6 @@ namespace sh
return true; // handled already
else if (name == "fragment_program")
return true; // handled already
else if (name == "ffp_vertex_colour_ambient")
{
bool enabled = retrieveValue<BooleanValue>(value, context).get();
// fixed-function vertex colour tracking
mPass->setVertexColourTracking(enabled ? Ogre::TVC_AMBIENT : Ogre::TVC_NONE);
return true;
}
else
{
OgreMaterialSerializer& s = OgrePlatform::getSerializer();

@ -11,6 +11,7 @@ material openmw_objects_base
scene_blend default
depth_write default
alpha_rejection default
transparent_sorting default
pass
{
@ -30,6 +31,7 @@ material openmw_objects_base
scene_blend $scene_blend
alpha_rejection $alpha_rejection
depth_write $depth_write
transparent_sorting $transparent_sorting
texture_unit diffuseMap
{

Loading…
Cancel
Save