@series-inc/rundot-3d-engine 0.5.13 → 0.5.15
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/{chunk-ETKDCGQV.js → chunk-JD4M2BHR.js} +24 -44
- package/dist/chunk-JD4M2BHR.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/systems/index.d.ts +24 -2
- package/dist/systems/index.js +284 -238
- package/dist/systems/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-ETKDCGQV.js.map +0 -1
package/dist/systems/index.js
CHANGED
|
@@ -58,7 +58,7 @@ import {
|
|
|
58
58
|
VenusGame,
|
|
59
59
|
createCollisionGroup,
|
|
60
60
|
isTransformComponent
|
|
61
|
-
} from "../chunk-
|
|
61
|
+
} from "../chunk-JD4M2BHR.js";
|
|
62
62
|
import {
|
|
63
63
|
__decorateClass,
|
|
64
64
|
__publicField
|
|
@@ -109,8 +109,53 @@ BoxColliderComponent = __decorateClass([
|
|
|
109
109
|
PrefabComponent("box")
|
|
110
110
|
], BoxColliderComponent);
|
|
111
111
|
|
|
112
|
-
// src/systems/physics/
|
|
112
|
+
// src/systems/physics/SphereColliderComponent.ts
|
|
113
113
|
import * as THREE2 from "three";
|
|
114
|
+
var SphereColliderComponent = class extends Component {
|
|
115
|
+
static fromPrefabJSON(json, _node) {
|
|
116
|
+
if (!json.isCollider) {
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
const radius = json.radius ?? 0.5;
|
|
120
|
+
const offset = new THREE2.Vector3(json.offset[0], json.offset[1], json.offset[2]);
|
|
121
|
+
const bodyType = json.bodyType ?? "static" /* STATIC */;
|
|
122
|
+
return new SphereColliderComponent(radius, offset, bodyType, json.isSensor, json.enableCollisionEvents);
|
|
123
|
+
}
|
|
124
|
+
rigidBody = null;
|
|
125
|
+
radius;
|
|
126
|
+
offset;
|
|
127
|
+
bodyType;
|
|
128
|
+
isSensor;
|
|
129
|
+
enableCollisionEvents;
|
|
130
|
+
constructor(radius, offset, bodyType = "static" /* STATIC */, isSensor, enableCollisionEvents) {
|
|
131
|
+
super();
|
|
132
|
+
this.radius = radius;
|
|
133
|
+
this.offset = offset;
|
|
134
|
+
this.bodyType = bodyType;
|
|
135
|
+
this.isSensor = isSensor;
|
|
136
|
+
this.enableCollisionEvents = enableCollisionEvents;
|
|
137
|
+
}
|
|
138
|
+
onCreate() {
|
|
139
|
+
this.rigidBody = new RigidBodyComponentThree({
|
|
140
|
+
type: this.bodyType,
|
|
141
|
+
shape: "sphere" /* SPHERE */,
|
|
142
|
+
radius: this.radius,
|
|
143
|
+
centerOffset: this.offset,
|
|
144
|
+
isSensor: this.isSensor,
|
|
145
|
+
enableCollisionEvents: this.enableCollisionEvents
|
|
146
|
+
});
|
|
147
|
+
this.gameObject.addComponent(this.rigidBody);
|
|
148
|
+
}
|
|
149
|
+
getRigidBody() {
|
|
150
|
+
return this.rigidBody;
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
SphereColliderComponent = __decorateClass([
|
|
154
|
+
PrefabComponent("sphere")
|
|
155
|
+
], SphereColliderComponent);
|
|
156
|
+
|
|
157
|
+
// src/systems/physics/MeshColliderComponent.ts
|
|
158
|
+
import * as THREE3 from "three";
|
|
114
159
|
var MeshColliderComponent = class extends Component {
|
|
115
160
|
static fromPrefabJSON(json, node) {
|
|
116
161
|
const colliderType = json.colliderType ?? "bounding_box";
|
|
@@ -149,9 +194,9 @@ var MeshColliderComponent = class extends Component {
|
|
|
149
194
|
static collectVertices(meshGroup, scale) {
|
|
150
195
|
meshGroup.updateMatrixWorld(true);
|
|
151
196
|
const allVertices = [];
|
|
152
|
-
const vertex = new
|
|
197
|
+
const vertex = new THREE3.Vector3();
|
|
153
198
|
meshGroup.traverse((child) => {
|
|
154
|
-
if (child instanceof
|
|
199
|
+
if (child instanceof THREE3.Mesh && child.geometry) {
|
|
155
200
|
const posAttr = child.geometry.getAttribute("position");
|
|
156
201
|
if (!posAttr) return;
|
|
157
202
|
for (let i = 0; i < posAttr.count; i++) {
|
|
@@ -175,10 +220,10 @@ var MeshColliderComponent = class extends Component {
|
|
|
175
220
|
*/
|
|
176
221
|
static computeBounds(meshGroup, scale) {
|
|
177
222
|
meshGroup.updateMatrixWorld(true);
|
|
178
|
-
const box = new
|
|
223
|
+
const box = new THREE3.Box3();
|
|
179
224
|
let foundMesh = false;
|
|
180
225
|
meshGroup.traverse((child) => {
|
|
181
|
-
if (child instanceof
|
|
226
|
+
if (child instanceof THREE3.Mesh && child.geometry) {
|
|
182
227
|
foundMesh = true;
|
|
183
228
|
if (!child.geometry.boundingBox) {
|
|
184
229
|
child.geometry.computeBoundingBox();
|
|
@@ -191,10 +236,10 @@ var MeshColliderComponent = class extends Component {
|
|
|
191
236
|
}
|
|
192
237
|
});
|
|
193
238
|
if (!foundMesh || box.isEmpty()) return null;
|
|
194
|
-
const size = new
|
|
239
|
+
const size = new THREE3.Vector3();
|
|
195
240
|
box.getSize(size);
|
|
196
241
|
size.multiply(scale);
|
|
197
|
-
const center = new
|
|
242
|
+
const center = new THREE3.Vector3();
|
|
198
243
|
box.getCenter(center);
|
|
199
244
|
center.multiply(scale);
|
|
200
245
|
return { size, center };
|
|
@@ -214,7 +259,7 @@ var MeshColliderComponent = class extends Component {
|
|
|
214
259
|
type: this.bodyType,
|
|
215
260
|
shape: "convex_hull" /* CONVEX_HULL */,
|
|
216
261
|
vertices,
|
|
217
|
-
centerOffset: new
|
|
262
|
+
centerOffset: new THREE3.Vector3(0, 0, 0),
|
|
218
263
|
isSensor: this.isSensor,
|
|
219
264
|
enableCollisionEvents: this.enableCollisionEvents
|
|
220
265
|
});
|
|
@@ -244,7 +289,7 @@ MeshColliderComponent = __decorateClass([
|
|
|
244
289
|
], MeshColliderComponent);
|
|
245
290
|
|
|
246
291
|
// src/systems/debug/RenderingDebugger.ts
|
|
247
|
-
import * as
|
|
292
|
+
import * as THREE4 from "three";
|
|
248
293
|
var RenderingDebugger = class _RenderingDebugger {
|
|
249
294
|
/**
|
|
250
295
|
* Get comprehensive rendering statistics from AssetManager
|
|
@@ -451,8 +496,8 @@ var RenderingDebugger = class _RenderingDebugger {
|
|
|
451
496
|
console.log(
|
|
452
497
|
`\u{1F535} Culling radius: ${batch.cullingRadius.toFixed(2)} (encompasses entire geometry)`
|
|
453
498
|
);
|
|
454
|
-
const frustum = new
|
|
455
|
-
const cameraMatrix = new
|
|
499
|
+
const frustum = new THREE4.Frustum();
|
|
500
|
+
const cameraMatrix = new THREE4.Matrix4().multiplyMatrices(
|
|
456
501
|
camera.projectionMatrix,
|
|
457
502
|
camera.matrixWorldInverse
|
|
458
503
|
);
|
|
@@ -460,12 +505,12 @@ var RenderingDebugger = class _RenderingDebugger {
|
|
|
460
505
|
let visibleCount = 0;
|
|
461
506
|
let culledCount = 0;
|
|
462
507
|
batch.instances.forEach((instance, index) => {
|
|
463
|
-
const position = new
|
|
464
|
-
const scale = new
|
|
508
|
+
const position = new THREE4.Vector3().setFromMatrixPosition(instance.matrix);
|
|
509
|
+
const scale = new THREE4.Vector3().setFromMatrixScale(instance.matrix);
|
|
465
510
|
const maxScale = Math.max(scale.x, scale.y, scale.z);
|
|
466
511
|
const actualRadius = batch.cullingRadius * maxScale;
|
|
467
512
|
const paddedRadius = actualRadius * 1.2;
|
|
468
|
-
const isVisible = frustum.intersectsSphere(new
|
|
513
|
+
const isVisible = frustum.intersectsSphere(new THREE4.Sphere(position, paddedRadius));
|
|
469
514
|
if (index < 5) {
|
|
470
515
|
console.log(
|
|
471
516
|
` Instance ${index}: pos(${position.x.toFixed(1)}, ${position.z.toFixed(1)}), radius: ${paddedRadius.toFixed(2)}, visible: ${isVisible}`
|
|
@@ -557,10 +602,10 @@ var RenderingDebugger = class _RenderingDebugger {
|
|
|
557
602
|
};
|
|
558
603
|
|
|
559
604
|
// src/systems/debug/DebugPanelThree.ts
|
|
560
|
-
import * as
|
|
605
|
+
import * as THREE10 from "three";
|
|
561
606
|
|
|
562
607
|
// src/systems/navigation/DynamicNavSystem.ts
|
|
563
|
-
import * as
|
|
608
|
+
import * as THREE6 from "three";
|
|
564
609
|
|
|
565
610
|
// src/systems/navigation/NavigationGrid.ts
|
|
566
611
|
var NavigationGrid = class _NavigationGrid {
|
|
@@ -936,7 +981,7 @@ var NavigationGrid = class _NavigationGrid {
|
|
|
936
981
|
};
|
|
937
982
|
|
|
938
983
|
// src/systems/navigation/NavGridDebugDisplayThree.ts
|
|
939
|
-
import * as
|
|
984
|
+
import * as THREE5 from "three";
|
|
940
985
|
var NavGridDebugDisplayThree = class _NavGridDebugDisplayThree {
|
|
941
986
|
static isInitialized = false;
|
|
942
987
|
static scene = null;
|
|
@@ -1000,38 +1045,38 @@ var NavGridDebugDisplayThree = class _NavGridDebugDisplayThree {
|
|
|
1000
1045
|
const worldPos = navigationGrid.gridToWorld(col, row);
|
|
1001
1046
|
if (col < dimensions.cols) {
|
|
1002
1047
|
const nextWorldPos = navigationGrid.gridToWorld(col + 1, row);
|
|
1003
|
-
points.push(new
|
|
1004
|
-
points.push(new
|
|
1048
|
+
points.push(new THREE5.Vector3(worldPos.x, 0.1, worldPos.z));
|
|
1049
|
+
points.push(new THREE5.Vector3(nextWorldPos.x, 0.1, nextWorldPos.z));
|
|
1005
1050
|
}
|
|
1006
1051
|
if (row < dimensions.rows) {
|
|
1007
1052
|
const nextWorldPos = navigationGrid.gridToWorld(col, row + 1);
|
|
1008
|
-
points.push(new
|
|
1009
|
-
points.push(new
|
|
1053
|
+
points.push(new THREE5.Vector3(worldPos.x, 0.1, worldPos.z));
|
|
1054
|
+
points.push(new THREE5.Vector3(nextWorldPos.x, 0.1, nextWorldPos.z));
|
|
1010
1055
|
}
|
|
1011
1056
|
}
|
|
1012
1057
|
}
|
|
1013
|
-
const geometry = new
|
|
1014
|
-
const material = new
|
|
1058
|
+
const geometry = new THREE5.BufferGeometry().setFromPoints(points);
|
|
1059
|
+
const material = new THREE5.LineBasicMaterial({
|
|
1015
1060
|
color: 65280,
|
|
1016
1061
|
// Green for walkable grid
|
|
1017
1062
|
transparent: true,
|
|
1018
1063
|
opacity: 0.3
|
|
1019
1064
|
});
|
|
1020
|
-
_NavGridDebugDisplayThree.debugLines = new
|
|
1065
|
+
_NavGridDebugDisplayThree.debugLines = new THREE5.LineSegments(geometry, material);
|
|
1021
1066
|
_NavGridDebugDisplayThree.scene.add(_NavGridDebugDisplayThree.debugLines);
|
|
1022
1067
|
}
|
|
1023
1068
|
/**
|
|
1024
1069
|
* Create red cubes for blocked areas
|
|
1025
1070
|
*/
|
|
1026
1071
|
static createBlockedAreas(navigationGrid, dimensions, gridData) {
|
|
1027
|
-
_NavGridDebugDisplayThree.blockedCubes = new
|
|
1072
|
+
_NavGridDebugDisplayThree.blockedCubes = new THREE5.Group();
|
|
1028
1073
|
_NavGridDebugDisplayThree.scene.add(_NavGridDebugDisplayThree.blockedCubes);
|
|
1029
|
-
const cubeGeometry = new
|
|
1074
|
+
const cubeGeometry = new THREE5.BoxGeometry(
|
|
1030
1075
|
dimensions.gridSize * 0.8,
|
|
1031
1076
|
0.2,
|
|
1032
1077
|
dimensions.gridSize * 0.8
|
|
1033
1078
|
);
|
|
1034
|
-
const blockedMaterial = new
|
|
1079
|
+
const blockedMaterial = new THREE5.MeshBasicMaterial({
|
|
1035
1080
|
color: 16711680,
|
|
1036
1081
|
// Red for blocked areas
|
|
1037
1082
|
transparent: true,
|
|
@@ -1041,7 +1086,7 @@ var NavGridDebugDisplayThree = class _NavGridDebugDisplayThree {
|
|
|
1041
1086
|
for (let col = 0; col < dimensions.cols; col++) {
|
|
1042
1087
|
if (!navigationGrid.isWalkable(col, row)) {
|
|
1043
1088
|
const worldPos = navigationGrid.gridToWorld(col, row);
|
|
1044
|
-
const cube = new
|
|
1089
|
+
const cube = new THREE5.Mesh(cubeGeometry, blockedMaterial);
|
|
1045
1090
|
cube.position.set(worldPos.x, 0.1, worldPos.z);
|
|
1046
1091
|
_NavGridDebugDisplayThree.blockedCubes.add(cube);
|
|
1047
1092
|
}
|
|
@@ -1061,9 +1106,9 @@ var NavGridDebugDisplayThree = class _NavGridDebugDisplayThree {
|
|
|
1061
1106
|
if (_NavGridDebugDisplayThree.blockedCubes && _NavGridDebugDisplayThree.scene) {
|
|
1062
1107
|
_NavGridDebugDisplayThree.scene.remove(_NavGridDebugDisplayThree.blockedCubes);
|
|
1063
1108
|
_NavGridDebugDisplayThree.blockedCubes.children.forEach((child) => {
|
|
1064
|
-
if (child instanceof
|
|
1109
|
+
if (child instanceof THREE5.Mesh) {
|
|
1065
1110
|
child.geometry.dispose();
|
|
1066
|
-
if (child.material instanceof
|
|
1111
|
+
if (child.material instanceof THREE5.Material) {
|
|
1067
1112
|
child.material.dispose();
|
|
1068
1113
|
}
|
|
1069
1114
|
}
|
|
@@ -1186,10 +1231,10 @@ var DynamicNavSystem = class _DynamicNavSystem {
|
|
|
1186
1231
|
const footprint = {
|
|
1187
1232
|
type: "polygon",
|
|
1188
1233
|
vertices: [
|
|
1189
|
-
new
|
|
1190
|
-
new
|
|
1191
|
-
new
|
|
1192
|
-
new
|
|
1234
|
+
new THREE6.Vector3(x - halfWidth, 0, z - halfDepth),
|
|
1235
|
+
new THREE6.Vector3(x + halfWidth, 0, z - halfDepth),
|
|
1236
|
+
new THREE6.Vector3(x + halfWidth, 0, z + halfDepth),
|
|
1237
|
+
new THREE6.Vector3(x - halfWidth, 0, z + halfDepth)
|
|
1193
1238
|
]
|
|
1194
1239
|
};
|
|
1195
1240
|
_DynamicNavSystem.navigationGrid.addObstacle(footprint);
|
|
@@ -1211,10 +1256,10 @@ var DynamicNavSystem = class _DynamicNavSystem {
|
|
|
1211
1256
|
const footprint = {
|
|
1212
1257
|
type: "polygon",
|
|
1213
1258
|
vertices: [
|
|
1214
|
-
new
|
|
1215
|
-
new
|
|
1216
|
-
new
|
|
1217
|
-
new
|
|
1259
|
+
new THREE6.Vector3(x - halfWidth, 0, z - halfDepth),
|
|
1260
|
+
new THREE6.Vector3(x + halfWidth, 0, z - halfDepth),
|
|
1261
|
+
new THREE6.Vector3(x + halfWidth, 0, z + halfDepth),
|
|
1262
|
+
new THREE6.Vector3(x - halfWidth, 0, z + halfDepth)
|
|
1218
1263
|
]
|
|
1219
1264
|
};
|
|
1220
1265
|
_DynamicNavSystem.navigationGrid.removeObstacle(footprint);
|
|
@@ -1224,7 +1269,7 @@ var DynamicNavSystem = class _DynamicNavSystem {
|
|
|
1224
1269
|
const rigidBody = gameObject.getComponent(RigidBodyComponentThree);
|
|
1225
1270
|
if (!rigidBody) return;
|
|
1226
1271
|
const bounds = rigidBody.getBounds();
|
|
1227
|
-
const boundsSize = bounds.getSize(new
|
|
1272
|
+
const boundsSize = bounds.getSize(new THREE6.Vector3());
|
|
1228
1273
|
_DynamicNavSystem.addBoxObstacleFromBounds(gameObject, boundsSize);
|
|
1229
1274
|
}
|
|
1230
1275
|
/**
|
|
@@ -1233,9 +1278,9 @@ var DynamicNavSystem = class _DynamicNavSystem {
|
|
|
1233
1278
|
* @param boundsSize The size from renderer bounds (uses X and Z for navigation)
|
|
1234
1279
|
*/
|
|
1235
1280
|
static addBoxObstacleFromBounds(gameObject, boundsSize) {
|
|
1236
|
-
const worldPos = gameObject.getWorldPosition(new
|
|
1237
|
-
const worldRotation = gameObject.getWorldQuaternion(new
|
|
1238
|
-
const euler = new
|
|
1281
|
+
const worldPos = gameObject.getWorldPosition(new THREE6.Vector3());
|
|
1282
|
+
const worldRotation = gameObject.getWorldQuaternion(new THREE6.Quaternion());
|
|
1283
|
+
const euler = new THREE6.Euler().setFromQuaternion(worldRotation);
|
|
1239
1284
|
const rotationY = euler.y;
|
|
1240
1285
|
let width = boundsSize.x;
|
|
1241
1286
|
let depth = boundsSize.z;
|
|
@@ -1262,15 +1307,15 @@ var DynamicNavSystem = class _DynamicNavSystem {
|
|
|
1262
1307
|
return "";
|
|
1263
1308
|
}
|
|
1264
1309
|
gameObject.updateMatrixWorld(true);
|
|
1265
|
-
const worldPos = gameObject.getWorldPosition(new
|
|
1266
|
-
const worldRotation = gameObject.getWorldQuaternion(new
|
|
1310
|
+
const worldPos = gameObject.getWorldPosition(new THREE6.Vector3());
|
|
1311
|
+
const worldRotation = gameObject.getWorldQuaternion(new THREE6.Quaternion());
|
|
1267
1312
|
const halfWidth = boundsSize.x * 0.5;
|
|
1268
1313
|
const halfDepth = boundsSize.z * 0.5;
|
|
1269
1314
|
const corners = [
|
|
1270
|
-
new
|
|
1271
|
-
new
|
|
1272
|
-
new
|
|
1273
|
-
new
|
|
1315
|
+
new THREE6.Vector3(-halfWidth, 0, -halfDepth),
|
|
1316
|
+
new THREE6.Vector3(halfWidth, 0, -halfDepth),
|
|
1317
|
+
new THREE6.Vector3(halfWidth, 0, halfDepth),
|
|
1318
|
+
new THREE6.Vector3(-halfWidth, 0, halfDepth)
|
|
1274
1319
|
];
|
|
1275
1320
|
const rotatedCorners = corners.map((corner) => {
|
|
1276
1321
|
const rotated = corner.clone();
|
|
@@ -1318,13 +1363,13 @@ var DynamicNavSystem = class _DynamicNavSystem {
|
|
|
1318
1363
|
*/
|
|
1319
1364
|
static findPath(startPos, endPos) {
|
|
1320
1365
|
let start, end;
|
|
1321
|
-
if (startPos instanceof
|
|
1322
|
-
start = new
|
|
1366
|
+
if (startPos instanceof THREE6.Vector3) {
|
|
1367
|
+
start = new THREE6.Vector2(startPos.x, startPos.z);
|
|
1323
1368
|
} else {
|
|
1324
1369
|
start = startPos;
|
|
1325
1370
|
}
|
|
1326
|
-
if (endPos instanceof
|
|
1327
|
-
end = new
|
|
1371
|
+
if (endPos instanceof THREE6.Vector3) {
|
|
1372
|
+
end = new THREE6.Vector2(endPos.x, endPos.z);
|
|
1328
1373
|
} else {
|
|
1329
1374
|
end = endPos;
|
|
1330
1375
|
}
|
|
@@ -1606,15 +1651,15 @@ var DynamicNavSystem = class _DynamicNavSystem {
|
|
|
1606
1651
|
return _DynamicNavSystem.hasLineOfSight({ x: startX, z: startZ }, { x: endX, z: endZ });
|
|
1607
1652
|
}
|
|
1608
1653
|
const result = _DynamicNavSystem.findPath(
|
|
1609
|
-
new
|
|
1610
|
-
new
|
|
1654
|
+
new THREE6.Vector2(startX, startZ),
|
|
1655
|
+
new THREE6.Vector2(endX, endZ)
|
|
1611
1656
|
);
|
|
1612
1657
|
return result.success;
|
|
1613
1658
|
}
|
|
1614
1659
|
};
|
|
1615
1660
|
|
|
1616
1661
|
// src/systems/navigation/PathVisualizationThree.ts
|
|
1617
|
-
import * as
|
|
1662
|
+
import * as THREE7 from "three";
|
|
1618
1663
|
var PathVisualizationThree = class _PathVisualizationThree {
|
|
1619
1664
|
static scene = null;
|
|
1620
1665
|
static isInitialized = false;
|
|
@@ -1644,26 +1689,26 @@ var PathVisualizationThree = class _PathVisualizationThree {
|
|
|
1644
1689
|
* Create materials for different visual elements
|
|
1645
1690
|
*/
|
|
1646
1691
|
static createMaterials() {
|
|
1647
|
-
_PathVisualizationThree.pathMaterial = new
|
|
1692
|
+
_PathVisualizationThree.pathMaterial = new THREE7.LineBasicMaterial({
|
|
1648
1693
|
color: 16776960,
|
|
1649
1694
|
// Bright yellow
|
|
1650
1695
|
linewidth: 3,
|
|
1651
1696
|
transparent: true,
|
|
1652
1697
|
opacity: 0.8
|
|
1653
1698
|
});
|
|
1654
|
-
_PathVisualizationThree.waypointMaterial = new
|
|
1699
|
+
_PathVisualizationThree.waypointMaterial = new THREE7.MeshBasicMaterial({
|
|
1655
1700
|
color: 16744448,
|
|
1656
1701
|
// Orange
|
|
1657
1702
|
transparent: true,
|
|
1658
1703
|
opacity: 0.9
|
|
1659
1704
|
});
|
|
1660
|
-
_PathVisualizationThree.startMaterial = new
|
|
1705
|
+
_PathVisualizationThree.startMaterial = new THREE7.MeshBasicMaterial({
|
|
1661
1706
|
color: 65280,
|
|
1662
1707
|
// Bright green
|
|
1663
1708
|
transparent: true,
|
|
1664
1709
|
opacity: 0.9
|
|
1665
1710
|
});
|
|
1666
|
-
_PathVisualizationThree.endMaterial = new
|
|
1711
|
+
_PathVisualizationThree.endMaterial = new THREE7.MeshBasicMaterial({
|
|
1667
1712
|
color: 16711680,
|
|
1668
1713
|
// Bright red
|
|
1669
1714
|
transparent: true,
|
|
@@ -1781,8 +1826,8 @@ var PathVisualizationThree = class _PathVisualizationThree {
|
|
|
1781
1826
|
*/
|
|
1782
1827
|
static createStartMarker(pathId, x, z) {
|
|
1783
1828
|
if (!_PathVisualizationThree.scene || !_PathVisualizationThree.startMaterial) return null;
|
|
1784
|
-
const geometry = new
|
|
1785
|
-
const marker = new
|
|
1829
|
+
const geometry = new THREE7.SphereGeometry(0.5, 16, 16);
|
|
1830
|
+
const marker = new THREE7.Mesh(geometry, _PathVisualizationThree.startMaterial);
|
|
1786
1831
|
marker.position.set(x, 0.5, z);
|
|
1787
1832
|
marker.name = `PathStartMarker_${pathId}`;
|
|
1788
1833
|
_PathVisualizationThree.scene.add(marker);
|
|
@@ -1793,8 +1838,8 @@ var PathVisualizationThree = class _PathVisualizationThree {
|
|
|
1793
1838
|
*/
|
|
1794
1839
|
static createEndMarker(pathId, x, z) {
|
|
1795
1840
|
if (!_PathVisualizationThree.scene || !_PathVisualizationThree.endMaterial) return null;
|
|
1796
|
-
const geometry = new
|
|
1797
|
-
const marker = new
|
|
1841
|
+
const geometry = new THREE7.SphereGeometry(0.5, 16, 16);
|
|
1842
|
+
const marker = new THREE7.Mesh(geometry, _PathVisualizationThree.endMaterial);
|
|
1798
1843
|
marker.position.set(x, 0.5, z);
|
|
1799
1844
|
marker.name = `PathEndMarker_${pathId}`;
|
|
1800
1845
|
_PathVisualizationThree.scene.add(marker);
|
|
@@ -1807,8 +1852,8 @@ var PathVisualizationThree = class _PathVisualizationThree {
|
|
|
1807
1852
|
if (!_PathVisualizationThree.scene || !_PathVisualizationThree.waypointMaterial) return [];
|
|
1808
1853
|
const spheres = [];
|
|
1809
1854
|
waypoints.forEach((waypoint, index) => {
|
|
1810
|
-
const geometry = new
|
|
1811
|
-
const sphere = new
|
|
1855
|
+
const geometry = new THREE7.SphereGeometry(0.3, 12, 12);
|
|
1856
|
+
const sphere = new THREE7.Mesh(geometry, _PathVisualizationThree.waypointMaterial);
|
|
1812
1857
|
sphere.position.set(waypoint.x, 0.3, waypoint.z);
|
|
1813
1858
|
sphere.name = `PathWaypoint_${pathId}_${index}`;
|
|
1814
1859
|
_PathVisualizationThree.scene.add(sphere);
|
|
@@ -1827,11 +1872,11 @@ var PathVisualizationThree = class _PathVisualizationThree {
|
|
|
1827
1872
|
const start = waypoints[i];
|
|
1828
1873
|
const end = waypoints[i + 1];
|
|
1829
1874
|
const points = [
|
|
1830
|
-
new
|
|
1831
|
-
new
|
|
1875
|
+
new THREE7.Vector3(start.x, 0.2, start.z),
|
|
1876
|
+
new THREE7.Vector3(end.x, 0.2, end.z)
|
|
1832
1877
|
];
|
|
1833
|
-
const geometry = new
|
|
1834
|
-
const line = new
|
|
1878
|
+
const geometry = new THREE7.BufferGeometry().setFromPoints(points);
|
|
1879
|
+
const line = new THREE7.Line(geometry, _PathVisualizationThree.pathMaterial);
|
|
1835
1880
|
line.name = `PathLine_${pathId}_${i}`;
|
|
1836
1881
|
_PathVisualizationThree.scene.add(line);
|
|
1837
1882
|
lines.push(line);
|
|
@@ -1875,8 +1920,8 @@ var PathVisualizationThree = class _PathVisualizationThree {
|
|
|
1875
1920
|
}
|
|
1876
1921
|
_PathVisualizationThree.initialize(_PathVisualizationThree.scene);
|
|
1877
1922
|
const result = DynamicNavSystem.findPath(
|
|
1878
|
-
new
|
|
1879
|
-
new
|
|
1923
|
+
new THREE7.Vector2(startX, startZ),
|
|
1924
|
+
new THREE7.Vector2(endX, endZ)
|
|
1880
1925
|
);
|
|
1881
1926
|
if (result.success) {
|
|
1882
1927
|
console.log(
|
|
@@ -1917,8 +1962,8 @@ if (typeof window !== "undefined") {
|
|
|
1917
1962
|
};
|
|
1918
1963
|
window.addPathThree = (pathId, startX, startZ, endX, endZ) => {
|
|
1919
1964
|
const result = DynamicNavSystem.findPath(
|
|
1920
|
-
new
|
|
1921
|
-
new
|
|
1965
|
+
new THREE7.Vector2(startX, startZ),
|
|
1966
|
+
new THREE7.Vector2(endX, endZ)
|
|
1922
1967
|
);
|
|
1923
1968
|
if (result.success) {
|
|
1924
1969
|
PathVisualizationThree.addPath(pathId, result, startX, startZ, endX, endZ);
|
|
@@ -1940,10 +1985,10 @@ if (typeof window !== "undefined") {
|
|
|
1940
1985
|
}
|
|
1941
1986
|
|
|
1942
1987
|
// src/systems/spline/SplineDebugManager.ts
|
|
1943
|
-
import * as
|
|
1988
|
+
import * as THREE9 from "three";
|
|
1944
1989
|
|
|
1945
1990
|
// src/systems/spline/SplineDebugRendererThree.ts
|
|
1946
|
-
import * as
|
|
1991
|
+
import * as THREE8 from "three";
|
|
1947
1992
|
var SplineDebugRendererThree = class extends Component {
|
|
1948
1993
|
spline;
|
|
1949
1994
|
options;
|
|
@@ -1960,13 +2005,13 @@ var SplineDebugRendererThree = class extends Component {
|
|
|
1960
2005
|
showCurve: options.showCurve ?? true,
|
|
1961
2006
|
showDirection: options.showDirection ?? false,
|
|
1962
2007
|
waypointSize: options.waypointSize ?? 0.5,
|
|
1963
|
-
waypointColor: options.waypointColor ?? new
|
|
1964
|
-
curveColor: options.curveColor ?? new
|
|
1965
|
-
directionColor: options.directionColor ?? new
|
|
2008
|
+
waypointColor: options.waypointColor ?? new THREE8.Color(16711680),
|
|
2009
|
+
curveColor: options.curveColor ?? new THREE8.Color(16776960),
|
|
2010
|
+
directionColor: options.directionColor ?? new THREE8.Color(65280),
|
|
1966
2011
|
directionLength: options.directionLength ?? 2,
|
|
1967
2012
|
directionSpacing: options.directionSpacing ?? 0.1
|
|
1968
2013
|
};
|
|
1969
|
-
this.parentGroup = new
|
|
2014
|
+
this.parentGroup = new THREE8.Group();
|
|
1970
2015
|
}
|
|
1971
2016
|
onCreate() {
|
|
1972
2017
|
if (!this.gameObject) return;
|
|
@@ -2033,8 +2078,8 @@ var SplineDebugRendererThree = class extends Component {
|
|
|
2033
2078
|
* Create waypoint spheres
|
|
2034
2079
|
*/
|
|
2035
2080
|
createWaypoints() {
|
|
2036
|
-
const geometry = new
|
|
2037
|
-
const material = new
|
|
2081
|
+
const geometry = new THREE8.SphereGeometry(this.options.waypointSize, 8, 6);
|
|
2082
|
+
const material = new THREE8.MeshBasicMaterial({
|
|
2038
2083
|
color: this.options.waypointColor,
|
|
2039
2084
|
depthTest: false,
|
|
2040
2085
|
transparent: true,
|
|
@@ -2042,7 +2087,7 @@ var SplineDebugRendererThree = class extends Component {
|
|
|
2042
2087
|
});
|
|
2043
2088
|
const waypoints = this.spline.getWaypoints();
|
|
2044
2089
|
waypoints.forEach((waypoint, index) => {
|
|
2045
|
-
const mesh = new
|
|
2090
|
+
const mesh = new THREE8.Mesh(geometry, material.clone());
|
|
2046
2091
|
mesh.position.copy(waypoint);
|
|
2047
2092
|
mesh.renderOrder = 1e3;
|
|
2048
2093
|
this.waypointMeshes.push(mesh);
|
|
@@ -2055,14 +2100,14 @@ var SplineDebugRendererThree = class extends Component {
|
|
|
2055
2100
|
createCurve() {
|
|
2056
2101
|
const points = this.spline.getInterpolatedPoints();
|
|
2057
2102
|
if (points.length < 2) return;
|
|
2058
|
-
const geometry = new
|
|
2059
|
-
const material = new
|
|
2103
|
+
const geometry = new THREE8.BufferGeometry().setFromPoints(points);
|
|
2104
|
+
const material = new THREE8.LineBasicMaterial({
|
|
2060
2105
|
color: this.options.curveColor,
|
|
2061
2106
|
linewidth: 2,
|
|
2062
2107
|
transparent: true,
|
|
2063
2108
|
opacity: 0.8
|
|
2064
2109
|
});
|
|
2065
|
-
this.curveLine = new
|
|
2110
|
+
this.curveLine = new THREE8.Line(geometry, material);
|
|
2066
2111
|
this.curveLine.renderOrder = 999;
|
|
2067
2112
|
this.parentGroup.add(this.curveLine);
|
|
2068
2113
|
}
|
|
@@ -2085,24 +2130,24 @@ var SplineDebugRendererThree = class extends Component {
|
|
|
2085
2130
|
* Create a single direction arrow
|
|
2086
2131
|
*/
|
|
2087
2132
|
createArrow(position, direction, length) {
|
|
2088
|
-
const group = new
|
|
2089
|
-
const shaftGeometry = new
|
|
2090
|
-
const shaftMaterial = new
|
|
2133
|
+
const group = new THREE8.Group();
|
|
2134
|
+
const shaftGeometry = new THREE8.CylinderGeometry(0.02, 0.02, length * 0.8, 4);
|
|
2135
|
+
const shaftMaterial = new THREE8.MeshBasicMaterial({
|
|
2091
2136
|
color: this.options.directionColor
|
|
2092
2137
|
});
|
|
2093
|
-
const shaft = new
|
|
2094
|
-
const headGeometry = new
|
|
2095
|
-
const headMaterial = new
|
|
2138
|
+
const shaft = new THREE8.Mesh(shaftGeometry, shaftMaterial);
|
|
2139
|
+
const headGeometry = new THREE8.ConeGeometry(0.08, length * 0.2, 6);
|
|
2140
|
+
const headMaterial = new THREE8.MeshBasicMaterial({
|
|
2096
2141
|
color: this.options.directionColor
|
|
2097
2142
|
});
|
|
2098
|
-
const head = new
|
|
2143
|
+
const head = new THREE8.Mesh(headGeometry, headMaterial);
|
|
2099
2144
|
head.position.y = length * 0.4;
|
|
2100
2145
|
group.add(shaft);
|
|
2101
2146
|
group.add(head);
|
|
2102
2147
|
group.position.copy(position);
|
|
2103
2148
|
group.position.y += 0.1;
|
|
2104
|
-
const up = new
|
|
2105
|
-
const quaternion = new
|
|
2149
|
+
const up = new THREE8.Vector3(0, 1, 0);
|
|
2150
|
+
const quaternion = new THREE8.Quaternion().setFromUnitVectors(up, direction.normalize());
|
|
2106
2151
|
group.setRotationFromQuaternion(quaternion);
|
|
2107
2152
|
return group;
|
|
2108
2153
|
}
|
|
@@ -2133,7 +2178,7 @@ var SplineDebugRendererThree = class extends Component {
|
|
|
2133
2178
|
this.directionArrows.forEach((arrow) => {
|
|
2134
2179
|
this.parentGroup.remove(arrow);
|
|
2135
2180
|
arrow.traverse((child) => {
|
|
2136
|
-
if (child instanceof
|
|
2181
|
+
if (child instanceof THREE8.Mesh) {
|
|
2137
2182
|
child.geometry.dispose();
|
|
2138
2183
|
if (Array.isArray(child.material)) {
|
|
2139
2184
|
child.material.forEach((mat) => mat.dispose());
|
|
@@ -2157,8 +2202,8 @@ var SplineDebugManager = class _SplineDebugManager {
|
|
|
2157
2202
|
showCurve: true,
|
|
2158
2203
|
showDirection: false,
|
|
2159
2204
|
waypointSize: 0.4,
|
|
2160
|
-
waypointColor: new
|
|
2161
|
-
curveColor: new
|
|
2205
|
+
waypointColor: new THREE9.Color(16711680),
|
|
2206
|
+
curveColor: new THREE9.Color(16776960)
|
|
2162
2207
|
};
|
|
2163
2208
|
constructor() {
|
|
2164
2209
|
}
|
|
@@ -2467,7 +2512,7 @@ var DebugPanelThree = class _DebugPanelThree {
|
|
|
2467
2512
|
const scene = this.findScene();
|
|
2468
2513
|
if (!scene) return;
|
|
2469
2514
|
scene.traverse((obj) => {
|
|
2470
|
-
if (obj instanceof
|
|
2515
|
+
if (obj instanceof THREE10.SkinnedMesh) {
|
|
2471
2516
|
obj.visible = !checked;
|
|
2472
2517
|
}
|
|
2473
2518
|
});
|
|
@@ -2490,7 +2535,7 @@ var DebugPanelThree = class _DebugPanelThree {
|
|
|
2490
2535
|
let skinnedCount = 0;
|
|
2491
2536
|
let blobCount = 0;
|
|
2492
2537
|
scene.traverse((obj) => {
|
|
2493
|
-
if (obj instanceof
|
|
2538
|
+
if (obj instanceof THREE10.SkinnedMesh) {
|
|
2494
2539
|
obj.castShadow = checked;
|
|
2495
2540
|
skinnedCount++;
|
|
2496
2541
|
}
|
|
@@ -2562,10 +2607,10 @@ var DebugPanelThree = class _DebugPanelThree {
|
|
|
2562
2607
|
let skinnedMeshCount = 0;
|
|
2563
2608
|
let totalMeshes = 0;
|
|
2564
2609
|
scene.traverse((obj) => {
|
|
2565
|
-
if (obj instanceof
|
|
2610
|
+
if (obj instanceof THREE10.SkinnedMesh) {
|
|
2566
2611
|
skinnedMeshCount++;
|
|
2567
2612
|
totalMeshes++;
|
|
2568
|
-
} else if (obj instanceof
|
|
2613
|
+
} else if (obj instanceof THREE10.Mesh && obj.visible) {
|
|
2569
2614
|
totalMeshes++;
|
|
2570
2615
|
const geomId = obj.geometry.uuid;
|
|
2571
2616
|
const triangles = obj.geometry.index ? obj.geometry.index.count / 3 : (obj.geometry.attributes.position?.count || 0) / 3;
|
|
@@ -2633,19 +2678,19 @@ var DebugPanelThree = class _DebugPanelThree {
|
|
|
2633
2678
|
scene.traverse((obj) => {
|
|
2634
2679
|
totalObjects++;
|
|
2635
2680
|
if (obj.matrixAutoUpdate) {
|
|
2636
|
-
if (!(obj instanceof
|
|
2681
|
+
if (!(obj instanceof THREE10.SkinnedMesh) && !(obj.parent instanceof THREE10.SkinnedMesh) && !obj.name.toLowerCase().includes("player")) {
|
|
2637
2682
|
staticCandidates++;
|
|
2638
2683
|
}
|
|
2639
2684
|
} else {
|
|
2640
2685
|
alreadyStatic++;
|
|
2641
2686
|
}
|
|
2642
|
-
if (obj instanceof
|
|
2687
|
+
if (obj instanceof THREE10.SkinnedMesh) {
|
|
2643
2688
|
skinnedMeshes++;
|
|
2644
2689
|
if (obj.skeleton) {
|
|
2645
2690
|
skinnedBoneCount += obj.skeleton.bones.length;
|
|
2646
2691
|
}
|
|
2647
2692
|
}
|
|
2648
|
-
if (obj instanceof
|
|
2693
|
+
if (obj instanceof THREE10.Mesh || obj instanceof THREE10.SkinnedMesh) {
|
|
2649
2694
|
if (obj.castShadow) shadowCasters++;
|
|
2650
2695
|
if (obj.receiveShadow) shadowReceivers++;
|
|
2651
2696
|
const mat = obj.material;
|
|
@@ -2656,7 +2701,7 @@ var DebugPanelThree = class _DebugPanelThree {
|
|
|
2656
2701
|
});
|
|
2657
2702
|
let shadowLights = 0;
|
|
2658
2703
|
scene.traverse((obj) => {
|
|
2659
|
-
if (obj instanceof
|
|
2704
|
+
if (obj instanceof THREE10.Light && obj.castShadow) {
|
|
2660
2705
|
shadowLights++;
|
|
2661
2706
|
}
|
|
2662
2707
|
});
|
|
@@ -2724,9 +2769,9 @@ var DebugPanelThree = class _DebugPanelThree {
|
|
|
2724
2769
|
);
|
|
2725
2770
|
const geometryGroups = /* @__PURE__ */ new Map();
|
|
2726
2771
|
scene.traverse((obj) => {
|
|
2727
|
-
if (obj instanceof
|
|
2728
|
-
if (obj instanceof
|
|
2729
|
-
if (obj instanceof
|
|
2772
|
+
if (obj instanceof THREE10.SkinnedMesh) return;
|
|
2773
|
+
if (obj instanceof THREE10.InstancedMesh) return;
|
|
2774
|
+
if (obj instanceof THREE10.Mesh && obj.visible) {
|
|
2730
2775
|
const geomId = obj.geometry.uuid;
|
|
2731
2776
|
if (!geometryGroups.has(geomId)) {
|
|
2732
2777
|
geometryGroups.set(geomId, []);
|
|
@@ -2742,11 +2787,11 @@ var DebugPanelThree = class _DebugPanelThree {
|
|
|
2742
2787
|
const geometry = firstMesh.geometry;
|
|
2743
2788
|
const material = firstMesh.material;
|
|
2744
2789
|
if (Array.isArray(material)) continue;
|
|
2745
|
-
const instancedMesh = new
|
|
2790
|
+
const instancedMesh = new THREE10.InstancedMesh(geometry, material, meshes.length);
|
|
2746
2791
|
instancedMesh.name = `Instanced_${firstMesh.name || "unnamed"}`;
|
|
2747
2792
|
instancedMesh.castShadow = firstMesh.castShadow;
|
|
2748
2793
|
instancedMesh.receiveShadow = firstMesh.receiveShadow;
|
|
2749
|
-
const matrix = new
|
|
2794
|
+
const matrix = new THREE10.Matrix4();
|
|
2750
2795
|
for (let i = 0; i < meshes.length; i++) {
|
|
2751
2796
|
const mesh = meshes[i];
|
|
2752
2797
|
mesh.updateWorldMatrix(true, false);
|
|
@@ -3059,7 +3104,7 @@ var DebugPanelThree = class _DebugPanelThree {
|
|
|
3059
3104
|
return;
|
|
3060
3105
|
}
|
|
3061
3106
|
try {
|
|
3062
|
-
const worldPos = new
|
|
3107
|
+
const worldPos = new THREE10.Vector3();
|
|
3063
3108
|
this.playerGameObject.getWorldPosition(worldPos);
|
|
3064
3109
|
const xDisplay = document.getElementById("player-x-display");
|
|
3065
3110
|
const yDisplay = document.getElementById("player-y-display");
|
|
@@ -3138,12 +3183,12 @@ var DebugPanelThree = class _DebugPanelThree {
|
|
|
3138
3183
|
};
|
|
3139
3184
|
|
|
3140
3185
|
// src/systems/lighting/DirectionalLightComponentThree.ts
|
|
3141
|
-
import * as
|
|
3186
|
+
import * as THREE11 from "three";
|
|
3142
3187
|
var DirectionalLightComponent = class extends Component {
|
|
3143
3188
|
light;
|
|
3144
3189
|
constructor(options = {}) {
|
|
3145
3190
|
super();
|
|
3146
|
-
this.light = new
|
|
3191
|
+
this.light = new THREE11.DirectionalLight(options.color || 16777215, options.intensity || 1);
|
|
3147
3192
|
if (options.castShadow) {
|
|
3148
3193
|
this.light.castShadow = true;
|
|
3149
3194
|
if (options.shadowMapSize) {
|
|
@@ -3209,7 +3254,7 @@ var DirectionalLightComponent = class extends Component {
|
|
|
3209
3254
|
};
|
|
3210
3255
|
|
|
3211
3256
|
// src/systems/lighting/AmbientLightComponentThree.ts
|
|
3212
|
-
import * as
|
|
3257
|
+
import * as THREE12 from "three";
|
|
3213
3258
|
var AmbientLightComponent = class extends Component {
|
|
3214
3259
|
ambientLight;
|
|
3215
3260
|
hemisphereLight = null;
|
|
@@ -3218,7 +3263,7 @@ var AmbientLightComponent = class extends Component {
|
|
|
3218
3263
|
super();
|
|
3219
3264
|
if (options.groundColor !== void 0) {
|
|
3220
3265
|
this.useHemispheric = true;
|
|
3221
|
-
this.hemisphereLight = new
|
|
3266
|
+
this.hemisphereLight = new THREE12.HemisphereLight(
|
|
3222
3267
|
options.color || 16777215,
|
|
3223
3268
|
// sky color
|
|
3224
3269
|
options.groundColor,
|
|
@@ -3229,7 +3274,7 @@ var AmbientLightComponent = class extends Component {
|
|
|
3229
3274
|
this.hemisphereLight.position.copy(options.direction);
|
|
3230
3275
|
}
|
|
3231
3276
|
} else {
|
|
3232
|
-
this.ambientLight = new
|
|
3277
|
+
this.ambientLight = new THREE12.AmbientLight(
|
|
3233
3278
|
options.color || 4210752,
|
|
3234
3279
|
options.intensity || 0.4
|
|
3235
3280
|
);
|
|
@@ -3286,11 +3331,11 @@ var AmbientLightComponent = class extends Component {
|
|
|
3286
3331
|
};
|
|
3287
3332
|
|
|
3288
3333
|
// src/systems/materials/MaterialUtils.ts
|
|
3289
|
-
import * as
|
|
3334
|
+
import * as THREE13 from "three";
|
|
3290
3335
|
var MaterialUtils = class _MaterialUtils {
|
|
3291
3336
|
// Centralized default path for the toon gradient ramp used by toon materials
|
|
3292
3337
|
static DEFAULT_TOON_GRADIENT_PATH = "assets/cozy_game_general/threeTone.jpg";
|
|
3293
|
-
static textureLoader = new
|
|
3338
|
+
static textureLoader = new THREE13.TextureLoader();
|
|
3294
3339
|
static cachedGradientMap = null;
|
|
3295
3340
|
/**
|
|
3296
3341
|
* Create a standard PBR material with common settings
|
|
@@ -3313,19 +3358,19 @@ var MaterialUtils = class _MaterialUtils {
|
|
|
3313
3358
|
} else if (options.normalMap) {
|
|
3314
3359
|
materialOptions.normalMap = options.normalMap;
|
|
3315
3360
|
}
|
|
3316
|
-
return new
|
|
3361
|
+
return new THREE13.MeshStandardMaterial(materialOptions);
|
|
3317
3362
|
}
|
|
3318
3363
|
/**
|
|
3319
3364
|
* Create a basic material with a color
|
|
3320
3365
|
*/
|
|
3321
3366
|
static createBasicMaterial(color) {
|
|
3322
|
-
return new
|
|
3367
|
+
return new THREE13.MeshBasicMaterial({ color });
|
|
3323
3368
|
}
|
|
3324
3369
|
/**
|
|
3325
3370
|
* Create a Lambert material (good for low-poly/stylized looks)
|
|
3326
3371
|
*/
|
|
3327
3372
|
static createLambertMaterial(options = {}) {
|
|
3328
|
-
return new
|
|
3373
|
+
return new THREE13.MeshLambertMaterial({
|
|
3329
3374
|
color: options.color || 16777215,
|
|
3330
3375
|
map: options.map
|
|
3331
3376
|
});
|
|
@@ -3334,8 +3379,8 @@ var MaterialUtils = class _MaterialUtils {
|
|
|
3334
3379
|
* Create a material with texture
|
|
3335
3380
|
*/
|
|
3336
3381
|
static createTexturedMaterial(textureUrl, options = {}) {
|
|
3337
|
-
const texture = new
|
|
3338
|
-
return new
|
|
3382
|
+
const texture = new THREE13.TextureLoader().load(textureUrl);
|
|
3383
|
+
return new THREE13.MeshStandardMaterial({
|
|
3339
3384
|
color: options.color || 16777215,
|
|
3340
3385
|
map: texture,
|
|
3341
3386
|
roughness: options.roughness || 0.5,
|
|
@@ -3346,7 +3391,7 @@ var MaterialUtils = class _MaterialUtils {
|
|
|
3346
3391
|
* Create a simple shared material for prototyping
|
|
3347
3392
|
*/
|
|
3348
3393
|
static createSharedMaterial(color = 16777215) {
|
|
3349
|
-
return new
|
|
3394
|
+
return new THREE13.MeshStandardMaterial({
|
|
3350
3395
|
color,
|
|
3351
3396
|
roughness: 0.7,
|
|
3352
3397
|
metalness: 0.1
|
|
@@ -3362,10 +3407,10 @@ var MaterialUtils = class _MaterialUtils {
|
|
|
3362
3407
|
return _MaterialUtils.cachedGradientMap;
|
|
3363
3408
|
}
|
|
3364
3409
|
const tex = _MaterialUtils.textureLoader.load(gradientPath);
|
|
3365
|
-
tex.minFilter =
|
|
3366
|
-
tex.magFilter =
|
|
3410
|
+
tex.minFilter = THREE13.NearestFilter;
|
|
3411
|
+
tex.magFilter = THREE13.NearestFilter;
|
|
3367
3412
|
tex.generateMipmaps = false;
|
|
3368
|
-
tex.colorSpace =
|
|
3413
|
+
tex.colorSpace = THREE13.SRGBColorSpace;
|
|
3369
3414
|
_MaterialUtils.cachedGradientMap = tex;
|
|
3370
3415
|
return tex;
|
|
3371
3416
|
}
|
|
@@ -3382,7 +3427,7 @@ var MaterialUtils = class _MaterialUtils {
|
|
|
3382
3427
|
if (options.map) params.map = options.map;
|
|
3383
3428
|
if (options.mapPath) params.map = _MaterialUtils.textureLoader.load(options.mapPath);
|
|
3384
3429
|
if (options.emissive !== void 0) params.emissive = options.emissive;
|
|
3385
|
-
return new
|
|
3430
|
+
return new THREE13.MeshToonMaterial(params);
|
|
3386
3431
|
}
|
|
3387
3432
|
/**
|
|
3388
3433
|
* Convert an arbitrary THREE.Material into a MeshToonMaterial while
|
|
@@ -3390,8 +3435,8 @@ var MaterialUtils = class _MaterialUtils {
|
|
|
3390
3435
|
*/
|
|
3391
3436
|
static convertToToon(material, gradientPath) {
|
|
3392
3437
|
const baseMat = material;
|
|
3393
|
-
const toon = new
|
|
3394
|
-
color: baseMat.color ? baseMat.color.clone() : new
|
|
3438
|
+
const toon = new THREE13.MeshToonMaterial({
|
|
3439
|
+
color: baseMat.color ? baseMat.color.clone() : new THREE13.Color(16777215),
|
|
3395
3440
|
map: baseMat.map ?? void 0,
|
|
3396
3441
|
transparent: baseMat.transparent ?? false,
|
|
3397
3442
|
opacity: baseMat.opacity ?? 1,
|
|
@@ -3407,7 +3452,7 @@ var MaterialUtils = class _MaterialUtils {
|
|
|
3407
3452
|
};
|
|
3408
3453
|
|
|
3409
3454
|
// src/systems/navigation/NavAgent.ts
|
|
3410
|
-
import * as
|
|
3455
|
+
import * as THREE14 from "three";
|
|
3411
3456
|
var NavAgent = class extends Component {
|
|
3412
3457
|
// Public movement parameters - can be adjusted directly
|
|
3413
3458
|
moveSpeed = 5;
|
|
@@ -3420,7 +3465,7 @@ var NavAgent = class extends Component {
|
|
|
3420
3465
|
waypoints = [];
|
|
3421
3466
|
currentWaypointIndex = 0;
|
|
3422
3467
|
// Smooth movement interpolation
|
|
3423
|
-
currentVelocity = new
|
|
3468
|
+
currentVelocity = new THREE14.Vector3();
|
|
3424
3469
|
maxSpeed = 5;
|
|
3425
3470
|
// Target tracking
|
|
3426
3471
|
currentTarget = null;
|
|
@@ -3439,7 +3484,7 @@ var NavAgent = class extends Component {
|
|
|
3439
3484
|
*/
|
|
3440
3485
|
moveTo(targetPosition) {
|
|
3441
3486
|
this.maxSpeed = this.moveSpeed;
|
|
3442
|
-
const target3D = targetPosition instanceof
|
|
3487
|
+
const target3D = targetPosition instanceof THREE14.Vector2 ? new THREE14.Vector3(targetPosition.x, 0, targetPosition.y) : targetPosition;
|
|
3443
3488
|
this.clearVisualization();
|
|
3444
3489
|
const result = DynamicNavSystem.findPath(this.gameObject.position, target3D);
|
|
3445
3490
|
if (result.success) {
|
|
@@ -3535,7 +3580,7 @@ var NavAgent = class extends Component {
|
|
|
3535
3580
|
this.clearTarget();
|
|
3536
3581
|
return false;
|
|
3537
3582
|
}
|
|
3538
|
-
const waypoints = pathResult.waypoints.map((wp) => new
|
|
3583
|
+
const waypoints = pathResult.waypoints.map((wp) => new THREE14.Vector3(wp.x, 0, wp.z));
|
|
3539
3584
|
this.setWaypoints(waypoints);
|
|
3540
3585
|
return true;
|
|
3541
3586
|
}
|
|
@@ -3578,7 +3623,7 @@ var NavAgent = class extends Component {
|
|
|
3578
3623
|
*/
|
|
3579
3624
|
handlePathComplete(deltaTime) {
|
|
3580
3625
|
if (this.currentWaypointIndex >= this.waypoints.length) {
|
|
3581
|
-
this.currentVelocity.lerp(new
|
|
3626
|
+
this.currentVelocity.lerp(new THREE14.Vector3(), this.deceleration * deltaTime);
|
|
3582
3627
|
this.applyMovement(deltaTime);
|
|
3583
3628
|
if (this.currentVelocity.length() < 0.1) {
|
|
3584
3629
|
this.isMoving = false;
|
|
@@ -3647,7 +3692,7 @@ var NavAgent = class extends Component {
|
|
|
3647
3692
|
};
|
|
3648
3693
|
|
|
3649
3694
|
// src/systems/ui/UIUtils.ts
|
|
3650
|
-
import * as
|
|
3695
|
+
import * as THREE15 from "three";
|
|
3651
3696
|
var UIUtils = class _UIUtils {
|
|
3652
3697
|
/**
|
|
3653
3698
|
* Create world-space UI plane with consistent text sizing
|
|
@@ -3673,18 +3718,18 @@ var UIUtils = class _UIUtils {
|
|
|
3673
3718
|
ctx.textAlign = "center";
|
|
3674
3719
|
ctx.imageSmoothingEnabled = true;
|
|
3675
3720
|
ctx.imageSmoothingQuality = "high";
|
|
3676
|
-
const texture = new
|
|
3677
|
-
texture.colorSpace =
|
|
3678
|
-
texture.minFilter =
|
|
3679
|
-
texture.magFilter =
|
|
3680
|
-
texture.wrapS =
|
|
3681
|
-
texture.wrapT =
|
|
3721
|
+
const texture = new THREE15.CanvasTexture(canvas);
|
|
3722
|
+
texture.colorSpace = THREE15.SRGBColorSpace;
|
|
3723
|
+
texture.minFilter = THREE15.LinearFilter;
|
|
3724
|
+
texture.magFilter = THREE15.LinearFilter;
|
|
3725
|
+
texture.wrapS = THREE15.ClampToEdgeWrapping;
|
|
3726
|
+
texture.wrapT = THREE15.ClampToEdgeWrapping;
|
|
3682
3727
|
texture.flipY = true;
|
|
3683
3728
|
texture.generateMipmaps = false;
|
|
3684
|
-
const geometry = new
|
|
3685
|
-
const material = new
|
|
3729
|
+
const geometry = new THREE15.PlaneGeometry(worldWidth, worldHeight);
|
|
3730
|
+
const material = new THREE15.ShaderMaterial({
|
|
3686
3731
|
transparent: true,
|
|
3687
|
-
side:
|
|
3732
|
+
side: THREE15.DoubleSide,
|
|
3688
3733
|
fog: false,
|
|
3689
3734
|
depthWrite: false,
|
|
3690
3735
|
uniforms: {
|
|
@@ -3708,7 +3753,7 @@ var UIUtils = class _UIUtils {
|
|
|
3708
3753
|
}
|
|
3709
3754
|
`
|
|
3710
3755
|
});
|
|
3711
|
-
const plane = new
|
|
3756
|
+
const plane = new THREE15.Mesh(geometry, material);
|
|
3712
3757
|
plane.rotation.x = -Math.PI / 2;
|
|
3713
3758
|
if (flipOrientation) {
|
|
3714
3759
|
plane.rotation.z = Math.PI;
|
|
@@ -4667,16 +4712,16 @@ var UILoadingScreen = class {
|
|
|
4667
4712
|
};
|
|
4668
4713
|
|
|
4669
4714
|
// src/systems/particle-system/index.ts
|
|
4670
|
-
import * as
|
|
4715
|
+
import * as THREE18 from "three";
|
|
4671
4716
|
|
|
4672
4717
|
// src/systems/particle-system/Particle.ts
|
|
4673
|
-
import * as
|
|
4718
|
+
import * as THREE16 from "three";
|
|
4674
4719
|
var Particle = class _Particle extends Component {
|
|
4675
4720
|
emitter = null;
|
|
4676
4721
|
config;
|
|
4677
4722
|
assets;
|
|
4678
4723
|
// Reusable vector to avoid allocation on trigger
|
|
4679
|
-
static _tempOrigin = new
|
|
4724
|
+
static _tempOrigin = new THREE16.Vector3();
|
|
4680
4725
|
/**
|
|
4681
4726
|
* Creates a new particle emitter component
|
|
4682
4727
|
* @param config - The emitter configuration
|
|
@@ -4924,7 +4969,7 @@ function updateKeyframe(curve, index, updates) {
|
|
|
4924
4969
|
}
|
|
4925
4970
|
|
|
4926
4971
|
// src/systems/particle-system/ParticleSystemPrefabComponent.ts
|
|
4927
|
-
import * as
|
|
4972
|
+
import * as THREE17 from "three";
|
|
4928
4973
|
function unwrapModule(module) {
|
|
4929
4974
|
const result = {};
|
|
4930
4975
|
for (const key in module) {
|
|
@@ -4944,12 +4989,12 @@ function isEnabled(val, defaultEnabled = true) {
|
|
|
4944
4989
|
function getBlendingMode(mode) {
|
|
4945
4990
|
switch (mode) {
|
|
4946
4991
|
case "additive":
|
|
4947
|
-
return
|
|
4992
|
+
return THREE17.AdditiveBlending;
|
|
4948
4993
|
case "multiply":
|
|
4949
|
-
return
|
|
4994
|
+
return THREE17.MultiplyBlending;
|
|
4950
4995
|
case "normal":
|
|
4951
4996
|
default:
|
|
4952
|
-
return
|
|
4997
|
+
return THREE17.NormalBlending;
|
|
4953
4998
|
}
|
|
4954
4999
|
}
|
|
4955
5000
|
function deepUnwrap(value) {
|
|
@@ -5019,7 +5064,7 @@ var ParticleSystemPrefabComponent = class extends Component {
|
|
|
5019
5064
|
if (!this.emitter) return;
|
|
5020
5065
|
const stowkit = StowKitSystem.getInstance();
|
|
5021
5066
|
const tex = await stowkit.getTexture(textureRef.assetId);
|
|
5022
|
-
tex.colorSpace =
|
|
5067
|
+
tex.colorSpace = THREE17.NoColorSpace;
|
|
5023
5068
|
tex.needsUpdate = true;
|
|
5024
5069
|
if (this.emitter) {
|
|
5025
5070
|
const material = this.emitter.object.material;
|
|
@@ -5074,23 +5119,23 @@ var ParticleSystemPrefabComponent = class extends Component {
|
|
|
5074
5119
|
shape: isEnabled(shape.enabled) ? shape.shape ?? "cone" : "point",
|
|
5075
5120
|
radius: shape.radius ?? 0.25,
|
|
5076
5121
|
coneAngle: [degToRad(shape.coneAngleMin ?? 15), degToRad(shape.coneAngleMax ?? 30)],
|
|
5077
|
-
coneDirection: new
|
|
5122
|
+
coneDirection: new THREE17.Vector3(
|
|
5078
5123
|
shape.coneDirection?.[0] ?? 0,
|
|
5079
5124
|
shape.coneDirection?.[1] ?? 1,
|
|
5080
5125
|
shape.coneDirection?.[2] ?? 0
|
|
5081
5126
|
),
|
|
5082
|
-
boxSize: new
|
|
5127
|
+
boxSize: new THREE17.Vector3(
|
|
5083
5128
|
shape.boxSize?.[0] ?? 1,
|
|
5084
5129
|
shape.boxSize?.[1] ?? 1,
|
|
5085
5130
|
shape.boxSize?.[2] ?? 1
|
|
5086
5131
|
),
|
|
5087
5132
|
sphereRadius: shape.sphereRadius ?? 1,
|
|
5088
5133
|
// Velocity - apply gravity modifier (like editor)
|
|
5089
|
-
gravity: isEnabled(velocity.enabled) ? new
|
|
5134
|
+
gravity: isEnabled(velocity.enabled) ? new THREE17.Vector3(
|
|
5090
5135
|
(baseGravity[0] ?? 0) * gravityModifier,
|
|
5091
5136
|
(baseGravity[1] ?? -9.8) * gravityModifier,
|
|
5092
5137
|
(baseGravity[2] ?? 0) * gravityModifier
|
|
5093
|
-
) : new
|
|
5138
|
+
) : new THREE17.Vector3(0, 0, 0),
|
|
5094
5139
|
// Damping
|
|
5095
5140
|
damping: isEnabled(velocity.enabled) ? velocity.damping ?? 0 : 0,
|
|
5096
5141
|
// Size - start from main, end from size module (like editor)
|
|
@@ -5121,7 +5166,7 @@ var ParticleSystemPrefabComponent = class extends Component {
|
|
|
5121
5166
|
} : void 0,
|
|
5122
5167
|
// Color (like editor)
|
|
5123
5168
|
color: {
|
|
5124
|
-
start: new
|
|
5169
|
+
start: new THREE17.Vector4(
|
|
5125
5170
|
main.startColor?.[0] ?? 1,
|
|
5126
5171
|
main.startColor?.[1] ?? 1,
|
|
5127
5172
|
main.startColor?.[2] ?? 1,
|
|
@@ -5129,23 +5174,23 @@ var ParticleSystemPrefabComponent = class extends Component {
|
|
|
5129
5174
|
),
|
|
5130
5175
|
// Random start colors list - convert array of [r,g,b,a] to Vector4 array
|
|
5131
5176
|
startList: isEnabled(main.useRandomStartColors, false) && Array.isArray(main.randomStartColors) && main.randomStartColors.length > 0 ? main.randomStartColors.map(
|
|
5132
|
-
(c) => new
|
|
5177
|
+
(c) => new THREE17.Vector4(c[0] ?? 1, c[1] ?? 1, c[2] ?? 1, c[3] ?? 1)
|
|
5133
5178
|
) : void 0,
|
|
5134
5179
|
// When colorOverLifetime is disabled, use start color as end (no fade)
|
|
5135
5180
|
// This ensures random start colors stay constant throughout particle lifetime
|
|
5136
5181
|
useStartAsEnd: !isEnabled(main.colorOverLifetime, false),
|
|
5137
|
-
mid: isEnabled(main.colorOverLifetime, false) && isEnabled(main.useMidColor, false) ? new
|
|
5182
|
+
mid: isEnabled(main.colorOverLifetime, false) && isEnabled(main.useMidColor, false) ? new THREE17.Vector4(
|
|
5138
5183
|
main.midColor?.[0] ?? 0.8,
|
|
5139
5184
|
main.midColor?.[1] ?? 0.8,
|
|
5140
5185
|
main.midColor?.[2] ?? 0.8,
|
|
5141
5186
|
main.midColor?.[3] ?? 0.7
|
|
5142
5187
|
) : void 0,
|
|
5143
|
-
end: isEnabled(main.colorOverLifetime, false) ? new
|
|
5188
|
+
end: isEnabled(main.colorOverLifetime, false) ? new THREE17.Vector4(
|
|
5144
5189
|
main.endColor?.[0] ?? 0.5,
|
|
5145
5190
|
main.endColor?.[1] ?? 0.5,
|
|
5146
5191
|
main.endColor?.[2] ?? 0.5,
|
|
5147
5192
|
main.endColor?.[3] ?? 0
|
|
5148
|
-
) : new
|
|
5193
|
+
) : new THREE17.Vector4(
|
|
5149
5194
|
main.startColor?.[0] ?? 1,
|
|
5150
5195
|
main.startColor?.[1] ?? 1,
|
|
5151
5196
|
main.startColor?.[2] ?? 1,
|
|
@@ -5214,7 +5259,7 @@ var ParticleSystemPrefabComponent = class extends Component {
|
|
|
5214
5259
|
gradient.addColorStop(1, "rgba(255, 255, 255, 0)");
|
|
5215
5260
|
ctx.fillStyle = gradient;
|
|
5216
5261
|
ctx.fillRect(0, 0, size, size);
|
|
5217
|
-
const texture = new
|
|
5262
|
+
const texture = new THREE17.CanvasTexture(canvas);
|
|
5218
5263
|
texture.needsUpdate = true;
|
|
5219
5264
|
return { texture };
|
|
5220
5265
|
}
|
|
@@ -5263,7 +5308,7 @@ var ParticleSystemPrefabComponent = class extends Component {
|
|
|
5263
5308
|
}
|
|
5264
5309
|
};
|
|
5265
5310
|
// Reusable vector to avoid allocation on trigger
|
|
5266
|
-
__publicField(ParticleSystemPrefabComponent, "_tempOrigin", new
|
|
5311
|
+
__publicField(ParticleSystemPrefabComponent, "_tempOrigin", new THREE17.Vector3());
|
|
5267
5312
|
ParticleSystemPrefabComponent = __decorateClass([
|
|
5268
5313
|
PrefabComponent("particle_system")
|
|
5269
5314
|
], ParticleSystemPrefabComponent);
|
|
@@ -5274,7 +5319,7 @@ function randRange(r) {
|
|
|
5274
5319
|
return r;
|
|
5275
5320
|
}
|
|
5276
5321
|
function randVec4(r, out) {
|
|
5277
|
-
if (r instanceof
|
|
5322
|
+
if (r instanceof THREE18.Vector4) {
|
|
5278
5323
|
out.copy(r);
|
|
5279
5324
|
return out;
|
|
5280
5325
|
}
|
|
@@ -5652,26 +5697,26 @@ function createParticleEmitter(cfg = {}, assets = {}) {
|
|
|
5652
5697
|
const baseSizeX = baseBillboardSize;
|
|
5653
5698
|
const baseSizeY = baseBillboardSize;
|
|
5654
5699
|
let velocityScaleFactor = cfg.alignment?.velocityScale ?? 0.4;
|
|
5655
|
-
const texture = assets.texture ? assets.texture : assets.textureUrl ? new
|
|
5656
|
-
texture.wrapS =
|
|
5657
|
-
texture.wrapT =
|
|
5658
|
-
texture.minFilter =
|
|
5659
|
-
texture.magFilter =
|
|
5700
|
+
const texture = assets.texture ? assets.texture : assets.textureUrl ? new THREE18.TextureLoader().load(assets.textureUrl) : cfg.textureUrl ? new THREE18.TextureLoader().load(cfg.textureUrl) : new THREE18.TextureLoader().load("assets/particle_tex.jpg");
|
|
5701
|
+
texture.wrapS = THREE18.ClampToEdgeWrapping;
|
|
5702
|
+
texture.wrapT = THREE18.ClampToEdgeWrapping;
|
|
5703
|
+
texture.minFilter = THREE18.NearestFilter;
|
|
5704
|
+
texture.magFilter = THREE18.NearestFilter;
|
|
5660
5705
|
texture.generateMipmaps = false;
|
|
5661
5706
|
texture.needsUpdate = true;
|
|
5662
|
-
const material = new
|
|
5707
|
+
const material = new THREE18.RawShaderMaterial({
|
|
5663
5708
|
uniforms: {
|
|
5664
5709
|
map: { value: texture },
|
|
5665
5710
|
spriteSheetEnabled: { value: cfg.spriteSheet ? 1 : 0 },
|
|
5666
5711
|
spriteGrid: {
|
|
5667
|
-
value: new
|
|
5712
|
+
value: new THREE18.Vector2(cfg.spriteSheet?.columns ?? 1, cfg.spriteSheet?.rows ?? 1)
|
|
5668
5713
|
},
|
|
5669
5714
|
spriteTotalFrames: {
|
|
5670
5715
|
value: cfg.spriteSheet ? cfg.spriteSheet.frameCount ?? (cfg.spriteSheet.columns ?? 1) * (cfg.spriteSheet.rows ?? 1) : 1
|
|
5671
5716
|
},
|
|
5672
5717
|
spriteCurrentFrame: { value: 0 },
|
|
5673
5718
|
spritePerParticle: { value: 1 },
|
|
5674
|
-
spritePad: { value: new
|
|
5719
|
+
spritePad: { value: new THREE18.Vector2(2e-3, 2e-3) },
|
|
5675
5720
|
useMaskFromLuminance: {
|
|
5676
5721
|
value: cfg.maskFromLuminance ?? false ? 1 : 0
|
|
5677
5722
|
}
|
|
@@ -5744,19 +5789,19 @@ function createParticleEmitter(cfg = {}, assets = {}) {
|
|
|
5744
5789
|
`,
|
|
5745
5790
|
transparent: true,
|
|
5746
5791
|
depthWrite: false,
|
|
5747
|
-
blending: cfg.blending ??
|
|
5748
|
-
side:
|
|
5792
|
+
blending: cfg.blending ?? THREE18.AdditiveBlending,
|
|
5793
|
+
side: THREE18.DoubleSide
|
|
5749
5794
|
});
|
|
5750
5795
|
material.premultipliedAlpha = cfg.premultipliedAlpha ?? false;
|
|
5751
|
-
const geometry = new
|
|
5752
|
-
const mesh = new
|
|
5796
|
+
const geometry = new THREE18.PlaneGeometry(1, 1);
|
|
5797
|
+
const mesh = new THREE18.InstancedMesh(geometry, material, particleCount);
|
|
5753
5798
|
const instanceColors = new Float32Array(particleCount * 3);
|
|
5754
5799
|
for (let i = 0; i < particleCount * 3; i++) instanceColors[i] = 1;
|
|
5755
|
-
mesh.instanceColor = new
|
|
5800
|
+
mesh.instanceColor = new THREE18.InstancedBufferAttribute(instanceColors, 3);
|
|
5756
5801
|
const instanceOpacity = new Float32Array(particleCount);
|
|
5757
|
-
geometry.setAttribute("instanceOpacity", new
|
|
5802
|
+
geometry.setAttribute("instanceOpacity", new THREE18.InstancedBufferAttribute(instanceOpacity, 1));
|
|
5758
5803
|
const instanceFrame = new Float32Array(particleCount);
|
|
5759
|
-
geometry.setAttribute("instanceFrame", new
|
|
5804
|
+
geometry.setAttribute("instanceFrame", new THREE18.InstancedBufferAttribute(instanceFrame, 1));
|
|
5760
5805
|
const positions = new Float32Array(particleCount * 3);
|
|
5761
5806
|
const velocities = new Float32Array(particleCount * 3);
|
|
5762
5807
|
const ages = new Float32Array(particleCount);
|
|
@@ -5784,7 +5829,7 @@ function createParticleEmitter(cfg = {}, assets = {}) {
|
|
|
5784
5829
|
const noiseOctaves = Math.max(1, Math.min(4, Math.round(noiseCfg.octaves ?? 1)));
|
|
5785
5830
|
const noiseStrengthX = noiseCfg.strengthX ?? 1;
|
|
5786
5831
|
const noiseStrengthY = noiseCfg.strengthY ?? 1;
|
|
5787
|
-
const gravity = cfg.gravity ? cfg.gravity.clone() : new
|
|
5832
|
+
const gravity = cfg.gravity ? cfg.gravity.clone() : new THREE18.Vector3(0, -9.8, 0);
|
|
5788
5833
|
const damping = cfg.damping ?? 0;
|
|
5789
5834
|
const orbitalX = cfg.orbital?.x ?? 0;
|
|
5790
5835
|
const orbitalY = cfg.orbital?.y ?? 0;
|
|
@@ -5794,7 +5839,7 @@ function createParticleEmitter(cfg = {}, assets = {}) {
|
|
|
5794
5839
|
const emission = cfg.emission ?? { mode: "constant", rateOverTime: 50 };
|
|
5795
5840
|
let currentSpawnRate = emission.mode === "constant" ? emission.rateOverTime ?? 50 : 0;
|
|
5796
5841
|
const shape = cfg.shape ?? EmitterShape.CONE;
|
|
5797
|
-
const coneDirection = (cfg.coneDirection ?? new
|
|
5842
|
+
const coneDirection = (cfg.coneDirection ?? new THREE18.Vector3(0, 1, 0)).clone().normalize();
|
|
5798
5843
|
const coneAngleRange = cfg.coneAngle ?? [Math.PI / 16, Math.PI / 12];
|
|
5799
5844
|
const speedRange = cfg.speed ?? [1, 3];
|
|
5800
5845
|
const lifeRange = cfg.lifetime ?? [1.5, 3];
|
|
@@ -5802,18 +5847,18 @@ function createParticleEmitter(cfg = {}, assets = {}) {
|
|
|
5802
5847
|
const sizeRangeEnd = cfg.size?.end ?? [0.2, 0.5];
|
|
5803
5848
|
const rotAngleRange = cfg.rotation ? cfg.rotation.angle ?? [0, Math.PI * 2] : [0, 0];
|
|
5804
5849
|
const rotVelRange = cfg.rotation ? cfg.rotation.velocity ?? [-6, 6] : [0, 0];
|
|
5805
|
-
const colorStartRange = cfg.color?.start ?? new
|
|
5850
|
+
const colorStartRange = cfg.color?.start ?? new THREE18.Vector4(1, 0.8, 0.2, 1);
|
|
5806
5851
|
const colorStartList = cfg.color?.startList;
|
|
5807
5852
|
const colorUseStartAsEnd = cfg.color?.useStartAsEnd ?? false;
|
|
5808
5853
|
const colorMidRange = cfg.color?.mid;
|
|
5809
|
-
const colorEndRange = cfg.color?.end ?? new
|
|
5854
|
+
const colorEndRange = cfg.color?.end ?? new THREE18.Vector4(0.8, 0.1, 0.02, 0);
|
|
5810
5855
|
const collisionCfg = cfg.collision ?? {};
|
|
5811
5856
|
const floorCollisionEnabled = collisionCfg.enabled ?? true;
|
|
5812
5857
|
const floorY = collisionCfg.planeY ?? 0;
|
|
5813
5858
|
const floorBounceRestitution = collisionCfg.restitution ?? 0.7;
|
|
5814
5859
|
const floorFriction = collisionCfg.friction ?? 0.5;
|
|
5815
5860
|
const killAfterBounces = collisionCfg.killAfterBounces ?? 2;
|
|
5816
|
-
let burstOrigin = new
|
|
5861
|
+
let burstOrigin = new THREE18.Vector3();
|
|
5817
5862
|
let spawnAccumulator = 0;
|
|
5818
5863
|
let isPlayingState = cfg.playOnAwake ?? true;
|
|
5819
5864
|
let elapsed = 0;
|
|
@@ -5838,34 +5883,34 @@ function createParticleEmitter(cfg = {}, assets = {}) {
|
|
|
5838
5883
|
const pts = [];
|
|
5839
5884
|
for (let i = 0; i <= 64; i++) {
|
|
5840
5885
|
const t = i / 64 * Math.PI * 2;
|
|
5841
|
-
const p = new
|
|
5886
|
+
const p = new THREE18.Vector3().copy(axis).multiplyScalar(L).addScaledVector(u, Math.cos(t) * r).addScaledVector(v, Math.sin(t) * r);
|
|
5842
5887
|
pts.push(p);
|
|
5843
5888
|
}
|
|
5844
|
-
const geom = new
|
|
5845
|
-
const mat = new
|
|
5889
|
+
const geom = new THREE18.BufferGeometry().setFromPoints(pts);
|
|
5890
|
+
const mat = new THREE18.LineBasicMaterial({
|
|
5846
5891
|
color,
|
|
5847
5892
|
transparent: true,
|
|
5848
5893
|
opacity: 0.6
|
|
5849
5894
|
});
|
|
5850
|
-
return new
|
|
5895
|
+
return new THREE18.Line(geom, mat);
|
|
5851
5896
|
};
|
|
5852
5897
|
var ring = ring2;
|
|
5853
|
-
debugGroup = new
|
|
5898
|
+
debugGroup = new THREE18.Group();
|
|
5854
5899
|
const L = 2;
|
|
5855
5900
|
const minA = Array.isArray(coneAngleRange) ? coneAngleRange[0] : coneAngleRange;
|
|
5856
5901
|
const maxA = Array.isArray(coneAngleRange) ? coneAngleRange[1] : coneAngleRange;
|
|
5857
5902
|
const axis = coneDirection;
|
|
5858
|
-
const u = new
|
|
5859
|
-
const v = new
|
|
5903
|
+
const u = new THREE18.Vector3();
|
|
5904
|
+
const v = new THREE18.Vector3();
|
|
5860
5905
|
if (Math.abs(axis.x) < 0.9) u.set(1, 0, 0);
|
|
5861
5906
|
else u.set(0, 1, 0);
|
|
5862
5907
|
u.cross(axis).normalize();
|
|
5863
5908
|
v.copy(axis).cross(u).normalize();
|
|
5864
|
-
const axisGeom = new
|
|
5865
|
-
new
|
|
5866
|
-
new
|
|
5909
|
+
const axisGeom = new THREE18.BufferGeometry().setFromPoints([
|
|
5910
|
+
new THREE18.Vector3(0, 0, 0),
|
|
5911
|
+
new THREE18.Vector3().copy(axis).multiplyScalar(L)
|
|
5867
5912
|
]);
|
|
5868
|
-
debugGroup.add(new
|
|
5913
|
+
debugGroup.add(new THREE18.Line(axisGeom, new THREE18.LineBasicMaterial({ color: 6737151 })));
|
|
5869
5914
|
debugGroup.add(ring2(minA, 4521796));
|
|
5870
5915
|
debugGroup.add(ring2(maxA, 16729156));
|
|
5871
5916
|
mesh.add(debugGroup);
|
|
@@ -5873,37 +5918,37 @@ function createParticleEmitter(cfg = {}, assets = {}) {
|
|
|
5873
5918
|
if (cfg.debugVelocities) {
|
|
5874
5919
|
const maxLines = Math.min(64, particleCount);
|
|
5875
5920
|
const linePos = new Float32Array(maxLines * 2 * 3);
|
|
5876
|
-
const geom = new
|
|
5877
|
-
geom.setAttribute("position", new
|
|
5878
|
-
const mat = new
|
|
5921
|
+
const geom = new THREE18.BufferGeometry();
|
|
5922
|
+
geom.setAttribute("position", new THREE18.BufferAttribute(linePos, 3));
|
|
5923
|
+
const mat = new THREE18.LineBasicMaterial({
|
|
5879
5924
|
color: 16777062,
|
|
5880
5925
|
transparent: true,
|
|
5881
5926
|
opacity: 0.85
|
|
5882
5927
|
});
|
|
5883
|
-
debugVelSegments = new
|
|
5928
|
+
debugVelSegments = new THREE18.LineSegments(geom, mat);
|
|
5884
5929
|
mesh.add(debugVelSegments);
|
|
5885
5930
|
}
|
|
5886
|
-
const m4 = new
|
|
5887
|
-
const invWorldMatrix = new
|
|
5888
|
-
const pos = new
|
|
5889
|
-
const right = new
|
|
5890
|
-
const up = new
|
|
5891
|
-
const forward = new
|
|
5892
|
-
const rightRot = new
|
|
5893
|
-
const upRot = new
|
|
5894
|
-
const viewDir = new
|
|
5895
|
-
const prevPos = new
|
|
5896
|
-
const prevNdc = new
|
|
5897
|
-
const currNdc = new
|
|
5898
|
-
const tmp4a = new
|
|
5899
|
-
const tmp4b = new
|
|
5900
|
-
const tmp4c = new
|
|
5901
|
-
const tmpColor = new
|
|
5902
|
-
const tmpVec3A = new
|
|
5903
|
-
const tmpVec3B = new
|
|
5904
|
-
const tmpVec3C = new
|
|
5905
|
-
const tmpVec3D = new
|
|
5906
|
-
const tmpVec3E = new
|
|
5931
|
+
const m4 = new THREE18.Matrix4();
|
|
5932
|
+
const invWorldMatrix = new THREE18.Matrix4();
|
|
5933
|
+
const pos = new THREE18.Vector3();
|
|
5934
|
+
const right = new THREE18.Vector3();
|
|
5935
|
+
const up = new THREE18.Vector3();
|
|
5936
|
+
const forward = new THREE18.Vector3();
|
|
5937
|
+
const rightRot = new THREE18.Vector3();
|
|
5938
|
+
const upRot = new THREE18.Vector3();
|
|
5939
|
+
const viewDir = new THREE18.Vector3();
|
|
5940
|
+
const prevPos = new THREE18.Vector3();
|
|
5941
|
+
const prevNdc = new THREE18.Vector3();
|
|
5942
|
+
const currNdc = new THREE18.Vector3();
|
|
5943
|
+
const tmp4a = new THREE18.Vector4();
|
|
5944
|
+
const tmp4b = new THREE18.Vector4();
|
|
5945
|
+
const tmp4c = new THREE18.Vector4();
|
|
5946
|
+
const tmpColor = new THREE18.Color();
|
|
5947
|
+
const tmpVec3A = new THREE18.Vector3();
|
|
5948
|
+
const tmpVec3B = new THREE18.Vector3();
|
|
5949
|
+
const tmpVec3C = new THREE18.Vector3();
|
|
5950
|
+
const tmpVec3D = new THREE18.Vector3();
|
|
5951
|
+
const tmpVec3E = new THREE18.Vector3();
|
|
5907
5952
|
function sampleDirection(spawnPos, out) {
|
|
5908
5953
|
switch (shape) {
|
|
5909
5954
|
case EmitterShape.CONE: {
|
|
@@ -5924,7 +5969,7 @@ function createParticleEmitter(cfg = {}, assets = {}) {
|
|
|
5924
5969
|
return out;
|
|
5925
5970
|
}
|
|
5926
5971
|
}
|
|
5927
|
-
const defaultBoxSize = new
|
|
5972
|
+
const defaultBoxSize = new THREE18.Vector3(1, 1, 1);
|
|
5928
5973
|
const boxSize = cfg.boxSize ?? defaultBoxSize;
|
|
5929
5974
|
function sampleSpawnPosition(origin, out) {
|
|
5930
5975
|
switch (shape) {
|
|
@@ -6043,9 +6088,9 @@ function createParticleEmitter(cfg = {}, assets = {}) {
|
|
|
6043
6088
|
mesh.count = 0;
|
|
6044
6089
|
}
|
|
6045
6090
|
const renderMode = cfg.renderMode ?? "billboard";
|
|
6046
|
-
const emitterRight = new
|
|
6047
|
-
const emitterUp = new
|
|
6048
|
-
const emitterForward = new
|
|
6091
|
+
const emitterRight = new THREE18.Vector3();
|
|
6092
|
+
const emitterUp = new THREE18.Vector3();
|
|
6093
|
+
const emitterForward = new THREE18.Vector3();
|
|
6049
6094
|
const update = (dt, camera, emitterWorldMatrix) => {
|
|
6050
6095
|
if (debugGroup) debugGroup.position.copy(burstOrigin);
|
|
6051
6096
|
if (debugVelSegments) {
|
|
@@ -6749,7 +6794,7 @@ var AnimationLibrary = class _AnimationLibrary {
|
|
|
6749
6794
|
};
|
|
6750
6795
|
|
|
6751
6796
|
// src/systems/animatrix/SharedAnimationManager.ts
|
|
6752
|
-
import * as
|
|
6797
|
+
import * as THREE19 from "three";
|
|
6753
6798
|
var SharedAnimationManager = class _SharedAnimationManager {
|
|
6754
6799
|
static instance = null;
|
|
6755
6800
|
// Cached clips (shared by all characters - this is the main memory savings)
|
|
@@ -6792,7 +6837,7 @@ var CharacterAnimationController = class {
|
|
|
6792
6837
|
isPaused = false;
|
|
6793
6838
|
constructor(model, manager) {
|
|
6794
6839
|
this.manager = manager;
|
|
6795
|
-
this.mixer = new
|
|
6840
|
+
this.mixer = new THREE19.AnimationMixer(model);
|
|
6796
6841
|
}
|
|
6797
6842
|
/**
|
|
6798
6843
|
* Pause animation updates (for off-screen or distant characters)
|
|
@@ -9147,7 +9192,7 @@ var AnimationConsoleFilter = class {
|
|
|
9147
9192
|
};
|
|
9148
9193
|
|
|
9149
9194
|
// src/systems/animatrix/AnimationPerformance.ts
|
|
9150
|
-
import * as
|
|
9195
|
+
import * as THREE20 from "three";
|
|
9151
9196
|
var AnimationPerformance = class {
|
|
9152
9197
|
/**
|
|
9153
9198
|
* Reduce the number of bone influences per vertex for better mobile performance
|
|
@@ -9202,7 +9247,7 @@ var AnimationPerformance = class {
|
|
|
9202
9247
|
let skeleton = null;
|
|
9203
9248
|
let bones = [];
|
|
9204
9249
|
model.traverse((child) => {
|
|
9205
|
-
if (child instanceof
|
|
9250
|
+
if (child instanceof THREE20.SkinnedMesh && child.skeleton) {
|
|
9206
9251
|
skeleton = child.skeleton;
|
|
9207
9252
|
bones = skeleton.bones;
|
|
9208
9253
|
}
|
|
@@ -9242,7 +9287,7 @@ var AnimationPerformance = class {
|
|
|
9242
9287
|
console.log("[AnimationPerformance] Removed objects:", uniqueObjects);
|
|
9243
9288
|
}
|
|
9244
9289
|
}
|
|
9245
|
-
const cleanedClip = new
|
|
9290
|
+
const cleanedClip = new THREE20.AnimationClip(
|
|
9246
9291
|
clip.name,
|
|
9247
9292
|
clip.duration,
|
|
9248
9293
|
validTracks,
|
|
@@ -9255,7 +9300,7 @@ var AnimationPerformance = class {
|
|
|
9255
9300
|
*/
|
|
9256
9301
|
static optimizeModelForMobile(model, maxInfluences = 2) {
|
|
9257
9302
|
model.traverse((child) => {
|
|
9258
|
-
if (child instanceof
|
|
9303
|
+
if (child instanceof THREE20.SkinnedMesh) {
|
|
9259
9304
|
this.reduceSkinInfluences(child, maxInfluences);
|
|
9260
9305
|
}
|
|
9261
9306
|
});
|
|
@@ -9304,7 +9349,7 @@ var AnimationPerformance = class {
|
|
|
9304
9349
|
};
|
|
9305
9350
|
|
|
9306
9351
|
// src/systems/spline/SplineThree.ts
|
|
9307
|
-
import * as
|
|
9352
|
+
import * as THREE21 from "three";
|
|
9308
9353
|
var SplineTypeThree = /* @__PURE__ */ ((SplineTypeThree2) => {
|
|
9309
9354
|
SplineTypeThree2["LINEAR"] = "linear";
|
|
9310
9355
|
SplineTypeThree2["CATMULL_ROM"] = "catmull_rom";
|
|
@@ -9343,7 +9388,7 @@ var SplineThree = class {
|
|
|
9343
9388
|
getPointAt(t) {
|
|
9344
9389
|
t = Math.max(0, Math.min(1, t));
|
|
9345
9390
|
if (this.interpolatedPoints.length === 0) {
|
|
9346
|
-
return new
|
|
9391
|
+
return new THREE21.Vector3();
|
|
9347
9392
|
}
|
|
9348
9393
|
if (t === 0) return this.interpolatedPoints[0].clone();
|
|
9349
9394
|
if (t === 1) return this.interpolatedPoints[this.interpolatedPoints.length - 1].clone();
|
|
@@ -9405,7 +9450,7 @@ var SplineThree = class {
|
|
|
9405
9450
|
* This now uses proper distance-based parameterization
|
|
9406
9451
|
*/
|
|
9407
9452
|
getPointAtDistance(distance) {
|
|
9408
|
-
if (this.totalLength === 0) return new
|
|
9453
|
+
if (this.totalLength === 0) return new THREE21.Vector3();
|
|
9409
9454
|
const t = this.getTFromDistance(distance);
|
|
9410
9455
|
return this.getPointAt(t);
|
|
9411
9456
|
}
|
|
@@ -9414,7 +9459,7 @@ var SplineThree = class {
|
|
|
9414
9459
|
* This now uses proper distance-based parameterization
|
|
9415
9460
|
*/
|
|
9416
9461
|
getDirectionAtDistance(distance) {
|
|
9417
|
-
if (this.totalLength === 0) return new
|
|
9462
|
+
if (this.totalLength === 0) return new THREE21.Vector3(0, 0, 1);
|
|
9418
9463
|
const t = this.getTFromDistance(distance);
|
|
9419
9464
|
return this.getDirectionAt(t);
|
|
9420
9465
|
}
|
|
@@ -9422,7 +9467,7 @@ var SplineThree = class {
|
|
|
9422
9467
|
* Find the closest point on the spline to a given position
|
|
9423
9468
|
*/
|
|
9424
9469
|
getClosestPoint(position) {
|
|
9425
|
-
let closestPoint = new
|
|
9470
|
+
let closestPoint = new THREE21.Vector3();
|
|
9426
9471
|
let closestT = 0;
|
|
9427
9472
|
let closestDistance = Infinity;
|
|
9428
9473
|
const samples = 100;
|
|
@@ -9716,6 +9761,7 @@ export {
|
|
|
9716
9761
|
SetMasterVolume,
|
|
9717
9762
|
SetMusicVolume,
|
|
9718
9763
|
SharedAnimationManager,
|
|
9764
|
+
SphereColliderComponent,
|
|
9719
9765
|
SplineDebugManager,
|
|
9720
9766
|
SplineDebugRendererThree,
|
|
9721
9767
|
SplineThree,
|