mirror of
https://github.com/love2d/love.git
synced 2026-08-17 11:00:31 +02:00
Added love.graphics.setColorMask(r, g, b, a) and love.graphics.getColorMask()
setColorMask enables or disables specific color components when rendering and clearing the screen. For example, setColorMask(true, false, true, true) will prevent the green component of the color of all rendered objects from being written to the current frame buffer. setColorMask is a wrapper for http://www.opengl.org/sdk/docs/man2/xhtml/glColorMask.xml --HG-- branch : love.graphics.setColorMask
This commit is contained in:
@@ -76,6 +76,9 @@ struct DisplayState
|
||||
bool scissor;
|
||||
GLint scissorBox[4];
|
||||
|
||||
// Color mask.
|
||||
bool colorMask[4];
|
||||
|
||||
// Window info.
|
||||
std::string caption;
|
||||
bool mouseVisible;
|
||||
@@ -94,6 +97,7 @@ struct DisplayState
|
||||
pointSize = 1.0f;
|
||||
pointStyle = Graphics::POINT_SMOOTH;
|
||||
scissor = false;
|
||||
colorMask[0] = colorMask[1] = colorMask[2] = colorMask[3] = true;
|
||||
caption = "";
|
||||
mouseVisible = true;
|
||||
}
|
||||
@@ -303,6 +307,17 @@ public:
|
||||
**/
|
||||
Font *getFont() const;
|
||||
|
||||
/**
|
||||
* Sets the enabled color components when rendering.
|
||||
**/
|
||||
void setColorMask(bool r, bool g, bool b, bool a);
|
||||
|
||||
/**
|
||||
* Gets the current color mask.
|
||||
* Returns an array of 4 booleans representing the mask.
|
||||
**/
|
||||
const bool *getColorMask() const;
|
||||
|
||||
/**
|
||||
* Sets the current blend mode.
|
||||
**/
|
||||
@@ -521,6 +536,7 @@ private:
|
||||
float lineWidth;
|
||||
GLint matrixLimit;
|
||||
GLint userMatrices;
|
||||
bool colorMask[4];
|
||||
|
||||
int getRenderHeight() const;
|
||||
}; // Graphics
|
||||
|
||||
Reference in New Issue
Block a user