Use the mooncircle textures (Fixes #1624, Fixes #1743)

openmw-35
scrawl 10 years ago
parent e0d0997409
commit 417f60f467

@ -187,6 +187,8 @@ Moon::Moon( const String& textureName,
{ {
setVisibility(1.0); setVisibility(1.0);
mMaterial->setProperty("alphatexture", sh::makeProperty(new sh::StringValue(textureName + "_alpha")));
mPhase = Moon::Phase_Full; mPhase = Moon::Phase_Full;
} }
@ -215,9 +217,15 @@ void Moon::setPhase(const Moon::Phase& phase)
textureName += ".dds"; textureName += ".dds";
if (mType == Moon::Type_Secunda) if (mType == Moon::Type_Secunda)
{
sh::Factory::getInstance ().setTextureAlias ("secunda_texture", textureName); sh::Factory::getInstance ().setTextureAlias ("secunda_texture", textureName);
sh::Factory::getInstance ().setTextureAlias ("secunda_texture_alpha", "textures\\tx_mooncircle_full_s.dds");
}
else else
{
sh::Factory::getInstance ().setTextureAlias ("masser_texture", textureName); sh::Factory::getInstance ().setTextureAlias ("masser_texture", textureName);
sh::Factory::getInstance ().setTextureAlias ("masser_texture_alpha", "textures\\tx_mooncircle_full_m.dds");
}
mPhase = phase; mPhase = phase;
} }

@ -38,16 +38,14 @@ shUniform(float4x4, projection) @shAutoConstant(projection, projection_matrix)
SH_START_PROGRAM SH_START_PROGRAM
{ {
float4 phaseTex = shSample(diffuseMap, UV);
float4 tex = shSample(diffuseMap, UV); float4 fullCircleTex = shSample(alphaMap, UV);
shOutputColour(0) = float4(materialEmissive.xyz, 1) * tex; shOutputColour(0).a = max(phaseTex.a, fullCircleTex.a) * materialDiffuse.a;
shOutputColour(0).a = shSample(alphaMap, UV).a * materialDiffuse.a;
shOutputColour(0).rgb += (1.0-tex.a) * shOutputColour(0).a * atmosphereColour.rgb; //fill dark side of moon with atmosphereColour
shOutputColour(0).rgb += (1.0-materialDiffuse.a) * atmosphereColour.rgb; //fade bump
shOutputColour(0).xyz = fullCircleTex.xyz * atmosphereColour.xyz;
shOutputColour(0).xyz = shLerp(shOutputColour(0).xyz, phaseTex.xyz, phaseTex.a);
shOutputColour(0).xyz *= materialEmissive.xyz;
} }
#endif #endif

@ -50,7 +50,7 @@ material openmw_moon
texture_unit alphaMap texture_unit alphaMap
{ {
direct_texture textures\tx_secunda_full.dds texture_alias $alphatexture
} }
} }
} }

Loading…
Cancel
Save