skinned gui srgb option
parent
3b69af1247
commit
b8be40e489
|
@ -1668,6 +1668,9 @@ typedef struct spine_t spine_t;
|
||||||
void spine_render(spine_t *p, vec3 offset, unsigned flags);
|
void spine_render(spine_t *p, vec3 offset, unsigned flags);
|
||||||
void spine_animate(spine_t *p, float delta);
|
void spine_animate(spine_t *p, float delta);
|
||||||
void ui_spine(spine_t *p);
|
void ui_spine(spine_t *p);
|
||||||
|
enum ATLAS_FLAGS {
|
||||||
|
ATLAS_SRGB = 2,
|
||||||
|
};
|
||||||
typedef struct atlas_frame_t {
|
typedef struct atlas_frame_t {
|
||||||
unsigned delay;
|
unsigned delay;
|
||||||
vec4 sheet;
|
vec4 sheet;
|
||||||
|
@ -1755,7 +1758,7 @@ typedef struct skinned_t {
|
||||||
atlas_t atlas;
|
atlas_t atlas;
|
||||||
float scale;
|
float scale;
|
||||||
} skinned_t;
|
} skinned_t;
|
||||||
guiskin_t gui_skinned(const char *asefile, float scale);
|
guiskin_t gui_skinned(const char *asefile, float scale, bool load_as_srgb);
|
||||||
bool steam_init(unsigned app_id);
|
bool steam_init(unsigned app_id);
|
||||||
void steam_tick();
|
void steam_tick();
|
||||||
void steam_trophy(const char *trophy_id, bool redeem);
|
void steam_trophy(const char *trophy_id, bool redeem);
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
void demo_kids(vec3 offs) {
|
void demo_kids(vec3 offs) {
|
||||||
// init
|
// init
|
||||||
static texture_t kids; do_once kids = texture( "spriteSheetExample.png", TEXTURE_LINEAR );
|
static texture_t kids; do_once kids = texture( "spriteSheetExample.png", TEXTURE_LINEAR|TEXTURE_SRGB );
|
||||||
static vec3 pos[2] = {{490,362},{442,362}}, vel[2] = {0};
|
static vec3 pos[2] = {{490,362},{442,362}}, vel[2] = {0};
|
||||||
static int row[2] = {0,3}, frame[2] = {0};
|
static int row[2] = {0,3}, frame[2] = {0};
|
||||||
static int inputs[2][4] = {{KEY_W,KEY_A,KEY_S,KEY_D},{KEY_UP,KEY_LEFT,KEY_DOWN,KEY_RIGHT}};
|
static int inputs[2][4] = {{KEY_W,KEY_A,KEY_S,KEY_D},{KEY_UP,KEY_LEFT,KEY_DOWN,KEY_RIGHT}};
|
||||||
|
@ -39,7 +39,7 @@ void demo_kids(vec3 offs) {
|
||||||
|
|
||||||
void demo_hud() {
|
void demo_hud() {
|
||||||
// draw pixel-art hud, 16x16 ui element, scaled and positioned in resolution-independant way
|
// draw pixel-art hud, 16x16 ui element, scaled and positioned in resolution-independant way
|
||||||
static texture_t inputs; do_once inputs = texture( "prompts_tilemap_34x24_16x16x1.png", TEXTURE_LINEAR );
|
static texture_t inputs; do_once inputs = texture( "prompts_tilemap_34x24_16x16x1.png", TEXTURE_LINEAR|TEXTURE_SRGB );
|
||||||
float spritesheet[3] = {17,34,24}, offset[2] = {0, - 2*absf(sin(window_time()*5))}; // sprite cell and animation
|
float spritesheet[3] = {17,34,24}, offset[2] = {0, - 2*absf(sin(window_time()*5))}; // sprite cell and animation
|
||||||
float scale[2] = {3, 3}, tile_w = 16 * scale[0], tile_h = 16 * scale[1]; // scaling
|
float scale[2] = {3, 3}, tile_w = 16 * scale[0], tile_h = 16 * scale[1]; // scaling
|
||||||
float position[3] = {window_width() - tile_w, window_height() - tile_h, window_height() }; // position in screen-coordinates (x,y,z-index)
|
float position[3] = {window_width() - tile_w, window_height() - tile_h, window_height() }; // position in screen-coordinates (x,y,z-index)
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
int main() {
|
int main() {
|
||||||
window_create(75.0, 0 );
|
window_create(75.0, 0 );
|
||||||
|
|
||||||
gui_pushskin(gui_skinned("golden.ase", 3.0f)); // x3 scale
|
gui_pushskin(gui_skinned("golden.ase", 3.0f, 1)); // x3 scale, sRGB enabled
|
||||||
skinned_t *skinned = (skinned_t*)gui_userdata();
|
skinned_t *skinned = (skinned_t*)gui_userdata();
|
||||||
|
|
||||||
vec4 pos = vec4(400,400,100, 30);
|
vec4 pos = vec4(400,400,100, 30);
|
||||||
|
|
|
@ -150,10 +150,10 @@ int main(int argc, char **argv) {
|
||||||
if(do_cats) NUM_SPRITES/=2; // cat-sprite+cat-shadow == 2 sprites
|
if(do_cats) NUM_SPRITES/=2; // cat-sprite+cat-shadow == 2 sprites
|
||||||
|
|
||||||
// load sprites and sheets
|
// load sprites and sheets
|
||||||
kids = texture( "spriteSheetExample.png", TEXTURE_LINEAR );
|
kids = texture( "spriteSheetExample.png", TEXTURE_LINEAR|TEXTURE_SRGB );
|
||||||
catImage = texture( "cat.png", TEXTURE_LINEAR ); //
|
catImage = texture( "cat.png", TEXTURE_LINEAR|TEXTURE_SRGB ); //
|
||||||
shadowImage = texture( "cat-shadow.png", TEXTURE_LINEAR );
|
shadowImage = texture( "cat-shadow.png", TEXTURE_LINEAR|TEXTURE_SRGB );
|
||||||
inputs = texture( "prompts_tilemap_34x24_16x16x1.png", TEXTURE_LINEAR );
|
inputs = texture( "prompts_tilemap_34x24_16x16x1.png", TEXTURE_LINEAR|TEXTURE_SRGB );
|
||||||
|
|
||||||
// load all fx files, including subdirs
|
// load all fx files, including subdirs
|
||||||
fx_load("fx**.fs");
|
fx_load("fx**.fs");
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
uniform sampler2D u_texture;
|
uniform sampler2D u_texture;
|
||||||
uniform float u_gamma; /// set:2.2
|
|
||||||
|
|
||||||
in vec2 vTexCoord;
|
in vec2 vTexCoord;
|
||||||
in vec4 vColor;
|
in vec4 vColor;
|
||||||
|
@ -54,5 +53,4 @@ void main() {
|
||||||
vec4 texColor = texture_AA2(u_texture, vTexCoord);
|
vec4 texColor = texture_AA2(u_texture, vTexCoord);
|
||||||
if(texColor.a < 0.9) discard;
|
if(texColor.a < 0.9) discard;
|
||||||
fragColor = vColor * texColor;
|
fragColor = vColor * texColor;
|
||||||
fragColor.rgb = pow(fragColor.rgb, vec3(u_gamma));
|
|
||||||
}
|
}
|
|
@ -1,5 +1,4 @@
|
||||||
uniform sampler2D texture0; /*unit0*/
|
uniform sampler2D texture0; /*unit0*/
|
||||||
uniform float u_inv_gamma;
|
|
||||||
uniform vec4 u_tint;
|
uniform vec4 u_tint;
|
||||||
uniform int u_has_tex;
|
uniform int u_has_tex;
|
||||||
|
|
||||||
|
@ -13,5 +12,4 @@ void main() {
|
||||||
} else {
|
} else {
|
||||||
fragcolor = u_tint;
|
fragcolor = u_tint;
|
||||||
}
|
}
|
||||||
fragcolor.rgb = pow( fragcolor.rgb, vec3( u_inv_gamma ) ); // defaults: 1.0/2.2 gamma
|
|
||||||
}
|
}
|
|
@ -18104,6 +18104,11 @@ API void ui_spine(spine_t *p);
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// atlas api
|
// atlas api
|
||||||
|
|
||||||
|
enum ATLAS_FLAGS {
|
||||||
|
ATLAS_SRGB = 2,
|
||||||
|
};
|
||||||
|
|
||||||
typedef struct atlas_frame_t {
|
typedef struct atlas_frame_t {
|
||||||
unsigned delay;
|
unsigned delay;
|
||||||
vec4 sheet;
|
vec4 sheet;
|
||||||
|
@ -18245,7 +18250,7 @@ typedef struct skinned_t {
|
||||||
// - "_hover" (ex. "slider_cursor_hover")
|
// - "_hover" (ex. "slider_cursor_hover")
|
||||||
// - "_press"
|
// - "_press"
|
||||||
//
|
//
|
||||||
API guiskin_t gui_skinned(const char *asefile, float scale);
|
API guiskin_t gui_skinned(const char *asefile, float scale, bool load_as_srgb);
|
||||||
#line 0
|
#line 0
|
||||||
|
|
||||||
#line 1 "v4k_steam.h"
|
#line 1 "v4k_steam.h"
|
||||||
|
@ -364094,7 +364099,7 @@ API void gui_drawrect( texture_t spritesheet, vec2 tex_start, vec2 tex_end, int
|
||||||
#define v42v2(rect) vec2(rect.x,rect.y), vec2(rect.z,rect.w)
|
#define v42v2(rect) vec2(rect.x,rect.y), vec2(rect.z,rect.w)
|
||||||
|
|
||||||
void gui_drawrect( texture_t texture, vec2 tex_start, vec2 tex_end, int rgba, vec2 start, vec2 end ) {
|
void gui_drawrect( texture_t texture, vec2 tex_start, vec2 tex_end, int rgba, vec2 start, vec2 end ) {
|
||||||
static int program = -1, vbo = -1, vao = -1, u_inv_gamma = -1, u_tint = -1, u_has_tex = -1, u_window_width = -1, u_window_height = -1;
|
static int program = -1, vbo = -1, vao = -1, u_tint = -1, u_has_tex = -1, u_window_width = -1, u_window_height = -1;
|
||||||
float gamma = window_get_gamma();
|
float gamma = window_get_gamma();
|
||||||
vec2 dpi = ifdef(osx, window_dpi(), vec2(1,1));
|
vec2 dpi = ifdef(osx, window_dpi(), vec2(1,1));
|
||||||
if( program < 0 ) {
|
if( program < 0 ) {
|
||||||
|
@ -364103,7 +364108,6 @@ void gui_drawrect( texture_t texture, vec2 tex_start, vec2 tex_end, int rgba, ve
|
||||||
|
|
||||||
program = shader(vs, fs, "", "fragcolor" , NULL);
|
program = shader(vs, fs, "", "fragcolor" , NULL);
|
||||||
ASSERT(program > 0);
|
ASSERT(program > 0);
|
||||||
u_inv_gamma = glGetUniformLocation(program, "u_inv_gamma");
|
|
||||||
u_tint = glGetUniformLocation(program, "u_tint");
|
u_tint = glGetUniformLocation(program, "u_tint");
|
||||||
u_has_tex = glGetUniformLocation(program, "u_has_tex");
|
u_has_tex = glGetUniformLocation(program, "u_has_tex");
|
||||||
u_window_width = glGetUniformLocation(program, "u_window_width");
|
u_window_width = glGetUniformLocation(program, "u_window_width");
|
||||||
|
@ -364122,7 +364126,6 @@ void gui_drawrect( texture_t texture, vec2 tex_start, vec2 tex_end, int rgba, ve
|
||||||
|
|
||||||
GLenum texture_type = texture.flags & TEXTURE_ARRAY ? GL_TEXTURE_2D_ARRAY : GL_TEXTURE_2D;
|
GLenum texture_type = texture.flags & TEXTURE_ARRAY ? GL_TEXTURE_2D_ARRAY : GL_TEXTURE_2D;
|
||||||
glUseProgram( program );
|
glUseProgram( program );
|
||||||
glUniform1f( u_inv_gamma, (gamma + !gamma) );
|
|
||||||
|
|
||||||
glBindVertexArray( vao );
|
glBindVertexArray( vao );
|
||||||
|
|
||||||
|
@ -364551,9 +364554,9 @@ void skinned_getscissorrect(void* userdata, const char *skin, const char *fallba
|
||||||
dims->w -= (skinsize.y - coresize.y);
|
dims->w -= (skinsize.y - coresize.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
guiskin_t gui_skinned(const char *asefile, float scale) {
|
guiskin_t gui_skinned(const char *asefile, float scale, bool load_as_srgb) {
|
||||||
skinned_t *a = REALLOC(0, sizeof(skinned_t));
|
skinned_t *a = REALLOC(0, sizeof(skinned_t));
|
||||||
a->atlas = atlas_create(asefile, 0);
|
a->atlas = atlas_create(asefile, load_as_srgb?ATLAS_SRGB:0);
|
||||||
a->scale = scale?scale:1.0f;
|
a->scale = scale?scale:1.0f;
|
||||||
guiskin_t skin={0};
|
guiskin_t skin={0};
|
||||||
skin.userdata = a;
|
skin.userdata = a;
|
||||||
|
@ -375862,7 +375865,6 @@ static void sprite_render_meshes_group(batch_group_t* sprites, int alpha_key, in
|
||||||
}
|
}
|
||||||
shader_bind(sprite_program);
|
shader_bind(sprite_program);
|
||||||
shader_mat44("u_mvp", mvp);
|
shader_mat44("u_mvp", mvp);
|
||||||
shader_float("u_gamma", window_get_gamma() + !window_get_gamma());
|
|
||||||
|
|
||||||
// set (unit 0) in the uniform texture sampler, and render batch
|
// set (unit 0) in the uniform texture sampler, and render batch
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
|
@ -376946,7 +376948,7 @@ atlas_t atlas_create(const char *inifile, unsigned flags) {
|
||||||
else if( strend(k, "bitmap") ) {
|
else if( strend(k, "bitmap") ) {
|
||||||
const char *text = v;
|
const char *text = v;
|
||||||
array(char) bin = base64_decode(text, strlen(text));
|
array(char) bin = base64_decode(text, strlen(text));
|
||||||
a.tex = texture_from_mem(bin, array_count(bin), 0);
|
a.tex = texture_from_mem(bin, array_count(bin), flags&ATLAS_SRGB ? TEXTURE_SRGB : 0);
|
||||||
array_free(bin);
|
array_free(bin);
|
||||||
}
|
}
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -377070,7 +377072,7 @@ void sprite_edit(sprite_t *s) {
|
||||||
|
|
||||||
sprite_t* sprite_new(const char *ase, int bindings[6]) {
|
sprite_t* sprite_new(const char *ase, int bindings[6]) {
|
||||||
sprite_t *s = obj_new(sprite_t, {bindings[0],bindings[1],bindings[2],bindings[3]}, {bindings[4],bindings[5]});
|
sprite_t *s = obj_new(sprite_t, {bindings[0],bindings[1],bindings[2],bindings[3]}, {bindings[4],bindings[5]});
|
||||||
atlas_t own = atlas_create(ase, 0);
|
atlas_t own = atlas_create(ase, ATLAS_SRGB);
|
||||||
memcpy(s->a = MALLOC(sizeof(atlas_t)), &own, sizeof(atlas_t)); // s->a = &s->own;
|
memcpy(s->a = MALLOC(sizeof(atlas_t)), &own, sizeof(atlas_t)); // s->a = &s->own;
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ API void gui_drawrect( texture_t spritesheet, vec2 tex_start, vec2 tex_end, int
|
||||||
#define v42v2(rect) vec2(rect.x,rect.y), vec2(rect.z,rect.w)
|
#define v42v2(rect) vec2(rect.x,rect.y), vec2(rect.z,rect.w)
|
||||||
|
|
||||||
void gui_drawrect( texture_t texture, vec2 tex_start, vec2 tex_end, int rgba, vec2 start, vec2 end ) {
|
void gui_drawrect( texture_t texture, vec2 tex_start, vec2 tex_end, int rgba, vec2 start, vec2 end ) {
|
||||||
static int program = -1, vbo = -1, vao = -1, u_inv_gamma = -1, u_tint = -1, u_has_tex = -1, u_window_width = -1, u_window_height = -1;
|
static int program = -1, vbo = -1, vao = -1, u_tint = -1, u_has_tex = -1, u_window_width = -1, u_window_height = -1;
|
||||||
float gamma = window_get_gamma();
|
float gamma = window_get_gamma();
|
||||||
vec2 dpi = ifdef(osx, window_dpi(), vec2(1,1));
|
vec2 dpi = ifdef(osx, window_dpi(), vec2(1,1));
|
||||||
if( program < 0 ) {
|
if( program < 0 ) {
|
||||||
|
@ -15,7 +15,6 @@ void gui_drawrect( texture_t texture, vec2 tex_start, vec2 tex_end, int rgba, ve
|
||||||
|
|
||||||
program = shader(vs, fs, "", "fragcolor" , NULL);
|
program = shader(vs, fs, "", "fragcolor" , NULL);
|
||||||
ASSERT(program > 0);
|
ASSERT(program > 0);
|
||||||
u_inv_gamma = glGetUniformLocation(program, "u_inv_gamma");
|
|
||||||
u_tint = glGetUniformLocation(program, "u_tint");
|
u_tint = glGetUniformLocation(program, "u_tint");
|
||||||
u_has_tex = glGetUniformLocation(program, "u_has_tex");
|
u_has_tex = glGetUniformLocation(program, "u_has_tex");
|
||||||
u_window_width = glGetUniformLocation(program, "u_window_width");
|
u_window_width = glGetUniformLocation(program, "u_window_width");
|
||||||
|
@ -34,7 +33,6 @@ void gui_drawrect( texture_t texture, vec2 tex_start, vec2 tex_end, int rgba, ve
|
||||||
|
|
||||||
GLenum texture_type = texture.flags & TEXTURE_ARRAY ? GL_TEXTURE_2D_ARRAY : GL_TEXTURE_2D;
|
GLenum texture_type = texture.flags & TEXTURE_ARRAY ? GL_TEXTURE_2D_ARRAY : GL_TEXTURE_2D;
|
||||||
glUseProgram( program );
|
glUseProgram( program );
|
||||||
glUniform1f( u_inv_gamma, (gamma + !gamma) );
|
|
||||||
|
|
||||||
glBindVertexArray( vao );
|
glBindVertexArray( vao );
|
||||||
|
|
||||||
|
@ -463,9 +461,9 @@ void skinned_getscissorrect(void* userdata, const char *skin, const char *fallba
|
||||||
dims->w -= (skinsize.y - coresize.y);
|
dims->w -= (skinsize.y - coresize.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
guiskin_t gui_skinned(const char *asefile, float scale) {
|
guiskin_t gui_skinned(const char *asefile, float scale, bool load_as_srgb) {
|
||||||
skinned_t *a = REALLOC(0, sizeof(skinned_t));
|
skinned_t *a = REALLOC(0, sizeof(skinned_t));
|
||||||
a->atlas = atlas_create(asefile, 0);
|
a->atlas = atlas_create(asefile, load_as_srgb?ATLAS_SRGB:0);
|
||||||
a->scale = scale?scale:1.0f;
|
a->scale = scale?scale:1.0f;
|
||||||
guiskin_t skin={0};
|
guiskin_t skin={0};
|
||||||
skin.userdata = a;
|
skin.userdata = a;
|
||||||
|
|
|
@ -62,4 +62,4 @@ typedef struct skinned_t {
|
||||||
// - "_hover" (ex. "slider_cursor_hover")
|
// - "_hover" (ex. "slider_cursor_hover")
|
||||||
// - "_press"
|
// - "_press"
|
||||||
//
|
//
|
||||||
API guiskin_t gui_skinned(const char *asefile, float scale);
|
API guiskin_t gui_skinned(const char *asefile, float scale, bool load_as_srgb);
|
||||||
|
|
|
@ -280,7 +280,6 @@ static void sprite_render_meshes_group(batch_group_t* sprites, int alpha_key, in
|
||||||
}
|
}
|
||||||
shader_bind(sprite_program);
|
shader_bind(sprite_program);
|
||||||
shader_mat44("u_mvp", mvp);
|
shader_mat44("u_mvp", mvp);
|
||||||
shader_float("u_gamma", window_get_gamma() + !window_get_gamma());
|
|
||||||
|
|
||||||
// set (unit 0) in the uniform texture sampler, and render batch
|
// set (unit 0) in the uniform texture sampler, and render batch
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
|
@ -1364,7 +1363,7 @@ atlas_t atlas_create(const char *inifile, unsigned flags) {
|
||||||
else if( strend(k, "bitmap") ) {
|
else if( strend(k, "bitmap") ) {
|
||||||
const char *text = v;
|
const char *text = v;
|
||||||
array(char) bin = base64_decode(text, strlen(text));
|
array(char) bin = base64_decode(text, strlen(text));
|
||||||
a.tex = texture_from_mem(bin, array_count(bin), 0);
|
a.tex = texture_from_mem(bin, array_count(bin), flags&ATLAS_SRGB ? TEXTURE_SRGB : 0);
|
||||||
array_free(bin);
|
array_free(bin);
|
||||||
}
|
}
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -1488,7 +1487,7 @@ void sprite_edit(sprite_t *s) {
|
||||||
|
|
||||||
sprite_t* sprite_new(const char *ase, int bindings[6]) {
|
sprite_t* sprite_new(const char *ase, int bindings[6]) {
|
||||||
sprite_t *s = obj_new(sprite_t, {bindings[0],bindings[1],bindings[2],bindings[3]}, {bindings[4],bindings[5]});
|
sprite_t *s = obj_new(sprite_t, {bindings[0],bindings[1],bindings[2],bindings[3]}, {bindings[4],bindings[5]});
|
||||||
atlas_t own = atlas_create(ase, 0);
|
atlas_t own = atlas_create(ase, ATLAS_SRGB);
|
||||||
memcpy(s->a = MALLOC(sizeof(atlas_t)), &own, sizeof(atlas_t)); // s->a = &s->own;
|
memcpy(s->a = MALLOC(sizeof(atlas_t)), &own, sizeof(atlas_t)); // s->a = &s->own;
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,6 +83,11 @@ API void ui_spine(spine_t *p);
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// atlas api
|
// atlas api
|
||||||
|
|
||||||
|
enum ATLAS_FLAGS {
|
||||||
|
ATLAS_SRGB = 2,
|
||||||
|
};
|
||||||
|
|
||||||
typedef struct atlas_frame_t {
|
typedef struct atlas_frame_t {
|
||||||
unsigned delay;
|
unsigned delay;
|
||||||
vec4 sheet;
|
vec4 sheet;
|
||||||
|
|
13
engine/v4k.c
13
engine/v4k.c
|
@ -11249,7 +11249,7 @@ API void gui_drawrect( texture_t spritesheet, vec2 tex_start, vec2 tex_end, int
|
||||||
#define v42v2(rect) vec2(rect.x,rect.y), vec2(rect.z,rect.w)
|
#define v42v2(rect) vec2(rect.x,rect.y), vec2(rect.z,rect.w)
|
||||||
|
|
||||||
void gui_drawrect( texture_t texture, vec2 tex_start, vec2 tex_end, int rgba, vec2 start, vec2 end ) {
|
void gui_drawrect( texture_t texture, vec2 tex_start, vec2 tex_end, int rgba, vec2 start, vec2 end ) {
|
||||||
static int program = -1, vbo = -1, vao = -1, u_inv_gamma = -1, u_tint = -1, u_has_tex = -1, u_window_width = -1, u_window_height = -1;
|
static int program = -1, vbo = -1, vao = -1, u_tint = -1, u_has_tex = -1, u_window_width = -1, u_window_height = -1;
|
||||||
float gamma = window_get_gamma();
|
float gamma = window_get_gamma();
|
||||||
vec2 dpi = ifdef(osx, window_dpi(), vec2(1,1));
|
vec2 dpi = ifdef(osx, window_dpi(), vec2(1,1));
|
||||||
if( program < 0 ) {
|
if( program < 0 ) {
|
||||||
|
@ -11258,7 +11258,6 @@ void gui_drawrect( texture_t texture, vec2 tex_start, vec2 tex_end, int rgba, ve
|
||||||
|
|
||||||
program = shader(vs, fs, "", "fragcolor" , NULL);
|
program = shader(vs, fs, "", "fragcolor" , NULL);
|
||||||
ASSERT(program > 0);
|
ASSERT(program > 0);
|
||||||
u_inv_gamma = glGetUniformLocation(program, "u_inv_gamma");
|
|
||||||
u_tint = glGetUniformLocation(program, "u_tint");
|
u_tint = glGetUniformLocation(program, "u_tint");
|
||||||
u_has_tex = glGetUniformLocation(program, "u_has_tex");
|
u_has_tex = glGetUniformLocation(program, "u_has_tex");
|
||||||
u_window_width = glGetUniformLocation(program, "u_window_width");
|
u_window_width = glGetUniformLocation(program, "u_window_width");
|
||||||
|
@ -11277,7 +11276,6 @@ void gui_drawrect( texture_t texture, vec2 tex_start, vec2 tex_end, int rgba, ve
|
||||||
|
|
||||||
GLenum texture_type = texture.flags & TEXTURE_ARRAY ? GL_TEXTURE_2D_ARRAY : GL_TEXTURE_2D;
|
GLenum texture_type = texture.flags & TEXTURE_ARRAY ? GL_TEXTURE_2D_ARRAY : GL_TEXTURE_2D;
|
||||||
glUseProgram( program );
|
glUseProgram( program );
|
||||||
glUniform1f( u_inv_gamma, (gamma + !gamma) );
|
|
||||||
|
|
||||||
glBindVertexArray( vao );
|
glBindVertexArray( vao );
|
||||||
|
|
||||||
|
@ -11706,9 +11704,9 @@ void skinned_getscissorrect(void* userdata, const char *skin, const char *fallba
|
||||||
dims->w -= (skinsize.y - coresize.y);
|
dims->w -= (skinsize.y - coresize.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
guiskin_t gui_skinned(const char *asefile, float scale) {
|
guiskin_t gui_skinned(const char *asefile, float scale, bool load_as_srgb) {
|
||||||
skinned_t *a = REALLOC(0, sizeof(skinned_t));
|
skinned_t *a = REALLOC(0, sizeof(skinned_t));
|
||||||
a->atlas = atlas_create(asefile, 0);
|
a->atlas = atlas_create(asefile, load_as_srgb?ATLAS_SRGB:0);
|
||||||
a->scale = scale?scale:1.0f;
|
a->scale = scale?scale:1.0f;
|
||||||
guiskin_t skin={0};
|
guiskin_t skin={0};
|
||||||
skin.userdata = a;
|
skin.userdata = a;
|
||||||
|
@ -23017,7 +23015,6 @@ static void sprite_render_meshes_group(batch_group_t* sprites, int alpha_key, in
|
||||||
}
|
}
|
||||||
shader_bind(sprite_program);
|
shader_bind(sprite_program);
|
||||||
shader_mat44("u_mvp", mvp);
|
shader_mat44("u_mvp", mvp);
|
||||||
shader_float("u_gamma", window_get_gamma() + !window_get_gamma());
|
|
||||||
|
|
||||||
// set (unit 0) in the uniform texture sampler, and render batch
|
// set (unit 0) in the uniform texture sampler, and render batch
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
|
@ -24101,7 +24098,7 @@ atlas_t atlas_create(const char *inifile, unsigned flags) {
|
||||||
else if( strend(k, "bitmap") ) {
|
else if( strend(k, "bitmap") ) {
|
||||||
const char *text = v;
|
const char *text = v;
|
||||||
array(char) bin = base64_decode(text, strlen(text));
|
array(char) bin = base64_decode(text, strlen(text));
|
||||||
a.tex = texture_from_mem(bin, array_count(bin), 0);
|
a.tex = texture_from_mem(bin, array_count(bin), flags&ATLAS_SRGB ? TEXTURE_SRGB : 0);
|
||||||
array_free(bin);
|
array_free(bin);
|
||||||
}
|
}
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -24225,7 +24222,7 @@ void sprite_edit(sprite_t *s) {
|
||||||
|
|
||||||
sprite_t* sprite_new(const char *ase, int bindings[6]) {
|
sprite_t* sprite_new(const char *ase, int bindings[6]) {
|
||||||
sprite_t *s = obj_new(sprite_t, {bindings[0],bindings[1],bindings[2],bindings[3]}, {bindings[4],bindings[5]});
|
sprite_t *s = obj_new(sprite_t, {bindings[0],bindings[1],bindings[2],bindings[3]}, {bindings[4],bindings[5]});
|
||||||
atlas_t own = atlas_create(ase, 0);
|
atlas_t own = atlas_create(ase, ATLAS_SRGB);
|
||||||
memcpy(s->a = MALLOC(sizeof(atlas_t)), &own, sizeof(atlas_t)); // s->a = &s->own;
|
memcpy(s->a = MALLOC(sizeof(atlas_t)), &own, sizeof(atlas_t)); // s->a = &s->own;
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4171,6 +4171,11 @@ API void ui_spine(spine_t *p);
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// atlas api
|
// atlas api
|
||||||
|
|
||||||
|
enum ATLAS_FLAGS {
|
||||||
|
ATLAS_SRGB = 2,
|
||||||
|
};
|
||||||
|
|
||||||
typedef struct atlas_frame_t {
|
typedef struct atlas_frame_t {
|
||||||
unsigned delay;
|
unsigned delay;
|
||||||
vec4 sheet;
|
vec4 sheet;
|
||||||
|
@ -4312,7 +4317,7 @@ typedef struct skinned_t {
|
||||||
// - "_hover" (ex. "slider_cursor_hover")
|
// - "_hover" (ex. "slider_cursor_hover")
|
||||||
// - "_press"
|
// - "_press"
|
||||||
//
|
//
|
||||||
API guiskin_t gui_skinned(const char *asefile, float scale);
|
API guiskin_t gui_skinned(const char *asefile, float scale, bool load_as_srgb);
|
||||||
#line 0
|
#line 0
|
||||||
|
|
||||||
#line 1 "v4k_steam.h"
|
#line 1 "v4k_steam.h"
|
||||||
|
|
Loading…
Reference in New Issue