@kvyverse/world-runtime 0.6.1 → 0.6.3
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.md +2 -2
- package/dist/{BallCollider-DdxrnexK.js → BallCollider-3L5vOrcL.js} +3 -3
- package/dist/{CapsuleCollider-XlGZqg_O.js → CapsuleCollider-CBTsR-Ys.js} +3 -3
- package/dist/{ChatModule-DzNY_v-3.js → ChatModule-2tiWS_Yr.js} +4 -4
- package/dist/{Collider-ElnvKET2.js → Collider-CPUCG3RA.js} +2 -2
- package/dist/{ConeCollider-CQfGphDa.js → ConeCollider-C3XU3Y9X.js} +3 -3
- package/dist/{ConvexMeshCollider-0Q2u7QAL.js → ConvexMeshCollider-DzNV4HTO.js} +2 -2
- package/dist/{CuboidCollider-Cm7kKRMA.js → CuboidCollider-Dp1DZoFM.js} +2 -2
- package/dist/{CylinderCollider-P2oZeEyb.js → CylinderCollider-C0h_nhB5.js} +3 -3
- package/dist/{FpsCameraController-CuYDbMHJ.js → FpsCameraController-2GNWJM5D.js} +1 -1
- package/dist/{MeshInstansing-CSd1gjpu.js → MeshInstansing-Bxij0Yc9.js} +1 -1
- package/dist/{PointerLockCameraControls-Cq0m2NLS.js → PointerLockCameraControls-DIK3cVmo.js} +1 -1
- package/dist/{RapierDebugRenderer-BSsFENi2.js → RapierDebugRenderer-BQy_m-3C.js} +1 -1
- package/dist/{RapierFpsPlayerController-By_mnB5m.js → RapierFpsPlayerController-DthD8dw9.js} +1 -1
- package/dist/{RapierPhysics-C22OXUaE.js → RapierPhysics-yrsRPFS3.js} +3 -3
- package/dist/{Rigidbody-BHRxJKXd.js → Rigidbody-DLhN8ddv.js} +1 -1
- package/dist/{ScalingToFro-CmXQHfR5.js → ScalingToFro-BD-E5-uR.js} +1 -1
- package/dist/{SightInteractableArea-C7xBqoQo.js → SightInteractableArea-DrqyB41W.js} +1 -1
- package/dist/{SimpleWASDMovement-BYu0AFeG.js → SimpleWASDMovement-C2m53YYH.js} +1 -1
- package/dist/{Spinning-DDhlLF3g.js → Spinning-sgUhHld8.js} +1 -1
- package/dist/{StartAnimation-BbY1HgSj.js → StartAnimation-B9eomOS2.js} +1 -1
- package/dist/{TrimeshCollider-CGirnNOf.js → TrimeshCollider-7dIs_xtZ.js} +1 -1
- package/dist/addons/lib-registry.d.ts +2 -1
- package/dist/{chat.module-descriptor-BMy5jpOU.js → chat.module-descriptor-BTsep-Kq.js} +3 -3
- package/dist/{get-scale-from-obj-bFMquHMV.js → get-scale-from-obj-B7JlVPni.js} +1 -1
- package/dist/index.js +65 -65
- package/dist/{lib-registry-B-NnzKUx.js → lib-registry-CPwXvdYs.js} +8 -1
- package/dist/modules/optional-module-descriptor.d.ts +7 -0
- package/dist/version.gen.d.ts +1 -1
- package/package.json +3 -3
package/LICENSE.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Kvyverse World Runtime License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2026
|
|
3
|
+
Copyright (c) 2026 Kvyverse, Inc. All rights reserved.
|
|
4
4
|
|
|
5
5
|
This package (`@kvyverse/world-runtime`, the "Software") is proprietary
|
|
6
6
|
software. It is **not** open source.
|
|
@@ -54,4 +54,4 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
54
54
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
55
55
|
SOFTWARE.
|
|
56
56
|
|
|
57
|
-
For other licensing needs, contact:
|
|
57
|
+
For other licensing needs, contact: legal@kvyverse.com
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as getRadiusScale } from "./get-scale-from-obj-
|
|
2
|
-
import { t as Collider } from "./Collider-
|
|
3
|
-
//#region src/behaviours/physics/BallCollider.ts
|
|
1
|
+
import { n as getRadiusScale } from "./get-scale-from-obj-B7JlVPni.js";
|
|
2
|
+
import { t as Collider } from "./Collider-CPUCG3RA.js";
|
|
3
|
+
//#region packages/world-runtime/src/behaviours/physics/BallCollider.ts
|
|
4
4
|
var BallCollider = class extends Collider {
|
|
5
5
|
type = "Ball";
|
|
6
6
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as getHalfheightRadiusScale } from "./get-scale-from-obj-
|
|
2
|
-
import { t as Collider } from "./Collider-
|
|
3
|
-
//#region src/behaviours/physics/CapsuleCollider.ts
|
|
1
|
+
import { t as getHalfheightRadiusScale } from "./get-scale-from-obj-B7JlVPni.js";
|
|
2
|
+
import { t as Collider } from "./Collider-CPUCG3RA.js";
|
|
3
|
+
//#region packages/world-runtime/src/behaviours/physics/CapsuleCollider.ts
|
|
4
4
|
var CapsuleCollider = class extends Collider {
|
|
5
5
|
type = "Capsule";
|
|
6
6
|
/**
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { t as CHAT_COMMAND_KEY } from "./chat.module-descriptor-
|
|
1
|
+
import { t as CHAT_COMMAND_KEY } from "./chat.module-descriptor-BTsep-Kq.js";
|
|
2
2
|
import { ContextModule, ThreeContextEvents } from "three-start";
|
|
3
3
|
import van from "vanjs-core";
|
|
4
|
-
//#region src/modules/chat/chat.css?inline
|
|
4
|
+
//#region packages/world-runtime/src/modules/chat/chat.css?inline
|
|
5
5
|
var chat_default = "/* Neutral base for the chat input: only what it breaks without on real devices.\n Looks are left to the world. */\n\n.kvy-chat {\n position: absolute;\n left: 0;\n bottom: 0;\n width: 100%;\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n /* On-screen keyboard: ChatDom writes the overlap height here. */\n padding-bottom: var(--kvy-chat-keyboard-inset, 0px);\n /* Click-through like the HUD around it: the root stretches over the whole feed,\n so catching events here would kill clicks on the world behind the messages.\n Only the input takes events back. */\n pointer-events: none;\n}\n\n.kvy-chat__form {\n display: flex;\n margin: 0;\n}\n\n.kvy-chat__input {\n flex: 1 1 auto;\n min-width: 0;\n /* 16px — below that iOS Safari zooms the page on focus. */\n font: inherit;\n font-size: 16px;\n line-height: 1.25;\n color: inherit;\n background: transparent;\n border: 0;\n outline: none;\n padding: 4px 6px;\n -webkit-appearance: none;\n appearance: none;\n border-radius: 0;\n /* The one interactive part of the chat. */\n pointer-events: auto;\n /* No 300ms delay and no double-tap zoom on the input. */\n touch-action: manipulation;\n}\n\n/* The message feed is a TTL queue, not a scroll container. It sticks to the\n bottom and extra lines are cut from the top — no scrollbar here by design. */\n.kvy-chat__feed {\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n max-height: 40vh;\n overflow: hidden;\n /* Belt and braces: the root is already click-through, but a world restyling it\n must not accidentally make messages catch clicks. */\n pointer-events: none;\n}\n\n.kvy-chat__line {\n opacity: 1;\n transition: opacity 300ms ease;\n overflow-wrap: anywhere;\n}\n\n/* The line has outlived its time: it fades but stays in the DOM — opening the\n chat shows it again instead of rebuilding the feed. */\n.kvy-chat__line--faded {\n opacity: 0;\n}\n\n/* Hidden submit button: backs up implicit submission in old webviews. */\n.kvy-chat__submit {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n border: 0;\n}\n\n/* Toggle mode: the input is hidden until entered (Enter on the canvas).\n Opacity, not visibility/display: an element hidden by those cannot be focused\n programmatically, leaving nothing to open the chat with. */\n.kvy-chat--idle-hidden .kvy-chat__input {\n opacity: 0;\n pointer-events: none;\n}\n";
|
|
6
6
|
//#endregion
|
|
7
|
-
//#region src/modules/chat/ChatDom.ts
|
|
7
|
+
//#region packages/world-runtime/src/modules/chat/ChatDom.ts
|
|
8
8
|
var { button, div, form, input } = van.tags;
|
|
9
9
|
var STYLE_ID = "kvyverse-chat-styles";
|
|
10
10
|
/**
|
|
@@ -299,7 +299,7 @@ var ChatDom = class ChatDom {
|
|
|
299
299
|
}
|
|
300
300
|
};
|
|
301
301
|
//#endregion
|
|
302
|
-
//#region src/modules/chat/ChatModule.ts
|
|
302
|
+
//#region packages/world-runtime/src/modules/chat/ChatModule.ts
|
|
303
303
|
/**
|
|
304
304
|
* The world chat as a pluggable ctx module: message history plus its own DOM
|
|
305
305
|
* input (`dom`), no React. Enabled from `settings.addons.json → modules`; it
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as Rigidbody } from "./Rigidbody-
|
|
1
|
+
import { t as Rigidbody } from "./Rigidbody-DLhN8ddv.js";
|
|
2
2
|
import * as THREE from "three/webgpu";
|
|
3
3
|
import { Object3DBehaviour, assertDefined, getComponents } from "three-start";
|
|
4
|
-
//#region src/behaviours/physics/Collider.ts
|
|
4
|
+
//#region packages/world-runtime/src/behaviours/physics/Collider.ts
|
|
5
5
|
/** Walk the parent chain (ancestors only); stop when `cb` returns `false`. */
|
|
6
6
|
function traverseUp(obj, cb) {
|
|
7
7
|
let cur = obj.parent;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as getHalfheightRadiusScale } from "./get-scale-from-obj-
|
|
2
|
-
import { t as Collider } from "./Collider-
|
|
3
|
-
//#region src/behaviours/physics/ConeCollider.ts
|
|
1
|
+
import { t as getHalfheightRadiusScale } from "./get-scale-from-obj-B7JlVPni.js";
|
|
2
|
+
import { t as Collider } from "./Collider-CPUCG3RA.js";
|
|
3
|
+
//#region packages/world-runtime/src/behaviours/physics/ConeCollider.ts
|
|
4
4
|
var ConeCollider = class extends Collider {
|
|
5
5
|
type = "Cone";
|
|
6
6
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as Collider } from "./Collider-
|
|
2
|
-
//#region src/behaviours/physics/ConvexMeshCollider.ts
|
|
1
|
+
import { t as Collider } from "./Collider-CPUCG3RA.js";
|
|
2
|
+
//#region packages/world-runtime/src/behaviours/physics/ConvexMeshCollider.ts
|
|
3
3
|
var ConvexMeshCollider = class extends Collider {
|
|
4
4
|
type = "Convex";
|
|
5
5
|
getDesc(rapier) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as Collider } from "./Collider-
|
|
2
|
-
//#region src/behaviours/physics/CuboidCollider.ts
|
|
1
|
+
import { t as Collider } from "./Collider-CPUCG3RA.js";
|
|
2
|
+
//#region packages/world-runtime/src/behaviours/physics/CuboidCollider.ts
|
|
3
3
|
var CuboidCollider = class extends Collider {
|
|
4
4
|
type = "Cuboid";
|
|
5
5
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as getHalfheightRadiusScale } from "./get-scale-from-obj-
|
|
2
|
-
import { t as Collider } from "./Collider-
|
|
3
|
-
//#region src/behaviours/physics/CylinderCollider.ts
|
|
1
|
+
import { t as getHalfheightRadiusScale } from "./get-scale-from-obj-B7JlVPni.js";
|
|
2
|
+
import { t as Collider } from "./Collider-CPUCG3RA.js";
|
|
3
|
+
//#region packages/world-runtime/src/behaviours/physics/CylinderCollider.ts
|
|
4
4
|
var CylinderCollider = class extends Collider {
|
|
5
5
|
type = "Cylinder";
|
|
6
6
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Object3DBehaviour } from "three-start";
|
|
2
|
-
//#region src/behaviours/controls/FpsCameraController.ts
|
|
2
|
+
//#region packages/world-runtime/src/behaviours/controls/FpsCameraController.ts
|
|
3
3
|
var FpsCameraController = class extends Object3DBehaviour {
|
|
4
4
|
sensitivity = .002;
|
|
5
5
|
mobileSensitivity = .006;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as THREE from "three/webgpu";
|
|
2
2
|
import { Object3DBehaviour } from "three-start";
|
|
3
|
-
//#region src/behaviours/utils/MeshInstansing.ts
|
|
3
|
+
//#region packages/world-runtime/src/behaviours/utils/MeshInstansing.ts
|
|
4
4
|
var MeshInstansing = class MeshInstansing extends Object3DBehaviour {
|
|
5
5
|
static _totalInstance = 0;
|
|
6
6
|
geometry = null;
|
package/dist/{PointerLockCameraControls-Cq0m2NLS.js → PointerLockCameraControls-DIK3cVmo.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as THREE from "three/webgpu";
|
|
2
2
|
import { Object3DBehaviour } from "three-start";
|
|
3
|
-
//#region src/behaviours/controls/PointerLockCameraControls.ts
|
|
3
|
+
//#region packages/world-runtime/src/behaviours/controls/PointerLockCameraControls.ts
|
|
4
4
|
var _euler = new THREE.Euler(0, 0, 0, "YXZ");
|
|
5
5
|
var _vector = new THREE.Vector3();
|
|
6
6
|
var _MOUSE_SENSITIVITY = .002;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as THREE from "three/webgpu";
|
|
2
|
-
//#region src/modules/physics/RapierDebugRenderer.ts
|
|
2
|
+
//#region packages/world-runtime/src/modules/physics/RapierDebugRenderer.ts
|
|
3
3
|
/**
|
|
4
4
|
* Draws rapier colliders as lines. Not a ctx module: it lives inside
|
|
5
5
|
* `RapierPhysics` (`enableDebug`/`disableDebug`) and is pulled dynamically —
|
package/dist/{RapierFpsPlayerController-By_mnB5m.js → RapierFpsPlayerController-DthD8dw9.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as THREE from "three/webgpu";
|
|
2
2
|
import { Object3DBehaviour } from "three-start";
|
|
3
|
-
//#region src/behaviours/physics/RapierFpsPlayerController.ts
|
|
3
|
+
//#region packages/world-runtime/src/behaviours/physics/RapierFpsPlayerController.ts
|
|
4
4
|
var RapierFpsPlayerController = class extends Object3DBehaviour {
|
|
5
5
|
halfHeight = .85;
|
|
6
6
|
radius = .5;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as LibId } from "./lib-registry-
|
|
1
|
+
import { a as LibId } from "./lib-registry-CPwXvdYs.js";
|
|
2
2
|
import { ContextModule, ThreeContextEvents, defineProps, readOnly } from "three-start";
|
|
3
|
-
//#region src/modules/physics/RapierPhysics.ts
|
|
3
|
+
//#region packages/world-runtime/src/modules/physics/RapierPhysics.ts
|
|
4
4
|
var RapierPhysics = class RapierPhysics extends ContextModule {
|
|
5
5
|
isRapierPhysics;
|
|
6
6
|
api;
|
|
@@ -53,7 +53,7 @@ var RapierPhysics = class RapierPhysics extends ContextModule {
|
|
|
53
53
|
}
|
|
54
54
|
/** Turn on collider debug drawing; the renderer is fetched on demand. */
|
|
55
55
|
async enableDebug() {
|
|
56
|
-
this._debug ??= new (await (import("./RapierDebugRenderer-
|
|
56
|
+
this._debug ??= new (await (import("./RapierDebugRenderer-BQy_m-3C.js"))).RapierDebugRenderer(this.ctx, this);
|
|
57
57
|
this._debug.start();
|
|
58
58
|
}
|
|
59
59
|
disableDebug() {
|
|
@@ -12,7 +12,7 @@ var __exportAll = (all, no_symbols) => {
|
|
|
12
12
|
return target;
|
|
13
13
|
};
|
|
14
14
|
//#endregion
|
|
15
|
-
//#region src/behaviours/physics/Rigidbody.ts
|
|
15
|
+
//#region packages/world-runtime/src/behaviours/physics/Rigidbody.ts
|
|
16
16
|
var Rigidbody_exports = /* @__PURE__ */ __exportAll({ default: () => Rigidbody });
|
|
17
17
|
/**
|
|
18
18
|
* @see {@link https://github.com/vladkrutenyuk/three-kvy-core/blob/main/src/addons/Rigidbody.ts | Source}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as THREE from "three/webgpu";
|
|
2
2
|
import { Object3DBehaviour } from "three-start";
|
|
3
|
-
//#region src/behaviours/player/SightInteractableArea.ts
|
|
3
|
+
//#region packages/world-runtime/src/behaviours/player/SightInteractableArea.ts
|
|
4
4
|
var raycaster = new THREE.Raycaster();
|
|
5
5
|
var SightInteractableArea = class SightInteractableArea extends Object3DBehaviour {
|
|
6
6
|
static _CURRENT = null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Object3DBehaviour } from "three-start";
|
|
2
|
-
//#region src/behaviours/controls/SimpleWASDMovement.ts
|
|
2
|
+
//#region packages/world-runtime/src/behaviours/controls/SimpleWASDMovement.ts
|
|
3
3
|
var SimpleWASDMovement = class extends Object3DBehaviour {
|
|
4
4
|
speed = 4;
|
|
5
5
|
onBeforeRender() {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as THREE from "three/webgpu";
|
|
2
2
|
import { Object3DBehaviour } from "three-start";
|
|
3
|
-
//#region src/behaviours/animation/StartAnimation.ts
|
|
3
|
+
//#region packages/world-runtime/src/behaviours/animation/StartAnimation.ts
|
|
4
4
|
var StartAnimation = class extends Object3DBehaviour {
|
|
5
5
|
mixer;
|
|
6
6
|
_action;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region src/modules/optional-module-descriptor.ts
|
|
1
|
+
//#region packages/world-runtime/src/modules/optional-module-descriptor.ts
|
|
2
2
|
/**
|
|
3
3
|
* Keys of the pluggable modules — the same keys as in
|
|
4
4
|
* `settings.addons.json → modules`. Core modules (`addons`/`env`/`html`/`input`/
|
|
@@ -11,7 +11,7 @@ var OptionalModuleId = /* @__PURE__ */ function(OptionalModuleId) {
|
|
|
11
11
|
}({});
|
|
12
12
|
var OPTIONAL_MODULE_IDS = Object.values(OptionalModuleId);
|
|
13
13
|
//#endregion
|
|
14
|
-
//#region src/modules/chat/chat.module-descriptor.ts
|
|
14
|
+
//#region packages/world-runtime/src/modules/chat/chat.module-descriptor.ts
|
|
15
15
|
/** `Slash` opens the chat with a "/" already typed — the Minecraft command gesture. */
|
|
16
16
|
var CHAT_COMMAND_KEY = "Slash";
|
|
17
17
|
var CHAT_INPUT_MODES = ["always", "toggle"];
|
|
@@ -49,7 +49,7 @@ var chatModuleDescriptor = {
|
|
|
49
49
|
normalize: (raw) => normalizeChat(raw),
|
|
50
50
|
defaultConfig: () => ({ ...DEFAULTS }),
|
|
51
51
|
create: async (config) => {
|
|
52
|
-
const { ChatModule } = await import("./ChatModule-
|
|
52
|
+
const { ChatModule } = await import("./ChatModule-2tiWS_Yr.js");
|
|
53
53
|
return new ChatModule(config);
|
|
54
54
|
},
|
|
55
55
|
schema: {
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as OPTIONAL_MODULE_IDS, i as normalizeChat, n as CHAT_INPUT_MODES, o as OptionalModuleId, r as chatModuleDescriptor } from "./chat.module-descriptor-
|
|
2
|
-
import { a as LibId, c as libByRequireKey, i as LIB_IDS, n as LIBS, o as OPTIONAL_LIB_DESCRIPTORS, r as LIB_DESCRIPTORS, s as OPTIONAL_LIB_IDS, t as BUILTIN_LIB_DESCRIPTORS } from "./lib-registry-
|
|
3
|
-
import { n as getRadiusScale, t as getHalfheightRadiusScale } from "./get-scale-from-obj-
|
|
1
|
+
import { a as OPTIONAL_MODULE_IDS, i as normalizeChat, n as CHAT_INPUT_MODES, o as OptionalModuleId, r as chatModuleDescriptor } from "./chat.module-descriptor-BTsep-Kq.js";
|
|
2
|
+
import { a as LibId, c as libByRequireKey, i as LIB_IDS, n as LIBS, o as OPTIONAL_LIB_DESCRIPTORS, r as LIB_DESCRIPTORS, s as OPTIONAL_LIB_IDS, t as BUILTIN_LIB_DESCRIPTORS } from "./lib-registry-CPwXvdYs.js";
|
|
3
|
+
import { n as getRadiusScale, t as getHalfheightRadiusScale } from "./get-scale-from-obj-B7JlVPni.js";
|
|
4
4
|
import * as THREE from "three/webgpu";
|
|
5
5
|
import { BufferGeometryLoader, LoadingManager, TextureLoader } from "three/webgpu";
|
|
6
6
|
import * as ThreeStartNS from "three-start";
|
|
@@ -15,7 +15,7 @@ import { clone } from "three/examples/jsm/utils/SkeletonUtils.js";
|
|
|
15
15
|
import EventEmitter from "eventemitter3";
|
|
16
16
|
import * as nanostores from "nanostores";
|
|
17
17
|
import { atom } from "nanostores";
|
|
18
|
-
//#region src/world-events.ts
|
|
18
|
+
//#region packages/world-runtime/src/world-events.ts
|
|
19
19
|
/**
|
|
20
20
|
* World lifecycle events, emitted on `game.emitter` (`world.events` in scripts)
|
|
21
21
|
* during classic-load. The entry script runs BEFORE them (step 9) — subscriptions
|
|
@@ -31,7 +31,7 @@ var WorldEvent = /* @__PURE__ */ function(WorldEvent) {
|
|
|
31
31
|
return WorldEvent;
|
|
32
32
|
}({});
|
|
33
33
|
//#endregion
|
|
34
|
-
//#region src/World.ts
|
|
34
|
+
//#region packages/world-runtime/src/World.ts
|
|
35
35
|
/**
|
|
36
36
|
* A loaded world is a three-start app with the scene already assembled.
|
|
37
37
|
* Mounting and starting are manual: `mount(container)` attaches the canvas and
|
|
@@ -66,7 +66,7 @@ var World = class extends ThreeStart {
|
|
|
66
66
|
}
|
|
67
67
|
};
|
|
68
68
|
//#endregion
|
|
69
|
-
//#region src/utils/lazy.ts
|
|
69
|
+
//#region packages/world-runtime/src/utils/lazy.ts
|
|
70
70
|
/**
|
|
71
71
|
* Object that forwards every access to `resolve()`. For script globals that are
|
|
72
72
|
* shortcuts into something created later (`modules` → `ctx.modules`): the script
|
|
@@ -100,7 +100,7 @@ function lazy(factory) {
|
|
|
100
100
|
} };
|
|
101
101
|
}
|
|
102
102
|
//#endregion
|
|
103
|
-
//#region src/resources/loaders.ts
|
|
103
|
+
//#region packages/world-runtime/src/resources/loaders.ts
|
|
104
104
|
var LOADING_MANAGER = new LoadingManager();
|
|
105
105
|
LOADING_MANAGER.onError = (url) => {
|
|
106
106
|
console.error(`Loading asset failed: ${url}`);
|
|
@@ -174,7 +174,7 @@ var AssetLoaders = {
|
|
|
174
174
|
})
|
|
175
175
|
};
|
|
176
176
|
//#endregion
|
|
177
|
-
//#region src/rendering/renderer-apply.ts
|
|
177
|
+
//#region packages/world-runtime/src/rendering/renderer-apply.ts
|
|
178
178
|
var SHADOW_MAP_TYPES$1 = {
|
|
179
179
|
Basic: THREE.BasicShadowMap,
|
|
180
180
|
PCF: THREE.PCFShadowMap,
|
|
@@ -210,7 +210,7 @@ function applyRendererConfig(renderer, cfg) {
|
|
|
210
210
|
renderer.setPixelRatio(window.devicePixelRatio * pixelResolution);
|
|
211
211
|
}
|
|
212
212
|
//#endregion
|
|
213
|
-
//#region src/rendering/SceneBloom.ts
|
|
213
|
+
//#region packages/world-runtime/src/rendering/SceneBloom.ts
|
|
214
214
|
/** BloomNode loads as a chunk only when bloom is enabled. */
|
|
215
215
|
var lazyBloomModule = lazy(() => import("three/addons/tsl/display/BloomNode.js"));
|
|
216
216
|
/**
|
|
@@ -296,7 +296,7 @@ function finiteOr(value, fallback) {
|
|
|
296
296
|
return typeof value === "number" && Number.isFinite(value) ? value : fallback;
|
|
297
297
|
}
|
|
298
298
|
//#endregion
|
|
299
|
-
//#region src/modules/controls/KeyboardControlsDriver.ts
|
|
299
|
+
//#region packages/world-runtime/src/modules/controls/KeyboardControlsDriver.ts
|
|
300
300
|
/** A diagonal must not be faster than a straight line. */
|
|
301
301
|
var DIAGONAL = Math.SQRT1_2;
|
|
302
302
|
/**
|
|
@@ -328,7 +328,7 @@ var KeyboardControlsDriver = class {
|
|
|
328
328
|
}
|
|
329
329
|
};
|
|
330
330
|
//#endregion
|
|
331
|
-
//#region src/modules/controls/ControlsModule.ts
|
|
331
|
+
//#region packages/world-runtime/src/modules/controls/ControlsModule.ts
|
|
332
332
|
/**
|
|
333
333
|
* The player's movement intent — what they want to do, whatever the hardware is.
|
|
334
334
|
* Input sources register as drivers (`addDriver`); the module polls them once a
|
|
@@ -441,8 +441,8 @@ var ControlsModule = class extends ContextModule {
|
|
|
441
441
|
}
|
|
442
442
|
};
|
|
443
443
|
//#endregion
|
|
444
|
-
//#region src/behaviours/physics/_required-patch.ts
|
|
445
|
-
var lazyRapierPhysicsModule = lazy(async () => (await import("./RapierPhysics-
|
|
444
|
+
//#region packages/world-runtime/src/behaviours/physics/_required-patch.ts
|
|
445
|
+
var lazyRapierPhysicsModule = lazy(async () => (await import("./RapierPhysics-yrsRPFS3.js")).default);
|
|
446
446
|
/** The only place the physics module is created — called by the registry
|
|
447
447
|
* descriptor. The module itself takes rapier from `ctx.modules.addons` on awake. */
|
|
448
448
|
async function createRapierPhysicsModule(config) {
|
|
@@ -468,7 +468,7 @@ async function applyRapierPhysicsPatch(starter) {
|
|
|
468
468
|
starter.addModules({ rapier: module });
|
|
469
469
|
}
|
|
470
470
|
//#endregion
|
|
471
|
-
//#region src/modules/physics/physics.module-descriptor.ts
|
|
471
|
+
//#region packages/world-runtime/src/modules/physics/physics.module-descriptor.ts
|
|
472
472
|
var PHYSICS_ENGINES = ["rapier"];
|
|
473
473
|
/** Physics defaults: the rapier engine, debug off. */
|
|
474
474
|
function normalizePhysics(value) {
|
|
@@ -484,6 +484,7 @@ function normalizePhysics(value) {
|
|
|
484
484
|
}
|
|
485
485
|
var physicsModuleDescriptor = {
|
|
486
486
|
id: OptionalModuleId.Physics,
|
|
487
|
+
ctxKey: "rapier",
|
|
487
488
|
normalize: (raw) => normalizePhysics(raw),
|
|
488
489
|
defaultConfig: () => ({
|
|
489
490
|
engine: "rapier",
|
|
@@ -521,7 +522,7 @@ var physicsModuleDescriptor = {
|
|
|
521
522
|
}
|
|
522
523
|
};
|
|
523
524
|
//#endregion
|
|
524
|
-
//#region src/modules/optional-modules.ts
|
|
525
|
+
//#region packages/world-runtime/src/modules/optional-modules.ts
|
|
525
526
|
/**
|
|
526
527
|
* Table of contents for the world's pluggable modules: what can be enabled from
|
|
527
528
|
* `settings.addons.json → modules`. The descriptors themselves live next to
|
|
@@ -538,7 +539,7 @@ function getOptionalModuleDescriptor(id) {
|
|
|
538
539
|
return descriptor;
|
|
539
540
|
}
|
|
540
541
|
//#endregion
|
|
541
|
-
//#region src/modules/is-mobile-device.ts
|
|
542
|
+
//#region packages/world-runtime/src/modules/is-mobile-device.ts
|
|
542
543
|
function isMobileDevice() {
|
|
543
544
|
if (typeof navigator === "undefined" || typeof window === "undefined") return false;
|
|
544
545
|
const ua = navigator.userAgent || navigator.vendor || window.opera;
|
|
@@ -549,7 +550,7 @@ function isMobileDevice() {
|
|
|
549
550
|
return "ontouchstart" in window || navigator.maxTouchPoints && navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0;
|
|
550
551
|
}
|
|
551
552
|
//#endregion
|
|
552
|
-
//#region src/modules/EnvModule.ts
|
|
553
|
+
//#region packages/world-runtime/src/modules/EnvModule.ts
|
|
553
554
|
var EnvModule = class extends ContextModule {
|
|
554
555
|
mode;
|
|
555
556
|
dev;
|
|
@@ -566,7 +567,7 @@ var EnvModule = class extends ContextModule {
|
|
|
566
567
|
}
|
|
567
568
|
};
|
|
568
569
|
//#endregion
|
|
569
|
-
//#region src/modules/HtmlHudModule.ts
|
|
570
|
+
//#region packages/world-runtime/src/modules/HtmlHudModule.ts
|
|
570
571
|
var { div } = van.tags;
|
|
571
572
|
var LAYER_STYLE = "position:fixed;inset:0;pointer-events:none;";
|
|
572
573
|
var HtmlHudModule = class extends ContextModule {
|
|
@@ -622,7 +623,7 @@ var HtmlHudModule = class extends ContextModule {
|
|
|
622
623
|
};
|
|
623
624
|
};
|
|
624
625
|
//#endregion
|
|
625
|
-
//#region src/modules/InputSystemModule.ts
|
|
626
|
+
//#region packages/world-runtime/src/modules/InputSystemModule.ts
|
|
626
627
|
var InputSystemModule = class extends ContextModule {
|
|
627
628
|
_dom;
|
|
628
629
|
_keys = /* @__PURE__ */ new Set();
|
|
@@ -689,7 +690,6 @@ var InputSystemModule = class extends ContextModule {
|
|
|
689
690
|
onAwake() {
|
|
690
691
|
const ctx = this.ctx;
|
|
691
692
|
this._dom = ctx.renderer.domElement;
|
|
692
|
-
this._dom.style.outline = "none";
|
|
693
693
|
window.addEventListener("resize", this.onWindowResize);
|
|
694
694
|
window.addEventListener("scroll", this.onWindowScroll);
|
|
695
695
|
window.addEventListener("blur", this.onBlur);
|
|
@@ -875,7 +875,7 @@ function isUiKeyboardTarget(target) {
|
|
|
875
875
|
}
|
|
876
876
|
}
|
|
877
877
|
//#endregion
|
|
878
|
-
//#region src/modules/SoundsModule.ts
|
|
878
|
+
//#region packages/world-runtime/src/modules/SoundsModule.ts
|
|
879
879
|
var SoundsModule = class extends ContextModule {
|
|
880
880
|
global = Howler;
|
|
881
881
|
/** three-start ContextModule has no onDestroy; teardown is explicit. */
|
|
@@ -884,7 +884,7 @@ var SoundsModule = class extends ContextModule {
|
|
|
884
884
|
}
|
|
885
885
|
};
|
|
886
886
|
//#endregion
|
|
887
|
-
//#region src/modules/UtilsModule.ts
|
|
887
|
+
//#region packages/world-runtime/src/modules/UtilsModule.ts
|
|
888
888
|
var UtilsModule = class extends ContextModule {
|
|
889
889
|
cloneObject3D;
|
|
890
890
|
mergeGeometries;
|
|
@@ -895,7 +895,7 @@ var UtilsModule = class extends ContextModule {
|
|
|
895
895
|
}
|
|
896
896
|
};
|
|
897
897
|
//#endregion
|
|
898
|
-
//#region src/modules/index.ts
|
|
898
|
+
//#region packages/world-runtime/src/modules/index.ts
|
|
899
899
|
/**
|
|
900
900
|
* Assembles the world's ctx modules: core ones always, pluggable ones per config.
|
|
901
901
|
* Pluggable classes are pulled dynamically, so a disabled module never reaches
|
|
@@ -920,7 +920,7 @@ async function createWorldModules(mode = "prod", options) {
|
|
|
920
920
|
const config = descriptor.normalize(options.modules?.[descriptor.id]);
|
|
921
921
|
if (!config) continue;
|
|
922
922
|
try {
|
|
923
|
-
modules[descriptor.id] = await descriptor.create(config);
|
|
923
|
+
modules[descriptor.ctxKey ?? descriptor.id] = await descriptor.create(config);
|
|
924
924
|
} catch (error) {
|
|
925
925
|
console.error(`[modules] failed to create "${descriptor.id}"`, error);
|
|
926
926
|
}
|
|
@@ -928,100 +928,100 @@ async function createWorldModules(mode = "prod", options) {
|
|
|
928
928
|
return modules;
|
|
929
929
|
}
|
|
930
930
|
//#endregion
|
|
931
|
-
//#region src/behaviours/registry.ts
|
|
931
|
+
//#region packages/world-runtime/src/behaviours/registry.ts
|
|
932
932
|
var entries = [
|
|
933
933
|
{
|
|
934
934
|
uuid: "spinning",
|
|
935
935
|
name: "Spinning",
|
|
936
|
-
load: () => loadDefault(import("./Spinning-
|
|
936
|
+
load: () => loadDefault(import("./Spinning-sgUhHld8.js"))
|
|
937
937
|
},
|
|
938
938
|
{
|
|
939
939
|
uuid: "scalingtofro",
|
|
940
940
|
name: "ScalingToFro",
|
|
941
|
-
load: () => loadDefault(import("./ScalingToFro-
|
|
941
|
+
load: () => loadDefault(import("./ScalingToFro-BD-E5-uR.js"))
|
|
942
942
|
},
|
|
943
943
|
{
|
|
944
944
|
uuid: "startanim",
|
|
945
945
|
name: "StartAnimation",
|
|
946
|
-
load: () => loadDefault(import("./StartAnimation-
|
|
946
|
+
load: () => loadDefault(import("./StartAnimation-B9eomOS2.js"))
|
|
947
947
|
},
|
|
948
948
|
{
|
|
949
949
|
uuid: "pointerlockcameracontrols",
|
|
950
950
|
name: "PointerLockCameraController",
|
|
951
|
-
load: () => loadDefault(import("./PointerLockCameraControls-
|
|
951
|
+
load: () => loadDefault(import("./PointerLockCameraControls-DIK3cVmo.js"))
|
|
952
952
|
},
|
|
953
953
|
{
|
|
954
954
|
uuid: "simplewasdmovement",
|
|
955
955
|
name: "SimpleWASDMovement",
|
|
956
|
-
load: () => loadDefault(import("./SimpleWASDMovement-
|
|
956
|
+
load: () => loadDefault(import("./SimpleWASDMovement-C2m53YYH.js"))
|
|
957
957
|
},
|
|
958
958
|
{
|
|
959
959
|
uuid: "fpscameracontroller",
|
|
960
960
|
name: "FpsCameraController",
|
|
961
|
-
load: () => loadDefault(import("./FpsCameraController-
|
|
961
|
+
load: () => loadDefault(import("./FpsCameraController-2GNWJM5D.js"))
|
|
962
962
|
},
|
|
963
963
|
{
|
|
964
964
|
uuid: "sightinteractablearea",
|
|
965
965
|
name: "SightInteractableArea",
|
|
966
|
-
load: () => loadDefault(import("./SightInteractableArea-
|
|
966
|
+
load: () => loadDefault(import("./SightInteractableArea-DrqyB41W.js"))
|
|
967
967
|
},
|
|
968
968
|
{
|
|
969
969
|
uuid: "meshinstansing",
|
|
970
970
|
name: "MeshInstansing",
|
|
971
|
-
load: () => loadDefault(import("./MeshInstansing-
|
|
971
|
+
load: () => loadDefault(import("./MeshInstansing-Bxij0Yc9.js"))
|
|
972
972
|
},
|
|
973
973
|
{
|
|
974
974
|
uuid: "rrb",
|
|
975
975
|
name: "Rigidbody",
|
|
976
|
-
load: () => loadDefault(import("./Rigidbody-
|
|
976
|
+
load: () => loadDefault(import("./Rigidbody-DLhN8ddv.js").then((n) => n.n)),
|
|
977
977
|
requiredPatch: rapierPhysicsPatch
|
|
978
978
|
},
|
|
979
979
|
{
|
|
980
980
|
uuid: "rapierballcol",
|
|
981
981
|
name: "BallCollider",
|
|
982
|
-
load: () => loadDefault(import("./BallCollider-
|
|
982
|
+
load: () => loadDefault(import("./BallCollider-3L5vOrcL.js")),
|
|
983
983
|
requiredPatch: rapierPhysicsPatch
|
|
984
984
|
},
|
|
985
985
|
{
|
|
986
986
|
uuid: "rapiercapscol",
|
|
987
987
|
name: "CapsuleCollider",
|
|
988
|
-
load: () => loadDefault(import("./CapsuleCollider-
|
|
988
|
+
load: () => loadDefault(import("./CapsuleCollider-CBTsR-Ys.js")),
|
|
989
989
|
requiredPatch: rapierPhysicsPatch
|
|
990
990
|
},
|
|
991
991
|
{
|
|
992
992
|
uuid: "rapierconecol",
|
|
993
993
|
name: "ConeCollider",
|
|
994
|
-
load: () => loadDefault(import("./ConeCollider-
|
|
994
|
+
load: () => loadDefault(import("./ConeCollider-C3XU3Y9X.js")),
|
|
995
995
|
requiredPatch: rapierPhysicsPatch
|
|
996
996
|
},
|
|
997
997
|
{
|
|
998
998
|
uuid: "rapierconvxcol",
|
|
999
999
|
name: "ConvexMeshCollider",
|
|
1000
|
-
load: () => loadDefault(import("./ConvexMeshCollider-
|
|
1000
|
+
load: () => loadDefault(import("./ConvexMeshCollider-DzNV4HTO.js")),
|
|
1001
1001
|
requiredPatch: rapierPhysicsPatch
|
|
1002
1002
|
},
|
|
1003
1003
|
{
|
|
1004
1004
|
uuid: "rapiercubcol",
|
|
1005
1005
|
name: "CuboidCollider",
|
|
1006
|
-
load: () => loadDefault(import("./CuboidCollider-
|
|
1006
|
+
load: () => loadDefault(import("./CuboidCollider-Dp1DZoFM.js")),
|
|
1007
1007
|
requiredPatch: rapierPhysicsPatch
|
|
1008
1008
|
},
|
|
1009
1009
|
{
|
|
1010
1010
|
uuid: "rapiercylcol",
|
|
1011
1011
|
name: "CylinderCollider",
|
|
1012
|
-
load: () => loadDefault(import("./CylinderCollider-
|
|
1012
|
+
load: () => loadDefault(import("./CylinderCollider-C0h_nhB5.js")),
|
|
1013
1013
|
requiredPatch: rapierPhysicsPatch
|
|
1014
1014
|
},
|
|
1015
1015
|
{
|
|
1016
1016
|
uuid: "rapiertricol",
|
|
1017
1017
|
name: "TrimeshCollider",
|
|
1018
|
-
load: () => loadDefault(import("./TrimeshCollider-
|
|
1018
|
+
load: () => loadDefault(import("./TrimeshCollider-7dIs_xtZ.js")),
|
|
1019
1019
|
requiredPatch: rapierPhysicsPatch
|
|
1020
1020
|
},
|
|
1021
1021
|
{
|
|
1022
1022
|
uuid: "rapierfpsplayercontroller",
|
|
1023
1023
|
name: "RapierFpsPlayerController",
|
|
1024
|
-
load: () => loadDefault(import("./RapierFpsPlayerController-
|
|
1024
|
+
load: () => loadDefault(import("./RapierFpsPlayerController-DthD8dw9.js")),
|
|
1025
1025
|
requiredPatch: rapierPhysicsPatch
|
|
1026
1026
|
}
|
|
1027
1027
|
];
|
|
@@ -1035,7 +1035,7 @@ async function loadDefault(module) {
|
|
|
1035
1035
|
return (await module).default;
|
|
1036
1036
|
}
|
|
1037
1037
|
//#endregion
|
|
1038
|
-
//#region src/resources/font.ts
|
|
1038
|
+
//#region packages/world-runtime/src/resources/font.ts
|
|
1039
1039
|
var FORMAT_BY_MIME = {
|
|
1040
1040
|
"font/ttf": "truetype",
|
|
1041
1041
|
"font/otf": "opentype",
|
|
@@ -1097,7 +1097,7 @@ function createFont(url, family, mime, name) {
|
|
|
1097
1097
|
return source;
|
|
1098
1098
|
}
|
|
1099
1099
|
//#endregion
|
|
1100
|
-
//#region src/addons/builtin-libs.ts
|
|
1100
|
+
//#region packages/world-runtime/src/addons/builtin-libs.ts
|
|
1101
1101
|
/**
|
|
1102
1102
|
* Libraries the runtime bundles itself: `require("<key>")` hands these back in
|
|
1103
1103
|
* every world, no config and no importer involved. Metadata (keys, labels) is
|
|
@@ -1124,7 +1124,7 @@ var BUILTIN_GLOBALS = {
|
|
|
1124
1124
|
van
|
|
1125
1125
|
};
|
|
1126
1126
|
//#endregion
|
|
1127
|
-
//#region src/addons/required-libs.ts
|
|
1127
|
+
//#region packages/world-runtime/src/addons/required-libs.ts
|
|
1128
1128
|
/**
|
|
1129
1129
|
* Libs the world needs beyond what `libs` lists: an enabled module or a built-in
|
|
1130
1130
|
* behaviour on the scene declares them itself (`requiredLibs`), so physics keeps
|
|
@@ -1147,7 +1147,7 @@ function collectRequiredLibs(addons, usedBuiltinUuids = []) {
|
|
|
1147
1147
|
return [...required];
|
|
1148
1148
|
}
|
|
1149
1149
|
//#endregion
|
|
1150
|
-
//#region src/addons/AddonsRuntime.ts
|
|
1150
|
+
//#region packages/world-runtime/src/addons/AddonsRuntime.ts
|
|
1151
1151
|
/**
|
|
1152
1152
|
* External dependencies of the world: libs and external scripts. Built-in libs
|
|
1153
1153
|
* are registered right away (the runtime bundles them), optional ones are loaded
|
|
@@ -1254,7 +1254,7 @@ function unwrapLib(id, module) {
|
|
|
1254
1254
|
return module.default ?? module;
|
|
1255
1255
|
}
|
|
1256
1256
|
//#endregion
|
|
1257
|
-
//#region src/world-stores.ts
|
|
1257
|
+
//#region packages/world-runtime/src/world-stores.ts
|
|
1258
1258
|
/**
|
|
1259
1259
|
* Shared reactive key-value state of a world (`world.stores` in scripts) — the
|
|
1260
1260
|
* state counterpart of the `world.events` bus. Stores are created lazily on
|
|
@@ -1315,7 +1315,7 @@ var WorldStores = class {
|
|
|
1315
1315
|
}
|
|
1316
1316
|
};
|
|
1317
1317
|
//#endregion
|
|
1318
|
-
//#region src/WorldRuntime.ts
|
|
1318
|
+
//#region packages/world-runtime/src/WorldRuntime.ts
|
|
1319
1319
|
/**
|
|
1320
1320
|
* Owner of the world's runtime state: assets, script execution, ctx access.
|
|
1321
1321
|
* The only object the generated code receives.
|
|
@@ -1577,10 +1577,10 @@ function isAbsoluteUrl(url) {
|
|
|
1577
1577
|
return /^(?:[a-z]+:)?\/\//i.test(url) || url.startsWith("data:");
|
|
1578
1578
|
}
|
|
1579
1579
|
//#endregion
|
|
1580
|
-
//#region src/version.gen.ts
|
|
1581
|
-
var RUNTIME_VERSION = "0.6.
|
|
1580
|
+
//#region packages/world-runtime/src/version.gen.ts
|
|
1581
|
+
var RUNTIME_VERSION = "0.6.3";
|
|
1582
1582
|
//#endregion
|
|
1583
|
-
//#region src/version.ts
|
|
1583
|
+
//#region packages/world-runtime/src/version.ts
|
|
1584
1584
|
/**
|
|
1585
1585
|
* Format version of the generated world. The codegen stamps it into the artifact,
|
|
1586
1586
|
* the runtime checks it on load. A breaking format change = package major bump.
|
|
@@ -1594,7 +1594,7 @@ function assertFormatVersion(version) {
|
|
|
1594
1594
|
throw new Error(`@kvyverse/world-runtime: world format v${version} is not supported by runtime (expected v1). Re-export the world or pin a matching runtime version.`);
|
|
1595
1595
|
}
|
|
1596
1596
|
//#endregion
|
|
1597
|
-
//#region src/bootstrap.ts
|
|
1597
|
+
//#region packages/world-runtime/src/bootstrap.ts
|
|
1598
1598
|
/**
|
|
1599
1599
|
* World assembly order. The only place where it is fixed: the artifact supplies
|
|
1600
1600
|
* the data and steps, the runtime owns the sequence. Mirrors the game's
|
|
@@ -1663,7 +1663,7 @@ async function createWorld(definition, runtime) {
|
|
|
1663
1663
|
return world;
|
|
1664
1664
|
}
|
|
1665
1665
|
//#endregion
|
|
1666
|
-
//#region src/define-world.ts
|
|
1666
|
+
//#region packages/world-runtime/src/define-world.ts
|
|
1667
1667
|
/**
|
|
1668
1668
|
* Entry point of the generated artifact: world definition → public `loadWorld`.
|
|
1669
1669
|
* The codegen prints `export const { loadWorld } = defineWorld({ ... })`.
|
|
@@ -1672,7 +1672,7 @@ function defineWorld(definition) {
|
|
|
1672
1672
|
return { loadWorld: (options = {}) => bootstrapWorld(definition, options) };
|
|
1673
1673
|
}
|
|
1674
1674
|
//#endregion
|
|
1675
|
-
//#region src/values.ts
|
|
1675
|
+
//#region packages/world-runtime/src/values.ts
|
|
1676
1676
|
/**
|
|
1677
1677
|
* Writes a color into an object field, creating a `Color` if the slot is empty.
|
|
1678
1678
|
* Mirrors the `$C` branch of `applyValues` — needed by generated code for fields
|
|
@@ -1689,7 +1689,7 @@ function setColor(target, key, hex) {
|
|
|
1689
1689
|
holder[key] = new THREE.Color(hex);
|
|
1690
1690
|
}
|
|
1691
1691
|
//#endregion
|
|
1692
|
-
//#region src/resources/default-resources.ts
|
|
1692
|
+
//#region packages/world-runtime/src/resources/default-resources.ts
|
|
1693
1693
|
/**
|
|
1694
1694
|
* Built-in engine resources with fixed uuids: world values reference them via
|
|
1695
1695
|
* a regular ref (`{$A:"6"}`), so the identifiers must never change.
|
|
@@ -1760,7 +1760,7 @@ function isDefaultResourceId(uuid) {
|
|
|
1760
1760
|
return DEFAULT_RESOURCE_IDS.includes(uuid);
|
|
1761
1761
|
}
|
|
1762
1762
|
//#endregion
|
|
1763
|
-
//#region src/resources/texture.ts
|
|
1763
|
+
//#region packages/world-runtime/src/resources/texture.ts
|
|
1764
1764
|
/**
|
|
1765
1765
|
* World texture defaults: clamp wrapping switches to repeat, color space
|
|
1766
1766
|
* is sRGB. Identical in the editor, the game and the exported world.
|
|
@@ -1778,7 +1778,7 @@ async function loadTexture(url, name) {
|
|
|
1778
1778
|
return texture;
|
|
1779
1779
|
}
|
|
1780
1780
|
//#endregion
|
|
1781
|
-
//#region src/resources/model.ts
|
|
1781
|
+
//#region packages/world-runtime/src/resources/model.ts
|
|
1782
1782
|
/** Parses model bytes into a hierarchy. `data`: ArrayBuffer, for obj — text. */
|
|
1783
1783
|
async function parseModel(data, format, name) {
|
|
1784
1784
|
let root;
|
|
@@ -1847,7 +1847,7 @@ function collectModelSubResources(root) {
|
|
|
1847
1847
|
};
|
|
1848
1848
|
}
|
|
1849
1849
|
//#endregion
|
|
1850
|
-
//#region src/resources/hdr.ts
|
|
1850
|
+
//#region packages/world-runtime/src/resources/hdr.ts
|
|
1851
1851
|
/** Parses hdr/exr into a `DataTexture` with environment defaults (equirect, no mipmaps). */
|
|
1852
1852
|
async function parseHdr(data, format, name) {
|
|
1853
1853
|
let texture;
|
|
@@ -1875,7 +1875,7 @@ async function loadHdr(url, format, name) {
|
|
|
1875
1875
|
return parseHdr(await response.arrayBuffer(), format, name);
|
|
1876
1876
|
}
|
|
1877
1877
|
//#endregion
|
|
1878
|
-
//#region src/resources/geometry.ts
|
|
1878
|
+
//#region packages/world-runtime/src/resources/geometry.ts
|
|
1879
1879
|
/** Geometry from our json format (`BufferGeometry.toJSON`). */
|
|
1880
1880
|
function parseGeometryJson(json, name) {
|
|
1881
1881
|
const geometry = AssetLoaders.bufferGeometry.get().parse(json);
|
|
@@ -1889,7 +1889,7 @@ async function loadGeometry(url, name) {
|
|
|
1889
1889
|
return parseGeometryJson(await response.json(), name);
|
|
1890
1890
|
}
|
|
1891
1891
|
//#endregion
|
|
1892
|
-
//#region src/resources/audio.ts
|
|
1892
|
+
//#region packages/world-runtime/src/resources/audio.ts
|
|
1893
1893
|
/**
|
|
1894
1894
|
* Audio asset source: a `Howl` with identity — this is what scripts get
|
|
1895
1895
|
* from `require("/Sounds/...")`.
|
|
@@ -1922,7 +1922,7 @@ function createAudio(url, format, name) {
|
|
|
1922
1922
|
});
|
|
1923
1923
|
}
|
|
1924
1924
|
//#endregion
|
|
1925
|
-
//#region src/resources/video.ts
|
|
1925
|
+
//#region packages/world-runtime/src/resources/video.ts
|
|
1926
1926
|
/**
|
|
1927
1927
|
* Video asset source: a `<video>` with identity — this is what scripts get
|
|
1928
1928
|
* from `require("/Videos/...")` (and `THREE.VideoTexture` from `element`).
|
|
@@ -1979,7 +1979,7 @@ async function createVideo(url, name) {
|
|
|
1979
1979
|
return source;
|
|
1980
1980
|
}
|
|
1981
1981
|
//#endregion
|
|
1982
|
-
//#region src/rendering/tsl-node.ts
|
|
1982
|
+
//#region packages/world-runtime/src/rendering/tsl-node.ts
|
|
1983
1983
|
/**
|
|
1984
1984
|
* World TSL node: the built graph node + its uniform nodes. This is what
|
|
1985
1985
|
* `require("/Shaders/....tsl")` returns, so the method set matches the editor's
|
|
@@ -2022,7 +2022,7 @@ function createTslNode(uniforms, build, name) {
|
|
|
2022
2022
|
return new TslNode(uniforms, build, name);
|
|
2023
2023
|
}
|
|
2024
2024
|
//#endregion
|
|
2025
|
-
//#region src/rendering/tsl-uniforms.ts
|
|
2025
|
+
//#region packages/world-runtime/src/rendering/tsl-uniforms.ts
|
|
2026
2026
|
var UNIFORM_TYPES = [
|
|
2027
2027
|
"float",
|
|
2028
2028
|
"int",
|
|
@@ -2083,10 +2083,10 @@ var UNIFORM_DEFAULTS = {
|
|
|
2083
2083
|
texture: () => getDefaultResource(DefaultResourceId.Texture)
|
|
2084
2084
|
};
|
|
2085
2085
|
//#endregion
|
|
2086
|
-
//#region src/addons/externals.ts
|
|
2086
|
+
//#region packages/world-runtime/src/addons/externals.ts
|
|
2087
2087
|
var EXTERNAL_TYPES = ["umd", "module"];
|
|
2088
2088
|
//#endregion
|
|
2089
|
-
//#region src/rendering/renderer-options.ts
|
|
2089
|
+
//#region packages/world-runtime/src/rendering/renderer-options.ts
|
|
2090
2090
|
/**
|
|
2091
2091
|
* String names for renderer options set as words in the config and mapped to
|
|
2092
2092
|
* THREE constants at runtime (game). Single source for the JSON schema
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region src/addons/lib-registry.ts
|
|
1
|
+
//#region packages/world-runtime/src/addons/lib-registry.ts
|
|
2
2
|
/**
|
|
3
3
|
* Registry of the libraries scripts can `require`. One entry describes one
|
|
4
4
|
* library; the flags say how it gets into the world:
|
|
@@ -32,6 +32,7 @@ var LibId = /* @__PURE__ */ function(LibId) {
|
|
|
32
32
|
LibId["Rapier"] = "rapier";
|
|
33
33
|
LibId["Css2d"] = "css2d";
|
|
34
34
|
LibId["Css3d"] = "css3d";
|
|
35
|
+
LibId["OrbitControls"] = "orbitControls";
|
|
35
36
|
return LibId;
|
|
36
37
|
}({});
|
|
37
38
|
var LIBS = {
|
|
@@ -126,6 +127,12 @@ var LIBS = {
|
|
|
126
127
|
requireKey: "three/addons/renderers/CSS3DRenderer.js",
|
|
127
128
|
packageName: "three",
|
|
128
129
|
label: "CSS3DRenderer (DOM elements in 3d)"
|
|
130
|
+
},
|
|
131
|
+
["orbitControls"]: {
|
|
132
|
+
id: "orbitControls",
|
|
133
|
+
requireKey: "three/addons/controls/OrbitControls.js",
|
|
134
|
+
packageName: "three",
|
|
135
|
+
label: "OrbitControls (camera orbiting a target)"
|
|
129
136
|
}
|
|
130
137
|
};
|
|
131
138
|
var LIB_IDS = Object.values(LibId);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { KvyverseModules } from "./registry";
|
|
1
2
|
import type { ContextModule } from "three-start";
|
|
2
3
|
import type { LibId } from "../addons/lib-registry";
|
|
3
4
|
/**
|
|
@@ -22,6 +23,12 @@ export type ModuleJsonSchema = Record<string, unknown>;
|
|
|
22
23
|
*/
|
|
23
24
|
export interface OptionalModuleDescriptor<TConfig = unknown> {
|
|
24
25
|
id: OptionalModuleId;
|
|
26
|
+
/**
|
|
27
|
+
* Key in `ctx.modules`, when it differs from the config key `id` (physics is
|
|
28
|
+
* configured as `modules.physics` but lives on `ctx.modules.rapier`, named
|
|
29
|
+
* after the engine). Defaults to `id`.
|
|
30
|
+
*/
|
|
31
|
+
ctxKey?: keyof KvyverseModules;
|
|
25
32
|
/** Config value → normalized config; `null` means the module is off. */
|
|
26
33
|
normalize: (raw: unknown) => TConfig | null;
|
|
27
34
|
/** Config for an on-demand enable (a behaviour pulled the module in without config). */
|
package/dist/version.gen.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const RUNTIME_VERSION = "0.6.
|
|
1
|
+
export declare const RUNTIME_VERSION = "0.6.3";
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kvyverse/world-runtime",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.3",
|
|
4
4
|
"description": "Runtime for worlds exported from the Kvyverse platform for self-hosting",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
|
-
"author": "
|
|
6
|
+
"author": "Kvyverse, Inc.",
|
|
7
7
|
"homepage": "https://kvyverse.com",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"main": "./dist/index.js",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"nipplejs": "^0.10.2",
|
|
40
40
|
"stats.js": "^0.17.0",
|
|
41
41
|
"three": "^0.184.0",
|
|
42
|
-
"three-start": "^0.1.
|
|
42
|
+
"three-start": "^0.1.3",
|
|
43
43
|
"vanjs-core": "^1.6.0"
|
|
44
44
|
},
|
|
45
45
|
"peerDependenciesMeta": {
|