DEADSOFTWARE

BlendMode.Filter is now a proper filter
authorfgsfds <pvt.fgsfds@gmail.com>
Wed, 19 Feb 2020 00:34:10 +0000 (03:34 +0300)
committerfgsfds <pvt.fgsfds@gmail.com>
Wed, 19 Feb 2020 00:34:10 +0000 (03:34 +0300)
src/engine/e_graphics.pas

index 4612a400e8a0055bfe3d7bf85e45e907a2bd942e..de31fa50ea46797507f03521c0fe58429658926a 100644 (file)
@@ -994,17 +994,12 @@ begin
   else
     glDisable(GL_BLEND);
 
-  if Blending = TBlending.Blend then
-    glBlendFunc(GL_SRC_ALPHA, GL_ONE)
-  else
-    if Blending = TBlending.Filter then
-      glBlendFunc(GL_DST_COLOR, GL_SRC_COLOR)
-    else
-      if Blending = TBlending.Invert then
-        glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ZERO)
-      else
-        if Alpha > 0 then
-          glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+  case Blending of
+    TBlending.None: if Alpha > 0 then glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+    TBlending.Blend: glBlendFunc(GL_SRC_ALPHA, GL_ONE);
+    TBlending.Invert: glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ZERO);
+    TBlending.Filter: glBlendFunc(GL_ZERO, GL_SRC_COLOR);
+  end;
 
   glDisable(GL_TEXTURE_2D);
   glColor4ub(Red, Green, Blue, 255-Alpha);
@@ -1020,7 +1015,6 @@ begin
   glEnd();
 
   glColor4ub(e_Colors.R, e_Colors.G, e_Colors.B, 255);
-
   glDisable(GL_BLEND);
 end;