diff --git a/CMakeLists.txt b/CMakeLists.txt index 4a15135..e1a15fa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.25) -project(graphs VERSION 0.0.15) +project(graphs VERSION 0.0.16) option(ENABLE_ADDRSAN "Enable the address sanitizer" OFF) option(ENABLE_UBSAN "Enable the ub sanitizer" OFF) @@ -38,5 +38,6 @@ if (${ENABLE_TSAN} MATCHES ON) endif () if (EMSCRIPTEN) - set_target_properties(graphs PROPERTIES LINK_FLAGS "-sMAX_WEBGL_VERSION=2 -sASSERTIONS=1 -sUSE_GLFW=3") + set(BLT_PRELOAD_PATH "../res@../res") + include(lib/BLT-With-Graphics-Template/cmake/link_flags.cmake) endif () \ No newline at end of file diff --git a/embuild.sh b/embuild.sh index 4b2879e..36aabf8 100755 --- a/embuild.sh +++ b/embuild.sh @@ -1,5 +1,6 @@ #!/bin/bash cd cmake-build-emrelwithdebinfo emcmake cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ../ +#emcmake cmake -DCMAKE_BUILD_TYPE=Release ../ emmake make -j 16 -cp graphs.js graphs.wasm /var/www/html +cp graphs.js graphs.data graphs.wasm /var/www/html diff --git a/lib/BLT-With-Graphics-Template b/lib/BLT-With-Graphics-Template index 7c7e978..0233ce7 160000 --- a/lib/BLT-With-Graphics-Template +++ b/lib/BLT-With-Graphics-Template @@ -1 +1 @@ -Subproject commit 7c7e97872da61d43400786e6da2a8d9d65b2e546 +Subproject commit 0233ce7549f5d0ef1df53157ed102e48f25c954e diff --git a/src/main.cpp b/src/main.cpp index 0c5d60f..480c4fc 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -28,13 +28,20 @@ blt::gfx::batch_renderer_2d renderer_2d(resources); blt::gfx::first_person_camera camera; blt::gfx::fbo_t render_texture; +#ifdef __EMSCRIPTEN__ + std::string resource_prefix = "../"; +#else + std::string resource_prefix = "../"; +#endif + void init(const blt::gfx::window_context& context) { using namespace blt::gfx; + resources.setPrefixDirectory(resource_prefix); - resources.enqueue("./res/debian.png", "debian"); - resources.enqueue("./res/parker.png", "parker"); - resources.enqueue("./res/parker cat ears.jpg", "parkercat"); + resources.enqueue("res/debian.png", "debian"); + resources.enqueue("res/parker.png", "parker"); + resources.enqueue("res/parker cat ears.jpg", "parkercat"); global_matrices.create_internals(); resources.load_resources();