From 7477cda527451c3d6629c76d4cd364d69eda7716 Mon Sep 17 00:00:00 2001 From: Noel Berry Date: Sat, 12 Feb 2022 23:15:04 -0800 Subject: [PATCH] added default Additive BlendMode --- include/blah/drawing/batch.h | 2 +- include/blah/graphics.h | 3 +-- src/graphics.cpp | 12 ++++++++++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/include/blah/drawing/batch.h b/include/blah/drawing/batch.h index 800acd7..fe94584 100644 --- a/include/blah/drawing/batch.h +++ b/include/blah/drawing/batch.h @@ -16,7 +16,7 @@ namespace Blah Normal, // Ignores the texture color but still uses transparency, essentially - // drawing the "shape" of the texture a solid color + // drawing the "shape" of the texture as a solid color Wash }; diff --git a/include/blah/graphics.h b/include/blah/graphics.h index 398fb26..d38b6dd 100644 --- a/include/blah/graphics.h +++ b/include/blah/graphics.h @@ -115,9 +115,8 @@ namespace Blah { // Normal, pre-multiplied, Blend Mode static const BlendMode Normal; - - // Subtractive Blend Mode static const BlendMode Subtract; + static const BlendMode Additive; BlendOp color_op; BlendFactor color_src; diff --git a/src/graphics.cpp b/src/graphics.cpp index 803d449..5f3b543 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -25,6 +25,18 @@ const BlendMode BlendMode::Subtract = BlendMode( 0xffffffff ); +const BlendMode BlendMode::Additive = BlendMode( + BlendOp::Add, + BlendFactor::SrcAlpha, + BlendFactor::One, + BlendOp::Add, + BlendFactor::SrcAlpha, + BlendFactor::One, + BlendMask::RGBA, + 0xffffffff +); + + VertexFormat::VertexFormat(const StackVector& attr, int str) { attributes = attr;