@woosh/meep-engine 2.167.0 → 2.168.0

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/package.json CHANGED
@@ -1,95 +1,95 @@
1
- {
2
- "name": "@woosh/meep-engine",
3
- "license": "UNLICENSED",
4
- "productName": "Meep",
5
- "homepage": "https://meep.company-named.com/",
6
- "description": "Pure JavaScript game engine. Fully featured and production ready.",
7
- "type": "module",
8
- "author": "Alexander Goldring",
9
- "version": "2.167.0",
10
- "main": "build/meep.module.js",
11
- "module": "build/meep.module.js",
12
- "exports": {
13
- "./build/*": "./build/*",
14
- "./src/*": "./src/*",
15
- "./editor/*": "./editor/*",
16
- "./*.md": "./*"
17
- },
18
- "scripts": {
19
- "test:ci": "jest --config ./jest.conf.json --collectCoverage --coverageDirectory=\"./coverage\" --ci --reporters=default --reporters=jest-junit --watchAll=false",
20
- "build-module": "rollup -c rollup.config.js",
21
- "publish-npm": "npm publish",
22
- "generate-types": "npx -p typescript tsc --project tsconfig.types.json || exit 0;"
23
- },
24
- "browserslist": [
25
- "last 2 chrome version",
26
- "last 2 firefox version",
27
- "last 2 safari version"
28
- ],
29
- "files": [
30
- "build",
31
- "src",
32
- "editor",
33
- "samples",
34
- "package.json",
35
- "README.md",
36
- "!src/**/*.spec.js",
37
- "!editor/**/*.spec.js"
38
- ],
39
- "dependencies": {
40
- "gl-matrix": "3.4.3",
41
- "opentype.js": "1.3.3",
42
- "pako": "2.0.3",
43
- "robust-predicates": "3.0.2"
44
- },
45
- "peerDependencies": {
46
- "three": ">=0.135.0"
47
- },
48
- "peerDependenciesMeta": {
49
- "three": {
50
- "optional": true
51
- }
52
- },
53
- "devDependencies": {
54
- "@babel/core": "7.22.15",
55
- "@babel/preset-env": "7.22.15",
56
- "@rollup/plugin-commonjs": "25.0.2",
57
- "@rollup/plugin-node-resolve": "15.1.0",
58
- "@rollup/plugin-strip": "3.0.2",
59
- "@rollup/plugin-terser": "0.4.3",
60
- "@types/jest": "29.5.12",
61
- "@types/three": "^0.135.0",
62
- "babel-jest": "29.7.0",
63
- "jest": "29.7.0",
64
- "jest-environment-jsdom": "29.7.0",
65
- "jest-junit": "16.0.0",
66
- "rollup": "3.26.2",
67
- "typescript": "5.2.2"
68
- },
69
- "keywords": [
70
- "game-engine",
71
- "gamedev",
72
- "ecs",
73
- "entity-component-system",
74
- "data-oriented",
75
- "zero-allocation",
76
- "modular",
77
- "tree-shaking",
78
- "3d",
79
- "webgl",
80
- "webgl2",
81
- "webgpu",
82
- "webaudio",
83
- "particles",
84
- "bvh",
85
- "behavior-tree",
86
- "inverse-kinematics",
87
- "fabrik",
88
- "clustered-lighting",
89
- "color-management",
90
- "typescript"
91
- ],
92
- "engines": {
93
- "node": ">=24"
94
- }
95
- }
1
+ {
2
+ "name": "@woosh/meep-engine",
3
+ "license": "UNLICENSED",
4
+ "productName": "Meep",
5
+ "homepage": "https://meep.company-named.com/",
6
+ "description": "Pure JavaScript game engine. Fully featured and production ready.",
7
+ "type": "module",
8
+ "author": "Alexander Goldring",
9
+ "version": "2.168.0",
10
+ "main": "build/meep.module.js",
11
+ "module": "build/meep.module.js",
12
+ "exports": {
13
+ "./build/*": "./build/*",
14
+ "./src/*": "./src/*",
15
+ "./editor/*": "./editor/*",
16
+ "./*.md": "./*"
17
+ },
18
+ "scripts": {
19
+ "test:ci": "jest --config ./jest.conf.json --collectCoverage --coverageDirectory=\"./coverage\" --ci --reporters=default --reporters=jest-junit --watchAll=false",
20
+ "build-module": "rollup -c rollup.config.js",
21
+ "publish-npm": "npm publish",
22
+ "generate-types": "npx -p typescript tsc --project tsconfig.types.json || exit 0;"
23
+ },
24
+ "browserslist": [
25
+ "last 2 chrome version",
26
+ "last 2 firefox version",
27
+ "last 2 safari version"
28
+ ],
29
+ "files": [
30
+ "build",
31
+ "src",
32
+ "editor",
33
+ "samples",
34
+ "package.json",
35
+ "README.md",
36
+ "!src/**/*.spec.js",
37
+ "!editor/**/*.spec.js"
38
+ ],
39
+ "dependencies": {
40
+ "gl-matrix": "3.4.3",
41
+ "opentype.js": "1.3.3",
42
+ "pako": "2.0.3",
43
+ "robust-predicates": "3.0.2"
44
+ },
45
+ "peerDependencies": {
46
+ "three": ">=0.135.0"
47
+ },
48
+ "peerDependenciesMeta": {
49
+ "three": {
50
+ "optional": true
51
+ }
52
+ },
53
+ "devDependencies": {
54
+ "@babel/core": "7.22.15",
55
+ "@babel/preset-env": "7.22.15",
56
+ "@rollup/plugin-commonjs": "25.0.2",
57
+ "@rollup/plugin-node-resolve": "15.1.0",
58
+ "@rollup/plugin-strip": "3.0.2",
59
+ "@rollup/plugin-terser": "0.4.3",
60
+ "@types/jest": "29.5.12",
61
+ "@types/three": "^0.135.0",
62
+ "babel-jest": "29.7.0",
63
+ "jest": "29.7.0",
64
+ "jest-environment-jsdom": "29.7.0",
65
+ "jest-junit": "16.0.0",
66
+ "rollup": "3.26.2",
67
+ "typescript": "5.2.2"
68
+ },
69
+ "keywords": [
70
+ "game-engine",
71
+ "gamedev",
72
+ "ecs",
73
+ "entity-component-system",
74
+ "data-oriented",
75
+ "zero-allocation",
76
+ "modular",
77
+ "tree-shaking",
78
+ "3d",
79
+ "webgl",
80
+ "webgl2",
81
+ "webgpu",
82
+ "webaudio",
83
+ "particles",
84
+ "bvh",
85
+ "behavior-tree",
86
+ "inverse-kinematics",
87
+ "fabrik",
88
+ "clustered-lighting",
89
+ "color-management",
90
+ "typescript"
91
+ ],
92
+ "engines": {
93
+ "node": ">=24"
94
+ }
95
+ }
@@ -24,7 +24,8 @@ export const FogOfWarEdgeMode = {
24
24
 
25
25
  /**
26
26
  * The fog EXTENDS outward instead: the border ring mirrors the cells just
27
- * inside it, and pixels with no geometry are left alone entirely.
27
+ * inside it, and a pixel with no geometry is located by projecting its camera
28
+ * ray onto the fog's own ground plane rather than read off the far plane.
28
29
  *
29
30
  * For a world with a VISIBLE boundary — a finite arena the camera can see
30
31
  * past. Under {@link FogOfWarEdgeMode.Conceal} such a scene gets a hard black
@@ -1 +1 @@
1
- {"version":3,"file":"screenSpaceFogOfWarShader.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/ecs/fow/shader/screenSpaceFogOfWarShader.js"],"names":[],"mappings":"AAGA;;;GAGG;AACH,kDAFW,cAAc,CA4LxB;+BAjMyE,OAAO"}
1
+ {"version":3,"file":"screenSpaceFogOfWarShader.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/ecs/fow/shader/screenSpaceFogOfWarShader.js"],"names":[],"mappings":"AAGA;;;GAGG;AACH,kDAFW,cAAc,CAmNxB;+BAxNyE,OAAO"}
@@ -108,25 +108,48 @@ export function buildScreenSpaceFogOfWarShader() {
108
108
  void main(){
109
109
  float sceneDepth = texture2D( tDepth, vUv ).x;
110
110
 
111
- // NOTHING WAS DRAWN HERE. The depth is the buffer's clear value, so
112
- // the position reconstructed from it lands on the far plane: a point
113
- // with no relationship to the scene, whose fog lookup is whatever the
114
- // sampler's clamp happens to return. In a world with a visible
115
- // boundary that is the concealed border ring, and it gets painted
116
- // across the entire void as a hard rectangle on the world's edge.
117
- // Under Extend, leave such a pixel alone rather than fog it on the
118
- // strength of a reconstruction that means nothing.
119
- //
120
- // Under Conceal this branch never taken, so the legacy path is
121
- // bit-identical — including the one case Extend gives up, a real
122
- // surface sitting exactly on the far plane.
111
+ vec3 worldPosition;
112
+
123
113
  if (uEdgeExtend > 0.5 && sceneDepth >= 1.0) {
124
- gl_FragColor = vec4(0.0);
125
- return;
126
- }
114
+ // NOTHING WAS DRAWN HERE, so there is no surface to locate: the
115
+ // depth is the buffer's clear value and computeWorldPosition would
116
+ // hand back a point on the far plane, unrelated to the scene, whose
117
+ // fog lookup is whatever the sampler's clamp happens to return.
118
+ //
119
+ // The fog is a GROUND field though — its sampler is indexed by
120
+ // world XZ and anchored at the world origin (uFogUvTransform is
121
+ // built from size and scale alone, with no Y term), so the
122
+ // meaningful position for such a pixel is where its camera ray
123
+ // crosses that field's own plane, y = 0.
124
+ //
125
+ // PROJECTING rather than skipping is what keeps a world boundary
126
+ // invisible. At the last pixel of ground the surface hit and the
127
+ // plane hit are the same point, so the fog value carries straight
128
+ // on across the edge; skipping instead steps it from whatever the
129
+ // edge reads to nothing at all, and that step is a visible line
130
+ // exactly where the world stops.
131
+ vec3 camPos = uViewInverse[3].xyz;
132
+ vec3 dir = computeWorldPosition(1.0) - camPos;
133
+
134
+ // parallel to the plane, or pointing away from it: nothing to
135
+ // sample, so leave the pixel alone
136
+ if (abs(dir.y) < 1e-6) {
137
+ gl_FragColor = vec4(0.0);
138
+ return;
139
+ }
140
+
141
+ float t = -camPos.y / dir.y;
127
142
 
128
- //get world fragment position
129
- vec3 worldPosition = computeWorldPosition(sceneDepth);
143
+ if (t <= 0.0) {
144
+ gl_FragColor = vec4(0.0);
145
+ return;
146
+ }
147
+
148
+ worldPosition = camPos + dir * t;
149
+ } else {
150
+ //get world fragment position
151
+ worldPosition = computeWorldPosition(sceneDepth);
152
+ }
130
153
 
131
154
  vec2 fogUv = worldPosition.xz * uFogUvTransform.zw + uFogUvTransform.xy;
132
155