@woosh/meep-engine 2.126.51 → 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,24 +118,43 @@ 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
|
+
);
|
|
132
128
|
|
|
133
|
-
|
|
129
|
+
if(distance_above_plane< plane_offset){
|
|
130
|
+
collision_mask |= (1 << plane_index);
|
|
131
|
+
}
|
|
134
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
|
+
}
|
|
147
|
+
}
|
|
135
148
|
|
|
136
149
|
|
|
137
150
|
const node_is_leaf = bvh.node_is_leaf(node);
|
|
138
151
|
|
|
139
152
|
if (!node_is_leaf) {
|
|
140
|
-
|
|
153
|
+
|
|
154
|
+
if(collision_mask === 0){
|
|
155
|
+
// does not affect any planes, skip
|
|
156
|
+
continue;
|
|
157
|
+
}
|
|
141
158
|
|
|
142
159
|
// inside
|
|
143
160
|
// read in-order
|
|
@@ -152,9 +169,9 @@ export function compute_tight_near_far_clipping_planes(
|
|
|
152
169
|
|
|
153
170
|
// leaf node
|
|
154
171
|
|
|
155
|
-
//
|
|
172
|
+
// expand planes
|
|
156
173
|
for (let i = 0; i < 6; i++) {
|
|
157
|
-
if (((
|
|
174
|
+
if (((collision_mask >> i) & 1) === 1) {
|
|
158
175
|
|
|
159
176
|
const plane_address = i * 4;
|
|
160
177
|
|
|
@@ -162,43 +179,32 @@ export function compute_tight_near_far_clipping_planes(
|
|
|
162
179
|
const plane_normal_x = scratch_frustum[plane_address];
|
|
163
180
|
const plane_normal_y = scratch_frustum[plane_address + 1];
|
|
164
181
|
const plane_normal_z = scratch_frustum[plane_address + 2];
|
|
165
|
-
const plane_offset = scratch_frustum[plane_address + 3];
|
|
166
182
|
|
|
167
|
-
|
|
168
|
-
// construct nearest and farthest corners along the plane normal
|
|
183
|
+
// get the nearest corner along the plane normal
|
|
169
184
|
if (plane_normal_x > 0) {
|
|
170
185
|
x0 = _x0;
|
|
171
|
-
x1 = _x1;
|
|
172
186
|
} else {
|
|
173
187
|
x0 = _x1;
|
|
174
|
-
x1 = _x0;
|
|
175
188
|
}
|
|
176
189
|
|
|
177
190
|
if (plane_normal_y > 0) {
|
|
178
191
|
y0 = _y0;
|
|
179
|
-
y1 = _y1;
|
|
180
192
|
} else {
|
|
181
193
|
y0 = _y1;
|
|
182
|
-
y1 = _y0;
|
|
183
194
|
}
|
|
184
195
|
|
|
185
196
|
if (plane_normal_z > 0) {
|
|
186
197
|
z0 = _z0;
|
|
187
|
-
z1 = _z1;
|
|
188
198
|
} else {
|
|
189
199
|
z0 = _z1;
|
|
190
|
-
z1 = _z0;
|
|
191
200
|
}
|
|
192
201
|
|
|
193
|
-
|
|
202
|
+
// move plane
|
|
203
|
+
scratch_frustum[plane_address + 3] = v3_distance_above_plane(
|
|
194
204
|
x0, y0, z0,
|
|
195
205
|
plane_normal_x, plane_normal_y, plane_normal_z, 0
|
|
196
206
|
);
|
|
197
207
|
|
|
198
|
-
if (distance_above_plane < plane_offset) {
|
|
199
|
-
// move plane
|
|
200
|
-
scratch_frustum[plane_address + 3] = distance_above_plane;
|
|
201
|
-
}
|
|
202
208
|
}
|
|
203
209
|
}
|
|
204
210
|
|