mirror of
https://github.com/OpenMW/openmw.git
synced 2025-04-01 22:36:39 +00:00
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);
|
vp->setVisibilityMask(RV_Map);
|
||||||
|
|
||||||
// use fallback techniques without shadows and without mrt
|
// use fallback techniques without shadows and without mrt
|
||||||
vp->setMaterialScheme("Fallback");
|
vp->setMaterialScheme("simple");
|
||||||
|
|
||||||
rtt->update();
|
rtt->update();
|
||||||
|
|
||||||
|
|
|
@ -336,7 +336,7 @@ void Water::applyRTT()
|
||||||
vp->setBackgroundColour(ColourValue(0.8f, 0.9f, 1.0f));
|
vp->setBackgroundColour(ColourValue(0.8f, 0.9f, 1.0f));
|
||||||
vp->setShadowsEnabled(false);
|
vp->setShadowsEnabled(false);
|
||||||
// use fallback techniques without shadows and without mrt (currently not implemented for sky and terrain)
|
// 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->addListener(this);
|
||||||
rtt->setActive(true);
|
rtt->setActive(true);
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,8 @@
|
||||||
#include <OgreSubMesh.h>
|
#include <OgreSubMesh.h>
|
||||||
#include <OgreRoot.h>
|
#include <OgreRoot.h>
|
||||||
|
|
||||||
|
#include <boost/lexical_cast.hpp>
|
||||||
|
|
||||||
#include <extern/shiny/Main/Factory.hpp>
|
#include <extern/shiny/Main/Factory.hpp>
|
||||||
|
|
||||||
#include <components/settings/settings.hpp>
|
#include <components/settings/settings.hpp>
|
||||||
|
@ -260,8 +262,8 @@ void NIFLoader::createMaterial(const String &name,
|
||||||
NifOverrides::TransparencyResult result = NifOverrides::Overrides::getTransparencyOverride(texName);
|
NifOverrides::TransparencyResult result = NifOverrides::Overrides::getTransparencyOverride(texName);
|
||||||
if (result.first)
|
if (result.first)
|
||||||
{
|
{
|
||||||
instance->setProperty("alpha_rejection_func", sh::makeProperty<sh::StringValue>(new sh::StringValue("greater_equal")));
|
instance->setProperty("alpha_rejection",
|
||||||
instance->setProperty("alpha_rejection_value", sh::makeProperty<sh::IntValue>(new sh::IntValue(result.second)));
|
sh::makeProperty<sh::StringValue>(new sh::StringValue("greater_equal " + boost::lexical_cast<std::string>(result.second))));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -272,81 +274,34 @@ void NIFLoader::createMaterial(const String &name,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
warn("Unhandled alpha setting for texture " + texName);
|
warn("Unhandled alpha setting for texture " + texName);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// As of yet UNTESTED code from Chris:
|
||||||
if (!texName.empty())
|
/*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);
|
std::cout << "Alpha flags set!" << endl;
|
||||||
/*TextureUnitState *txt =*/
|
if ((alphaFlags&1))
|
||||||
/*
|
|
||||||
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;
|
pass->setDepthWriteEnabled(false);
|
||||||
if ((alphaFlags&1))
|
pass->setSceneBlending(getBlendFactor((alphaFlags>>1)&0xf),
|
||||||
{
|
getBlendFactor((alphaFlags>>5)&0xf));
|
||||||
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));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
pass->setDepthWriteEnabled(true); */
|
pass->setDepthWriteEnabled(true);
|
||||||
|
|
||||||
/*
|
if ((alphaFlags>>9)&1)
|
||||||
// Add transparency if NiAlphaProperty was present
|
pass->setAlphaRejectSettings(getTestMode((alphaFlags>>10)&0x7),
|
||||||
if (alphaFlags != -1)
|
alphaTest);
|
||||||
{
|
|
||||||
// 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);
|
|
||||||
|
|
||||||
//pass->setDepthCheckEnabled(false);
|
pass->setTransparentSortingEnabled(!((alphaFlags>>13)&1));
|
||||||
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");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
*/
|
else
|
||||||
|
pass->setDepthWriteEnabled(true); */
|
||||||
}
|
}
|
||||||
|
|
||||||
// Takes a name and adds a unique part to it. This is just used to
|
// 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
|
#endif
|
||||||
|
|
||||||
#if SH_GLSL == 1
|
#if SH_GLSL == 1
|
||||||
@shGlslVersion(130)
|
@version 130
|
||||||
|
|
||||||
#define float2 vec2
|
#define float2 vec2
|
||||||
#define float3 vec3
|
#define float3 vec3
|
||||||
|
|
|
@ -7,30 +7,35 @@ material openmw_objects_base
|
||||||
has_vertex_colour false
|
has_vertex_colour false
|
||||||
diffuseMap black.png
|
diffuseMap black.png
|
||||||
fog true
|
fog true
|
||||||
|
mrt_output true
|
||||||
|
lighting true
|
||||||
|
|
||||||
is_transparent false // real transparency, alpha rejection doesn't count here
|
is_transparent false // real transparency, alpha rejection doesn't count here
|
||||||
scene_blend default
|
scene_blend default
|
||||||
alpha_rejection_value default
|
alpha_rejection default
|
||||||
alpha_rejection_func default
|
|
||||||
|
|
||||||
pass
|
pass
|
||||||
{
|
{
|
||||||
vertex_program openmw_objects_vertex
|
vertex_program openmw_objects_vertex
|
||||||
fragment_program openmw_objects_fragment
|
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
|
diffuse $diffuse
|
||||||
specular $specular
|
specular $specular
|
||||||
ambient $ambient
|
ambient $ambient
|
||||||
emissive $emissive
|
emissive $emissive
|
||||||
fog $fog
|
scene_blend $scene_blend
|
||||||
|
alpha_rejection $alpha_rejection
|
||||||
|
|
||||||
ffp_vertex_colour_ambient $has_vertex_colour
|
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
|
texture_unit diffuseMap
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,13 +2,10 @@
|
||||||
|
|
||||||
|
|
||||||
#define FOG @shPropertyBool(fog)
|
#define FOG @shPropertyBool(fog)
|
||||||
#define MRT @shPropertyNotBool(is_transparent)
|
#define MRT @shPropertyNotBool(is_transparent) && @shPropertyBool(mrt_output)
|
||||||
|
#define LIGHTING @shPropertyBool(lighting)
|
||||||
|
|
||||||
#if MRT
|
#if FOG || MRT
|
||||||
#define NEED_DEPTH
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if FOG
|
|
||||||
#define NEED_DEPTH
|
#define NEED_DEPTH
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -48,7 +45,9 @@
|
||||||
SH_BEGIN_PROGRAM
|
SH_BEGIN_PROGRAM
|
||||||
shSampler2D(diffuseMap)
|
shSampler2D(diffuseMap)
|
||||||
shInput(float2, UV)
|
shInput(float2, UV)
|
||||||
|
#if MRT
|
||||||
shDeclareMrtOutput(1)
|
shDeclareMrtOutput(1)
|
||||||
|
#endif
|
||||||
shInput(float4, normalPassthrough)
|
shInput(float4, normalPassthrough)
|
||||||
|
|
||||||
#ifdef NEED_DEPTH
|
#ifdef NEED_DEPTH
|
||||||
|
@ -79,7 +78,9 @@
|
||||||
shOutputColor(0).xyz = shLerp (shOutputColor(0).xyz, fogColor, fogValue);
|
shOutputColor(0).xyz = shLerp (shOutputColor(0).xyz, fogColor, fogValue);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if MRT
|
||||||
shOutputColor(1) = float4(depthPassthrough / far,1,1,1);
|
shOutputColor(1) = float4(depthPassthrough / far,1,1,1);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue