Changeset View
Changeset View
Standalone View
Standalone View
source/renderer/TerrainRenderer.cpp
Show First 20 Lines • Show All 278 Lines • ▼ Show 20 Lines | #else | ||||
// Now apply lighting | // Now apply lighting | ||||
const CLightEnv& lightEnv = g_Renderer.GetLightEnv(); | const CLightEnv& lightEnv = g_Renderer.GetLightEnv(); | ||||
pglClientActiveTextureARB(GL_TEXTURE0); | pglClientActiveTextureARB(GL_TEXTURE0); | ||||
glEnableClientState(GL_COLOR_ARRAY); // diffuse lighting colors | glEnableClientState(GL_COLOR_ARRAY); // diffuse lighting colors | ||||
// The vertex color is scaled by 0.5 to permit overbrightness without clamping. | // The vertex color is scaled by 0.5 to permit overbrightness without clamping. | ||||
// We therefore need to draw clamp((texture*lighting)*2.0), where 'texture' | // We therefore need to draw Clamp((texture*lighting)*2.0), where 'texture' | ||||
Stan: Space between operators :P | |||||
// is what previous passes drew onto the framebuffer, and 'lighting' is the | // is what previous passes drew onto the framebuffer, and 'lighting' is the | ||||
// color computed by this pass. | // color computed by this pass. | ||||
// We can do that with blending by getting it to draw dst*src + src*dst: | // We can do that with blending by getting it to draw dst*src + src*dst: | ||||
glBlendFunc(GL_DST_COLOR, GL_SRC_COLOR); | glBlendFunc(GL_DST_COLOR, GL_SRC_COLOR); | ||||
// Scale the ambient color by 0.5 to match the vertex diffuse colors | // Scale the ambient color by 0.5 to match the vertex diffuse colors | ||||
float terrainAmbientColor[4] = { | float terrainAmbientColor[4] = { | ||||
lightEnv.m_TerrainAmbientColor.X * 0.5f, | lightEnv.m_TerrainAmbientColor.X * 0.5f, | ||||
▲ Show 20 Lines • Show All 321 Lines • ▼ Show 20 Lines | for (size_t i = 0; i < visiblePatches.size(); ++i) | ||||
ADDBOUND(v2, v1, v3, v4); | ADDBOUND(v2, v1, v3, v4); | ||||
ADDBOUND(v3, v1, v2, v4); | ADDBOUND(v3, v1, v2, v4); | ||||
ADDBOUND(v4, v1, v2, v3); | ADDBOUND(v4, v1, v2, v3); | ||||
#undef ADDBOUND | #undef ADDBOUND | ||||
if (screenBounds[0].X >= 1.0f || screenBounds[1].X <= -1.0f || screenBounds[0].Y >= 1.0f || screenBounds[1].Y <= -1.0f) | if (screenBounds[0].X >= 1.0f || screenBounds[1].X <= -1.0f || screenBounds[0].Y >= 1.0f || screenBounds[1].Y <= -1.0f) | ||||
continue; | continue; | ||||
scissor += screenBounds; | scissor += screenBounds; | ||||
} | } | ||||
return CBoundingBoxAligned(CVector3D(clamp(scissor[0].X, -1.0f, 1.0f), clamp(scissor[0].Y, -1.0f, 1.0f), -1.0f), | return CBoundingBoxAligned(CVector3D(Clamp(scissor[0].X, -1.0f, 1.0f), Clamp(scissor[0].Y, -1.0f, 1.0f), -1.0f), | ||||
CVector3D(clamp(scissor[1].X, -1.0f, 1.0f), clamp(scissor[1].Y, -1.0f, 1.0f), 1.0f)); | CVector3D(Clamp(scissor[1].X, -1.0f, 1.0f), Clamp(scissor[1].Y, -1.0f, 1.0f), 1.0f)); | ||||
} | } | ||||
// Render fancy water | // Render fancy water | ||||
bool TerrainRenderer::RenderFancyWater(const CShaderDefines& context, int cullGroup, ShadowMap* shadow) | bool TerrainRenderer::RenderFancyWater(const CShaderDefines& context, int cullGroup, ShadowMap* shadow) | ||||
{ | { | ||||
PROFILE3_GPU("fancy water"); | PROFILE3_GPU("fancy water"); | ||||
WaterManager* WaterMgr = g_Renderer.GetWaterManager(); | WaterManager* WaterMgr = g_Renderer.GetWaterManager(); | ||||
▲ Show 20 Lines • Show All 330 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
Space between operators :P