mirror of https://github.com/bjornbytes/lovr.git
Improve lovr.graphics.clear;
This commit is contained in:
parent
55f804de7a
commit
020a4207bb
|
@ -24,8 +24,18 @@ void lovrGraphicsInit() {
|
|||
map_set(&BufferDrawModes, "fan", GL_TRIANGLE_FAN);
|
||||
}
|
||||
|
||||
void lovrGraphicsClear() {
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
void lovrGraphicsClear(int color, int depth) {
|
||||
int bits = 0;
|
||||
|
||||
if (color) {
|
||||
bits |= GL_COLOR_BUFFER_BIT;
|
||||
}
|
||||
|
||||
if (depth) {
|
||||
bits |= GL_DEPTH_BUFFER_BIT;
|
||||
}
|
||||
|
||||
glClear(bits);
|
||||
}
|
||||
|
||||
void lovrGraphicsPresent() {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include "shader.h"
|
||||
|
||||
void lovrGraphicsInit();
|
||||
void lovrGraphicsClear();
|
||||
void lovrGraphicsClear(int color, int depth);
|
||||
void lovrGraphicsPresent();
|
||||
void lovrGraphicsGetClearColor(float* r, float* g, float* b, float* a);
|
||||
void lovrGraphicsSetClearColor(float r, float g, float b, float a);
|
||||
|
|
|
@ -28,7 +28,9 @@ int l_lovrGraphicsInit(lua_State* L) {
|
|||
}
|
||||
|
||||
int l_lovrGraphicsClear(lua_State* L) {
|
||||
lovrGraphicsClear();
|
||||
int color = lua_gettop(L) < 1 || lua_toboolean(L, 1);
|
||||
int depth = lua_gettop(L) < 2 || lua_toboolean(L, 2);
|
||||
lovrGraphicsClear(color, depth);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue