Browse Source

Rename Mask to Stencil

vrld 14 years ago
parent
commit
ec2cf3fbe9

+ 4 - 4
src/modules/graphics/opengl/Graphics.cpp

@@ -312,7 +312,7 @@ namespace opengl
 	void Graphics::reset()
 	void Graphics::reset()
 	{
 	{
 		DisplayState s;
 		DisplayState s;
-		discardMask();
+		discardStencil();
 		Canvas::bindDefaultCanvas();
 		Canvas::bindDefaultCanvas();
 		restoreState(s);
 		restoreState(s);
 	}
 	}
@@ -451,7 +451,7 @@ namespace opengl
 		return 4;
 		return 4;
 	}
 	}
 
 
-	void Graphics::defineMask()
+	void Graphics::defineStencil()
 	{
 	{
 		glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
 		glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
 		glEnable(GL_STENCIL_TEST);
 		glEnable(GL_STENCIL_TEST);
@@ -460,14 +460,14 @@ namespace opengl
 		glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
 		glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
 	}
 	}
 
 
-	void Graphics::useMask(bool invert)
+	void Graphics::useStencil(bool invert)
 	{
 	{
 		glStencilFunc(GL_EQUAL, (int)(!invert), 1); // invert ? 0 : 1
 		glStencilFunc(GL_EQUAL, (int)(!invert), 1); // invert ? 0 : 1
 		glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
 		glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
 		glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
 		glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
 	}
 	}
 
 
-	void Graphics::discardMask()
+	void Graphics::discardStencil()
 	{
 	{
 		glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
 		glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
 		glDisable(GL_STENCIL_TEST);
 		glDisable(GL_STENCIL_TEST);

+ 3 - 3
src/modules/graphics/opengl/Graphics.h

@@ -252,7 +252,7 @@ namespace opengl
 		/**
 		/**
 		 * Enables the stencil buffer and set stencil function to fill it
 		 * Enables the stencil buffer and set stencil function to fill it
 		 */
 		 */
-		void defineMask();
+		void defineStencil();
 
 
 		/**
 		/**
 		 * Set stencil function to mask the following drawing calls using
 		 * Set stencil function to mask the following drawing calls using
@@ -260,12 +260,12 @@ namespace opengl
 		 * @param invert Invert the mask, i.e. draw everywhere expect where
 		 * @param invert Invert the mask, i.e. draw everywhere expect where
 		 *               the mask is defined.
 		 *               the mask is defined.
 		 */
 		 */
-		void useMask(bool invert = false);
+		void useStencil(bool invert = false);
 
 
 		/**
 		/**
 		 * Disables the stencil buffer
 		 * Disables the stencil buffer
 		 */
 		 */
-		void discardMask();
+		void discardStencil();
 
 
 		/**
 		/**
 		* Creates an Image object with padding and/or optimization.
 		* Creates an Image object with padding and/or optimization.

+ 12 - 12
src/modules/graphics/opengl/wrap_Graphics.cpp

@@ -157,7 +157,7 @@ namespace opengl
 		return instance->getScissor(L);
 		return instance->getScissor(L);
 	}
 	}
 
 
-	int w_newMask(lua_State * L)
+	int w_newStencil(lua_State * L)
 	{
 	{
 		// just return the function
 		// just return the function
 		if (!lua_isfunction(L, 1))
 		if (!lua_isfunction(L, 1))
@@ -166,32 +166,32 @@ namespace opengl
 		return 1;
 		return 1;
 	}
 	}
 
 
-	static int setMask(lua_State * L, bool invert)
+	static int setStencil(lua_State * L, bool invert)
 	{
 	{
 		// no argument -> clear mask
 		// no argument -> clear mask
 		if (lua_isnoneornil(L, 1)) {
 		if (lua_isnoneornil(L, 1)) {
-			instance->discardMask();
+			instance->discardStencil();
 			return 0;
 			return 0;
 		}
 		}
 
 
 		if (!lua_isfunction(L, 1))
 		if (!lua_isfunction(L, 1))
 			return luaL_typerror(L, 1, "mask");
 			return luaL_typerror(L, 1, "mask");
 
 
-		instance->defineMask();
+		instance->defineStencil();
 		lua_call(L, lua_gettop(L) - 1, 0); // call mask(...)
 		lua_call(L, lua_gettop(L) - 1, 0); // call mask(...)
-		instance->useMask(invert);
+		instance->useStencil(invert);
 
 
 		return 0;
 		return 0;
 	}
 	}
 
 
-	int w_setMask(lua_State * L)
+	int w_setStencil(lua_State * L)
 	{
 	{
-		return setMask(L, false);
+		return setStencil(L, false);
 	}
 	}
 
 
-	int w_setInvertedMask(lua_State * L)
+	int w_setInvertedStencil(lua_State * L)
 	{
 	{
-		return setMask(L, true);
+		return setStencil(L, true);
 	}
 	}
 
 
 	int w_newImage(lua_State * L)
 	int w_newImage(lua_State * L)
@@ -1192,9 +1192,9 @@ namespace opengl
 		{ "setScissor", w_setScissor },
 		{ "setScissor", w_setScissor },
 		{ "getScissor", w_getScissor },
 		{ "getScissor", w_getScissor },
 
 
-		{ "newMask", w_newMask },
-		{ "setMask", w_setMask },
-		{ "setInvertedMask", w_setInvertedMask },
+		{ "newStencil", w_newStencil },
+		{ "setStencil", w_setStencil },
+		{ "setInvertedStencil", w_setInvertedStencil },
 
 
 		{ "point", w_point },
 		{ "point", w_point },
 		{ "line", w_line },
 		{ "line", w_line },