main
Dominik Madarász 2024-08-31 09:02:19 +02:00
parent 9e2e216fd0
commit e3b02f8832
7 changed files with 82 additions and 18 deletions

View File

@ -1217,6 +1217,7 @@ typedef struct shadowmap_t {
bool shadowmap_step(shadowmap_t *s); bool shadowmap_step(shadowmap_t *s);
void shadowmap_light(shadowmap_t *s, light_t *l, mat44 cam_proj, mat44 cam_view); void shadowmap_light(shadowmap_t *s, light_t *l, mat44 cam_proj, mat44 cam_view);
void shadowmap_end(shadowmap_t *s); void shadowmap_end(shadowmap_t *s);
void ui_shadowmap(shadowmap_t *s);
unsigned shader(const char *vs, const char *fs, const char *attribs, const char *fragcolor, const char *defines); unsigned shader(const char *vs, const char *fs, const char *attribs, const char *fragcolor, const char *defines);
unsigned shader_geom(const char *gs, const char *vs, const char *fs, const char *attribs, const char *fragcolor, const char *defines); unsigned shader_geom(const char *gs, const char *vs, const char *fs, const char *attribs, const char *fragcolor, const char *defines);
unsigned shader_bind(unsigned program); unsigned shader_bind(unsigned program);

View File

@ -17359,6 +17359,7 @@ API void shadowmap_begin(shadowmap_t *s);
API bool shadowmap_step(shadowmap_t *s); //< roll over to the next light if it returns false API bool shadowmap_step(shadowmap_t *s); //< roll over to the next light if it returns false
API void shadowmap_light(shadowmap_t *s, light_t *l, mat44 cam_proj, mat44 cam_view); //< must be called at most once per shadowmap_step API void shadowmap_light(shadowmap_t *s, light_t *l, mat44 cam_proj, mat44 cam_view); //< must be called at most once per shadowmap_step
API void shadowmap_end(shadowmap_t *s); API void shadowmap_end(shadowmap_t *s);
API void ui_shadowmap(shadowmap_t *s);
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// shaders // shaders
@ -383959,6 +383960,22 @@ void shadowmap_end(shadowmap_t *s) {
} }
} }
void ui_shadowmap(shadowmap_t *s) {
if (!s) return;
int vsm_width = s->vsm_texture_width;
int csm_width = s->csm_texture_width;
ui_int("Texture Width (VSM)", &vsm_width);
ui_int("Texture Width (CSM)", &csm_width);
if (ui_collapse("VRAM Usage", "vram_usage")) {
ui_label2("Total VRAM", va("%lld KB", s->vram_usage_total / 1024));
ui_label2("VSM VRAM", va("%lld KB", s->vram_usage_vsm / 1024));
ui_label2("CSM VRAM", va("%lld KB", s->vram_usage_csm / 1024));
ui_collapse_end();
}
}
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Occlusion queries // Occlusion queries
@ -396640,7 +396657,7 @@ struct editor_t {
} editor = { } editor = {
.active = 1, .active = 1,
.gamepad = 1, .gamepad = 1,
.hz_high = 60, .hz_medium = 18, .hz_low = 5, .hz_high = 60, .hz_medium = 40, .hz_low = 30,
}; };
int editor_begin(const char *title, int mode) { int editor_begin(const char *title, int mode) {
@ -396948,10 +396965,14 @@ const char* editor_recv(int jobid, double timeout_ss) {
} }
// plain and ctrl keys // plain and ctrl keys
EDITOR_BIND(play, "down(F5)", { window_pause(0); /* if(!editor.slomo) editor.active = 0; */ editor.slomo = 1; } ); EDITOR_BIND(play, "down(F5)", {
EDITOR_BIND(stop, "down(ESC)", { if(editor.t > 0) { window_pause(1), editor.frame = 0, editor.t = 0, editor.dt = 0, editor.slomo = 0, editor.active = 1; editor_select("**"); editor_destroy_selected(); }} ); if(editor.t > 0) { window_pause(1), editor.frame = 0, editor.t = 0, editor.dt = 0, editor.slomo = 0, editor.active = 1; window_cursor(1); editor_select("**"); editor_destroy_selected(); }
window_pause(0); /* if(!editor.slomo) editor.active = 0; */ editor.slomo = 1;
}
);
EDITOR_BIND(stop, "down(ESC)", { if(editor.t > 0) { window_pause(1), editor.frame = 0, editor.t = 0, editor.dt = 0, editor.slomo = 0, editor.active = 1; window_cursor(1); editor_select("**"); editor_destroy_selected(); }} );
EDITOR_BIND(eject, "down(F1)", { /*window_pause(!editor.active); editor.slomo = !!editor.active;*/ editor.active ^= 1; } ); EDITOR_BIND(eject, "down(F1)", { /*window_pause(!editor.active); editor.slomo = !!editor.active;*/ editor.active ^= 1; } );
EDITOR_BIND(pause, "(held(CTRL) & down(P)) | down(PAUSE)", { window_pause( window_has_pause() ^ 1 ); } ); EDITOR_BIND(pause, "(held(CTRL) & down(P)) | down(PAUSE) | down(F6)", { window_pause( window_has_pause() ^ 1 ); } );
EDITOR_BIND(frame, "held(CTRL) & down(LEFT)", { window_pause(1); editor.frame++, editor.t += (editor.dt = 1/60.f); } ); EDITOR_BIND(frame, "held(CTRL) & down(LEFT)", { window_pause(1); editor.frame++, editor.t += (editor.dt = 1/60.f); } );
EDITOR_BIND(slomo, "held(CTRL) & down(RIGHT)", { window_pause(0); editor.slomo = maxf(fmod(editor.slomo * 2, 16), 0.125); } ); EDITOR_BIND(slomo, "held(CTRL) & down(RIGHT)", { window_pause(0); editor.slomo = maxf(fmod(editor.slomo * 2, 16), 0.125); } );
EDITOR_BIND(reload, "held(CTRL) & down(F5)", { window_reload(); } ); EDITOR_BIND(reload, "held(CTRL) & down(F5)", { window_reload(); } );
@ -397047,8 +397068,8 @@ void editor_frame( void (*game)(unsigned, float, double) ) {
window_cursor_shape(CURSOR_SW_AUTO); window_cursor_shape(CURSOR_SW_AUTO);
editor.hz_high = window_fps_target(); editor.hz_high = window_fps_target();
fx_load("**/editorOutline.fs"); // fx_load("**/editorOutline.fs");
fx_enable(0, 1); // fx_enable(0, 1);
obj_setname(editor.root = obj_new(obj), "Signals"); obj_setname(editor.root = obj_new(obj), "Signals");
obj_setname(editor.on_init = obj_new(obj), "onInit"); obj_setname(editor.on_init = obj_new(obj), "onInit");

View File

@ -142,7 +142,7 @@ struct editor_t {
} editor = { } editor = {
.active = 1, .active = 1,
.gamepad = 1, .gamepad = 1,
.hz_high = 60, .hz_medium = 18, .hz_low = 5, .hz_high = 60, .hz_medium = 40, .hz_low = 30,
}; };
int editor_begin(const char *title, int mode) { int editor_begin(const char *title, int mode) {
@ -450,10 +450,14 @@ const char* editor_recv(int jobid, double timeout_ss) {
} }
// plain and ctrl keys // plain and ctrl keys
EDITOR_BIND(play, "down(F5)", { window_pause(0); /* if(!editor.slomo) editor.active = 0; */ editor.slomo = 1; } ); EDITOR_BIND(play, "down(F5)", {
EDITOR_BIND(stop, "down(ESC)", { if(editor.t > 0) { window_pause(1), editor.frame = 0, editor.t = 0, editor.dt = 0, editor.slomo = 0, editor.active = 1; editor_select("**"); editor_destroy_selected(); }} ); if(editor.t > 0) { window_pause(1), editor.frame = 0, editor.t = 0, editor.dt = 0, editor.slomo = 0, editor.active = 1; window_cursor(1); editor_select("**"); editor_destroy_selected(); }
window_pause(0); /* if(!editor.slomo) editor.active = 0; */ editor.slomo = 1;
}
);
EDITOR_BIND(stop, "down(ESC)", { if(editor.t > 0) { window_pause(1), editor.frame = 0, editor.t = 0, editor.dt = 0, editor.slomo = 0, editor.active = 1; window_cursor(1); editor_select("**"); editor_destroy_selected(); }} );
EDITOR_BIND(eject, "down(F1)", { /*window_pause(!editor.active); editor.slomo = !!editor.active;*/ editor.active ^= 1; } ); EDITOR_BIND(eject, "down(F1)", { /*window_pause(!editor.active); editor.slomo = !!editor.active;*/ editor.active ^= 1; } );
EDITOR_BIND(pause, "(held(CTRL) & down(P)) | down(PAUSE)", { window_pause( window_has_pause() ^ 1 ); } ); EDITOR_BIND(pause, "(held(CTRL) & down(P)) | down(PAUSE) | down(F6)", { window_pause( window_has_pause() ^ 1 ); } );
EDITOR_BIND(frame, "held(CTRL) & down(LEFT)", { window_pause(1); editor.frame++, editor.t += (editor.dt = 1/60.f); } ); EDITOR_BIND(frame, "held(CTRL) & down(LEFT)", { window_pause(1); editor.frame++, editor.t += (editor.dt = 1/60.f); } );
EDITOR_BIND(slomo, "held(CTRL) & down(RIGHT)", { window_pause(0); editor.slomo = maxf(fmod(editor.slomo * 2, 16), 0.125); } ); EDITOR_BIND(slomo, "held(CTRL) & down(RIGHT)", { window_pause(0); editor.slomo = maxf(fmod(editor.slomo * 2, 16), 0.125); } );
EDITOR_BIND(reload, "held(CTRL) & down(F5)", { window_reload(); } ); EDITOR_BIND(reload, "held(CTRL) & down(F5)", { window_reload(); } );
@ -549,8 +553,8 @@ void editor_frame( void (*game)(unsigned, float, double) ) {
window_cursor_shape(CURSOR_SW_AUTO); window_cursor_shape(CURSOR_SW_AUTO);
editor.hz_high = window_fps_target(); editor.hz_high = window_fps_target();
fx_load("**/editorOutline.fs"); // fx_load("**/editorOutline.fs");
fx_enable(0, 1); // fx_enable(0, 1);
obj_setname(editor.root = obj_new(obj), "Signals"); obj_setname(editor.root = obj_new(obj), "Signals");
obj_setname(editor.on_init = obj_new(obj), "onInit"); obj_setname(editor.on_init = obj_new(obj), "onInit");

View File

@ -2217,6 +2217,22 @@ void shadowmap_end(shadowmap_t *s) {
} }
} }
void ui_shadowmap(shadowmap_t *s) {
if (!s) return;
int vsm_width = s->vsm_texture_width;
int csm_width = s->csm_texture_width;
ui_int("Texture Width (VSM)", &vsm_width);
ui_int("Texture Width (CSM)", &csm_width);
if (ui_collapse("VRAM Usage", "vram_usage")) {
ui_label2("Total VRAM", va("%lld KB", s->vram_usage_total / 1024));
ui_label2("VSM VRAM", va("%lld KB", s->vram_usage_vsm / 1024));
ui_label2("CSM VRAM", va("%lld KB", s->vram_usage_csm / 1024));
ui_collapse_end();
}
}
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Occlusion queries // Occlusion queries

