@skewedaspect/sage 0.13.0 → 0.13.1
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/dist/interfaces/game.d.ts +2 -0
- package/dist/sage.es.js +72 -66
- package/dist/sage.es.js.map +1 -1
- package/package.json +2 -2
|
@@ -12,6 +12,8 @@ export interface BabylonEngineOptions {
|
|
|
12
12
|
export type RenderEngineOptions = (BabylonEngineOptions | NullEngineOptions | WebGPUEngineOptions) & {
|
|
13
13
|
/** Forces `webgl` or `webgpu` in place of the default `auto`. */
|
|
14
14
|
engine?: EngineType;
|
|
15
|
+
/** How long, in seconds, boot waits to learn whether WebGPU is supported. Three unless set. */
|
|
16
|
+
webGPUSupportTimeout?: number;
|
|
15
17
|
};
|
|
16
18
|
/**
|
|
17
19
|
* The options a game passes `createGameEngine` (design/engine.md#booting-an-engine).
|
package/dist/sage.es.js
CHANGED
|
@@ -68,7 +68,7 @@ var He = class {
|
|
|
68
68
|
configurable: !0
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
|
-
}, j = "0.13.
|
|
71
|
+
}, j = "0.13.1", Ue = class e {
|
|
72
72
|
canvas;
|
|
73
73
|
renderEngine;
|
|
74
74
|
managers;
|
|
@@ -2518,7 +2518,7 @@ var sn = class {
|
|
|
2518
2518
|
n = t;
|
|
2519
2519
|
} else n = e, this.registerLevelConfig(n);
|
|
2520
2520
|
let r = this._loadedLevels.get(n.name);
|
|
2521
|
-
if (r) return this._log.
|
|
2521
|
+
if (r) return this._log.debug(`Level '${n.name}' is already loaded`), r;
|
|
2522
2522
|
this._log.debug(`Loading level: ${n.name}`);
|
|
2523
2523
|
let i = this._createLevelInstance(n);
|
|
2524
2524
|
this._loadingLevel = i;
|
|
@@ -2755,24 +2755,30 @@ var sn = class {
|
|
|
2755
2755
|
let n = this._materials.get(e);
|
|
2756
2756
|
return n || (n = new E(`sage-collider-debug-${e}`, t.getScene()), n.emissiveColor = i.FromHexString(e), n.disableLighting = !0, n.wireframe = !0, this._materials.set(e, n), n);
|
|
2757
2757
|
}
|
|
2758
|
-
};
|
|
2759
|
-
//#endregion
|
|
2760
|
-
//#region src/utils/graphics.ts
|
|
2761
|
-
async function hn() {
|
|
2762
|
-
return Ve() ? be.IsSupportedAsync : !1;
|
|
2763
|
-
}
|
|
2758
|
+
}, hn = 3;
|
|
2764
2759
|
async function gn(e, t) {
|
|
2760
|
+
if (!Ve()) return !1;
|
|
2761
|
+
let n, r = new Promise((t) => {
|
|
2762
|
+
n = setTimeout(() => {
|
|
2763
|
+
t("ran out");
|
|
2764
|
+
}, e * 1e3);
|
|
2765
|
+
}), i = await Promise.race([be.IsSupportedAsync, r]);
|
|
2766
|
+
return clearTimeout(n), i === "ran out" ? (t.warn(`WebGPU support did not answer within ${e} seconds; treating WebGPU as unsupported.`), !1) : i;
|
|
2767
|
+
}
|
|
2768
|
+
async function _n(e, t) {
|
|
2765
2769
|
let n = new be(e, t);
|
|
2766
2770
|
return await n.initAsync(), n;
|
|
2767
2771
|
}
|
|
2768
|
-
function
|
|
2772
|
+
function vn(e, t) {
|
|
2769
2773
|
return new u(e, t.antialias, t.options, t.adaptToDeviceRatio);
|
|
2770
2774
|
}
|
|
2771
|
-
function
|
|
2775
|
+
function yn(e) {
|
|
2772
2776
|
return new te(e);
|
|
2773
2777
|
}
|
|
2774
|
-
async function
|
|
2775
|
-
|
|
2778
|
+
async function bn(e, t, n = !1, r = new H("Boot")) {
|
|
2779
|
+
let i = t.webGPUSupportTimeout ?? hn;
|
|
2780
|
+
if (!Number.isFinite(i) || i <= 0) throw RangeError(`webGPUSupportTimeout is a positive, finite number of seconds, got ${i}.`);
|
|
2781
|
+
if (e === null) return r.debug("Using Null Engine"), yn(t);
|
|
2776
2782
|
if (n) {
|
|
2777
2783
|
if ("options" in t) {
|
|
2778
2784
|
let e = t;
|
|
@@ -2788,27 +2794,27 @@ async function yn(e, t, n = !1, r = new H("Boot")) {
|
|
|
2788
2794
|
useLargeWorldRendering: !0
|
|
2789
2795
|
};
|
|
2790
2796
|
}
|
|
2791
|
-
let
|
|
2792
|
-
if (
|
|
2793
|
-
if (await
|
|
2794
|
-
return r.debug("Using forced WebGPU engine"), await
|
|
2797
|
+
let a = t.engine || "auto";
|
|
2798
|
+
if (a === "webgpu") {
|
|
2799
|
+
if (await gn(i, r)) try {
|
|
2800
|
+
return r.debug("Using forced WebGPU engine"), await _n(e, t);
|
|
2795
2801
|
} catch (e) {
|
|
2796
2802
|
throw r.error("Forced WebGPU initialization failed:", e), Error("Forced WebGPU failed to initialize. If WebGPU is required, check browser compatibility.", { cause: e });
|
|
2797
2803
|
}
|
|
2798
2804
|
throw Error("WebGPU was forced but is not available in this browser.");
|
|
2799
2805
|
}
|
|
2800
|
-
if (
|
|
2801
|
-
if (await
|
|
2802
|
-
return r.debug("Using WebGPU"), await
|
|
2806
|
+
if (a === "webgl") return r.debug("Using forced WebGL engine"), vn(e, t);
|
|
2807
|
+
if (await gn(i, r)) try {
|
|
2808
|
+
return r.debug("Using WebGPU"), await _n(e, t);
|
|
2803
2809
|
} catch (e) {
|
|
2804
2810
|
r.warn("WebGPU initialization failed, falling back to WebGL:", e);
|
|
2805
2811
|
}
|
|
2806
2812
|
else r.warn("WebGPU not supported, falling back to WebGL.");
|
|
2807
|
-
return r.debug("Using WebGL"),
|
|
2813
|
+
return r.debug("Using WebGL"), vn(e, t);
|
|
2808
2814
|
}
|
|
2809
2815
|
//#endregion
|
|
2810
2816
|
//#region src/utils/timer.ts
|
|
2811
|
-
var
|
|
2817
|
+
var xn = class {
|
|
2812
2818
|
_nextId = 0;
|
|
2813
2819
|
_delays = [];
|
|
2814
2820
|
_intervals = [];
|
|
@@ -2872,17 +2878,17 @@ function Z(e) {
|
|
|
2872
2878
|
}
|
|
2873
2879
|
return e.simulation;
|
|
2874
2880
|
}
|
|
2875
|
-
function
|
|
2881
|
+
function Sn(e, t) {
|
|
2876
2882
|
return typeof e == "string" ? Z(t)?.getEntity(e) : e;
|
|
2877
2883
|
}
|
|
2878
|
-
function
|
|
2884
|
+
function Cn(e, t) {
|
|
2879
2885
|
let n = t.managers.gameManager, r = t.managers.levelManager, i = [];
|
|
2880
2886
|
e.expose("engine", t), e.expose("events", t.bus), e.expose("physics", { get: () => r.currentLevel?.scene?.getPhysicsEngine() ?? null }), e.expose("colliders", t.debug.colliders), e.expose("entities", new Proxy({}, { get(e, n) {
|
|
2881
2887
|
if (typeof n == "symbol") return;
|
|
2882
2888
|
let r = Z(t)?.getEntity(n);
|
|
2883
2889
|
return r || console.warn(`[sage] Entity not found: ${n}`), r;
|
|
2884
2890
|
} })), e.expose("level", { get: () => r.currentLevel }), e.expose("scene", { get: () => r.currentLevel?.scene ?? null }), e.expose("tp", (e, n, r, i) => {
|
|
2885
|
-
let a =
|
|
2891
|
+
let a = Sn(e, t);
|
|
2886
2892
|
if (!a) {
|
|
2887
2893
|
console.warn(`[sage] Entity not found: ${e}`);
|
|
2888
2894
|
return;
|
|
@@ -2923,7 +2929,7 @@ function Sn(e, t) {
|
|
|
2923
2929
|
});
|
|
2924
2930
|
return console.table(a), [...i];
|
|
2925
2931
|
}), e.expose("inspect", (e) => {
|
|
2926
|
-
let n =
|
|
2932
|
+
let n = Sn(e, t);
|
|
2927
2933
|
if (!n) {
|
|
2928
2934
|
console.warn(`[sage] Entity not found: ${e}`);
|
|
2929
2935
|
return;
|
|
@@ -2956,7 +2962,7 @@ function Sn(e, t) {
|
|
|
2956
2962
|
}
|
|
2957
2963
|
//#endregion
|
|
2958
2964
|
//#region src/interfaces/logger.ts
|
|
2959
|
-
var
|
|
2965
|
+
var wn = [
|
|
2960
2966
|
"trace",
|
|
2961
2967
|
"debug",
|
|
2962
2968
|
"info",
|
|
@@ -2966,7 +2972,7 @@ var Cn = [
|
|
|
2966
2972
|
];
|
|
2967
2973
|
//#endregion
|
|
2968
2974
|
//#region src/entities/defineEntity.ts
|
|
2969
|
-
function
|
|
2975
|
+
function Tn(e, t) {
|
|
2970
2976
|
let n = t ?? {}, r = e.tags ?? [], i = n.tags ?? [];
|
|
2971
2977
|
return {
|
|
2972
2978
|
...e.defaultState,
|
|
@@ -2974,13 +2980,13 @@ function wn(e, t) {
|
|
|
2974
2980
|
tags: [.../* @__PURE__ */ new Set([...r, ...i])]
|
|
2975
2981
|
};
|
|
2976
2982
|
}
|
|
2977
|
-
function
|
|
2983
|
+
function En(e) {
|
|
2978
2984
|
class t extends B {
|
|
2979
2985
|
static behaviors = e.behaviors;
|
|
2980
2986
|
static meshConfig = e.mesh;
|
|
2981
2987
|
static actions = e.actions;
|
|
2982
2988
|
static create(t, n, r, i) {
|
|
2983
|
-
let a =
|
|
2989
|
+
let a = Tn(e, r);
|
|
2984
2990
|
return super.create(t, n, a, i);
|
|
2985
2991
|
}
|
|
2986
2992
|
}
|
|
@@ -2991,12 +2997,12 @@ function Tn(e) {
|
|
|
2991
2997
|
function Q(e) {
|
|
2992
2998
|
return new i(e.r, e.g, e.b);
|
|
2993
2999
|
}
|
|
2994
|
-
function
|
|
3000
|
+
function Dn(e, t, n) {
|
|
2995
3001
|
let r = `Create${t.charAt(0).toUpperCase()}${t.slice(1)}`, i = b[r];
|
|
2996
3002
|
if (typeof i != "function") throw Error(`No Babylon mesh builder provides the primitive shape "${t}".`);
|
|
2997
3003
|
return i(t, n ?? {}, e);
|
|
2998
3004
|
}
|
|
2999
|
-
function
|
|
3005
|
+
function On(e, t, n) {
|
|
3000
3006
|
if (n.type === "pbr") {
|
|
3001
3007
|
let r = new ne(`${t.name}-material`, e);
|
|
3002
3008
|
n.color !== void 0 && (r.albedoColor = Q(n.color)), n.emissive !== void 0 && (r.emissiveColor = Q(n.emissive)), n.metallic !== void 0 && (r.metallic = n.metallic), n.roughness !== void 0 && (r.roughness = n.roughness), t.material = r;
|
|
@@ -3005,19 +3011,19 @@ function Dn(e, t, n) {
|
|
|
3005
3011
|
n.color !== void 0 && (r.diffuseColor = Q(n.color)), n.emissive !== void 0 && (r.emissiveColor = Q(n.emissive)), t.material = r;
|
|
3006
3012
|
}
|
|
3007
3013
|
}
|
|
3008
|
-
async function
|
|
3014
|
+
async function kn(e, t, n) {
|
|
3009
3015
|
let r;
|
|
3010
|
-
return t.source.includes("#") ? (await n.load(t.source), r = n.clone(t.source, e)) : r =
|
|
3016
|
+
return t.source.includes("#") ? (await n.load(t.source), r = n.clone(t.source, e)) : r = Dn(e, t.source, t.params), r.isVisible = t.visible ?? !0, t.material !== void 0 && On(e, r, t.material), r;
|
|
3011
3017
|
}
|
|
3012
|
-
function
|
|
3018
|
+
function An(e, t) {
|
|
3013
3019
|
return async (n, r) => {
|
|
3014
3020
|
let i = e[r]?.meshConfig;
|
|
3015
|
-
if (i !== void 0) return
|
|
3021
|
+
if (i !== void 0) return kn(n, i, t);
|
|
3016
3022
|
};
|
|
3017
3023
|
}
|
|
3018
3024
|
//#endregion
|
|
3019
3025
|
//#region src/behaviors/sound.ts
|
|
3020
|
-
var
|
|
3026
|
+
var jn = class extends k {
|
|
3021
3027
|
static ops = ["play", "stop"];
|
|
3022
3028
|
defaults = { sounds: {} };
|
|
3023
3029
|
#e = /* @__PURE__ */ new Map();
|
|
@@ -3059,10 +3065,10 @@ var An = class extends k {
|
|
|
3059
3065
|
};
|
|
3060
3066
|
//#endregion
|
|
3061
3067
|
//#region src/behaviors/physicsBody.ts
|
|
3062
|
-
function
|
|
3068
|
+
function Mn(e) {
|
|
3063
3069
|
return e === "sphere" ? w.SPHERE : e === "cylinder" ? w.CYLINDER : e === "convex" ? w.CONVEX_HULL : e === "mesh" ? w.MESH : w.BOX;
|
|
3064
3070
|
}
|
|
3065
|
-
function
|
|
3071
|
+
function Nn(e, t) {
|
|
3066
3072
|
let { extents: n, center: r } = t;
|
|
3067
3073
|
return e === "sphere" ? {
|
|
3068
3074
|
radius: Math.max(n.x, n.y, n.z) / 2,
|
|
@@ -3076,7 +3082,7 @@ function Mn(e, t) {
|
|
|
3076
3082
|
center: r
|
|
3077
3083
|
};
|
|
3078
3084
|
}
|
|
3079
|
-
function
|
|
3085
|
+
function Pn(e, t) {
|
|
3080
3086
|
let { extents: n } = e;
|
|
3081
3087
|
if (e.shape === "sphere") return new ce(O.Zero(), n.x / 2, t);
|
|
3082
3088
|
if (e.shape === "cylinder") {
|
|
@@ -3088,17 +3094,17 @@ function Nn(e, t) {
|
|
|
3088
3094
|
function $(e) {
|
|
3089
3095
|
return e === "static" ? S.STATIC : e === "kinematic" ? S.ANIMATED : S.DYNAMIC;
|
|
3090
3096
|
}
|
|
3091
|
-
function
|
|
3097
|
+
function Fn(e) {
|
|
3092
3098
|
return e === S.STATIC ? "static" : e === S.ANIMATED ? "kinematic" : "dynamic";
|
|
3093
3099
|
}
|
|
3094
|
-
function
|
|
3100
|
+
function In(e) {
|
|
3095
3101
|
return e === "kinematic" ? C.ACTION : C.TELEPORT;
|
|
3096
3102
|
}
|
|
3097
|
-
function
|
|
3103
|
+
function Ln(e) {
|
|
3098
3104
|
for (let t of e.getChildMeshes(!1)) if (t.getTotalVertices() > 0) return !0;
|
|
3099
3105
|
return !1;
|
|
3100
3106
|
}
|
|
3101
|
-
var
|
|
3107
|
+
var Rn = class extends k {
|
|
3102
3108
|
static ops = ["applyImpulse"];
|
|
3103
3109
|
defaults = {
|
|
3104
3110
|
shape: "box",
|
|
@@ -3159,13 +3165,13 @@ var Ln = class extends k {
|
|
|
3159
3165
|
if (r === "convex" || r === "mesh") {
|
|
3160
3166
|
let a = e.mesh;
|
|
3161
3167
|
if (!(a instanceof y) || a.getTotalVertices() === 0) throw Error(`HavokPhysicsBodyBehavior: entity "${e.id}" asked for a "${r}" body, which reads vertices, and it has no mesh geometry to read.`);
|
|
3162
|
-
return new x(n,
|
|
3168
|
+
return new x(n, Mn(r), {
|
|
3163
3169
|
mass: i,
|
|
3164
3170
|
mesh: a
|
|
3165
3171
|
}, t);
|
|
3166
3172
|
}
|
|
3167
|
-
let a =
|
|
3168
|
-
return new x(n,
|
|
3173
|
+
let a = Nn(r, this.#s(e));
|
|
3174
|
+
return new x(n, Mn(r), {
|
|
3169
3175
|
mass: i,
|
|
3170
3176
|
...a
|
|
3171
3177
|
}, t);
|
|
@@ -3179,13 +3185,13 @@ var Ln = class extends k {
|
|
|
3179
3185
|
center: e.center.clone()
|
|
3180
3186
|
};
|
|
3181
3187
|
}
|
|
3182
|
-
if (!
|
|
3188
|
+
if (!Ln(e.node)) throw Error(`HavokPhysicsBodyBehavior: entity "${e.id}" has neither a mesh nor anything under its node to size a body from.`);
|
|
3183
3189
|
return J(e.node);
|
|
3184
3190
|
}
|
|
3185
3191
|
#c(e) {
|
|
3186
3192
|
let t = new oe(e);
|
|
3187
3193
|
for (let n of this.state.parts) {
|
|
3188
|
-
let r =
|
|
3194
|
+
let r = Pn(n, e);
|
|
3189
3195
|
t.addChild(r, N(n.position), F(n.rotation)), this.#a.push(r);
|
|
3190
3196
|
}
|
|
3191
3197
|
return this.#a.push(t), t;
|
|
@@ -3220,7 +3226,7 @@ var Ln = class extends k {
|
|
|
3220
3226
|
get: () => s,
|
|
3221
3227
|
set: r
|
|
3222
3228
|
}), this.computed("motion", {
|
|
3223
|
-
get: () => this.#n ?
|
|
3229
|
+
get: () => this.#n ? Fn(this.#r) : Fn(this.#y().getMotionType()),
|
|
3224
3230
|
set: (e) => {
|
|
3225
3231
|
if (this.#n) {
|
|
3226
3232
|
this.#r = $(e);
|
|
@@ -3258,7 +3264,7 @@ var Ln = class extends k {
|
|
|
3258
3264
|
}
|
|
3259
3265
|
#d(e, t) {
|
|
3260
3266
|
let n = this.#y(), r = n.transformNode;
|
|
3261
|
-
r.position = N(e), r.rotationQuaternion = F(t), !this.#n && (n.setPrestepType(Fn(
|
|
3267
|
+
r.position = N(e), r.rotationQuaternion = F(t), !this.#n && (n.setPrestepType(In(Fn(n.getMotionType()))), this.#b().setPhysicsBodyTransformation(n, r), n.setPrestepType(C.DISABLED));
|
|
3262
3268
|
}
|
|
3263
3269
|
#f(e) {
|
|
3264
3270
|
if (e !== this.#n) {
|
|
@@ -3311,12 +3317,12 @@ var Ln = class extends k {
|
|
|
3311
3317
|
if (this.#t === void 0) throw Error(`HavokPhysicsBodyBehavior: entity "${this.entity.id}" has no physics plugin to answer for.`);
|
|
3312
3318
|
return this.#t;
|
|
3313
3319
|
}
|
|
3314
|
-
},
|
|
3315
|
-
function
|
|
3320
|
+
}, zn = new O(0, -1, 0), Bn = "standing";
|
|
3321
|
+
function Vn(e) {
|
|
3316
3322
|
let t = Object.keys(e);
|
|
3317
3323
|
return t.sort((t, n) => e[n].height - e[t].height), t;
|
|
3318
3324
|
}
|
|
3319
|
-
var
|
|
3325
|
+
var Hn = class extends k {
|
|
3320
3326
|
defaults = {
|
|
3321
3327
|
moveX: 0,
|
|
3322
3328
|
moveZ: 0,
|
|
@@ -3351,7 +3357,7 @@ var Vn = class extends k {
|
|
|
3351
3357
|
z: 0
|
|
3352
3358
|
},
|
|
3353
3359
|
grounded: !1,
|
|
3354
|
-
stance:
|
|
3360
|
+
stance: Bn
|
|
3355
3361
|
};
|
|
3356
3362
|
#e;
|
|
3357
3363
|
#t;
|
|
@@ -3361,7 +3367,7 @@ var Vn = class extends k {
|
|
|
3361
3367
|
#a = /* @__PURE__ */ new Map();
|
|
3362
3368
|
#o = W();
|
|
3363
3369
|
#s = !1;
|
|
3364
|
-
#c =
|
|
3370
|
+
#c = Bn;
|
|
3365
3371
|
#l = !1;
|
|
3366
3372
|
#u;
|
|
3367
3373
|
#d = O.Zero();
|
|
@@ -3381,7 +3387,7 @@ var Vn = class extends k {
|
|
|
3381
3387
|
onUpdate(e) {
|
|
3382
3388
|
let t = this.#e;
|
|
3383
3389
|
if (t === void 0) return;
|
|
3384
|
-
let n = t.checkSupport(e,
|
|
3390
|
+
let n = t.checkSupport(e, zn);
|
|
3385
3391
|
this.#l = n.supportedState === r.SUPPORTED, this.#l ? this.#h = 0 : this.#h += 1, this.#S(), this.#u = this.#O(), this.#E().y <= 0 && (this.#g = !1);
|
|
3386
3392
|
let i = this.desiredVelocity(e, n);
|
|
3387
3393
|
this.#w(n) && (this.#g = !0, i.y = this.state.jumpSpeed), this.#d = this.#D(), i.addInPlace(this.#d), t.setVelocity(i), t.integrate(e, n, this.#o), this.entity.node.setAbsolutePosition(this.#B(t.getPosition())), this.state.velocity = M(t.getVelocity());
|
|
@@ -3427,7 +3433,7 @@ var Vn = class extends k {
|
|
|
3427
3433
|
this.#v(this.state.wantsStance);
|
|
3428
3434
|
let e = this.#c;
|
|
3429
3435
|
if (this.stanceFits(this.state.wantsStance)) e = this.state.wantsStance;
|
|
3430
|
-
else for (let t of
|
|
3436
|
+
else for (let t of Vn(this.state.stances)) if (this.#_(this.state.stances[t]) && this.stanceFits(t)) {
|
|
3431
3437
|
e = t;
|
|
3432
3438
|
break;
|
|
3433
3439
|
}
|
|
@@ -3525,7 +3531,7 @@ var Vn = class extends k {
|
|
|
3525
3531
|
return t;
|
|
3526
3532
|
}
|
|
3527
3533
|
#R() {
|
|
3528
|
-
let e =
|
|
3534
|
+
let e = Vn(this.state.stances);
|
|
3529
3535
|
if (e.length === 0) throw Error(`CharacterControllerBehavior: entity "${this.entity.id}" has no stances to be in, and a character is always in one.`);
|
|
3530
3536
|
return e[0];
|
|
3531
3537
|
}
|
|
@@ -3543,7 +3549,7 @@ var Vn = class extends k {
|
|
|
3543
3549
|
if (this.#e === void 0) throw Error(`CharacterControllerBehavior: entity "${this.entity.id}" has no capsule to answer for.`);
|
|
3544
3550
|
return this.#e;
|
|
3545
3551
|
}
|
|
3546
|
-
},
|
|
3552
|
+
}, Un = class {
|
|
3547
3553
|
#e;
|
|
3548
3554
|
#t;
|
|
3549
3555
|
#n;
|
|
@@ -3571,24 +3577,24 @@ var Vn = class extends k {
|
|
|
3571
3577
|
};
|
|
3572
3578
|
//#endregion
|
|
3573
3579
|
//#region src/input/configuration.ts
|
|
3574
|
-
function
|
|
3580
|
+
function Wn(e, t, n) {
|
|
3575
3581
|
return {
|
|
3576
3582
|
actions: [...e],
|
|
3577
3583
|
bindings: t.map((e) => e.toDefinition()),
|
|
3578
3584
|
contexts: [...n]
|
|
3579
3585
|
};
|
|
3580
3586
|
}
|
|
3581
|
-
function
|
|
3587
|
+
function Gn(e, t, n) {
|
|
3582
3588
|
for (let n of e.actions) t.register(n);
|
|
3583
3589
|
for (let t of e.contexts) n.registerContext(t.name, t.exclusive);
|
|
3584
3590
|
return [...e.bindings];
|
|
3585
3591
|
}
|
|
3586
3592
|
//#endregion
|
|
3587
3593
|
//#region src/sage.ts
|
|
3588
|
-
async function
|
|
3594
|
+
async function Kn(e, t, n = {}) {
|
|
3589
3595
|
let r = new U(n.logLevel || "debug"), i = r.getLogger("SAGE");
|
|
3590
3596
|
i.info(`Initializing SAGE Game Engine v${j}...`), i.debug("Creating rendering engine...");
|
|
3591
|
-
let a = await
|
|
3597
|
+
let a = await bn(e, {
|
|
3592
3598
|
antialias: !0,
|
|
3593
3599
|
adaptToDeviceRatio: !0,
|
|
3594
3600
|
enableAllFeatures: !0,
|
|
@@ -3623,7 +3629,7 @@ async function Gn(e, t, n = {}) {
|
|
|
3623
3629
|
typeof n.debug == "object" && n.debug.namespace !== void 0 && (e = n.debug.namespace), v = new He(e);
|
|
3624
3630
|
}
|
|
3625
3631
|
i.debug("Creating game timer...");
|
|
3626
|
-
let y = new
|
|
3632
|
+
let y = new xn();
|
|
3627
3633
|
d.registerFrameCallback((e) => y.tick(e * 1e3)), i.info(`SAGE Game Engine v${j} initialized successfully.`);
|
|
3628
3634
|
let b = new Ue(e, a, o, r, y, ee, {
|
|
3629
3635
|
sceneEngine: s,
|
|
@@ -3642,9 +3648,9 @@ async function Gn(e, t, n = {}) {
|
|
|
3642
3648
|
v?.expose(e, t);
|
|
3643
3649
|
}
|
|
3644
3650
|
});
|
|
3645
|
-
return l.$setGameEngine(b), d.$setGameEngine(b), u.$setGameEngine(b), v &&
|
|
3651
|
+
return l.$setGameEngine(b), d.$setGameEngine(b), u.$setGameEngine(b), v && Cn(v, b), b;
|
|
3646
3652
|
}
|
|
3647
3653
|
//#endregion
|
|
3648
|
-
export { ht as ActionContextRegistry, gt as ActionRegistry, pt as AssetManager, lt as AudioEngine, dn as AudioManager, an as BUILT_IN_PROPERTIES, xe as Behavior,
|
|
3654
|
+
export { ht as ActionContextRegistry, gt as ActionRegistry, pt as AssetManager, lt as AudioEngine, dn as AudioManager, an as BUILT_IN_PROPERTIES, xe as Behavior, Hn as CharacterControllerBehavior, mn as ColliderDebugManager, at as ConsoleBackend, He as DebugConsole, Ot as DeltaBinding, Se as EventBus, Ue as GameEngine, we as GameEntity, ln as GameLevel, mt as GameManager, Ee as GameRandom, De as GameSimulation, xn as GameTimer, yt as GamepadReader, Rn as HavokPhysicsBodyBehavior, Un as InputCapture, Lt as InputManager, bt as KeyboardReader, sn as Level, un as LevelManager, wn as LogLevels, U as LoggingUtility, xt as MouseReader, ke as NamedBehavior, B as NodeEntity, ct as NodePool, ot as NodeSimulation, V as NullBackend, cn as OutlineManager, K as ROUTING_LOOP_SENDER_ID, H as SAGELogger, dt as SceneEngine, pn as SimulationSaveManager, jn as SoundBehavior, je as StateMachineBehavior, Et as ToggleBinding, Tt as TriggerBinding, j as VERSION, Dt as ValueBinding, Bt as applyPostProcessing, An as buildStandardMeshSource, J as computeHierarchyBounds, Kn as createGameEngine, En as defineEntity, Me as defineStates, _t as deliverAction, Ne as dilationLimit, Pe as drainPassLimit, Wn as exportConfiguration, qe as getCanonicalTransform, Gn as importConfiguration, A as isBrowser, Fe as operationCallDepthLimit, st as poolSizeLimit, wt as readerFor, on as registerAllPropertyHandlers, Cn as registerBuiltins, Yt as registerColliderHandler, Zt as registerLodHandler, Qt as registerOcclusionHandler, en as registerSoundHandler, nn as registerTriggerHandler, rn as registerVisibleHandler, kt as resolveBinding, G as schemeOf, P as toQuatObject, F as toQuaternion, M as toVec3Object, N as toVector3 };
|
|
3649
3655
|
|
|
3650
3656
|
//# sourceMappingURL=sage.es.js.map
|