@bornengine/engine 0.4.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +231 -0
- package/native/android/Cargo.lock +1848 -0
- package/native/android/Cargo.toml +24 -0
- package/native/android/src/lib.rs +702 -0
- package/native/ios/Cargo.lock +1690 -0
- package/native/ios/Cargo.toml +32 -0
- package/native/ios/src/lib.rs +1267 -0
- package/native/linux/Cargo.lock +3279 -0
- package/native/linux/Cargo.toml +29 -0
- package/native/linux/src/lib.rs +1331 -0
- package/native/macos/Cargo.lock +3310 -0
- package/native/macos/Cargo.toml +46 -0
- package/native/macos/src/lib.rs +1302 -0
- package/native/shared/Cargo.lock +1899 -0
- package/native/shared/Cargo.toml +62 -0
- package/native/shared/assets/default_font.ttf +0 -0
- package/native/shared/build.rs +270 -0
- package/native/shared/shaders/common/clouds.wgsl +122 -0
- package/native/shared/shaders/common/fog.wgsl +16 -0
- package/native/shared/shaders/common/foliage_wind.wgsl +98 -0
- package/native/shared/shaders/common/imposter.wgsl +112 -0
- package/native/shared/shaders/common/pbr.wgsl +186 -0
- package/native/shared/shaders/common/shadows.wgsl +186 -0
- package/native/shared/shaders/common/sky.wgsl +8 -0
- package/native/shared/shaders/common/tonemap.wgsl +25 -0
- package/native/shared/shaders/impulse_field.wgsl +57 -0
- package/native/shared/shaders/material_abi.wgsl +383 -0
- package/native/shared/shaders/materials/test_minimal.wgsl +42 -0
- package/native/shared/src/anim_mixer.rs +61 -0
- package/native/shared/src/attach.rs +263 -0
- package/native/shared/src/audio/decode.rs +123 -0
- package/native/shared/src/audio/mod.rs +863 -0
- package/native/shared/src/audio/render.rs +892 -0
- package/native/shared/src/audio/spsc.rs +156 -0
- package/native/shared/src/audio/stream.rs +226 -0
- package/native/shared/src/custom_shaders.rs +104 -0
- package/native/shared/src/decals.rs +245 -0
- package/native/shared/src/drs.rs +211 -0
- package/native/shared/src/engine.rs +261 -0
- package/native/shared/src/ffi.rs +116 -0
- package/native/shared/src/ffi_core/assets.rs +388 -0
- package/native/shared/src/ffi_core/audio_ffi.rs +184 -0
- package/native/shared/src/ffi_core/draw.rs +334 -0
- package/native/shared/src/ffi_core/game_loop.rs +577 -0
- package/native/shared/src/ffi_core/input.rs +234 -0
- package/native/shared/src/ffi_core/mod.rs +127 -0
- package/native/shared/src/ffi_core/models.rs +1154 -0
- package/native/shared/src/ffi_core/ragdoll_ffi.rs +261 -0
- package/native/shared/src/ffi_core/scene.rs +626 -0
- package/native/shared/src/ffi_core/vfx.rs +212 -0
- package/native/shared/src/ffi_core/visual.rs +691 -0
- package/native/shared/src/frame_callbacks.rs +122 -0
- package/native/shared/src/geometry.rs +236 -0
- package/native/shared/src/handles.rs +182 -0
- package/native/shared/src/input.rs +448 -0
- package/native/shared/src/jolt_sys.rs +822 -0
- package/native/shared/src/lib.rs +55 -0
- package/native/shared/src/models.rs +1093 -0
- package/native/shared/src/models_gltf.rs +1280 -0
- package/native/shared/src/particles.rs +391 -0
- package/native/shared/src/physics_jolt.rs +1908 -0
- package/native/shared/src/picking.rs +298 -0
- package/native/shared/src/postfx.rs +345 -0
- package/native/shared/src/profiler.rs +492 -0
- package/native/shared/src/ragdoll.rs +474 -0
- package/native/shared/src/renderer/atmosphere_lut.rs +573 -0
- package/native/shared/src/renderer/brdf_lut.rs +154 -0
- package/native/shared/src/renderer/draw2d.rs +143 -0
- package/native/shared/src/renderer/formats.rs +822 -0
- package/native/shared/src/renderer/froxel.rs +421 -0
- package/native/shared/src/renderer/gi_bake.rs +653 -0
- package/native/shared/src/renderer/graph.rs +462 -0
- package/native/shared/src/renderer/hiz.rs +269 -0
- package/native/shared/src/renderer/hot_reload.rs +390 -0
- package/native/shared/src/renderer/impulse_field.rs +456 -0
- package/native/shared/src/renderer/lighting.rs +154 -0
- package/native/shared/src/renderer/material_instancing.rs +171 -0
- package/native/shared/src/renderer/material_pipeline.rs +700 -0
- package/native/shared/src/renderer/material_system.rs +1996 -0
- package/native/shared/src/renderer/material_system_tests.rs +601 -0
- package/native/shared/src/renderer/material_system_wasm.rs +41 -0
- package/native/shared/src/renderer/mod.rs +12556 -0
- package/native/shared/src/renderer/model_draw.rs +641 -0
- package/native/shared/src/renderer/occlusion.rs +429 -0
- package/native/shared/src/renderer/planar_pass.rs +593 -0
- package/native/shared/src/renderer/planar_reflection.rs +499 -0
- package/native/shared/src/renderer/post_pass.rs +249 -0
- package/native/shared/src/renderer/postfx_chain.rs +728 -0
- package/native/shared/src/renderer/pt_pass.rs +577 -0
- package/native/shared/src/renderer/scene_pass.rs +607 -0
- package/native/shared/src/renderer/shader_include.rs +205 -0
- package/native/shared/src/renderer/shader_library.rs +135 -0
- package/native/shared/src/renderer/shaders/ao.rs +570 -0
- package/native/shared/src/renderer/shaders/core.rs +1243 -0
- package/native/shared/src/renderer/shaders/env.rs +907 -0
- package/native/shared/src/renderer/shaders/gi.rs +810 -0
- package/native/shared/src/renderer/shaders/mod.rs +19 -0
- package/native/shared/src/renderer/shaders/post.rs +1558 -0
- package/native/shared/src/renderer/shaders/pt.rs +1859 -0
- package/native/shared/src/renderer/shaders/ssgi.rs +1586 -0
- package/native/shared/src/renderer/shadow_pass.rs +731 -0
- package/native/shared/src/renderer/ssgi_pass.rs +392 -0
- package/native/shared/src/renderer/ssr_pass.rs +188 -0
- package/native/shared/src/renderer/texture_store.rs +473 -0
- package/native/shared/src/renderer/transient.rs +591 -0
- package/native/shared/src/renderer/types.rs +941 -0
- package/native/shared/src/renderer/util.rs +152 -0
- package/native/shared/src/scene.rs +1362 -0
- package/native/shared/src/sdf_cache.rs +274 -0
- package/native/shared/src/shadows.rs +1036 -0
- package/native/shared/src/staging.rs +102 -0
- package/native/shared/src/string_header.rs +266 -0
- package/native/shared/src/text_renderer.rs +502 -0
- package/native/shared/src/textures.rs +197 -0
- package/native/tvos/Cargo.lock +1693 -0
- package/native/tvos/Cargo.toml +36 -0
- package/native/tvos/metal-patched/Cargo.toml +178 -0
- package/native/tvos/metal-patched/LICENSE-APACHE +201 -0
- package/native/tvos/metal-patched/LICENSE-MIT +25 -0
- package/native/tvos/metal-patched/src/acceleration_structure.rs +667 -0
- package/native/tvos/metal-patched/src/acceleration_structure_pass.rs +108 -0
- package/native/tvos/metal-patched/src/argument.rs +366 -0
- package/native/tvos/metal-patched/src/blitpass.rs +102 -0
- package/native/tvos/metal-patched/src/buffer.rs +71 -0
- package/native/tvos/metal-patched/src/capturedescriptor.rs +76 -0
- package/native/tvos/metal-patched/src/capturemanager.rs +113 -0
- package/native/tvos/metal-patched/src/commandbuffer.rs +192 -0
- package/native/tvos/metal-patched/src/commandqueue.rs +44 -0
- package/native/tvos/metal-patched/src/computepass.rs +107 -0
- package/native/tvos/metal-patched/src/constants.rs +152 -0
- package/native/tvos/metal-patched/src/counters.rs +119 -0
- package/native/tvos/metal-patched/src/depthstencil.rs +190 -0
- package/native/tvos/metal-patched/src/device.rs +2134 -0
- package/native/tvos/metal-patched/src/drawable.rs +39 -0
- package/native/tvos/metal-patched/src/encoder.rs +2041 -0
- package/native/tvos/metal-patched/src/heap.rs +281 -0
- package/native/tvos/metal-patched/src/indirect_encoder.rs +344 -0
- package/native/tvos/metal-patched/src/lib.rs +657 -0
- package/native/tvos/metal-patched/src/library.rs +902 -0
- package/native/tvos/metal-patched/src/mps.rs +575 -0
- package/native/tvos/metal-patched/src/pipeline/compute.rs +475 -0
- package/native/tvos/metal-patched/src/pipeline/mod.rs +71 -0
- package/native/tvos/metal-patched/src/pipeline/render.rs +762 -0
- package/native/tvos/metal-patched/src/renderpass.rs +443 -0
- package/native/tvos/metal-patched/src/resource.rs +182 -0
- package/native/tvos/metal-patched/src/sampler.rs +165 -0
- package/native/tvos/metal-patched/src/sync.rs +178 -0
- package/native/tvos/metal-patched/src/texture.rs +352 -0
- package/native/tvos/metal-patched/src/types.rs +90 -0
- package/native/tvos/metal-patched/src/vertexdescriptor.rs +250 -0
- package/native/tvos/src/audio_backend.rs +197 -0
- package/native/tvos/src/lib.rs +1891 -0
- package/native/visionos/Cargo.lock +1693 -0
- package/native/visionos/Cargo.toml +40 -0
- package/native/visionos/src/audio_backend.rs +197 -0
- package/native/visionos/src/lib.rs +1887 -0
- package/native/watchos/Cargo.lock +16 -0
- package/native/watchos/Cargo.toml +19 -0
- package/native/watchos/shaders/bloom_postfx.metal +99 -0
- package/native/watchos/src/BloomWatchApp.swift +1267 -0
- package/native/watchos/src/BloomWatchAudio.swift +179 -0
- package/native/watchos/src/audio.rs +55 -0
- package/native/watchos/src/draw_list.rs +229 -0
- package/native/watchos/src/ffi_stubs.rs +915 -0
- package/native/watchos/src/ffi_stubs_manual.rs +35 -0
- package/native/watchos/src/lib.rs +1124 -0
- package/native/watchos/src/models.rs +746 -0
- package/native/watchos/src/postfx.rs +95 -0
- package/native/watchos/src/scene.rs +534 -0
- package/native/watchos/src/textures.rs +184 -0
- package/native/web/Cargo.lock +1657 -0
- package/native/web/Cargo.toml +43 -0
- package/native/web/bloom_glue.js +695 -0
- package/native/web/build.sh +131 -0
- package/native/web/index.html +35 -0
- package/native/web/jolt_bridge.js +1519 -0
- package/native/web/src/input_ffi.rs +286 -0
- package/native/web/src/lib.rs +1796 -0
- package/native/web/src/material_ffi.rs +710 -0
- package/native/web/src/parity_ffi.rs +343 -0
- package/native/web/src/physics_ffi.rs +643 -0
- package/native/web/src/ragdoll_ffi.rs +250 -0
- package/native/web/src/render_settings.rs +98 -0
- package/native/windows/Cargo.lock +1815 -0
- package/native/windows/Cargo.toml +68 -0
- package/native/windows/src/lib.rs +1486 -0
- package/package.json +4279 -0
- package/src/audio/index.ts +315 -0
- package/src/core/colors.ts +63 -0
- package/src/core/index.ts +1206 -0
- package/src/core/keys.ts +63 -0
- package/src/core/types.ts +104 -0
- package/src/index.ts +171 -0
- package/src/math/index.ts +516 -0
- package/src/mobile/index.ts +294 -0
- package/src/models/index.ts +1258 -0
- package/src/physics/index.ts +1134 -0
- package/src/scene/index.ts +698 -0
- package/src/shapes/index.ts +120 -0
- package/src/text/index.ts +48 -0
- package/src/textures/index.ts +187 -0
- package/src/vfx/index.ts +191 -0
- package/src/world/index.ts +24 -0
- package/src/world/loader.ts +423 -0
- package/src/world/prefab.ts +217 -0
- package/src/world/render.ts +172 -0
- package/src/world/saver.ts +108 -0
- package/src/world/serialize.ts +301 -0
- package/src/world/terrain.ts +355 -0
- package/src/world/types.ts +160 -0
- package/src/world/validate.ts +319 -0
- package/src/world/version.ts +114 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# This file is automatically @generated by Cargo.
|
|
2
|
+
# It is not intended for manual editing.
|
|
3
|
+
version = 4
|
|
4
|
+
|
|
5
|
+
[[package]]
|
|
6
|
+
name = "bloom-watchos"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
dependencies = [
|
|
9
|
+
"libc",
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
[[package]]
|
|
13
|
+
name = "libc"
|
|
14
|
+
version = "0.2.185"
|
|
15
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
16
|
+
checksum = "52ff2c0fe9bc6cb6b14a0592c2ff4fa9ceb83eea9db979b0487cd054946a2b8f"
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "bloom-watchos"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
edition = "2021"
|
|
5
|
+
|
|
6
|
+
[lib]
|
|
7
|
+
name = "bloom_watchos"
|
|
8
|
+
crate-type = ["staticlib"]
|
|
9
|
+
|
|
10
|
+
[dependencies]
|
|
11
|
+
libc = "0.2"
|
|
12
|
+
|
|
13
|
+
# Match perry-runtime's panic strategy so -Zbuild-std=std,panic_abort produces
|
|
14
|
+
# bit-identical std rlibs that dedupe at link time. Without abort, the crate
|
|
15
|
+
# pulls in unwinding support (rust_eh_personality, etc.) that collides with
|
|
16
|
+
# perry-runtime's copy when Swift drives the final link.
|
|
17
|
+
[profile.release]
|
|
18
|
+
panic = "abort"
|
|
19
|
+
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
// bloom_postfx.metal — Combined post-process pass for watchOS via SCNTechnique.
|
|
2
|
+
//
|
|
3
|
+
// Compiled into the .app's default.metallib by Perry's metal_sources
|
|
4
|
+
// pipeline. Loaded at runtime by BloomPostFXTechnique.swift, which builds
|
|
5
|
+
// an SCNTechnique that runs this pass after SceneKit's main color pass.
|
|
6
|
+
//
|
|
7
|
+
// Three effects (chromatic aberration, film grain, sun shafts) are chained
|
|
8
|
+
// in one fragment to avoid ping-pong target plumbing. Each effect reads its
|
|
9
|
+
// strength from the uniforms — strength 0 short-circuits to no-op so games
|
|
10
|
+
// only pay for what's enabled. Vignette + exposure stay on the SwiftUI side
|
|
11
|
+
// (cheaper, no shader needed).
|
|
12
|
+
//
|
|
13
|
+
// SCNTechnique on watchOS requires standard vertex+fragment entry points;
|
|
14
|
+
// `[[ stitchable ]]` (the SwiftUI Shader annotation) doesn't apply here.
|
|
15
|
+
|
|
16
|
+
#include <metal_stdlib>
|
|
17
|
+
using namespace metal;
|
|
18
|
+
|
|
19
|
+
struct PostFxVertOut {
|
|
20
|
+
float4 position [[position]];
|
|
21
|
+
float2 uv;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
// Fullscreen triangle. SceneKit's DRAW_QUAD draw mode runs this with
|
|
25
|
+
// vertex_count = 3; the math expands to a 2:2 triangle whose rasterized
|
|
26
|
+
// region is exactly the viewport.
|
|
27
|
+
vertex PostFxVertOut bloom_postfx_vertex(uint vid [[vertex_id]]) {
|
|
28
|
+
PostFxVertOut out;
|
|
29
|
+
float2 uv = float2((vid << 1) & 2, vid & 2);
|
|
30
|
+
out.uv = uv;
|
|
31
|
+
out.position = float4(uv * 2.0 - 1.0, 0.0, 1.0);
|
|
32
|
+
return out;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Uniforms — three SCNTechnique vec4 symbols bound at buffer 0/1/2.
|
|
36
|
+
// params0 = (chromatic aberration strength, film grain strength,
|
|
37
|
+
// film grain time, sun shafts strength)
|
|
38
|
+
// params1 = (sun X UV, sun Y UV, sun decay, screen width px)
|
|
39
|
+
// params2 = (sun tint R, sun tint G, sun tint B, screen height px)
|
|
40
|
+
//
|
|
41
|
+
// SCNTechnique symbol-to-buffer binding maps each `vec4` symbol to a
|
|
42
|
+
// sequential `[[buffer(N)]]` slot in declaration order.
|
|
43
|
+
fragment half4 bloom_postfx_combined(
|
|
44
|
+
PostFxVertOut in [[stage_in]],
|
|
45
|
+
texture2d<half> color [[texture(0)]],
|
|
46
|
+
constant float4 ¶ms0 [[buffer(0)]],
|
|
47
|
+
constant float4 ¶ms1 [[buffer(1)]],
|
|
48
|
+
constant float4 ¶ms2 [[buffer(2)]]
|
|
49
|
+
) {
|
|
50
|
+
constexpr sampler s(filter::linear, address::clamp_to_edge);
|
|
51
|
+
|
|
52
|
+
// Chromatic aberration — sample R/G/B at radial offset positions.
|
|
53
|
+
half3 rgb;
|
|
54
|
+
half a;
|
|
55
|
+
float ca_strength = params0.x;
|
|
56
|
+
if (ca_strength > 0.001) {
|
|
57
|
+
float2 center = float2(0.5);
|
|
58
|
+
float2 radial = in.uv - center;
|
|
59
|
+
float dist = dot(radial, radial); // 0 center → 0.5 corner
|
|
60
|
+
float2 px_to_uv = 1.0 / float2(max(params1.w, 1.0), max(params2.w, 1.0));
|
|
61
|
+
float2 offset = radial * (ca_strength * dist * 4.0) * px_to_uv;
|
|
62
|
+
rgb.r = color.sample(s, in.uv + offset).r;
|
|
63
|
+
half4 g = color.sample(s, in.uv);
|
|
64
|
+
rgb.g = g.g;
|
|
65
|
+
a = g.a;
|
|
66
|
+
rgb.b = color.sample(s, in.uv - offset).b;
|
|
67
|
+
} else {
|
|
68
|
+
half4 c = color.sample(s, in.uv);
|
|
69
|
+
rgb = c.rgb;
|
|
70
|
+
a = c.a;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Sun shafts — radial accumulation from a screen-space sun position.
|
|
74
|
+
float sun_strength = params0.w;
|
|
75
|
+
if (sun_strength > 0.001) {
|
|
76
|
+
const int STEPS = 12;
|
|
77
|
+
float2 sun = float2(params1.x, params1.y);
|
|
78
|
+
float decay = params1.z;
|
|
79
|
+
float2 delta = (in.uv - sun) / float(STEPS);
|
|
80
|
+
half3 acc = half3(0.0);
|
|
81
|
+
float w = 1.0;
|
|
82
|
+
for (int i = 0; i < STEPS; i++) {
|
|
83
|
+
acc += color.sample(s, in.uv - delta * float(i)).rgb * half(w);
|
|
84
|
+
w *= decay;
|
|
85
|
+
}
|
|
86
|
+
half3 tint = half3(params2.x, params2.y, params2.z);
|
|
87
|
+
rgb += (acc / half(STEPS)) * tint * half(sun_strength);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Film grain — hash noise added per-pixel.
|
|
91
|
+
float grain_strength = params0.y;
|
|
92
|
+
if (grain_strength > 0.001) {
|
|
93
|
+
float2 p = in.uv * 1024.0 + float2(params0.z * 13.1, params0.z * 7.3);
|
|
94
|
+
float n = fract(sin(dot(p, float2(12.9898, 78.233))) * 43758.5453);
|
|
95
|
+
rgb += half((n - 0.5) * grain_strength);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return half4(rgb, a);
|
|
99
|
+
}
|