mirror of
https://github.com/RetroDECK/Supermodel.git
synced 2024-11-26 07:35:40 +00:00
Scroll fog is like a clear colour for the render target, but can be semi transparent as the tilegen layer can be shown underneath. I assumed that transprent polys would be drawn to the render target for transparent polys but unfortunately the logic does not work. So where else could it be drawn? Well with limited memory it must be draw to the buffer for opaque polys, which means this render target is also blended.
This commit is contained in:
parent
392900fee2
commit
86d477263f
|
@ -227,9 +227,7 @@ void R3DFrameBuffers::AllocShaderBase()
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
vec4 colBase = texture(tex1, fsTexCoord);
|
fragColor = texture(tex1, fsTexCoord);
|
||||||
if(colBase.a < 1.0) discard;
|
|
||||||
fragColor = colBase;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
)glsl";
|
)glsl";
|
||||||
|
@ -302,7 +300,8 @@ void R3DFrameBuffers::Draw()
|
||||||
glViewport (0, 0, m_width, m_height); // cover the entire screen
|
glViewport (0, 0, m_width, m_height); // cover the entire screen
|
||||||
glDisable (GL_DEPTH_TEST); // disable depth testing / writing
|
glDisable (GL_DEPTH_TEST); // disable depth testing / writing
|
||||||
glDisable (GL_CULL_FACE);
|
glDisable (GL_CULL_FACE);
|
||||||
glDisable (GL_BLEND);
|
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
glEnable (GL_BLEND);
|
||||||
|
|
||||||
for (int i = 0; i < (int)std::size(m_texIDs); i++) { // bind our textures to correct texture units
|
for (int i = 0; i < (int)std::size(m_texIDs); i++) { // bind our textures to correct texture units
|
||||||
glActiveTexture(GL_TEXTURE0 + i);
|
glActiveTexture(GL_TEXTURE0 + i);
|
||||||
|
@ -313,10 +312,6 @@ void R3DFrameBuffers::Draw()
|
||||||
glBindVertexArray (m_vao);
|
glBindVertexArray (m_vao);
|
||||||
|
|
||||||
DrawBaseLayer ();
|
DrawBaseLayer ();
|
||||||
|
|
||||||
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
|
||||||
glEnable (GL_BLEND);
|
|
||||||
|
|
||||||
DrawAlphaLayer ();
|
DrawAlphaLayer ();
|
||||||
|
|
||||||
glDisable (GL_BLEND);
|
glDisable (GL_BLEND);
|
||||||
|
|
|
@ -48,16 +48,9 @@ void WriteOutputs(vec4 colour)
|
||||||
{
|
{
|
||||||
vec4 blank = vec4(0.0);
|
vec4 blank = vec4(0.0);
|
||||||
|
|
||||||
if(colour.a < 1.0) { // some transparency
|
out0 = colour;
|
||||||
out0 = blank;
|
out1 = blank;
|
||||||
out1 = colour;
|
out2 = blank;
|
||||||
out2 = blank;
|
|
||||||
}
|
|
||||||
else { // opaque
|
|
||||||
out0 = colour;
|
|
||||||
out1 = blank;
|
|
||||||
out2 = blank;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
|
@ -117,8 +110,6 @@ void R3DScrollFog::DrawScrollFog(float rgba[4], float attenuation, float ambient
|
||||||
// some ogl states
|
// some ogl states
|
||||||
glDepthMask (GL_FALSE); // disable z writes
|
glDepthMask (GL_FALSE); // disable z writes
|
||||||
glDisable (GL_DEPTH_TEST); // disable depth testing
|
glDisable (GL_DEPTH_TEST); // disable depth testing
|
||||||
glEnable (GL_BLEND);
|
|
||||||
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
|
||||||
|
|
||||||
glBindVertexArray (m_vao);
|
glBindVertexArray (m_vao);
|
||||||
glUseProgram (m_shaderProgram);
|
glUseProgram (m_shaderProgram);
|
||||||
|
|
Loading…
Reference in a new issue