emscripten / webasm full support
parent
c76d16eacd
commit
ba3735f83b
|
@ -1,5 +1,5 @@
|
||||||
cmake_minimum_required(VERSION 3.25)
|
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_ADDRSAN "Enable the address sanitizer" OFF)
|
||||||
option(ENABLE_UBSAN "Enable the ub sanitizer" OFF)
|
option(ENABLE_UBSAN "Enable the ub sanitizer" OFF)
|
||||||
|
@ -38,5 +38,6 @@ if (${ENABLE_TSAN} MATCHES ON)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (EMSCRIPTEN)
|
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 ()
|
endif ()
|
|
@ -1,5 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
cd cmake-build-emrelwithdebinfo
|
cd cmake-build-emrelwithdebinfo
|
||||||
emcmake cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ../
|
emcmake cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ../
|
||||||
|
#emcmake cmake -DCMAKE_BUILD_TYPE=Release ../
|
||||||
emmake make -j 16
|
emmake make -j 16
|
||||||
cp graphs.js graphs.wasm /var/www/html
|
cp graphs.js graphs.data graphs.wasm /var/www/html
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 7c7e97872da61d43400786e6da2a8d9d65b2e546
|
Subproject commit 0233ce7549f5d0ef1df53157ed102e48f25c954e
|
13
src/main.cpp
13
src/main.cpp
|
@ -28,13 +28,20 @@ blt::gfx::batch_renderer_2d renderer_2d(resources);
|
||||||
blt::gfx::first_person_camera camera;
|
blt::gfx::first_person_camera camera;
|
||||||
blt::gfx::fbo_t render_texture;
|
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)
|
void init(const blt::gfx::window_context& context)
|
||||||
{
|
{
|
||||||
using namespace blt::gfx;
|
using namespace blt::gfx;
|
||||||
|
resources.setPrefixDirectory(resource_prefix);
|
||||||
|
|
||||||
resources.enqueue("./res/debian.png", "debian");
|
resources.enqueue("res/debian.png", "debian");
|
||||||
resources.enqueue("./res/parker.png", "parker");
|
resources.enqueue("res/parker.png", "parker");
|
||||||
resources.enqueue("./res/parker cat ears.jpg", "parkercat");
|
resources.enqueue("res/parker cat ears.jpg", "parkercat");
|
||||||
|
|
||||||
global_matrices.create_internals();
|
global_matrices.create_internals();
|
||||||
resources.load_resources();
|
resources.load_resources();
|
||||||
|
|
Loading…
Reference in New Issue