@woosh/meep-engine 2.126.50 → 2.126.52
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
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"description": "Pure JavaScript game engine. Fully featured and production ready.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"author": "Alexander Goldring",
|
|
8
|
-
"version": "2.126.
|
|
8
|
+
"version": "2.126.52",
|
|
9
9
|
"main": "build/meep.module.js",
|
|
10
10
|
"module": "build/meep.module.js",
|
|
11
11
|
"exports": {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compute_tight_near_far_clipping_planes.d.ts","sourceRoot":"","sources":["../../../../../../src/core/bvh2/bvh3/query/compute_tight_near_far_clipping_planes.js"],"names":[],"mappings":"AAWA;;;;;;;;GAQG;AACH,+DAPW,MAAM,EAAE,iBACR,MAAM,cACN,MAAM,OACN,GAAG,WACH,MAAM,EAAE,GAAC,SAAS,CAAC,MAAM,CAAC,GAAC,YAAY,GACrC,OAAO,
|
|
1
|
+
{"version":3,"file":"compute_tight_near_far_clipping_planes.d.ts","sourceRoot":"","sources":["../../../../../../src/core/bvh2/bvh3/query/compute_tight_near_far_clipping_planes.js"],"names":[],"mappings":"AAWA;;;;;;;;GAQG;AACH,+DAPW,MAAM,EAAE,iBACR,MAAM,cACN,MAAM,OACN,GAAG,WACH,MAAM,EAAE,GAAC,SAAS,CAAC,MAAM,CAAC,GAAC,YAAY,GACrC,OAAO,CAwMnB"}
|
|
@@ -79,12 +79,10 @@ export function compute_tight_near_far_clipping_planes(
|
|
|
79
79
|
const _y1 = scratch_aabb[4];
|
|
80
80
|
const _z1 = scratch_aabb[5];
|
|
81
81
|
|
|
82
|
+
let collision_mask = 0;
|
|
83
|
+
|
|
82
84
|
for (let plane_index = 0; plane_index < 6; plane_index++) {
|
|
83
85
|
|
|
84
|
-
if (((plane_mask >> plane_index) & 1) === 1) {
|
|
85
|
-
// plane is not fixed, we're done here
|
|
86
|
-
continue;
|
|
87
|
-
}
|
|
88
86
|
|
|
89
87
|
const plane_address = plane_index * 4;
|
|
90
88
|
|
|
@@ -120,16 +118,32 @@ export function compute_tight_near_far_clipping_planes(
|
|
|
120
118
|
z1 = _z0;
|
|
121
119
|
}
|
|
122
120
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
plane_normal_x, plane_normal_y, plane_normal_z, plane_offset
|
|
126
|
-
);
|
|
121
|
+
if (((plane_mask >> plane_index) & 1) === 1) {
|
|
122
|
+
// plane is not fixed, we're done here
|
|
127
123
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
124
|
+
const distance_above_plane = v3_distance_above_plane(
|
|
125
|
+
x0, y0, z0,
|
|
126
|
+
plane_normal_x, plane_normal_y, plane_normal_z, 0
|
|
127
|
+
);
|
|
128
|
+
|
|
129
|
+
if(distance_above_plane< plane_offset){
|
|
130
|
+
collision_mask |= (1 << plane_index);
|
|
131
|
+
}
|
|
132
132
|
|
|
133
|
+
}else {
|
|
134
|
+
|
|
135
|
+
// fixed plane
|
|
136
|
+
const distance_above_plane = v3_distance_above_plane(
|
|
137
|
+
x1, y1, z1,
|
|
138
|
+
plane_normal_x, plane_normal_y, plane_normal_z, plane_offset
|
|
139
|
+
);
|
|
140
|
+
|
|
141
|
+
if (distance_above_plane < 0) {
|
|
142
|
+
// below plane, reject this branch
|
|
143
|
+
continue node_loop;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
}
|
|
133
147
|
}
|
|
134
148
|
|
|
135
149
|
|
|
@@ -137,6 +151,11 @@ export function compute_tight_near_far_clipping_planes(
|
|
|
137
151
|
|
|
138
152
|
if (!node_is_leaf) {
|
|
139
153
|
|
|
154
|
+
if(collision_mask === 0){
|
|
155
|
+
// does not affect any planes, skip
|
|
156
|
+
continue;
|
|
157
|
+
}
|
|
158
|
+
|
|
140
159
|
// inside
|
|
141
160
|
// read in-order
|
|
142
161
|
const child1 = bvh.node_get_child1(node);
|
|
@@ -150,9 +169,9 @@ export function compute_tight_near_far_clipping_planes(
|
|
|
150
169
|
|
|
151
170
|
// leaf node
|
|
152
171
|
|
|
153
|
-
//
|
|
172
|
+
// expand planes
|
|
154
173
|
for (let i = 0; i < 6; i++) {
|
|
155
|
-
if (((
|
|
174
|
+
if (((collision_mask >> i) & 1) === 1) {
|
|
156
175
|
|
|
157
176
|
const plane_address = i * 4;
|
|
158
177
|
|
|
@@ -160,43 +179,32 @@ export function compute_tight_near_far_clipping_planes(
|
|
|
160
179
|
const plane_normal_x = scratch_frustum[plane_address];
|
|
161
180
|
const plane_normal_y = scratch_frustum[plane_address + 1];
|
|
162
181
|
const plane_normal_z = scratch_frustum[plane_address + 2];
|
|
163
|
-
const plane_offset = scratch_frustum[plane_address + 3];
|
|
164
182
|
|
|
165
|
-
|
|
166
|
-
// construct nearest and farthest corners along the plane normal
|
|
183
|
+
// get the nearest corner along the plane normal
|
|
167
184
|
if (plane_normal_x > 0) {
|
|
168
185
|
x0 = _x0;
|
|
169
|
-
x1 = _x1;
|
|
170
186
|
} else {
|
|
171
187
|
x0 = _x1;
|
|
172
|
-
x1 = _x0;
|
|
173
188
|
}
|
|
174
189
|
|
|
175
190
|
if (plane_normal_y > 0) {
|
|
176
191
|
y0 = _y0;
|
|
177
|
-
y1 = _y1;
|
|
178
192
|
} else {
|
|
179
193
|
y0 = _y1;
|
|
180
|
-
y1 = _y0;
|
|
181
194
|
}
|
|
182
195
|
|
|
183
196
|
if (plane_normal_z > 0) {
|
|
184
197
|
z0 = _z0;
|
|
185
|
-
z1 = _z1;
|
|
186
198
|
} else {
|
|
187
199
|
z0 = _z1;
|
|
188
|
-
z1 = _z0;
|
|
189
200
|
}
|
|
190
201
|
|
|
191
|
-
|
|
192
|
-
|
|
202
|
+
// move plane
|
|
203
|
+
scratch_frustum[plane_address + 3] = v3_distance_above_plane(
|
|
204
|
+
x0, y0, z0,
|
|
193
205
|
plane_normal_x, plane_normal_y, plane_normal_z, 0
|
|
194
206
|
);
|
|
195
207
|
|
|
196
|
-
if (distance_above_plane < plane_offset) {
|
|
197
|
-
// move plane
|
|
198
|
-
scratch_frustum[plane_address + 3] = distance_above_plane;
|
|
199
|
-
}
|
|
200
208
|
}
|
|
201
209
|
}
|
|
202
210
|
|