Commits

Alex Szpakowski  committed 2254d46

Renamed blend modes "additive", "subtractive", and "multiplicative" to "add", "subtract", and "multiply" (resolves issue #864)

  • Participants
  • Parent commits afe0217
  • Branches minor

Comments (0)

Files changed (5)

File src/modules/graphics/Graphics.cpp

 StringMap<Graphics::BlendMode, Graphics::BLEND_MAX_ENUM>::Entry Graphics::blendModeEntries[] =
 {
 	{ "alpha", Graphics::BLEND_ALPHA },
-	{ "additive", Graphics::BLEND_ADDITIVE },
-	{ "subtractive", Graphics::BLEND_SUBTRACTIVE },
-	{ "multiplicative", Graphics::BLEND_MULTIPLICATIVE },
+	{ "add", Graphics::BLEND_ADD },
+	{ "subtract", Graphics::BLEND_SUBTRACT },
+	{ "multiply", Graphics::BLEND_MULTIPLY },
 	{ "premultiplied", Graphics::BLEND_PREMULTIPLIED },
 	{ "screen", Graphics::BLEND_SCREEN },
 	{ "replace", Graphics::BLEND_REPLACE },

File src/modules/graphics/Graphics.h

 	enum BlendMode
 	{
 		BLEND_ALPHA = 1,
-		BLEND_ADDITIVE,
-		BLEND_SUBTRACTIVE,
-		BLEND_MULTIPLICATIVE,
+		BLEND_ADD,
+		BLEND_SUBTRACT,
+		BLEND_MULTIPLY,
 		BLEND_PREMULTIPLIED,
 		BLEND_SCREEN,
 		BLEND_REPLACE,

File src/modules/graphics/opengl/Graphics.cpp

 		state.srcA = GL_ONE;
 		state.dstRGB = state.dstA = GL_ONE_MINUS_SRC_ALPHA;
 		break;
-	case BLEND_MULTIPLICATIVE:
+	case BLEND_MULTIPLY:
 		state.srcRGB = state.srcA = GL_DST_COLOR;
 		state.dstRGB = state.dstA = GL_ZERO;
 		break;
 		state.srcRGB = state.srcA = GL_ONE;
 		state.dstRGB = state.dstA = GL_ONE_MINUS_SRC_ALPHA;
 		break;
-	case BLEND_SUBTRACTIVE:
+	case BLEND_SUBTRACT:
 		state.func = GL_FUNC_REVERSE_SUBTRACT;
-	case BLEND_ADDITIVE:
+	case BLEND_ADD:
 		state.srcRGB = state.srcA = GL_SRC_ALPHA;
 		state.dstRGB = state.dstA = GL_ONE;
 		break;
 	OpenGL::BlendState state = gl.getBlendState();
 
 	if (state.func == GL_FUNC_REVERSE_SUBTRACT)  // && src == GL_SRC_ALPHA && dst == GL_ONE
-		return BLEND_SUBTRACTIVE;
+		return BLEND_SUBTRACT;
 	// Everything else has equation == GL_FUNC_ADD.
 	else if (state.srcRGB == state.srcA && state.dstRGB == state.dstA)
 	{
 		if (state.srcRGB == GL_SRC_ALPHA && state.dstRGB == GL_ONE)
-			return BLEND_ADDITIVE;
+			return BLEND_ADD;
 		else if (state.srcRGB == GL_SRC_ALPHA && state.dstRGB == GL_ONE_MINUS_SRC_ALPHA)
 			return BLEND_ALPHA; // alpha blend mode fallback for very old OpenGL versions.
 		else if (state.srcRGB == GL_DST_COLOR && state.dstRGB == GL_ZERO)
-			return BLEND_MULTIPLICATIVE;
+			return BLEND_MULTIPLY;
 		else if (state.srcRGB == GL_ONE && state.dstRGB == GL_ONE_MINUS_SRC_ALPHA)
 			return BLEND_PREMULTIPLIED;
 		else if (state.srcRGB == GL_ONE && state.dstRGB == GL_ONE_MINUS_SRC_COLOR)

File src/scripts/boot.lua

 		local small_y = -rain.spacing_y + y / 2
 		local big_y = -rain.spacing_y + y
 
-		love.graphics.setBlendMode("subtractive")
+		love.graphics.setBlendMode("subtract")
 		love.graphics.setColor(255, 255, 255, 128)
 		love.graphics.draw(rain.batch, -rain.spacing_x, small_y, 0, 0.5, 0.5)
 
 		love.graphics.draw(background.image, bx, by, 0, 0.7, 0.7, 256, 256)
 		love.graphics.setColor(255, 255, 255, 32 + 16*intensity)
 		love.graphics.draw(background.image, bx, by, 0, 0.65, 0.65, 256, 256)
-		love.graphics.setBlendMode("additive")
+		love.graphics.setBlendMode("add")
 		love.graphics.setColor(255, 255, 255, 16 + 16*intensity)
 		love.graphics.draw(background.image, bx, by, 0, 0.6, 0.6, 256, 256)
 	end

File src/scripts/boot.lua.h

 	0x61, 0x69, 0x6e, 0x2e, 0x73, 0x70, 0x61, 0x63, 0x69, 0x6e, 0x67, 0x5f, 0x79, 0x20, 0x2b, 0x20, 0x79, 0x0a,
 	0x09, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x73, 0x65, 
 	0x74, 0x42, 0x6c, 0x65, 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x28, 0x22, 0x73, 0x75, 0x62, 0x74, 0x72, 0x61, 
-	0x63, 0x74, 0x69, 0x76, 0x65, 0x22, 0x29, 0x0a,
+	0x63, 0x74, 0x22, 0x29, 0x0a,
 	0x09, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x73, 0x65, 
 	0x74, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x32, 0x35, 0x35, 0x2c, 0x20, 0x32, 0x35, 0x35, 0x2c, 0x20, 0x32, 
 	0x35, 0x35, 0x2c, 0x20, 0x31, 0x32, 0x38, 0x29, 0x0a,
 	0x65, 0x2c, 0x20, 0x62, 0x78, 0x2c, 0x20, 0x62, 0x79, 0x2c, 0x20, 0x30, 0x2c, 0x20, 0x30, 0x2e, 0x36, 0x35, 
 	0x2c, 0x20, 0x30, 0x2e, 0x36, 0x35, 0x2c, 0x20, 0x32, 0x35, 0x36, 0x2c, 0x20, 0x32, 0x35, 0x36, 0x29, 0x0a,
 	0x09, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x73, 0x65, 
-	0x74, 0x42, 0x6c, 0x65, 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x28, 0x22, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 
-	0x76, 0x65, 0x22, 0x29, 0x0a,
+	0x74, 0x42, 0x6c, 0x65, 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x28, 0x22, 0x61, 0x64, 0x64, 0x22, 0x29, 0x0a,
 	0x09, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x73, 0x65, 
 	0x74, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x32, 0x35, 0x35, 0x2c, 0x20, 0x32, 0x35, 0x35, 0x2c, 0x20, 0x32, 
 	0x35, 0x35, 0x2c, 0x20, 0x31, 0x36, 0x20, 0x2b, 0x20, 0x31, 0x36, 0x2a, 0x69, 0x6e, 0x74, 0x65, 0x6e, 0x73,