@woosh/meep-engine 2.36.15 → 2.36.16
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/engine/graphics/particles/particular/engine/renderers/billboard/ParticleBillboardMaterial.js
CHANGED
|
@@ -11,8 +11,6 @@ import {
|
|
|
11
11
|
} from "three";
|
|
12
12
|
import { Vector2 as ThreeVector2 } from "three/src/math/Vector2.js";
|
|
13
13
|
|
|
14
|
-
const DEPTH_ERROR_MARGIN = 0.0001;
|
|
15
|
-
|
|
16
14
|
const CHUNK_LAMBERT_LIGHTING = `
|
|
17
15
|
vec3 diffuse = vec3( 1.0 );
|
|
18
16
|
|
|
@@ -234,24 +232,32 @@ function make_fragment_shader() {
|
|
|
234
232
|
|
|
235
233
|
float d_n = 2.0*z - 1.0;
|
|
236
234
|
|
|
237
|
-
float fn = f*n;
|
|
238
|
-
|
|
239
235
|
float z_diff = f - n;
|
|
240
236
|
|
|
241
237
|
float denominator = (f + n - d_n * z_diff );
|
|
242
|
-
|
|
243
|
-
float z_view = (2.0*
|
|
238
|
+
|
|
239
|
+
float z_view = (2.0*f*n) / denominator;
|
|
244
240
|
|
|
245
241
|
return z_view-n;
|
|
246
242
|
}
|
|
247
243
|
|
|
244
|
+
float depthToLinear_v2(float z){
|
|
245
|
+
float far = cameraFar;
|
|
246
|
+
float near = cameraNear;
|
|
247
|
+
|
|
248
|
+
// perspectiveDepthToViewZ
|
|
249
|
+
float view_z = ( near * far ) / ( ( near-far ) * z + far );
|
|
250
|
+
|
|
251
|
+
return view_z;
|
|
252
|
+
}
|
|
253
|
+
|
|
248
254
|
|
|
249
255
|
float calculateFade(in float particleDepth, in float sceneDepth){
|
|
250
256
|
float zFade;
|
|
251
257
|
|
|
252
|
-
float linearParticleDepth =
|
|
258
|
+
float linearParticleDepth = depthToLinear_v2(particleDepth);
|
|
253
259
|
|
|
254
|
-
float linearSceneDepth =
|
|
260
|
+
float linearSceneDepth = depthToLinear_v2(sceneDepth);
|
|
255
261
|
|
|
256
262
|
float depthDelta = (linearSceneDepth - linearParticleDepth);
|
|
257
263
|
|
|
@@ -266,9 +272,9 @@ function make_fragment_shader() {
|
|
|
266
272
|
}
|
|
267
273
|
|
|
268
274
|
if(inputDepth <= 0.5){
|
|
269
|
-
zFade = 0
|
|
275
|
+
zFade = 2.0 * pow( clamp(inputDepth, 0.0, 1.0), 2.0);
|
|
270
276
|
}else{
|
|
271
|
-
zFade = 1.0 - 0
|
|
277
|
+
zFade = 1.0 - 2.0 * pow( clamp(1.0 - inputDepth, 0.0, 1.0), 2.0);
|
|
272
278
|
}
|
|
273
279
|
|
|
274
280
|
return zFade;
|
|
@@ -335,7 +341,7 @@ function make_fragment_shader() {
|
|
|
335
341
|
|
|
336
342
|
#ifdef DEPTH_READ_ENABLED
|
|
337
343
|
|
|
338
|
-
if(fragmentDepth
|
|
344
|
+
if(fragmentDepth > sceneDepth){
|
|
339
345
|
discard;
|
|
340
346
|
}
|
|
341
347
|
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"productName": "Meep",
|
|
6
6
|
"description": "production-ready JavaScript game engine based on Entity Component System Architecture",
|
|
7
7
|
"author": "Alexander Goldring",
|
|
8
|
-
"version": "2.36.
|
|
8
|
+
"version": "2.36.16",
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"gl-matrix": "3.4.3",
|
|
11
11
|
"fast-levenshtein": "2.0.6",
|