View File

@ -391,6 +391,7 @@ API void shadowmap_begin(shadowmap_t *s);
API bool shadowmap_step(shadowmap_t *s); //< roll over to the next light if it returns false API bool shadowmap_step(shadowmap_t *s); //< roll over to the next light if it returns false
API void shadowmap_light(shadowmap_t *s, light_t *l, mat44 cam_proj, mat44 cam_view); //< must be called at most once per shadowmap_step API void shadowmap_light(shadowmap_t *s, light_t *l, mat44 cam_proj, mat44 cam_view); //< must be called at most once per shadowmap_step
API void shadowmap_end(shadowmap_t *s); API void shadowmap_end(shadowmap_t *s);
API void ui_shadowmap(shadowmap_t *s);
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// shaders // shaders

View File

@ -19016,6 +19016,22 @@ void shadowmap_end(shadowmap_t *s) {
} }
} }
void ui_shadowmap(shadowmap_t *s) {
if (!s) return;
int vsm_width = s->vsm_texture_width;
int csm_width = s->csm_texture_width;
ui_int("Texture Width (VSM)", &vsm_width);
ui_int("Texture Width (CSM)", &csm_width);
if (ui_collapse("VRAM Usage", "vram_usage")) {
ui_label2("Total VRAM", va("%lld KB", s->vram_usage_total / 1024));
ui_label2("VSM VRAM", va("%lld KB", s->vram_usage_vsm / 1024));
ui_label2("CSM VRAM", va("%lld KB", s->vram_usage_csm / 1024));
ui_collapse_end();
}
}
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Occlusion queries // Occlusion queries
@ -31697,7 +31713,7 @@ struct editor_t {
} editor = { } editor = {
.active = 1, .active = 1,
.gamepad = 1, .gamepad = 1,
.hz_high = 60, .hz_medium = 18, .hz_low = 5, .hz_high = 60, .hz_medium = 40, .hz_low = 30,
}; };
int editor_begin(const char *title, int mode) { int editor_begin(const char *title, int mode) {
@ -32005,10 +32021,14 @@ const char* editor_recv(int jobid, double timeout_ss) {
} }
// plain and ctrl keys // plain and ctrl keys
EDITOR_BIND(play, "down(F5)", { window_pause(0); /* if(!editor.slomo) editor.active = 0; */ editor.slomo = 1; } ); EDITOR_BIND(play, "down(F5)", {
EDITOR_BIND(stop, "down(ESC)", { if(editor.t > 0) { window_pause(1), editor.frame = 0, editor.t = 0, editor.dt = 0, editor.slomo = 0, editor.active = 1; editor_select("**"); editor_destroy_selected(); }} ); if(editor.t > 0) { window_pause(1), editor.frame = 0, editor.t = 0, editor.dt = 0, editor.slomo = 0, editor.active = 1; window_cursor(1); editor_select("**"); editor_destroy_selected(); }
window_pause(0); /* if(!editor.slomo) editor.active = 0; */ editor.slomo = 1;
}
);
EDITOR_BIND(stop, "down(ESC)", { if(editor.t > 0) { window_pause(1), editor.frame = 0, editor.t = 0, editor.dt = 0, editor.slomo = 0, editor.active = 1; window_cursor(1); editor_select("**"); editor_destroy_selected(); }} );
EDITOR_BIND(eject, "down(F1)", { /*window_pause(!editor.active); editor.slomo = !!editor.active;*/ editor.active ^= 1; } ); EDITOR_BIND(eject, "down(F1)", { /*window_pause(!editor.active); editor.slomo = !!editor.active;*/ editor.active ^= 1; } );
EDITOR_BIND(pause, "(held(CTRL) & down(P)) | down(PAUSE)", { window_pause( window_has_pause() ^ 1 ); } ); EDITOR_BIND(pause, "(held(CTRL) & down(P)) | down(PAUSE) | down(F6)", { window_pause( window_has_pause() ^ 1 ); } );
EDITOR_BIND(frame, "held(CTRL) & down(LEFT)", { window_pause(1); editor.frame++, editor.t += (editor.dt = 1/60.f); } ); EDITOR_BIND(frame, "held(CTRL) & down(LEFT)", { window_pause(1); editor.frame++, editor.t += (editor.dt = 1/60.f); } );
EDITOR_BIND(slomo, "held(CTRL) & down(RIGHT)", { window_pause(0); editor.slomo = maxf(fmod(editor.slomo * 2, 16), 0.125); } ); EDITOR_BIND(slomo, "held(CTRL) & down(RIGHT)", { window_pause(0); editor.slomo = maxf(fmod(editor.slomo * 2, 16), 0.125); } );
EDITOR_BIND(reload, "held(CTRL) & down(F5)", { window_reload(); } ); EDITOR_BIND(reload, "held(CTRL) & down(F5)", { window_reload(); } );
@ -32104,8 +32124,8 @@ void editor_frame( void (*game)(unsigned, float, double) ) {
window_cursor_shape(CURSOR_SW_AUTO); window_cursor_shape(CURSOR_SW_AUTO);
editor.hz_high = window_fps_target(); editor.hz_high = window_fps_target();
fx_load("**/editorOutline.fs"); // fx_load("**/editorOutline.fs");
fx_enable(0, 1); // fx_enable(0, 1);
obj_setname(editor.root = obj_new(obj), "Signals"); obj_setname(editor.root = obj_new(obj), "Signals");
obj_setname(editor.on_init = obj_new(obj), "onInit"); obj_setname(editor.on_init = obj_new(obj), "onInit");

View File

@ -3426,6 +3426,7 @@ API void shadowmap_begin(shadowmap_t *s);
API bool shadowmap_step(shadowmap_t *s); //< roll over to the next light if it returns false API bool shadowmap_step(shadowmap_t *s); //< roll over to the next light if it returns false
API void shadowmap_light(shadowmap_t *s, light_t *l, mat44 cam_proj, mat44 cam_view); //< must be called at most once per shadowmap_step API void shadowmap_light(shadowmap_t *s, light_t *l, mat44 cam_proj, mat44 cam_view); //< must be called at most once per shadowmap_step
API void shadowmap_end(shadowmap_t *s); API void shadowmap_end(shadowmap_t *s);
API void ui_shadowmap(shadowmap_t *s);
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// shaders // shaders