forked from mirror/openmw-tes3mp
more accurate fog, TODO: apply this to the terrain
This commit is contained in:
parent
dbf7547003
commit
96c37d3e7c
2 changed files with 7 additions and 2 deletions
|
@ -334,8 +334,11 @@ WeatherManager::WeatherManager(MWRender::RenderingManager* rendering, MWWorld::E
|
|||
|
||||
void WeatherManager::setWeather(const String& weather, bool instant)
|
||||
{
|
||||
if (weather == mCurrentWeather && mNextWeather == "")
|
||||
if (weather == mCurrentWeather && mNextWeather == "")
|
||||
{
|
||||
mFirstUpdate = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (instant || mFirstUpdate)
|
||||
{
|
||||
|
|
|
@ -328,6 +328,7 @@ void NIFLoader::createMaterial(const String &name,
|
|||
" out float4 oNormal : TEXCOORD2, \n"
|
||||
" out float oDepth : TEXCOORD3, \n"
|
||||
" out float4 oVertexColour : TEXCOORD4, \n"
|
||||
" uniform float4 cameraPosObjSpace, \n"
|
||||
" uniform float4x4 worldViewProj \n"
|
||||
") \n"
|
||||
"{ \n"
|
||||
|
@ -335,12 +336,13 @@ void NIFLoader::createMaterial(const String &name,
|
|||
" oUV = uv; \n"
|
||||
" oNormal = normal; \n"
|
||||
" oPosition = mul( worldViewProj, position ); \n"
|
||||
" oDepth = oPosition.z; \n"
|
||||
" oDepth = length(position.xyz - cameraPosObjSpace.xyz); \n"
|
||||
" oPositionObjSpace = position; \n"
|
||||
"}";
|
||||
vertex->setSource(outStream.str());
|
||||
vertex->load();
|
||||
vertex->getDefaultParameters()->setNamedAutoConstant("worldViewProj", GpuProgramParameters::ACT_WORLDVIEWPROJ_MATRIX);
|
||||
vertex->getDefaultParameters()->setNamedAutoConstant("cameraPosObjSpace", GpuProgramParameters::ACT_CAMERA_POSITION_OBJECT_SPACE);
|
||||
}
|
||||
else
|
||||
vertex = mgr.getByName("main_vp");
|
||||
|
|
Loading…
Reference in a new issue