@mml-io/3d-web-client-core 0.21.3 → 0.21.4

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/index.js CHANGED
@@ -1516,7 +1516,7 @@ var Character = class extends Group {
1516
1516
  color: new Color3(0.125, 0.125, 0.125)
1517
1517
  });
1518
1518
  this.add(tooltip);
1519
- this.chatTooltips.push(tooltip);
1519
+ this.chatTooltips.unshift(tooltip);
1520
1520
  tooltip.setText(message, () => {
1521
1521
  this.chatTooltips = this.chatTooltips.filter((t) => t !== tooltip);
1522
1522
  this.remove(tooltip);
@@ -4077,7 +4077,6 @@ import {
4077
4077
  Uniform as Uniform7,
4078
4078
  Vector2 as Vector26,
4079
4079
  Vector3 as Vector314,
4080
- WebGLMultipleRenderTargets,
4081
4080
  WebGLRenderTarget
4082
4081
  } from "three";
4083
4082
 
@@ -4339,11 +4338,15 @@ var EffectCompositer = {
4339
4338
  vec4 clipSpacePosition = vec4(coord * 2.0 - 1.0, z, 1.0);
4340
4339
  vec4 viewSpacePosition = projectionMatrixInv * clipSpacePosition;
4341
4340
 
4342
- vec4 worldSpacePosition = viewSpacePosition;
4343
- worldSpacePosition.xyz /= worldSpacePosition.w;
4344
- return worldSpacePosition.xyz;
4341
+ if (abs(viewSpacePosition.w) < 1e-6) {
4342
+ discard;
4343
+ }
4344
+
4345
+ viewSpacePosition /= viewSpacePosition.w;
4346
+ return (viewMatrixInv * viewSpacePosition).xyz;
4345
4347
  }
4346
4348
 
4349
+
4347
4350
  vec3 computeNormal(vec3 worldPos, vec2 vUv) {
4348
4351
  ivec2 p = ivec2(vUv * resolution);
4349
4352
  float c0 = texelFetch(sceneDepth, p, 0).x;
@@ -5051,22 +5054,18 @@ var N8SSAOPass = class extends Pass {
5051
5054
  }
5052
5055
  configureHalfResTargets() {
5053
5056
  if (this.configuration.halfRes) {
5054
- this.depthDownsampleTarget = new WebGLMultipleRenderTargets(
5055
- this.width / 2,
5056
- this.height / 2,
5057
- 2,
5058
- {
5059
- depthBuffer: false
5060
- }
5061
- );
5062
- this.depthDownsampleTarget.texture[0].format = RedFormat;
5063
- this.depthDownsampleTarget.texture[0].type = FloatType;
5064
- this.depthDownsampleTarget.texture[0].minFilter = NearestFilter;
5065
- this.depthDownsampleTarget.texture[0].magFilter = NearestFilter;
5066
- this.depthDownsampleTarget.texture[1].format = RGBAFormat2;
5067
- this.depthDownsampleTarget.texture[1].type = HalfFloatType;
5068
- this.depthDownsampleTarget.texture[1].minFilter = NearestFilter;
5069
- this.depthDownsampleTarget.texture[1].magFilter = NearestFilter;
5057
+ this.depthDownsampleTarget = new WebGLRenderTarget(this.width / 2, this.height / 2, {
5058
+ count: 2,
5059
+ depthBuffer: false
5060
+ });
5061
+ this.depthDownsampleTarget.textures[0].format = RedFormat;
5062
+ this.depthDownsampleTarget.textures[0].type = FloatType;
5063
+ this.depthDownsampleTarget.textures[0].minFilter = NearestFilter;
5064
+ this.depthDownsampleTarget.textures[0].magFilter = NearestFilter;
5065
+ this.depthDownsampleTarget.textures[1].format = RGBAFormat2;
5066
+ this.depthDownsampleTarget.textures[1].type = HalfFloatType;
5067
+ this.depthDownsampleTarget.textures[1].minFilter = NearestFilter;
5068
+ this.depthDownsampleTarget.textures[1].magFilter = NearestFilter;
5070
5069
  this.depthDownsampleQuad = new FullScreenTriangle(new ShaderMaterial4(DepthDownSample));
5071
5070
  } else {
5072
5071
  if (this.depthDownsampleTarget) {
@@ -5229,8 +5228,8 @@ var N8SSAOPass = class extends Pass {
5229
5228
  if (!this.effectShaderQuad) return;
5230
5229
  const effectShaderUniforms = this.effectShaderQuad.material.uniforms;
5231
5230
  effectShaderUniforms.sceneDiffuse.value = inputBuffer.texture;
5232
- effectShaderUniforms.sceneDepth.value = this.configuration.halfRes ? this.depthDownsampleTarget.texture[0] : this.depthTexture;
5233
- effectShaderUniforms.sceneNormal.value = this.configuration.halfRes ? this.depthDownsampleTarget.texture[1] : null;
5231
+ effectShaderUniforms.sceneDepth.value = this.configuration.halfRes ? this.depthDownsampleTarget.textures[0] : this.depthTexture;
5232
+ effectShaderUniforms.sceneNormal.value = this.configuration.halfRes ? this.depthDownsampleTarget.textures[1] : null;
5234
5233
  effectShaderUniforms.projMat.value = this.camera.projectionMatrix;
5235
5234
  effectShaderUniforms.viewMat.value = this.camera.matrixWorldInverse;
5236
5235
  effectShaderUniforms.projViewMat.value = this.camera.projectionMatrix.clone().multiply(this.camera.matrixWorldInverse.clone());
@@ -5259,7 +5258,7 @@ var N8SSAOPass = class extends Pass {
5259
5258
  this.writeTargetInternal
5260
5259
  ];
5261
5260
  poissonBlurUniforms.tDiffuse.value = this.readTargetInternal.texture;
5262
- poissonBlurUniforms.sceneDepth.value = this.configuration.halfRes ? this.depthDownsampleTarget.texture[0] : this.depthTexture;
5261
+ poissonBlurUniforms.sceneDepth.value = this.configuration.halfRes ? this.depthDownsampleTarget.textures[0] : this.depthTexture;
5263
5262
  poissonBlurUniforms.projMat.value = this.camera.projectionMatrix;
5264
5263
  poissonBlurUniforms.viewMat.value = this.camera.matrixWorldInverse;
5265
5264
  poissonBlurUniforms.projectionMatrixInv.value = this.camera.projectionMatrixInverse;
@@ -5290,7 +5289,7 @@ var N8SSAOPass = class extends Pass {
5290
5289
  effectCompositerUniforms.viewMatrixInv.value = this.camera.matrixWorld;
5291
5290
  effectCompositerUniforms.logDepth.value = renderer.capabilities.logarithmicDepthBuffer;
5292
5291
  effectCompositerUniforms.ortho.value = this.camera instanceof OrthographicCamera3;
5293
- effectCompositerUniforms.downsampledDepth.value = this.configuration.halfRes ? this.depthDownsampleTarget.texture[0] : this.depthTexture;
5292
+ effectCompositerUniforms.downsampledDepth.value = this.configuration.halfRes ? this.depthDownsampleTarget.textures[0] : this.depthTexture;
5294
5293
  effectCompositerUniforms.resolution.value = this.r;
5295
5294
  effectCompositerUniforms.blueNoise.value = this.bluenoise;
5296
5295
  effectCompositerUniforms.intensity.value = this.configuration.intensity;