main
Dominik Madarász 2023-10-14 22:20:34 +02:00
parent 759ace3441
commit 49d7893354
7 changed files with 32 additions and 31 deletions

View File

@ -7,8 +7,8 @@ int main() {
window_create(75, 0); // WINDOW_MSAA8); window_create(75, 0); // WINDOW_MSAA8);
array(char*) list = 0; array(char*) list = 0;
for( const char **dir = file_list("demos/art/shadertoys/", "**.fs"); *dir; dir++ ) { for each_array( file_list("demos/art/shadertoys/**.fs"), char*, dir ) {
array_push(list, STRDUP(file_name(*dir))); array_push(list, STRDUP(file_name(dir)));
} }
shadertoy_t sh = shadertoy(*list, 0); // 0:no flags shadertoy_t sh = shadertoy(*list, 0); // 0:no flags

View File

@ -380,16 +380,14 @@ void camera_fit(camera_t *cam) {
camera_lookat(cam, vec3(0,0,0)); camera_lookat(cam, vec3(0,0,0));
} }
int main( int argc, const char *argv[] ) { int main() {
window_create( 75, WINDOW_MSAA2 ); window_create( 75, WINDOW_MSAA2 );
window_title(__FILE__); window_title(__FILE__);
// load all fx files in all subdirs // load all fx files in all subdirs
fx_load("fx**.fs"); fx_load("fx**.fs");
if( !LoadShaderConfig( 0 ) ) { LoadShaderConfig( 0 );
return -4;
}
brdf_lut(); 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 ); 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); 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 ); ModelRebind( &gModel, gShader );
} }
@ -634,15 +632,15 @@ int main( int argc, const char *argv[] ) {
pbr_material_t *it = &gModel.materials[i]; pbr_material_t *it = &gModel.materials[i];
ui_label(va("Name: %s", it->name)); ui_label(va("Name: %s", it->name));
ui_float( "Specular shininess", &it->specular_shininess ); 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( "Albedo", &it->albedo )) colormap(&it->albedo , app_loadfile(), 1);
ui_separator(); if(ui_colormap( "Ambient", &it->ambient )) colormap(&it->ambient , dialog_load(), 0); 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 , dialog_load(), 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 , dialog_load(), 1); 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 , dialog_load(), 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 , dialog_load(), 0); 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 , dialog_load(), 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, dialog_load(), 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 , dialog_load(), 0); ui_separator(); if(ui_colormap( "Specular", &it->specular )) colormap(&it->specular , app_loadfile(), 0);
} }
ui_panel_end(); ui_panel_end();

View File

@ -14057,7 +14057,7 @@ extern "C" {
#endif #endif
#ifndef ENABLE_AUTOTESTS #ifndef ENABLE_AUTOTESTS
#define ENABLE_AUTOTESTS ifdef(debug, 1, 0) ///+ #define ENABLE_AUTOTESTS ifdef(debug, ifndef(ems, 1, 0), 0) ///+
#endif #endif
#ifndef ENABLE_RETAIL #ifndef ENABLE_RETAIL
@ -355405,10 +355405,11 @@ int window_record(const char *outfile_mp4) {
} }
vec2 window_dpi() { vec2 window_dpi() {
float x=0.0f; vec2 dpi = vec2(1,1);
float y=0.0f; #ifndef __EMSCRIPTEN__
glfwGetMonitorContentScale(glfwGetPrimaryMonitor(), &x, &y); glfwGetMonitorContentScale(glfwGetPrimaryMonitor(), &dpi.x, &dpi.y);
return vec2(x,y); #endif
return dpi;
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------

View File

@ -26,7 +26,7 @@
#endif #endif
#ifndef ENABLE_AUTOTESTS #ifndef ENABLE_AUTOTESTS
#define ENABLE_AUTOTESTS ifdef(debug, 1, 0) ///+ #define ENABLE_AUTOTESTS ifdef(debug, ifndef(ems, 1, 0), 0) ///+
#endif #endif
#ifndef ENABLE_RETAIL #ifndef ENABLE_RETAIL

View File

@ -1044,10 +1044,11 @@ int window_record(const char *outfile_mp4) {
} }
vec2 window_dpi() { vec2 window_dpi() {
float x=0.0f; vec2 dpi = vec2(1,1);
float y=0.0f; #ifndef __EMSCRIPTEN__
glfwGetMonitorContentScale(glfwGetPrimaryMonitor(), &x, &y); glfwGetMonitorContentScale(glfwGetPrimaryMonitor(), &dpi.x, &dpi.y);
return vec2(x,y); #endif
return dpi;
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------

View File

@ -24367,10 +24367,11 @@ int window_record(const char *outfile_mp4) {
} }
vec2 window_dpi() { vec2 window_dpi() {
float x=0.0f; vec2 dpi = vec2(1,1);
float y=0.0f; #ifndef __EMSCRIPTEN__
glfwGetMonitorContentScale(glfwGetPrimaryMonitor(), &x, &y); glfwGetMonitorContentScale(glfwGetPrimaryMonitor(), &dpi.x, &dpi.y);
return vec2(x,y); #endif
return dpi;
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------

View File

@ -124,7 +124,7 @@ extern "C" {
#endif #endif
#ifndef ENABLE_AUTOTESTS #ifndef ENABLE_AUTOTESTS
#define ENABLE_AUTOTESTS ifdef(debug, 1, 0) ///+ #define ENABLE_AUTOTESTS ifdef(debug, ifndef(ems, 1, 0), 0) ///+
#endif #endif
#ifndef ENABLE_RETAIL #ifndef ENABLE_RETAIL