Changeset View
Changeset View
Standalone View
Standalone View
source/renderer/TerrainOverlay.cpp
Show First 20 Lines • Show All 118 Lines • ▼ Show 20 Lines | #else | ||||
// To ensure that outlines are drawn on top of the terrain correctly (and | // To ensure that outlines are drawn on top of the terrain correctly (and | ||||
// don't Z-fight and flicker nastily), draw them as QUADS with the LINE | // don't Z-fight and flicker nastily), draw them as QUADS with the LINE | ||||
// PolygonMode, and use PolygonOffset to pull them towards the camera. | // PolygonMode, and use PolygonOffset to pull them towards the camera. | ||||
// (See e.g. http://www.opengl.org/resources/faq/technical/polygonoffset.htm) | // (See e.g. http://www.opengl.org/resources/faq/technical/polygonoffset.htm) | ||||
glPolygonOffset(-1.f, -1.f); | glPolygonOffset(-1.f, -1.f); | ||||
//glEnable(GL_POLYGON_OFFSET_LINE); | //glEnable(GL_POLYGON_OFFSET_LINE); | ||||
glEnable(GL_POLYGON_OFFSET_FILL); | glEnable(GL_POLYGON_OFFSET_FILL); | ||||
pglActiveTextureARB(GL_TEXTURE0); | glActiveTextureARB(GL_TEXTURE0); | ||||
glDisable(GL_TEXTURE_2D); | glDisable(GL_TEXTURE_2D); | ||||
StartRender(); | StartRender(); | ||||
ssize_t min_i, min_j, max_i, max_j; | ssize_t min_i, min_j, max_i, max_j; | ||||
GetTileExtents(min_i, min_j, max_i, max_j); | GetTileExtents(min_i, min_j, max_i, max_j); | ||||
// Clamp the min to 0, but the max to -1 - so tile -1 can never be rendered, | // Clamp the min to 0, but the max to -1 - so tile -1 can never be rendered, | ||||
// but if unclamped_max<0 then no tiles at all will be rendered. And the same | // but if unclamped_max<0 then no tiles at all will be rendered. And the same | ||||
▲ Show 20 Lines • Show All 133 Lines • ▼ Show 20 Lines | |||||
void TerrainTextureOverlay::RenderAfterWater(int cullGroup) | void TerrainTextureOverlay::RenderAfterWater(int cullGroup) | ||||
{ | { | ||||
CTerrain* terrain = g_Game->GetWorld()->GetTerrain(); | CTerrain* terrain = g_Game->GetWorld()->GetTerrain(); | ||||
ssize_t w = (ssize_t)(terrain->GetTilesPerSide() * m_TexelsPerTile); | ssize_t w = (ssize_t)(terrain->GetTilesPerSide() * m_TexelsPerTile); | ||||
ssize_t h = (ssize_t)(terrain->GetTilesPerSide() * m_TexelsPerTile); | ssize_t h = (ssize_t)(terrain->GetTilesPerSide() * m_TexelsPerTile); | ||||
pglActiveTextureARB(GL_TEXTURE0); | glActiveTextureARB(GL_TEXTURE0); | ||||
// Recreate the texture with new size if necessary | // Recreate the texture with new size if necessary | ||||
if (round_up_to_pow2(w) != m_TextureW || round_up_to_pow2(h) != m_TextureH) | if (round_up_to_pow2(w) != m_TextureW || round_up_to_pow2(h) != m_TextureH) | ||||
{ | { | ||||
m_TextureW = round_up_to_pow2(w); | m_TextureW = round_up_to_pow2(w); | ||||
m_TextureH = round_up_to_pow2(h); | m_TextureH = round_up_to_pow2(h); | ||||
glBindTexture(GL_TEXTURE_2D, m_Texture); | glBindTexture(GL_TEXTURE_2D, m_Texture); | ||||
▲ Show 20 Lines • Show All 62 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator