From 3effd73596fb8c804d0e5dafbd95d1d1b62e5cf4 Mon Sep 17 00:00:00 2001 From: BeaR Date: Mon, 13 Aug 2012 12:57:40 +0200 Subject: [PATCH] Fix Renderingbug: If u change the alpha value inside a colorenvelope, the tileset-/quad-rendering is messed sometimes http://i.solidfiles.net/580a9699c4.png(map: run_exchange by delo) --- src/game/client/render_map.cpp | 5 +++-- src/game/editor/layer_quads.cpp | 5 ++++- src/game/editor/layer_tiles.cpp | 6 +++++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/game/client/render_map.cpp b/src/game/client/render_map.cpp index 23fa42e02..3b409fb89 100644 --- a/src/game/client/render_map.cpp +++ b/src/game/client/render_map.cpp @@ -99,9 +99,10 @@ void CRenderTools::RenderQuads(CQuad *pQuads, int NumQuads, int RenderFlags, ENV } bool Opaque = false; + /* TODO: Analyze quadtexture if(a < 0.01f || (q->m_aColors[0].a < 0.01f && q->m_aColors[1].a < 0.01f && q->m_aColors[2].a < 0.01f && q->m_aColors[3].a < 0.01f)) Opaque = true; - + */ if(Opaque && !(RenderFlags&LAYERRENDERFLAG_OPAQUE)) continue; if(!Opaque && !(RenderFlags&LAYERRENDERFLAG_TRANSPARENT)) @@ -236,7 +237,7 @@ void CRenderTools::RenderTilemap(CTile *pTiles, int w, int h, float Scale, vec4 unsigned char Flags = pTiles[c].m_Flags; bool Render = false; - if(Flags&TILEFLAG_OPAQUE) + if(Flags&TILEFLAG_OPAQUE && Color.a*a > 250/255.0f) { if(RenderFlags&LAYERRENDERFLAG_OPAQUE) Render = true; diff --git a/src/game/editor/layer_quads.cpp b/src/game/editor/layer_quads.cpp index 2551a824b..b033aa1d3 100644 --- a/src/game/editor/layer_quads.cpp +++ b/src/game/editor/layer_quads.cpp @@ -27,7 +27,10 @@ void CLayerQuads::Render() if(m_Image >= 0 && m_Image < m_pEditor->m_Map.m_lImages.size()) Graphics()->TextureSet(m_pEditor->m_Map.m_lImages[m_Image]->m_Texture); - m_pEditor->RenderTools()->RenderQuads(m_lQuads.base_ptr(), m_lQuads.size(), LAYERRENDERFLAG_OPAQUE|LAYERRENDERFLAG_TRANSPARENT, m_pEditor->EnvelopeEval, m_pEditor); + Graphics()->BlendNone(); + m_pEditor->RenderTools()->RenderQuads(m_lQuads.base_ptr(), m_lQuads.size(), LAYERRENDERFLAG_OPAQUE, m_pEditor->EnvelopeEval, m_pEditor); + Graphics()->BlendNormal(); + m_pEditor->RenderTools()->RenderQuads(m_lQuads.base_ptr(), m_lQuads.size(), LAYERRENDERFLAG_TRANSPARENT, m_pEditor->EnvelopeEval, m_pEditor); } CQuad *CLayerQuads::NewQuad() diff --git a/src/game/editor/layer_tiles.cpp b/src/game/editor/layer_tiles.cpp index 12cd7b1d7..309774bdb 100644 --- a/src/game/editor/layer_tiles.cpp +++ b/src/game/editor/layer_tiles.cpp @@ -63,7 +63,11 @@ void CLayerTiles::Render() m_Texture = m_pEditor->m_Map.m_lImages[m_Image]->m_Texture; Graphics()->TextureSet(m_Texture); vec4 Color = vec4(m_Color.r/255.0f, m_Color.g/255.0f, m_Color.b/255.0f, m_Color.a/255.0f); - m_pEditor->RenderTools()->RenderTilemap(m_pTiles, m_Width, m_Height, 32.0f, Color, LAYERRENDERFLAG_OPAQUE|LAYERRENDERFLAG_TRANSPARENT, + Graphics()->BlendNone(); + m_pEditor->RenderTools()->RenderTilemap(m_pTiles, m_Width, m_Height, 32.0f, Color, LAYERRENDERFLAG_OPAQUE, + m_pEditor->EnvelopeEval, m_pEditor, m_ColorEnv, m_ColorEnvOffset); + Graphics()->BlendNormal(); + m_pEditor->RenderTools()->RenderTilemap(m_pTiles, m_Width, m_Height, 32.0f, Color, LAYERRENDERFLAG_TRANSPARENT, m_pEditor->EnvelopeEval, m_pEditor, m_ColorEnv, m_ColorEnvOffset); }