forked from mirror/openmw-tes3mp
update
This commit is contained in:
parent
8e683c2e05
commit
33c48b9481
7 changed files with 48 additions and 87 deletions
|
@ -229,7 +229,7 @@ void LocalMap::render(const float x, const float y,
|
|||
vp->setVisibilityMask(RV_Map);
|
||||
|
||||
// use fallback techniques without shadows and without mrt
|
||||
vp->setMaterialScheme("Fallback");
|
||||
vp->setMaterialScheme("simple");
|
||||
|
||||
rtt->update();
|
||||
|
||||
|
|
|
@ -336,7 +336,7 @@ void Water::applyRTT()
|
|||
vp->setBackgroundColour(ColourValue(0.8f, 0.9f, 1.0f));
|
||||
vp->setShadowsEnabled(false);
|
||||
// use fallback techniques without shadows and without mrt (currently not implemented for sky and terrain)
|
||||
//vp->setMaterialScheme("Fallback");
|
||||
vp->setMaterialScheme("simple");
|
||||
rtt->addListener(this);
|
||||
rtt->setActive(true);
|
||||
|
||||
|
|
|
@ -33,6 +33,8 @@
|
|||
#include <OgreSubMesh.h>
|
||||
#include <OgreRoot.h>
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include <extern/shiny/Main/Factory.hpp>
|
||||
|
||||
#include <components/settings/settings.hpp>
|
||||
|
@ -260,8 +262,8 @@ void NIFLoader::createMaterial(const String &name,
|
|||
NifOverrides::TransparencyResult result = NifOverrides::Overrides::getTransparencyOverride(texName);
|
||||
if (result.first)
|
||||
{
|
||||
instance->setProperty("alpha_rejection_func", sh::makeProperty<sh::StringValue>(new sh::StringValue("greater_equal")));
|
||||
instance->setProperty("alpha_rejection_value", sh::makeProperty<sh::IntValue>(new sh::IntValue(result.second)));
|
||||
instance->setProperty("alpha_rejection",
|
||||
sh::makeProperty<sh::StringValue>(new sh::StringValue("greater_equal " + boost::lexical_cast<std::string>(result.second))));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -272,81 +274,34 @@ void NIFLoader::createMaterial(const String &name,
|
|||
}
|
||||
else
|
||||
warn("Unhandled alpha setting for texture " + texName);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
if (!texName.empty())
|
||||
// As of yet UNTESTED code from Chris:
|
||||
/*pass->setTextureFiltering(Ogre::TFO_ANISOTROPIC);
|
||||
pass->setDepthFunction(Ogre::CMPF_LESS_EQUAL);
|
||||
pass->setDepthCheckEnabled(true);
|
||||
|
||||
// Add transparency if NiAlphaProperty was present
|
||||
if (alphaFlags != -1)
|
||||
{
|
||||
Pass *pass = material->getTechnique(0)->getPass(0);
|
||||
/*TextureUnitState *txt =*/
|
||||
/*
|
||||
pass->createTextureUnitState(texName);
|
||||
|
||||
pass->setVertexColourTracking(TVC_DIFFUSE);
|
||||
*/
|
||||
// As of yet UNTESTED code from Chris:
|
||||
/*pass->setTextureFiltering(Ogre::TFO_ANISOTROPIC);
|
||||
pass->setDepthFunction(Ogre::CMPF_LESS_EQUAL);
|
||||
pass->setDepthCheckEnabled(true);
|
||||
|
||||
// Add transparency if NiAlphaProperty was present
|
||||
if (alphaFlags != -1)
|
||||
std::cout << "Alpha flags set!" << endl;
|
||||
if ((alphaFlags&1))
|
||||
{
|
||||
std::cout << "Alpha flags set!" << endl;
|
||||
if ((alphaFlags&1))
|
||||
{
|
||||
pass->setDepthWriteEnabled(false);
|
||||
pass->setSceneBlending(getBlendFactor((alphaFlags>>1)&0xf),
|
||||
getBlendFactor((alphaFlags>>5)&0xf));
|
||||
}
|
||||
else
|
||||
pass->setDepthWriteEnabled(true);
|
||||
|
||||
if ((alphaFlags>>9)&1)
|
||||
pass->setAlphaRejectSettings(getTestMode((alphaFlags>>10)&0x7),
|
||||
alphaTest);
|
||||
|
||||
pass->setTransparentSortingEnabled(!((alphaFlags>>13)&1));
|
||||
pass->setDepthWriteEnabled(false);
|
||||
pass->setSceneBlending(getBlendFactor((alphaFlags>>1)&0xf),
|
||||
getBlendFactor((alphaFlags>>5)&0xf));
|
||||
}
|
||||
else
|
||||
pass->setDepthWriteEnabled(true); */
|
||||
pass->setDepthWriteEnabled(true);
|
||||
|
||||
/*
|
||||
// Add transparency if NiAlphaProperty was present
|
||||
if (alphaFlags != -1)
|
||||
{
|
||||
// The 237 alpha flags are by far the most common. Check
|
||||
// NiAlphaProperty in nif/property.h if you need to decode
|
||||
// other values. 237 basically means normal transparencly.
|
||||
if (alphaFlags == 237)
|
||||
{
|
||||
NifOverrides::TransparencyResult result = NifOverrides::Overrides::getTransparencyOverride(texName);
|
||||
if (result.first)
|
||||
{
|
||||
pass->setAlphaRejectFunction(CMPF_GREATER_EQUAL);
|
||||
pass->setAlphaRejectValue(result.second);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Enable transparency
|
||||
pass->setSceneBlending(SBT_TRANSPARENT_ALPHA);
|
||||
if ((alphaFlags>>9)&1)
|
||||
pass->setAlphaRejectSettings(getTestMode((alphaFlags>>10)&0x7),
|
||||
alphaTest);
|
||||
|
||||
//pass->setDepthCheckEnabled(false);
|
||||
pass->setDepthWriteEnabled(false);
|
||||
//std::cout << "alpha 237; material: " << name << " texName: " << texName << std::endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
warn("Unhandled alpha setting for texture " + texName);
|
||||
}
|
||||
else
|
||||
{
|
||||
material->getTechnique(0)->setShadowCasterMaterial("depth_shadow_caster_noalpha");
|
||||
}
|
||||
pass->setTransparentSortingEnabled(!((alphaFlags>>13)&1));
|
||||
}
|
||||
*/
|
||||
|
||||
else
|
||||
pass->setDepthWriteEnabled(true); */
|
||||
}
|
||||
|
||||
// Takes a name and adds a unique part to it. This is just used to
|
||||
|
|
2
extern/shiny
vendored
2
extern/shiny
vendored
|
@ -1 +1 @@
|
|||
Subproject commit 3a1b8e2aefa746ef0922e78f4be3ff736ce92fc3
|
||||
Subproject commit 8af2cce2db40aa67edcba78c534a268e595696c8
|
|
@ -52,7 +52,7 @@
|
|||
#endif
|
||||
|
||||
#if SH_GLSL == 1
|
||||
@shGlslVersion(130)
|
||||
@version 130
|
||||
|
||||
#define float2 vec2
|
||||
#define float3 vec3
|
||||
|
|
|
@ -7,30 +7,35 @@ material openmw_objects_base
|
|||
has_vertex_colour false
|
||||
diffuseMap black.png
|
||||
fog true
|
||||
mrt_output true
|
||||
lighting true
|
||||
|
||||
is_transparent false // real transparency, alpha rejection doesn't count here
|
||||
scene_blend default
|
||||
alpha_rejection_value default
|
||||
alpha_rejection_func default
|
||||
alpha_rejection default
|
||||
|
||||
pass
|
||||
{
|
||||
vertex_program openmw_objects_vertex
|
||||
fragment_program openmw_objects_fragment
|
||||
|
||||
shader_properties
|
||||
{
|
||||
fog $fog
|
||||
mrt_output $mrt_output
|
||||
lighting $lighting
|
||||
has_vertex_colour $has_vertex_colour
|
||||
is_transparent $is_transparent
|
||||
}
|
||||
|
||||
diffuse $diffuse
|
||||
specular $specular
|
||||
ambient $ambient
|
||||
emissive $emissive
|
||||
fog $fog
|
||||
scene_blend $scene_blend
|
||||
alpha_rejection $alpha_rejection
|
||||
|
||||
ffp_vertex_colour_ambient $has_vertex_colour
|
||||
has_vertex_colour $has_vertex_colour
|
||||
|
||||
is_transparent $is_transparent
|
||||
scene_blend $scene_blend
|
||||
alpha_rejection_value $alpha_rejection_value
|
||||
alpha_rejection_func $alpha_rejection_func
|
||||
|
||||
texture_unit diffuseMap
|
||||
{
|
||||
|
|
|
@ -2,13 +2,10 @@
|
|||
|
||||
|
||||
#define FOG @shPropertyBool(fog)
|
||||
#define MRT @shPropertyNotBool(is_transparent)
|
||||
#define MRT @shPropertyNotBool(is_transparent) && @shPropertyBool(mrt_output)
|
||||
#define LIGHTING @shPropertyBool(lighting)
|
||||
|
||||
#if MRT
|
||||
#define NEED_DEPTH
|
||||
#endif
|
||||
|
||||
#if FOG
|
||||
#if FOG || MRT
|
||||
#define NEED_DEPTH
|
||||
#endif
|
||||
|
||||
|
@ -48,7 +45,9 @@
|
|||
SH_BEGIN_PROGRAM
|
||||
shSampler2D(diffuseMap)
|
||||
shInput(float2, UV)
|
||||
#if MRT
|
||||
shDeclareMrtOutput(1)
|
||||
#endif
|
||||
shInput(float4, normalPassthrough)
|
||||
|
||||
#ifdef NEED_DEPTH
|
||||
|
@ -79,7 +78,9 @@
|
|||
shOutputColor(0).xyz = shLerp (shOutputColor(0).xyz, fogColor, fogValue);
|
||||
#endif
|
||||
|
||||
#if MRT
|
||||
shOutputColor(1) = float4(depthPassthrough / far,1,1,1);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue