diff --git a/demos/09-shadertoy.c b/demos/09-shadertoy.c index 3804c11..569cf4d 100644 --- a/demos/09-shadertoy.c +++ b/demos/09-shadertoy.c @@ -7,8 +7,8 @@ int main() { window_create(75, 0); // WINDOW_MSAA8); array(char*) list = 0; - for( const char **dir = file_list("demos/art/shadertoys/", "**.fs"); *dir; dir++ ) { - array_push(list, STRDUP(file_name(*dir))); + for each_array( file_list("demos/art/shadertoys/**.fs"), char*, dir ) { + array_push(list, STRDUP(file_name(dir))); } shadertoy_t sh = shadertoy(*list, 0); // 0:no flags diff --git a/demos/99-pbr.c b/demos/99-pbr.c index 5244487..307d9fd 100644 --- a/demos/99-pbr.c +++ b/demos/99-pbr.c @@ -380,16 +380,14 @@ void camera_fit(camera_t *cam) { camera_lookat(cam, vec3(0,0,0)); } -int main( int argc, const char *argv[] ) { +int main() { window_create( 75, WINDOW_MSAA2 ); window_title(__FILE__); // load all fx files in all subdirs fx_load("fx**.fs"); - if( !LoadShaderConfig( 0 ) ) { - return -4; - } + LoadShaderConfig( 0 ); brdf_lut(); @@ -421,7 +419,7 @@ int main( int argc, const char *argv[] ) { unsigned skysphereShader = shader( vfs_read("Skyboxes/skysphere.vs"), vfs_read("Skyboxes/skysphere.fs"), NULL, NULL, NULL ); Model skysphere = { 0 }; ModelLoad(&skysphere, "Skyboxes/skysphere.fbx"); ModelRebind(&skysphere, skysphereShader); - if( ModelLoad( &gModel, argc > 1 && argv[1][0] != '-' ? argv[ 1 ] : "damagedhelmet.gltf" ) ) { + if( ModelLoad( &gModel, option("--model", "damagedhelmet.gltf") ) ) { ModelRebind( &gModel, gShader ); } @@ -634,15 +632,15 @@ int main( int argc, const char *argv[] ) { pbr_material_t *it = &gModel.materials[i]; ui_label(va("Name: %s", it->name)); ui_float( "Specular shininess", &it->specular_shininess ); - ui_separator(); if(ui_colormap( "Albedo", &it->albedo )) colormap(&it->albedo , dialog_load(), 1); - ui_separator(); if(ui_colormap( "Ambient", &it->ambient )) colormap(&it->ambient , dialog_load(), 0); - ui_separator(); if(ui_colormap( "AO", &it->ao )) colormap(&it->ao , dialog_load(), 0); - ui_separator(); if(ui_colormap( "Diffuse", &it->diffuse )) colormap(&it->diffuse , dialog_load(), 1); - ui_separator(); if(ui_colormap( "Emissive", &it->emissive )) colormap(&it->emissive , dialog_load(), 1); - ui_separator(); if(ui_colormap( "Metallic", &it->metallic )) colormap(&it->metallic , dialog_load(), 0); - ui_separator(); if(ui_colormap( "Normal", &it->normals )) colormap(&it->normals , dialog_load(), 0); - ui_separator(); if(ui_colormap( "Roughness", &it->roughness )) colormap(&it->roughness, dialog_load(), 0); - ui_separator(); if(ui_colormap( "Specular", &it->specular )) colormap(&it->specular , dialog_load(), 0); + ui_separator(); if(ui_colormap( "Albedo", &it->albedo )) colormap(&it->albedo , app_loadfile(), 1); + ui_separator(); if(ui_colormap( "Ambient", &it->ambient )) colormap(&it->ambient , app_loadfile(), 0); + ui_separator(); if(ui_colormap( "AO", &it->ao )) colormap(&it->ao , app_loadfile(), 0); + ui_separator(); if(ui_colormap( "Diffuse", &it->diffuse )) colormap(&it->diffuse , app_loadfile(), 1); + ui_separator(); if(ui_colormap( "Emissive", &it->emissive )) colormap(&it->emissive , app_loadfile(), 1); + ui_separator(); if(ui_colormap( "Metallic", &it->metallic )) colormap(&it->metallic , app_loadfile(), 0); + ui_separator(); if(ui_colormap( "Normal", &it->normals )) colormap(&it->normals , app_loadfile(), 0); + ui_separator(); if(ui_colormap( "Roughness", &it->roughness )) colormap(&it->roughness, app_loadfile(), 0); + ui_separator(); if(ui_colormap( "Specular", &it->specular )) colormap(&it->specular , app_loadfile(), 0); } ui_panel_end(); diff --git a/engine/joint/v4k.h b/engine/joint/v4k.h index ec69b3b..9ca9738 100644 --- a/engine/joint/v4k.h +++ b/engine/joint/v4k.h @@ -14057,7 +14057,7 @@ extern "C" { #endif #ifndef ENABLE_AUTOTESTS -#define ENABLE_AUTOTESTS ifdef(debug, 1, 0) ///+ +#define ENABLE_AUTOTESTS ifdef(debug, ifndef(ems, 1, 0), 0) ///+ #endif #ifndef ENABLE_RETAIL @@ -355405,10 +355405,11 @@ int window_record(const char *outfile_mp4) { } vec2 window_dpi() { - float x=0.0f; - float y=0.0f; - glfwGetMonitorContentScale(glfwGetPrimaryMonitor(), &x, &y); - return vec2(x,y); + vec2 dpi = vec2(1,1); +#ifndef __EMSCRIPTEN__ + glfwGetMonitorContentScale(glfwGetPrimaryMonitor(), &dpi.x, &dpi.y); +#endif + return dpi; } // ----------------------------------------------------------------------------- diff --git a/engine/split/v4k_config.h b/engine/split/v4k_config.h index 931a2e0..232208e 100644 --- a/engine/split/v4k_config.h +++ b/engine/split/v4k_config.h @@ -26,7 +26,7 @@ #endif #ifndef ENABLE_AUTOTESTS -#define ENABLE_AUTOTESTS ifdef(debug, 1, 0) ///+ +#define ENABLE_AUTOTESTS ifdef(debug, ifndef(ems, 1, 0), 0) ///+ #endif #ifndef ENABLE_RETAIL diff --git a/engine/split/v4k_window.c b/engine/split/v4k_window.c index 6924add..b245279 100644 --- a/engine/split/v4k_window.c +++ b/engine/split/v4k_window.c @@ -1044,10 +1044,11 @@ int window_record(const char *outfile_mp4) { } vec2 window_dpi() { - float x=0.0f; - float y=0.0f; - glfwGetMonitorContentScale(glfwGetPrimaryMonitor(), &x, &y); - return vec2(x,y); + vec2 dpi = vec2(1,1); +#ifndef __EMSCRIPTEN__ + glfwGetMonitorContentScale(glfwGetPrimaryMonitor(), &dpi.x, &dpi.y); +#endif + return dpi; } // ----------------------------------------------------------------------------- diff --git a/engine/v4k.c b/engine/v4k.c index 2dae04a..5fb2a4f 100644 --- a/engine/v4k.c +++ b/engine/v4k.c @@ -24367,10 +24367,11 @@ int window_record(const char *outfile_mp4) { } vec2 window_dpi() { - float x=0.0f; - float y=0.0f; - glfwGetMonitorContentScale(glfwGetPrimaryMonitor(), &x, &y); - return vec2(x,y); + vec2 dpi = vec2(1,1); +#ifndef __EMSCRIPTEN__ + glfwGetMonitorContentScale(glfwGetPrimaryMonitor(), &dpi.x, &dpi.y); +#endif + return dpi; } // ----------------------------------------------------------------------------- diff --git a/engine/v4k.h b/engine/v4k.h index c1ff770..a5254f6 100644 --- a/engine/v4k.h +++ b/engine/v4k.h @@ -124,7 +124,7 @@ extern "C" { #endif #ifndef ENABLE_AUTOTESTS -#define ENABLE_AUTOTESTS ifdef(debug, 1, 0) ///+ +#define ENABLE_AUTOTESTS ifdef(debug, ifndef(ems, 1, 0), 0) ///+ #endif #ifndef ENABLE_RETAIL