Pulp
1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
threejs_resources.hpp
Go to the documentation of this file.
1
// SPDX-License-Identifier: MIT
2
//
3
// Bundled Three.js IIFE resource helpers.
4
//
5
// Returns the bundled `three.iife.js` source on platforms where it is
6
// embedded inside the AUv3 `.appex` (currently iOS). The IIFE bundle
7
// is produced at build time by
8
// `tools/scripts/bundle_threejs_for_jsc.mjs` and copied into
9
// `<appex>/threejs/three.iife.js` by the iOS AUv3 CMake rules. (iOS
10
// bundles are flat — `<appex>/Resources/` is a macOS-only path that
11
// NSBundle does not search on iOS.)
12
//
13
// On non-Apple-mobile platforms this returns `std::nullopt` — the
14
// macOS / desktop lanes resolve Three.js source files via the
15
// `examples/threejs-native-demo/main.cpp` ESM resolver pattern
16
// (`PULP_THREEJS_SOURCE_DIR` + path-on-disk), which has access to V8's
17
// public ESM API. JSC does not, so iOS uses the IIFE bundle instead.
18
19
#pragma once
20
21
#include <optional>
22
#include <string>
23
24
namespace
pulp::view
{
25
26
// Returns the embedded `three.iife.js` source if available on this
27
// platform. On iOS the source lives at
28
// `threejs/three.iife.js` inside the AUv3 `.appex` (iOS bundles are
29
// flat — `<appex>/Resources/` is macOS-only). It is located at
30
// runtime via `[NSBundle bundleForClass:[PulpAUViewController class]]`
31
// and `pathForResource:ofType:inDirectory:@"threejs"`. On non-iOS
32
// platforms (and on Apple-mobile builds where the resource is
33
// missing), returns `std::nullopt`.
34
//
35
// The returned string is the full IIFE wrapper that, when run through
36
// JSC `evaluate()`, registers `THREE` on `globalThis`. Callers should
37
// then emit the standard Three.js bundle diagnostics:
38
//
39
// PULP_THREEJS: bundle loaded (N bytes)
40
// PULP_THREEJS: globalThis.THREE available
41
//
42
// to keep the diagnostic surface aligned with the rest of the
43
// program.
44
std::optional<std::string>
threejs_iife_source
();
45
46
}
// namespace pulp::view
pulp::view
Hover-cursor tracking for platform window hosts.
Definition
fwd.hpp:27
pulp::view::threejs_iife_source
std::optional< std::string > threejs_iife_source()
core
view
include
pulp
view
threejs_resources.hpp
Generated by
1.15.0