Changeset View
Changeset View
Standalone View
Standalone View
source/graphics/MiniMapTexture.cpp
Show First 20 Lines • Show All 231 Lines • ▼ Show 20 Lines | void CMiniMapTexture::CreateTextures(const CTerrain* terrain) | ||||
g_Renderer.BindTexture(0, m_FinalTexture); | g_Renderer.BindTexture(0, m_FinalTexture); | ||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, FINAL_TEXTURE_SIZE, FINAL_TEXTURE_SIZE, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); | glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, FINAL_TEXTURE_SIZE, FINAL_TEXTURE_SIZE, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); | ||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | ||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); | ||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); | ||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); | ||||
pglGenFramebuffersEXT(1, &m_FinalTextureFBO); | glGenFramebuffersEXT(1, &m_FinalTextureFBO); | ||||
pglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_FinalTextureFBO); | glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_FinalTextureFBO); | ||||
pglFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, m_FinalTexture, 0); | glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, m_FinalTexture, 0); | ||||
GLenum status = pglCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); | GLenum status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); | ||||
if (status != GL_FRAMEBUFFER_COMPLETE_EXT) | if (status != GL_FRAMEBUFFER_COMPLETE_EXT) | ||||
{ | { | ||||
LOGWARNING("MiniMapTexture Framebuffer object incomplete (A): 0x%04X", status); | LOGWARNING("MiniMapTexture Framebuffer object incomplete (A): 0x%04X", status); | ||||
} | } | ||||
pglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); | glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); | ||||
} | } | ||||
void CMiniMapTexture::DestroyTextures() | void CMiniMapTexture::DestroyTextures() | ||||
{ | { | ||||
if (m_TerrainTexture) | if (m_TerrainTexture) | ||||
{ | { | ||||
glDeleteTextures(1, &m_TerrainTexture); | glDeleteTextures(1, &m_TerrainTexture); | ||||
m_TerrainTexture = 0; | m_TerrainTexture = 0; | ||||
▲ Show 20 Lines • Show All 81 Lines • ▼ Show 20 Lines | void CMiniMapTexture::RenderFinalTexture() | ||||
const double currentTime = timer_Time(); | const double currentTime = timer_Time(); | ||||
const bool doUpdate = (currentTime - m_LastFinalTextureUpdate > 0.5) || m_FinalTextureDirty; | const bool doUpdate = (currentTime - m_LastFinalTextureUpdate > 0.5) || m_FinalTextureDirty; | ||||
if (doUpdate) | if (doUpdate) | ||||
m_LastFinalTextureUpdate = currentTime; | m_LastFinalTextureUpdate = currentTime; | ||||
else | else | ||||
return; | return; | ||||
m_FinalTextureDirty = false; | m_FinalTextureDirty = false; | ||||
pglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_FinalTextureFBO); | glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_FinalTextureFBO); | ||||
const SViewPort oldViewPort = g_Renderer.GetViewport(); | const SViewPort oldViewPort = g_Renderer.GetViewport(); | ||||
const SViewPort viewPort = { 0, 0, FINAL_TEXTURE_SIZE, FINAL_TEXTURE_SIZE }; | const SViewPort viewPort = { 0, 0, FINAL_TEXTURE_SIZE, FINAL_TEXTURE_SIZE }; | ||||
g_Renderer.SetViewport(viewPort); | g_Renderer.SetViewport(viewPort); | ||||
CmpPtr<ICmpRangeManager> cmpRangeManager(m_Simulation, SYSTEM_ENTITY); | CmpPtr<ICmpRangeManager> cmpRangeManager(m_Simulation, SYSTEM_ENTITY); | ||||
ENSURE(cmpRangeManager); | ENSURE(cmpRangeManager); | ||||
CLOSTexture& losTexture = g_Game->GetView()->GetLOSTexture(); | CLOSTexture& losTexture = g_Game->GetView()->GetLOSTexture(); | ||||
▲ Show 20 Lines • Show All 159 Lines • ▼ Show 20 Lines | |||||
#if !CONFIG2_GLES | #if !CONFIG2_GLES | ||||
glDisable(GL_VERTEX_PROGRAM_POINT_SIZE); | glDisable(GL_VERTEX_PROGRAM_POINT_SIZE); | ||||
#endif | #endif | ||||
glDisable(GL_SCISSOR_TEST); | glDisable(GL_SCISSOR_TEST); | ||||
} | } | ||||
tech->EndPass(); | tech->EndPass(); | ||||
pglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); | glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); | ||||
g_Renderer.SetViewport(oldViewPort); | g_Renderer.SetViewport(oldViewPort); | ||||
} | } | ||||
// static | // static | ||||
float CMiniMapTexture::GetShallowPassageHeight() | float CMiniMapTexture::GetShallowPassageHeight() | ||||
{ | { | ||||
float shallowPassageHeight = 0.0f; | float shallowPassageHeight = 0.0f; | ||||
CParamNode externalParamNode; | CParamNode externalParamNode; | ||||
CParamNode::LoadXML(externalParamNode, L"simulation/data/pathfinder.xml", "pathfinder"); | CParamNode::LoadXML(externalParamNode, L"simulation/data/pathfinder.xml", "pathfinder"); | ||||
const CParamNode pathingSettings = externalParamNode.GetChild("Pathfinder").GetChild("PassabilityClasses"); | const CParamNode pathingSettings = externalParamNode.GetChild("Pathfinder").GetChild("PassabilityClasses"); | ||||
if (pathingSettings.GetChild("default").IsOk() && pathingSettings.GetChild("default").GetChild("MaxWaterDepth").IsOk()) | if (pathingSettings.GetChild("default").IsOk() && pathingSettings.GetChild("default").GetChild("MaxWaterDepth").IsOk()) | ||||
shallowPassageHeight = pathingSettings.GetChild("default").GetChild("MaxWaterDepth").ToFloat(); | shallowPassageHeight = pathingSettings.GetChild("default").GetChild("MaxWaterDepth").ToFloat(); | ||||
return shallowPassageHeight; | return shallowPassageHeight; | ||||
} | } |
Wildfire Games · Phabricator