rm lovr.graphics.getScissor; rm lovr.graphics.setScissor;

This commit is contained in:
bjorn 2017-08-01 19:24:40 -07:00
parent a652036111
commit ed25eef2d3
3 changed files with 0 additions and 76 deletions

View File

@ -263,36 +263,6 @@ int l_lovrGraphicsSetColorMask(lua_State* L) {
return 0;
}
int l_lovrGraphicsGetScissor(lua_State* L) {
if (!lovrGraphicsIsScissorEnabled()) {
lua_pushnil(L);
return 1;
}
int x, y, width, height;
lovrGraphicsGetScissor(&x, &y, &width, &height);
lua_pushnumber(L, x);
lua_pushnumber(L, y);
lua_pushnumber(L, width);
lua_pushnumber(L, height);
return 4;
}
int l_lovrGraphicsSetScissor(lua_State* L) {
if (lua_gettop(L) <= 1 && lua_isnoneornil(L, 1)) {
lovrGraphicsSetScissorEnabled(0);
return 0;
}
int x = luaL_checkint(L, 1);
int y = luaL_checkint(L, 2);
int width = luaL_checkint(L, 3);
int height = luaL_checkint(L, 4);
lovrGraphicsSetScissor(x, y, width, height);
lovrGraphicsSetScissorEnabled(1);
return 0;
}
int l_lovrGraphicsGetShader(lua_State* L) {
Shader* shader = lovrGraphicsGetShader();
luax_pushtype(L, Shader, shader);
@ -815,8 +785,6 @@ const luaL_Reg lovrGraphics[] = {
{ "setColor", l_lovrGraphicsSetColor },
{ "getColorMask", l_lovrGraphicsGetColorMask },
{ "setColorMask", l_lovrGraphicsSetColorMask },
{ "getScissor", l_lovrGraphicsGetScissor },
{ "setScissor", l_lovrGraphicsSetScissor },
{ "getShader", l_lovrGraphicsGetShader },
{ "setShader", l_lovrGraphicsSetShader },
{ "getFont", l_lovrGraphicsGetFont },

View File

@ -136,7 +136,6 @@ void lovrGraphicsReset() {
lovrGraphicsSetBlendMode(BLEND_ALPHA, BLEND_ALPHA_MULTIPLY);
lovrGraphicsSetColor(255, 255, 255, 255);
lovrGraphicsSetColorMask(1, 1, 1, 1);
lovrGraphicsSetScissorEnabled(0);
lovrGraphicsSetLineWidth(1);
lovrGraphicsSetPointSize(1);
lovrGraphicsSetCullingEnabled(0);
@ -256,36 +255,6 @@ void lovrGraphicsSetColorMask(char r, char g, char b, char a) {
glColorMask(r, g, b, a);
}
int lovrGraphicsIsScissorEnabled() {
return state.isScissorEnabled;
}
void lovrGraphicsSetScissorEnabled(int isEnabled) {
state.isScissorEnabled = isEnabled;
if (isEnabled) {
glEnable(GL_SCISSOR_TEST);
} else {
glDisable(GL_SCISSOR_TEST);
}
}
void lovrGraphicsGetScissor(int* x, int* y, int* width, int* height) {
*x = state.scissor.x;
*y = state.scissor.x;
*width = state.scissor.width;
*height = state.scissor.height;
}
void lovrGraphicsSetScissor(int x, int y, int width, int height) {
int windowWidth, windowHeight;
glfwGetFramebufferSize(state.window, &windowWidth, &windowHeight);
state.scissor.x = x;
state.scissor.x = y;
state.scissor.width = width;
state.scissor.height = height;
glScissor(x, windowHeight - y, width, height);
}
Shader* lovrGraphicsGetShader() {
return state.activeShader;
}

View File

@ -56,13 +56,6 @@ typedef enum {
LIMIT_TEXTURE_ANISOTROPY
} GraphicsLimit;
typedef struct {
int x;
int y;
int width;
int height;
} ScissorRectangle;
typedef struct {
int framebuffer;
float projection[16];
@ -88,8 +81,6 @@ typedef struct {
char colorMask;
BlendMode blendMode;
BlendAlphaMode blendAlphaMode;
int isScissorEnabled;
ScissorRectangle scissor;
GLuint shapeArray;
GLuint shapeBuffer;
GLuint shapeIndexBuffer;
@ -126,10 +117,6 @@ void lovrGraphicsGetColor(unsigned char* r, unsigned char* g, unsigned char* b,
void lovrGraphicsSetColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a);
void lovrGraphicsGetColorMask(char* r, char* g, char* b, char* a);
void lovrGraphicsSetColorMask(char r, char g, char b, char a);
int lovrGraphicsIsScissorEnabled();
void lovrGraphicsSetScissorEnabled(int isEnabled);
void lovrGraphicsGetScissor(int* x, int* y, int* width, int* height);
void lovrGraphicsSetScissor(int x, int y, int width, int height);
Shader* lovrGraphicsGetShader();
void lovrGraphicsSetShader(Shader* shader);
void lovrGraphicsEnsureFont();