mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-03 22:45:35 +00:00
allow setting the clouds opacity
This commit is contained in:
parent
c1fb5ce769
commit
b2de9e8f45
3 changed files with 12 additions and 2 deletions
|
@ -368,17 +368,19 @@ SkyManager::SkyManager (SceneNode* pMwRoot, Camera* pCamera)
|
||||||
" in float4 color : TEXCOORD1, \n"
|
" in float4 color : TEXCOORD1, \n"
|
||||||
" uniform sampler2D texture : TEXUNIT0, \n"
|
" uniform sampler2D texture : TEXUNIT0, \n"
|
||||||
" uniform float time, \n"
|
" uniform float time, \n"
|
||||||
|
" uniform float opacity, \n"
|
||||||
" uniform float4 emissive \n"
|
" uniform float4 emissive \n"
|
||||||
") \n"
|
") \n"
|
||||||
"{ \n"
|
"{ \n"
|
||||||
" uv += float2(1,1) * time * "<<CLOUD_SPEED<<"; \n" // Scroll in x,y direction
|
" uv += float2(1,1) * time * "<<CLOUD_SPEED<<"; \n" // Scroll in x,y direction
|
||||||
" float4 tex = tex2D(texture, uv); \n"
|
" float4 tex = tex2D(texture, uv); \n"
|
||||||
" oColor = color * float4(emissive.xyz,1) * tex2D(texture, uv); \n"
|
" oColor = color * float4(emissive.xyz,1) * tex2D(texture, uv) * float4(1,1,1,opacity); \n"
|
||||||
"}";
|
"}";
|
||||||
mCloudFragmentShader->setSource(outStream2.str());
|
mCloudFragmentShader->setSource(outStream2.str());
|
||||||
mCloudFragmentShader->load();
|
mCloudFragmentShader->load();
|
||||||
mCloudFragmentShader->getDefaultParameters()->setNamedAutoConstant("emissive", GpuProgramParameters::ACT_SURFACE_EMISSIVE_COLOUR);
|
mCloudFragmentShader->getDefaultParameters()->setNamedAutoConstant("emissive", GpuProgramParameters::ACT_SURFACE_EMISSIVE_COLOUR);
|
||||||
mCloudMaterial->getTechnique(0)->getPass(0)->setFragmentProgram(mCloudFragmentShader->getName());
|
mCloudMaterial->getTechnique(0)->getPass(0)->setFragmentProgram(mCloudFragmentShader->getName());
|
||||||
|
setCloudsOpacity(0.75);
|
||||||
|
|
||||||
ModVertexAlpha(clouds_ent, 1);
|
ModVertexAlpha(clouds_ent, 1);
|
||||||
|
|
||||||
|
@ -438,3 +440,8 @@ void SkyManager::setMoonColour (bool red)
|
||||||
mSecunda->setColour( red ? ColourValue(1.0, 0.0, 0.0)
|
mSecunda->setColour( red ? ColourValue(1.0, 0.0, 0.0)
|
||||||
: ColourValue(1.0, 1.0, 1.0));
|
: ColourValue(1.0, 1.0, 1.0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SkyManager::setCloudsOpacity(float opacity)
|
||||||
|
{
|
||||||
|
mCloudMaterial->getTechnique(0)->getPass(0)->getFragmentProgramParameters()->setNamedConstant("opacity", Real(opacity));
|
||||||
|
}
|
||||||
|
|
|
@ -120,6 +120,9 @@ namespace MWRender
|
||||||
void setMoonColour (bool red);
|
void setMoonColour (bool red);
|
||||||
///< change Secunda colour to red
|
///< change Secunda colour to red
|
||||||
|
|
||||||
|
void setCloudsOpacity(float opacity);
|
||||||
|
///< change opacity of the clouds
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CelestialBody* mSun;
|
CelestialBody* mSun;
|
||||||
Moon* mMasser;
|
Moon* mMasser;
|
||||||
|
|
|
@ -157,7 +157,7 @@ namespace MWWorld
|
||||||
|
|
||||||
mRendering = new MWRender::RenderingManager(renderer, resDir, mPhysEngine, environment);
|
mRendering = new MWRender::RenderingManager(renderer, resDir, mPhysEngine, environment);
|
||||||
|
|
||||||
mWeatherManager = new MWWorld::WeatherManager();
|
mWeatherManager = new MWWorld::WeatherManager(mRendering);
|
||||||
|
|
||||||
boost::filesystem::path masterPath (fileCollections.getCollection (".esm").getPath (master));
|
boost::filesystem::path masterPath (fileCollections.getCollection (".esm").getPath (master));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue