Changeset View
Changeset View
Standalone View
Standalone View
source/renderer/TerrainRenderer.cpp
Show First 20 Lines • Show All 750 Lines • ▼ Show 20 Lines | if (WaterMgr->m_WaterFancyEffects) | ||||
m->fancyWaterShader->BindTexture(str_waterEffectsTexOther, WaterMgr->m_FancyTextureOther); | m->fancyWaterShader->BindTexture(str_waterEffectsTexOther, WaterMgr->m_FancyTextureOther); | ||||
} | } | ||||
if (WaterMgr->m_WaterRealDepth) | if (WaterMgr->m_WaterRealDepth) | ||||
m->fancyWaterShader->BindTexture(str_depthTex, WaterMgr->m_depthTT); | m->fancyWaterShader->BindTexture(str_depthTex, WaterMgr->m_depthTT); | ||||
if (WaterMgr->m_WaterRefraction) | if (WaterMgr->m_WaterRefraction) | ||||
m->fancyWaterShader->BindTexture(str_refractionMap, WaterMgr->m_RefractionTexture); | m->fancyWaterShader->BindTexture(str_refractionMap, WaterMgr->m_RefractionTexture); | ||||
if (WaterMgr->m_WaterReflection) | |||||
m->fancyWaterShader->BindTexture(str_reflectionMap, WaterMgr->m_ReflectionTexture); | m->fancyWaterShader->BindTexture(str_reflectionMap, WaterMgr->m_ReflectionTexture); | ||||
m->fancyWaterShader->BindTexture(str_losMap, losTexture.GetTextureSmooth()); | m->fancyWaterShader->BindTexture(str_losMap, losTexture.GetTextureSmooth()); | ||||
const CLightEnv& lightEnv = g_Renderer.GetLightEnv(); | const CLightEnv& lightEnv = g_Renderer.GetLightEnv(); | ||||
m->fancyWaterShader->Uniform(str_transform, g_Renderer.GetViewCamera().GetViewProjection()); | m->fancyWaterShader->Uniform(str_transform, g_Renderer.GetViewCamera().GetViewProjection()); | ||||
//TODO: bind only what's needed | //TODO: bind only what's needed | ||||
if (WaterMgr->m_WaterRefraction || WaterMgr->m_WaterReflection) | if (WaterMgr->m_WaterRefraction || WaterMgr->m_WaterReflection) | ||||
{ | { | ||||
m->fancyWaterShader->BindTexture(str_skyCube, g_Renderer.GetSkyManager()->GetSkyCube()); | m->fancyWaterShader->BindTexture(str_skyCube, g_Renderer.GetSkyManager()->GetSkyCube()); | ||||
// TODO: check that this rotates in the right direction. | // TODO: check that this rotates in the right direction. | ||||
CMatrix3D skyBoxRotation; | CMatrix3D skyBoxRotation; | ||||
skyBoxRotation.SetIdentity(); | skyBoxRotation.SetIdentity(); | ||||
skyBoxRotation.RotateY(M_PI + lightEnv.GetRotation()); | skyBoxRotation.RotateY(M_PI + lightEnv.GetRotation()); | ||||
m->fancyWaterShader->Uniform(str_skyBoxRot, skyBoxRotation); | m->fancyWaterShader->Uniform(str_skyBoxRot, skyBoxRotation); | ||||
if (WaterMgr->m_WaterRefraction) | |||||
m->fancyWaterShader->Uniform(str_refractionMatrix, WaterMgr->m_RefractionMatrix); | |||||
if (WaterMgr->m_WaterReflection) | |||||
m->fancyWaterShader->Uniform(str_reflectionMatrix, WaterMgr->m_ReflectionMatrix); | |||||
} | } | ||||
m->fancyWaterShader->Uniform(str_sunDir, lightEnv.GetSunDir()); | m->fancyWaterShader->Uniform(str_sunDir, lightEnv.GetSunDir()); | ||||
m->fancyWaterShader->Uniform(str_sunColor, lightEnv.m_SunColor); | m->fancyWaterShader->Uniform(str_sunColor, lightEnv.m_SunColor); | ||||
m->fancyWaterShader->Uniform(str_color, WaterMgr->m_WaterColor); | m->fancyWaterShader->Uniform(str_color, WaterMgr->m_WaterColor); | ||||
m->fancyWaterShader->Uniform(str_tint, WaterMgr->m_WaterTint); | m->fancyWaterShader->Uniform(str_tint, WaterMgr->m_WaterTint); | ||||
m->fancyWaterShader->Uniform(str_waviness, WaterMgr->m_Waviness); | m->fancyWaterShader->Uniform(str_waviness, WaterMgr->m_Waviness); | ||||
m->fancyWaterShader->Uniform(str_murkiness, WaterMgr->m_Murkiness); | m->fancyWaterShader->Uniform(str_murkiness, WaterMgr->m_Murkiness); | ||||
m->fancyWaterShader->Uniform(str_windAngle, WaterMgr->m_WindAngle); | m->fancyWaterShader->Uniform(str_windAngle, WaterMgr->m_WindAngle); | ||||
m->fancyWaterShader->Uniform(str_repeatScale, 1.0f / repeatPeriod); | m->fancyWaterShader->Uniform(str_repeatScale, 1.0f / repeatPeriod); | ||||
m->fancyWaterShader->Uniform(str_reflectionMatrix, WaterMgr->m_ReflectionMatrix); | |||||
m->fancyWaterShader->Uniform(str_refractionMatrix, WaterMgr->m_RefractionMatrix); | |||||
m->fancyWaterShader->Uniform(str_losMatrix, losTexture.GetTextureMatrix()); | m->fancyWaterShader->Uniform(str_losMatrix, losTexture.GetTextureMatrix()); | ||||
m->fancyWaterShader->Uniform(str_cameraPos, camPos); | m->fancyWaterShader->Uniform(str_cameraPos, camPos); | ||||
m->fancyWaterShader->Uniform(str_fogColor, lightEnv.m_FogColor); | m->fancyWaterShader->Uniform(str_fogColor, lightEnv.m_FogColor); | ||||
m->fancyWaterShader->Uniform(str_fogParams, lightEnv.m_FogFactor, lightEnv.m_FogMax, 0.f, 0.f); | m->fancyWaterShader->Uniform(str_fogParams, lightEnv.m_FogFactor, lightEnv.m_FogMax, 0.f, 0.f); | ||||
m->fancyWaterShader->Uniform(str_time, (float)time); | m->fancyWaterShader->Uniform(str_time, (float)time); | ||||
m->fancyWaterShader->Uniform(str_screenSize, (float)g_Renderer.GetWidth(), (float)g_Renderer.GetHeight(), 0.0f, 0.0f); | m->fancyWaterShader->Uniform(str_screenSize, (float)g_Renderer.GetWidth(), (float)g_Renderer.GetHeight(), 0.0f, 0.0f); | ||||
if (WaterMgr->m_WaterType == L"clap") | if (WaterMgr->m_WaterType == L"clap") | ||||
▲ Show 20 Lines • Show All 169 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator