@mml-io/3d-web-client-core 0.0.0-experimental-1dac27a-20240426 → 0.0.0-experimental-31c8e60-20240506
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/build/character/CharacterState.d.ts +9 -0
- package/build/index.js +72 -53
- package/build/index.js.map +3 -3
- package/package.json +4 -4
package/build/index.js
CHANGED
@@ -279,7 +279,7 @@ var CameraManager = class {
|
|
279
279
|
this.targetPhi = initialPhi;
|
280
280
|
this.theta = initialTheta;
|
281
281
|
this.targetTheta = initialTheta;
|
282
|
-
this.camera = new PerspectiveCamera(this.fov, window.innerWidth / window.innerHeight, 0.1,
|
282
|
+
this.camera = new PerspectiveCamera(this.fov, window.innerWidth / window.innerHeight, 0.1, 300);
|
283
283
|
this.camera.position.set(0, 1.4, -this.initialDistance);
|
284
284
|
this.rayCaster = new Raycaster();
|
285
285
|
this.hasTouchControl = VirtualJoystick.checkForTouch();
|
@@ -672,7 +672,7 @@ var CharacterMaterial = class extends MeshStandardMaterial {
|
|
672
672
|
);
|
673
673
|
shader.fragmentShader = injectBefore(
|
674
674
|
shader.fragmentShader,
|
675
|
-
"#include <
|
675
|
+
"#include <dithering_fragment>",
|
676
676
|
/* glsl */
|
677
677
|
`
|
678
678
|
if (discardAll == 1) {
|
@@ -786,6 +786,11 @@ var _CharacterModel = class _CharacterModel {
|
|
786
786
|
if (!this.mesh)
|
787
787
|
return;
|
788
788
|
this.mesh.traverse((child) => {
|
789
|
+
if (child.isBone) {
|
790
|
+
if (child.name === "head") {
|
791
|
+
this.headBone = child;
|
792
|
+
}
|
793
|
+
}
|
789
794
|
if (child.isMesh || child.isSkinnedMesh) {
|
790
795
|
const asMesh = child;
|
791
796
|
const originalMaterial = asMesh.material;
|
@@ -1019,7 +1024,7 @@ var CharacterSpeakingIndicator = class {
|
|
1019
1024
|
this.scene.add(this.mesh);
|
1020
1025
|
}
|
1021
1026
|
setBillboarding(position, camera) {
|
1022
|
-
this.mesh.position.set(position.x, position.y
|
1027
|
+
this.mesh.position.set(position.x, position.y, position.z);
|
1023
1028
|
this.mesh.lookAt(camera.position);
|
1024
1029
|
}
|
1025
1030
|
setTime(value) {
|
@@ -1641,6 +1646,8 @@ var LocalController = class {
|
|
1641
1646
|
}
|
1642
1647
|
updateNetworkState() {
|
1643
1648
|
const characterQuaternion = this.config.character.getWorldQuaternion(this.tempQuaternion);
|
1649
|
+
const cameraQuaternion = new Quaternion2();
|
1650
|
+
this.config.cameraManager.camera.getWorldQuaternion(cameraQuaternion);
|
1644
1651
|
this.networkState = {
|
1645
1652
|
id: this.config.id,
|
1646
1653
|
position: {
|
@@ -1649,6 +1656,15 @@ var LocalController = class {
|
|
1649
1656
|
z: this.config.character.position.z
|
1650
1657
|
},
|
1651
1658
|
rotation: { quaternionY: characterQuaternion.y, quaternionW: characterQuaternion.w },
|
1659
|
+
camPosition: {
|
1660
|
+
x: this.config.cameraManager.camera.position.x,
|
1661
|
+
y: this.config.cameraManager.camera.position.y,
|
1662
|
+
z: this.config.cameraManager.camera.position.z
|
1663
|
+
},
|
1664
|
+
camQuaternion: {
|
1665
|
+
y: cameraQuaternion.y,
|
1666
|
+
w: cameraQuaternion.w
|
1667
|
+
},
|
1652
1668
|
state: this.config.character.getCurrentAnimation()
|
1653
1669
|
};
|
1654
1670
|
}
|
@@ -2121,8 +2137,8 @@ import { Pane } from "tweakpane";
|
|
2121
2137
|
|
2122
2138
|
// src/tweakpane/blades/bcsFolder.ts
|
2123
2139
|
var bcsValues = {
|
2124
|
-
brightness: 0,
|
2125
|
-
contrast: 1,
|
2140
|
+
brightness: 0.06,
|
2141
|
+
contrast: 1.2,
|
2126
2142
|
saturation: 1
|
2127
2143
|
};
|
2128
2144
|
var bcsOptions = {
|
@@ -2169,10 +2185,10 @@ var BrightnessContrastSaturationFolder = class {
|
|
2169
2185
|
// src/tweakpane/blades/environmentFolder.ts
|
2170
2186
|
var sunValues = {
|
2171
2187
|
sunPosition: {
|
2172
|
-
sunAzimuthalAngle:
|
2173
|
-
sunPolarAngle: -
|
2188
|
+
sunAzimuthalAngle: 219,
|
2189
|
+
sunPolarAngle: -37
|
2174
2190
|
},
|
2175
|
-
sunIntensity:
|
2191
|
+
sunIntensity: 3.7,
|
2176
2192
|
sunColor: { r: 1, g: 1, b: 1 }
|
2177
2193
|
};
|
2178
2194
|
var sunOptions = {
|
@@ -2180,17 +2196,17 @@ var sunOptions = {
|
|
2180
2196
|
sunAzimuthalAngle: { min: 0, max: 360, step: 1 },
|
2181
2197
|
sunPolarAngle: { min: -90, max: 90, step: 1 }
|
2182
2198
|
},
|
2183
|
-
sunIntensity: { min: 0, max:
|
2199
|
+
sunIntensity: { min: 0, max: 10, step: 0.1 }
|
2184
2200
|
};
|
2185
2201
|
var envValues = {
|
2186
2202
|
ambientLight: {
|
2187
|
-
ambientLightIntensity: 0.
|
2203
|
+
ambientLightIntensity: 0.27,
|
2188
2204
|
ambientLightColor: { r: 1, g: 1, b: 1 }
|
2189
2205
|
},
|
2190
2206
|
fog: {
|
2191
|
-
fogNear:
|
2192
|
-
fogFar:
|
2193
|
-
fogColor: { r: 0.
|
2207
|
+
fogNear: 21,
|
2208
|
+
fogFar: 180,
|
2209
|
+
fogColor: { r: 0.7, g: 0.7, b: 0.7 }
|
2194
2210
|
}
|
2195
2211
|
};
|
2196
2212
|
var envOptions = {
|
@@ -2323,15 +2339,15 @@ var EnvironmentFolder = class {
|
|
2323
2339
|
|
2324
2340
|
// src/tweakpane/blades/postExtrasFolder.ts
|
2325
2341
|
var extrasValues = {
|
2326
|
-
grain: 0.
|
2327
|
-
bloom:
|
2342
|
+
grain: 0.045,
|
2343
|
+
bloom: 0.75
|
2328
2344
|
};
|
2329
2345
|
var extrasOptions = {
|
2330
2346
|
grain: {
|
2331
2347
|
amount: { min: 0, max: 0.2, step: 2e-3 }
|
2332
2348
|
},
|
2333
2349
|
bloom: {
|
2334
|
-
amount: { min: 0, max:
|
2350
|
+
amount: { min: 0, max: 50, step: 0.05 }
|
2335
2351
|
}
|
2336
2352
|
};
|
2337
2353
|
var PostExtrasFolder = class {
|
@@ -2363,8 +2379,8 @@ var PostExtrasFolder = class {
|
|
2363
2379
|
var rendererValues = {
|
2364
2380
|
shadowMap: 2,
|
2365
2381
|
toneMapping: 5,
|
2366
|
-
exposure: 1,
|
2367
|
-
bgIntensity:
|
2382
|
+
exposure: 1.7,
|
2383
|
+
bgIntensity: 0.8,
|
2368
2384
|
bgBlurriness: 0
|
2369
2385
|
};
|
2370
2386
|
var rendererOptions = {
|
@@ -2396,6 +2412,8 @@ var setShadowMapType = (value) => {
|
|
2396
2412
|
};
|
2397
2413
|
var setToneMappingType = (value) => {
|
2398
2414
|
monitoredValues.toneMappingType = toneMappingTypes[value];
|
2415
|
+
rendererValues.toneMapping = value;
|
2416
|
+
console.log(rendererValues.toneMapping);
|
2399
2417
|
};
|
2400
2418
|
var RendererFolder = class {
|
2401
2419
|
constructor(parentFolder, expand = false) {
|
@@ -2418,13 +2436,13 @@ var RendererFolder = class {
|
|
2418
2436
|
return;
|
2419
2437
|
switch (target) {
|
2420
2438
|
case "shadowMap": {
|
2421
|
-
const
|
2422
|
-
renderer.shadowMap.type =
|
2423
|
-
setShadowMapType(
|
2439
|
+
const value2 = e.value;
|
2440
|
+
renderer.shadowMap.type = value2;
|
2441
|
+
setShadowMapType(value2);
|
2424
2442
|
break;
|
2425
2443
|
}
|
2426
2444
|
case "toneMapping":
|
2427
|
-
|
2445
|
+
const value = e.value;
|
2428
2446
|
toneMappingFolder.hidden = e.value !== 5;
|
2429
2447
|
toneMappingPass.enabled = e.value === 5 ? true : false;
|
2430
2448
|
setToneMappingType(e.value);
|
@@ -2496,10 +2514,10 @@ var ppssaoValues = {
|
|
2496
2514
|
samples: 30,
|
2497
2515
|
rings: 11,
|
2498
2516
|
luminanceInfluence: 0.7,
|
2499
|
-
radius: 0.
|
2500
|
-
intensity:
|
2501
|
-
bias: 0.
|
2502
|
-
fade: 0.
|
2517
|
+
radius: 0.045,
|
2518
|
+
intensity: 3.14,
|
2519
|
+
bias: 0.01,
|
2520
|
+
fade: 0.06,
|
2503
2521
|
resolutionScale: 0.5,
|
2504
2522
|
color: { r: 0, g: 0, b: 0 },
|
2505
2523
|
worldDistanceThreshold: 30,
|
@@ -2746,7 +2764,7 @@ var SSAOFolder = class {
|
|
2746
2764
|
|
2747
2765
|
// src/tweakpane/blades/toneMappingFolder.ts
|
2748
2766
|
var toneMappingValues = {
|
2749
|
-
mode:
|
2767
|
+
mode: 7,
|
2750
2768
|
resolution: 512,
|
2751
2769
|
whitePoint: 32,
|
2752
2770
|
middleGrey: 21,
|
@@ -2755,20 +2773,24 @@ var toneMappingValues = {
|
|
2755
2773
|
adaptationRate: 2
|
2756
2774
|
};
|
2757
2775
|
var toneMappingOptions = {
|
2758
|
-
mode: { min: 0, max:
|
2776
|
+
mode: { min: 0, max: 8, step: 1 },
|
2759
2777
|
resolution: { min: 64, max: 512, step: 64 },
|
2760
2778
|
whitePoint: { min: 0, max: 32, step: 0.01 },
|
2761
2779
|
middleGrey: { min: 0, max: 32, step: 0.01 },
|
2762
2780
|
minLuminance: { min: 0, max: 32, step: 1e-3 },
|
2763
|
-
averageLuminance: { min: 1e-3, max:
|
2781
|
+
averageLuminance: { min: 1e-3, max: 2, step: 1e-3 },
|
2764
2782
|
adaptationRate: { min: 0.1, max: 2, step: 0.1 }
|
2765
2783
|
};
|
2766
2784
|
var customToneMappingTypes = {
|
2767
|
-
0: "
|
2768
|
-
1: "
|
2769
|
-
2: "
|
2770
|
-
3: "
|
2771
|
-
4: "
|
2785
|
+
0: "LINEAR",
|
2786
|
+
1: "REINHARD",
|
2787
|
+
2: "REINHARD2",
|
2788
|
+
3: "REINHARD2_ADAPTIVE",
|
2789
|
+
4: "UNCHARTED2",
|
2790
|
+
5: "OPTIMIZED_CINEON",
|
2791
|
+
6: "ACES_FILMIC",
|
2792
|
+
7: "AGX",
|
2793
|
+
8: "NEUTRAL"
|
2772
2794
|
};
|
2773
2795
|
var customToneMappingBlade = {
|
2774
2796
|
customToneMappingType: customToneMappingTypes[toneMappingValues.mode]
|
@@ -2791,13 +2813,13 @@ var ToneMappingFolder = class {
|
|
2791
2813
|
"minLuminance",
|
2792
2814
|
toneMappingOptions.minLuminance
|
2793
2815
|
);
|
2794
|
-
this.minLuminance.hidden =
|
2816
|
+
this.minLuminance.hidden = false;
|
2795
2817
|
this.avgLuminance = this.folder.addBinding(
|
2796
2818
|
toneMappingValues,
|
2797
2819
|
"averageLuminance",
|
2798
2820
|
toneMappingOptions.averageLuminance
|
2799
2821
|
);
|
2800
|
-
this.avgLuminance.hidden =
|
2822
|
+
this.avgLuminance.hidden = false;
|
2801
2823
|
this.folder.addBinding(toneMappingValues, "adaptationRate", toneMappingOptions.adaptationRate);
|
2802
2824
|
}
|
2803
2825
|
setupChangeEvent(toneMappingEffect) {
|
@@ -2806,8 +2828,6 @@ var ToneMappingFolder = class {
|
|
2806
2828
|
if (!target)
|
2807
2829
|
return;
|
2808
2830
|
if (target === "mode") {
|
2809
|
-
this.minLuminance.hidden = toneMappingValues.mode === 2 ? true : false;
|
2810
|
-
this.avgLuminance.hidden = toneMappingValues.mode === 2 ? true : false;
|
2811
2831
|
setCustomToneMappingType(e.value);
|
2812
2832
|
}
|
2813
2833
|
toneMappingEffect[target] = e.value;
|
@@ -3111,7 +3131,7 @@ var Sun = class extends Group4 {
|
|
3111
3131
|
}
|
3112
3132
|
this.directionalLight = new DirectionalLight(16777215);
|
3113
3133
|
this.directionalLight.intensity = sunValues.sunIntensity;
|
3114
|
-
this.directionalLight.shadow.normalBias = 0.
|
3134
|
+
this.directionalLight.shadow.normalBias = 0.1;
|
3115
3135
|
this.directionalLight.shadow.radius = 0.02;
|
3116
3136
|
this.directionalLight.shadow.camera = this.shadowCamera;
|
3117
3137
|
this.directionalLight.shadow.mapSize.set(this.shadowResolution, this.shadowResolution);
|
@@ -4637,9 +4657,7 @@ var Composer = class {
|
|
4637
4657
|
this.spawnSun = spawnSun;
|
4638
4658
|
this.renderer = new WebGLRenderer4({
|
4639
4659
|
powerPreference: "high-performance",
|
4640
|
-
antialias: false
|
4641
|
-
stencil: false,
|
4642
|
-
depth: false
|
4660
|
+
antialias: false
|
4643
4661
|
});
|
4644
4662
|
this.renderer.outputColorSpace = SRGBColorSpace;
|
4645
4663
|
this.renderer.info.autoReset = false;
|
@@ -4720,6 +4738,8 @@ var Composer = class {
|
|
4720
4738
|
this.bcs.uniforms.contrast.value = bcsValues.contrast;
|
4721
4739
|
this.bcs.uniforms.saturation.value = bcsValues.saturation;
|
4722
4740
|
this.gaussGrainPass = new ShaderPass(this.gaussGrainEffect, "tDiffuse");
|
4741
|
+
this.gaussGrainEffect.uniforms.amount.value = extrasValues.grain;
|
4742
|
+
this.gaussGrainEffect.uniforms.alpha.value = 1;
|
4723
4743
|
this.smaaPass = new EffectPass2(this.camera, this.smaaEffect);
|
4724
4744
|
this.effectComposer.addPass(this.renderPass);
|
4725
4745
|
if (ppssaoValues.enabled) {
|
@@ -4730,7 +4750,6 @@ var Composer = class {
|
|
4730
4750
|
this.effectComposer.addPass(this.n8aopass);
|
4731
4751
|
}
|
4732
4752
|
this.effectComposer.addPass(this.fxaaPass);
|
4733
|
-
this.effectComposer.addPass(this.smaaPass);
|
4734
4753
|
this.effectComposer.addPass(this.bloomPass);
|
4735
4754
|
this.effectComposer.addPass(this.toneMappingPass);
|
4736
4755
|
this.effectComposer.addPass(this.bcsPass);
|
@@ -4803,15 +4822,15 @@ var Composer = class {
|
|
4803
4822
|
this.bloomPass.setSize(this.width, this.height);
|
4804
4823
|
this.toneMappingPass.setSize(this.width, this.height);
|
4805
4824
|
this.gaussGrainPass.setSize(this.width, this.height);
|
4825
|
+
this.gaussGrainEffect.uniforms.resolution.value = new Vector27(this.width, this.height);
|
4806
4826
|
this.renderer.setSize(this.width, this.height);
|
4807
4827
|
}
|
4808
4828
|
render(timeManager) {
|
4809
4829
|
this.renderer.info.reset();
|
4810
4830
|
this.normalPass.texture.needsUpdate = true;
|
4811
|
-
this.gaussGrainEffect.uniforms.resolution.value = this.resolution;
|
4812
4831
|
this.gaussGrainEffect.uniforms.time.value = timeManager.time;
|
4813
|
-
this.gaussGrainEffect.uniforms.alpha.value = 1;
|
4814
4832
|
this.effectComposer.render();
|
4833
|
+
this.renderer.clearDepth();
|
4815
4834
|
this.renderer.render(this.postPostScene, this.camera);
|
4816
4835
|
}
|
4817
4836
|
useHDRJPG(url, fromFile = false) {
|
@@ -4977,7 +4996,7 @@ import {
|
|
4977
4996
|
MeshBasicMaterial as MeshBasicMaterial3,
|
4978
4997
|
Quaternion as Quaternion6,
|
4979
4998
|
Ray as Ray2,
|
4980
|
-
Vector3 as
|
4999
|
+
Vector3 as Vector315
|
4981
5000
|
} from "three";
|
4982
5001
|
import { VertexNormalsHelper } from "three/examples/jsm/helpers/VertexNormalsHelper.js";
|
4983
5002
|
import * as BufferGeometryUtils from "three/examples/jsm/utils/BufferGeometryUtils.js";
|
@@ -4985,9 +5004,9 @@ import { MeshBVH, MeshBVHHelper } from "three-mesh-bvh";
|
|
4985
5004
|
var CollisionsManager = class {
|
4986
5005
|
constructor(scene) {
|
4987
5006
|
this.debug = false;
|
4988
|
-
this.tempVector = new
|
4989
|
-
this.tempVector2 = new
|
4990
|
-
this.tempVector3 = new
|
5007
|
+
this.tempVector = new Vector315();
|
5008
|
+
this.tempVector2 = new Vector315();
|
5009
|
+
this.tempVector3 = new Vector315();
|
4991
5010
|
this.tempQuaternion = new Quaternion6();
|
4992
5011
|
this.tempRay = new Ray2();
|
4993
5012
|
this.tempMatrix = new Matrix46();
|
@@ -5003,7 +5022,7 @@ var CollisionsManager = class {
|
|
5003
5022
|
raycastFirst(ray) {
|
5004
5023
|
let minimumDistance = null;
|
5005
5024
|
let minimumHit = null;
|
5006
|
-
let minimumNormal = new
|
5025
|
+
let minimumNormal = new Vector315();
|
5007
5026
|
for (const [, collisionMeshState] of this.collisionMeshState) {
|
5008
5027
|
this.tempRay.copy(ray).applyMatrix4(this.tempMatrix.copy(collisionMeshState.matrix).invert());
|
5009
5028
|
const hit = collisionMeshState.meshBVH.raycastFirst(this.tempRay, DoubleSide);
|
@@ -5144,7 +5163,7 @@ var CollisionsManager = class {
|
|
5144
5163
|
const realDistance = intersectionSegment.distance();
|
5145
5164
|
if (realDistance < capsuleRadius) {
|
5146
5165
|
if (!collisionPosition) {
|
5147
|
-
collisionPosition = new
|
5166
|
+
collisionPosition = new Vector315().copy(closestPointOnSegment).applyMatrix4(meshState.matrix);
|
5148
5167
|
}
|
5149
5168
|
const ratio = realDistance / modelReferenceDistance;
|
5150
5169
|
const realDepth = capsuleRadius - realDistance;
|
@@ -5212,9 +5231,9 @@ var canvas = document.createElement("canvas");
|
|
5212
5231
|
canvas.width = 2;
|
5213
5232
|
canvas.height = 2;
|
5214
5233
|
var ctx = canvas.getContext("2d");
|
5215
|
-
ctx.fillStyle = "#
|
5234
|
+
ctx.fillStyle = "#e0e0e0";
|
5216
5235
|
ctx.fillRect(0, 0, 2, 2);
|
5217
|
-
ctx.fillStyle = "#
|
5236
|
+
ctx.fillStyle = "#606060";
|
5218
5237
|
ctx.fillRect(0, 0, 1, 1);
|
5219
5238
|
ctx.fillRect(1, 1, 1, 1);
|
5220
5239
|
var GroundPlane = class extends Group6 {
|