diff --git a/bind/v4k.lua b/bind/v4k.lua index fff0fd5..7105d8a 100644 --- a/bind/v4k.lua +++ b/bind/v4k.lua @@ -1392,6 +1392,7 @@ typedef struct skybox_t { void skybox_sh_add_light(skybox_t *sky, vec3 light, vec3 dir, float strength); int skybox_push_state(skybox_t *sky, mat44 proj, mat44 view); int skybox_pop_state(); + void viewport_color(unsigned color); void viewport_clear(bool color, bool depth); void viewport_clip(vec2 from, vec2 to); int fx_load(const char *file); diff --git a/engine/joint/v4k.h b/engine/joint/v4k.h index 2aee142..358768e 100644 --- a/engine/joint/v4k.h +++ b/engine/joint/v4k.h @@ -17653,6 +17653,7 @@ API int skybox_pop_state(); // @to deprecate // ----------------------------------------------------------------------------- // post-fxs +API void viewport_color(unsigned color); API void viewport_clear(bool color, bool depth); API void viewport_clip(vec2 from, vec2 to); @@ -372047,6 +372048,14 @@ void* screenshot_async( int n ) { // 3 RGB, 4 RGBA, -3 BGR, -4 BGRA // ----------------------------------------------------------------------------- // viewports +void viewport_color(unsigned color) { + unsigned r = (color >> 0) & 255; + unsigned g = (color >> 8) & 255; + unsigned b = (color >> 16) & 255; + unsigned a = (color >> 24) & 255; + glClearColor(r, g, b, a); +} + void viewport_clear(bool color, bool depth) { glClearDepthf(1); glClearStencil(0); diff --git a/engine/split/v4k_render.c b/engine/split/v4k_render.c index 8a02642..806fe27 100644 --- a/engine/split/v4k_render.c +++ b/engine/split/v4k_render.c @@ -2010,6 +2010,14 @@ void* screenshot_async( int n ) { // 3 RGB, 4 RGBA, -3 BGR, -4 BGRA // ----------------------------------------------------------------------------- // viewports +void viewport_color(unsigned color) { + unsigned r = (color >> 0) & 255; + unsigned g = (color >> 8) & 255; + unsigned b = (color >> 16) & 255; + unsigned a = (color >> 24) & 255; + glClearColor(r, g, b, a); +} + void viewport_clear(bool color, bool depth) { glClearDepthf(1); glClearStencil(0); diff --git a/engine/split/v4k_render.h b/engine/split/v4k_render.h index 247ed04..e523422 100644 --- a/engine/split/v4k_render.h +++ b/engine/split/v4k_render.h @@ -631,6 +631,7 @@ API int skybox_pop_state(); // @to deprecate // ----------------------------------------------------------------------------- // post-fxs +API void viewport_color(unsigned color); API void viewport_clear(bool color, bool depth); API void viewport_clip(vec2 from, vec2 to); diff --git a/engine/v4k.c b/engine/v4k.c index 9371da1..61db82c 100644 --- a/engine/v4k.c +++ b/engine/v4k.c @@ -19184,6 +19184,14 @@ void* screenshot_async( int n ) { // 3 RGB, 4 RGBA, -3 BGR, -4 BGRA // ----------------------------------------------------------------------------- // viewports +void viewport_color(unsigned color) { + unsigned r = (color >> 0) & 255; + unsigned g = (color >> 8) & 255; + unsigned b = (color >> 16) & 255; + unsigned a = (color >> 24) & 255; + glClearColor(r, g, b, a); +} + void viewport_clear(bool color, bool depth) { glClearDepthf(1); glClearStencil(0); diff --git a/engine/v4k.h b/engine/v4k.h index a3db514..2881501 100644 --- a/engine/v4k.h +++ b/engine/v4k.h @@ -3720,6 +3720,7 @@ API int skybox_pop_state(); // @to deprecate // ----------------------------------------------------------------------------- // post-fxs +API void viewport_color(unsigned color); API void viewport_clear(bool color, bool depth); API void viewport_clip(vec2 from, vec2 to);