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)
This commit is contained in:
BeaR 2012-08-13 12:57:40 +02:00
parent 322b57bd83
commit 3effd73596
3 changed files with 12 additions and 4 deletions

View file

@ -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;

View file

@ -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()

View file

@ -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);
}