@woosh/meep-engine 2.128.23 → 2.129.1

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.
Files changed (24) hide show
  1. package/package.json +1 -1
  2. package/src/core/collection/array/typed/typed_array_value_denormalize.d.ts +9 -0
  3. package/src/core/collection/array/typed/typed_array_value_denormalize.d.ts.map +1 -0
  4. package/src/core/collection/array/typed/typed_array_value_denormalize.js +47 -0
  5. package/src/core/collection/array/typed/typed_array_value_normalize.d.ts +9 -0
  6. package/src/core/collection/array/typed/typed_array_value_normalize.d.ts.map +1 -0
  7. package/src/core/collection/array/typed/typed_array_value_normalize.js +47 -0
  8. package/src/core/geom/3d/ray/Ray3.d.ts +6 -0
  9. package/src/core/geom/3d/ray/Ray3.d.ts.map +1 -1
  10. package/src/core/geom/3d/ray/Ray3.js +8 -1
  11. package/src/engine/ecs/terrain/tiles/TerrainTile.js +4 -4
  12. package/src/engine/graphics/geometry/buffered/buffer_attribute_denormalize.d.ts +8 -0
  13. package/src/engine/graphics/geometry/buffered/buffer_attribute_denormalize.d.ts.map +1 -0
  14. package/src/engine/graphics/geometry/buffered/buffer_attribute_denormalize.js +66 -0
  15. package/src/engine/graphics/geometry/buffered/query/GeometrySpatialQueryAccelerator.d.ts.map +1 -1
  16. package/src/engine/graphics/geometry/buffered/query/GeometrySpatialQueryAccelerator.js +8 -13
  17. package/src/engine/graphics/geometry/buffered/query/bvh32_geometry_overlap_clipping_volume.d.ts +2 -1
  18. package/src/engine/graphics/geometry/buffered/query/bvh32_geometry_overlap_clipping_volume.d.ts.map +1 -1
  19. package/src/engine/graphics/geometry/buffered/query/bvh32_geometry_overlap_clipping_volume.js +29 -9
  20. package/src/engine/graphics/geometry/buffered/query/bvh32_geometry_raycast.d.ts +2 -1
  21. package/src/engine/graphics/geometry/buffered/query/bvh32_geometry_raycast.d.ts.map +1 -1
  22. package/src/engine/graphics/geometry/buffered/query/bvh32_geometry_raycast.js +32 -9
  23. package/src/engine/graphics/particles/particular/engine/renderers/billboard/ParticleBillboardMaterial.d.ts.map +1 -1
  24. package/src/engine/graphics/particles/particular/engine/renderers/billboard/ParticleBillboardMaterial.js +2 -1
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.128.23",
8
+ "version": "2.129.1",
9
9
  "main": "build/meep.module.js",
10
10
  "module": "build/meep.module.js",
11
11
  "exports": {
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Denormalizes the given value according to the given typed array.
3
+ *
4
+ * @param {number} value - The value to denormalize.
5
+ * @param {TypedArray} array - The typed array that defines the data type of the value.
6
+ * @return {number} The denormalize (float) value in the range `[0,1]`.
7
+ */
8
+ export function typed_array_value_denormalize(value: number, array: TypedArray): number;
9
+ //# sourceMappingURL=typed_array_value_denormalize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typed_array_value_denormalize.d.ts","sourceRoot":"","sources":["../../../../../../src/core/collection/array/typed/typed_array_value_denormalize.js"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,qDAJW,MAAM,sBAEL,MAAM,CAyCjB"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Denormalizes the given value according to the given typed array.
3
+ *
4
+ * @param {number} value - The value to denormalize.
5
+ * @param {TypedArray} array - The typed array that defines the data type of the value.
6
+ * @return {number} The denormalize (float) value in the range `[0,1]`.
7
+ */
8
+ export function typed_array_value_denormalize( value, array ) {
9
+ // taken from https://github.com/mrdoob/three.js/blob/da275a4e00536723155b68518944de5eb7945550/src/math/MathUtils.js#L388
10
+
11
+ switch ( array.constructor ) {
12
+
13
+ case Float32Array:
14
+
15
+ return value;
16
+
17
+ case Uint32Array:
18
+
19
+ return value / 4294967295.0;
20
+
21
+ case Uint16Array:
22
+
23
+ return value / 65535.0;
24
+
25
+ case Uint8Array:
26
+
27
+ return value / 255.0;
28
+
29
+ case Int32Array:
30
+
31
+ return Math.max( value / 2147483647.0, - 1.0 );
32
+
33
+ case Int16Array:
34
+
35
+ return Math.max( value / 32767.0, - 1.0 );
36
+
37
+ case Int8Array:
38
+
39
+ return Math.max( value / 127.0, - 1.0 );
40
+
41
+ default:
42
+
43
+ throw new Error( 'Invalid component type.' );
44
+
45
+ }
46
+
47
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Normalizes the given value according to the given typed array.
3
+ *
4
+ * @param {number} value - The float value in the range `[0,1]` to normalize.
5
+ * @param {TypedArray} array - The typed array that defines the data type of the value.
6
+ * @return {number} The normalize value.
7
+ */
8
+ export function typed_array_value_normalize(value: number, array: TypedArray): number;
9
+ //# sourceMappingURL=typed_array_value_normalize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typed_array_value_normalize.d.ts","sourceRoot":"","sources":["../../../../../../src/core/collection/array/typed/typed_array_value_normalize.js"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,mDAJW,MAAM,sBAEL,MAAM,CAyCjB"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Normalizes the given value according to the given typed array.
3
+ *
4
+ * @param {number} value - The float value in the range `[0,1]` to normalize.
5
+ * @param {TypedArray} array - The typed array that defines the data type of the value.
6
+ * @return {number} The normalize value.
7
+ */
8
+ export function typed_array_value_normalize(value, array) {
9
+ // taken from https://github.com/mrdoob/three.js/blob/da275a4e00536723155b68518944de5eb7945550/src/math/MathUtils.js#L435
10
+
11
+ switch (array.constructor) {
12
+
13
+ case Float32Array:
14
+
15
+ return value;
16
+
17
+ case Uint32Array:
18
+
19
+ return Math.round(value * 4294967295.0);
20
+
21
+ case Uint16Array:
22
+
23
+ return Math.round(value * 65535.0);
24
+
25
+ case Uint8Array:
26
+
27
+ return Math.round(value * 255.0);
28
+
29
+ case Int32Array:
30
+
31
+ return Math.round(value * 2147483647.0);
32
+
33
+ case Int16Array:
34
+
35
+ return Math.round(value * 32767.0);
36
+
37
+ case Int8Array:
38
+
39
+ return Math.round(value * 127.0);
40
+
41
+ default:
42
+
43
+ throw new Error('Invalid component type.');
44
+
45
+ }
46
+
47
+ }
@@ -105,5 +105,11 @@ export class Ray3 extends Float32Array {
105
105
  * @returns {number}
106
106
  */
107
107
  computeSignedDistance(x: number, y: number, z: number): number;
108
+ /**
109
+ * Useful for type checking
110
+ * @readonly
111
+ * @type {boolean}
112
+ */
113
+ readonly isRay3: boolean;
108
114
  }
109
115
  //# sourceMappingURL=Ray3.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Ray3.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/ray/Ray3.js"],"names":[],"mappings":"AAUA;;;GAGG;AACH;IAkOI;;;;;;;;;;OAUG;IACH,sBATW,MAAM,YACN,MAAM,YACN,MAAM,eACN,MAAM,eACN,MAAM,eACN,MAAM,UACN,MAAM,GACL,IAAI,CAqBf;IA/PD,cAKC;IAMD,mBAEC;IAND,gBAEC;IAGG,OAAW;IAOf;;;OAGG;IACH,yCAEC;IAVD,sCAEC;IAUD,uBAEC;IAED,uBAEC;IAED,uBAEC;IAGD;;;;;OAKG;IACH,aAJW,MAAM,KACN,MAAM,KACN,MAAM,QAUhB;IAHG,UAAW;IACX,UAAW;IACX,UAAW;IAQf;;;OAGG;IACH,4CAEC;IAVD,yCAEC;IAWD,0BAEC;IAED,0BAEC;IAED,0BAEC;IAED;;;;;OAKG;IACH,gBAJW,MAAM,KACN,MAAM,KACN,MAAM,QAUhB;IAHG,UAAW;IACX,UAAW;IACX,UAAW;IAGf,2BAEC;IAED;;;;;;;OAOG;IACH,gCANW,MAAM,KACN,MAAM,KACN,MAAM,aACN,MAAM,EAAE,GAAC,YAAY,OAAK,sBAC1B,MAAM,EAAE,GAAC,YAAY,OAAK,QA6BpC;IAED;;;OAGG;IACH,uBAFW,MAAM,QAMhB;IAED;;;OAGG;IACH,iBAFW,MAAM,EAAE,UAAM,YAAY,QAepC;IAED;;;OAGG;IACH,SAFa,IAAI,CAQhB;IAED;;;OAGG;IACH,YAFW,IAAI,QAId;IAED,eAEC;IAED;;;;OAIG;IACH,cAHW,IAAI,GACF,OAAO,CAInB;IAED;;;;;;;;;OASG;IACH,yBALW,MAAM,KACN,MAAM,KACN,MAAM,GACJ,MAAM,CAclB;CAiCJ"}
1
+ {"version":3,"file":"Ray3.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/ray/Ray3.js"],"names":[],"mappings":"AAUA;;;GAGG;AACH;IAkOI;;;;;;;;;;OAUG;IACH,sBATW,MAAM,YACN,MAAM,YACN,MAAM,eACN,MAAM,eACN,MAAM,eACN,MAAM,UACN,MAAM,GACL,IAAI,CAqBf;IA/PD,cAKC;IAMD,mBAEC;IAND,gBAEC;IAGG,OAAW;IAOf;;;OAGG;IACH,yCAEC;IAVD,sCAEC;IAUD,uBAEC;IAED,uBAEC;IAED,uBAEC;IAGD;;;;;OAKG;IACH,aAJW,MAAM,KACN,MAAM,KACN,MAAM,QAUhB;IAHG,UAAW;IACX,UAAW;IACX,UAAW;IAQf;;;OAGG;IACH,4CAEC;IAVD,yCAEC;IAWD,0BAEC;IAED,0BAEC;IAED,0BAEC;IAED;;;;;OAKG;IACH,gBAJW,MAAM,KACN,MAAM,KACN,MAAM,QAUhB;IAHG,UAAW;IACX,UAAW;IACX,UAAW;IAGf,2BAEC;IAED;;;;;;;OAOG;IACH,gCANW,MAAM,KACN,MAAM,KACN,MAAM,aACN,MAAM,EAAE,GAAC,YAAY,OAAK,sBAC1B,MAAM,EAAE,GAAC,YAAY,OAAK,QA6BpC;IAED;;;OAGG;IACH,uBAFW,MAAM,QAMhB;IAED;;;OAGG;IACH,iBAFW,MAAM,EAAE,UAAM,YAAY,QAepC;IAED;;;OAGG;IACH,SAFa,IAAI,CAQhB;IAED;;;OAGG;IACH,YAFW,IAAI,QAId;IAED,eAEC;IAED;;;;OAIG;IACH,cAHW,IAAI,GACF,OAAO,CAInB;IAED;;;;;;;;;OASG;IACH,yBALW,MAAM,KACN,MAAM,KACN,MAAM,GACJ,MAAM,CAclB;IAmCL;;;;OAIG;IACH,iBAFU,OAAO,CAEI;CAPpB"}
@@ -269,4 +269,11 @@ export class Ray3 extends Float32Array {
269
269
 
270
270
  return ray;
271
271
  }
272
- }
272
+ }
273
+
274
+ /**
275
+ * Useful for type checking
276
+ * @readonly
277
+ * @type {boolean}
278
+ */
279
+ Ray3.prototype.isRay3 = true;
@@ -191,12 +191,12 @@ class TerrainTile {
191
191
  const geometry = this.geometry;
192
192
 
193
193
  const geometryIndices = geometry.getIndex().array;
194
- const geometryPositions = geometry.getAttribute('position').array;
194
+ const attribute_position = geometry.getAttribute('position');
195
+ const position_array = attribute_position.array;
195
196
 
196
197
  let hit_found = bvh32_geometry_raycast(
197
- result,
198
- this.bvh,
199
- geometryPositions, 0, 3,
198
+ result, this.bvh, position_array, 0, 3,
199
+ attribute_position.normalized,
200
200
  geometryIndices,
201
201
  _originX, _originY, _originZ,
202
202
  _directionX, _directionY, _directionZ
@@ -0,0 +1,8 @@
1
+ /**
2
+ *
3
+ * @param {THREE.BufferAttribute} attribute
4
+ * @returns {THREE.BufferAttribute} returns denormalized attribute, if input is already denormalized returns input
5
+ */
6
+ export function buffer_attribute_denormalize(attribute: THREE.BufferAttribute): THREE.BufferAttribute;
7
+ import { BufferAttribute } from "three";
8
+ //# sourceMappingURL=buffer_attribute_denormalize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buffer_attribute_denormalize.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/geometry/buffered/buffer_attribute_denormalize.js"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wDAHW,qBAAqB,GACnB,qBAAqB,CA2DjC;gCAjE+B,OAAO"}
@@ -0,0 +1,66 @@
1
+ import { BufferAttribute } from "three";
2
+ import { assert } from "../../../../core/assert.js";
3
+
4
+ /**
5
+ *
6
+ * @param {THREE.BufferAttribute} attribute
7
+ * @returns {THREE.BufferAttribute} returns denormalized attribute, if input is already denormalized returns input
8
+ */
9
+ export function buffer_attribute_denormalize(attribute) {
10
+ assert.notEqual(attribute.isInterleavedBufferAttribute, true, 'attribute must not be interleaved');
11
+
12
+ if (!attribute.normalized) {
13
+ // already denormalized
14
+ return attribute;
15
+ }
16
+
17
+ const raw_data = attribute.array;
18
+ const input_array_type = raw_data.constructor;
19
+
20
+ if (input_array_type === Float32Array) {
21
+ // special case
22
+ return new BufferAttribute(raw_data, attribute.itemSize, false);
23
+ }
24
+
25
+ const value_count = attribute.count * attribute.itemSize;
26
+ const denormalized = new Float32Array(value_count);
27
+
28
+ // denormalization inlined for speed
29
+ switch (input_array_type) {
30
+ case Uint32Array:
31
+ for (let i = 0; i < value_count; i++) {
32
+ denormalized[i] = raw_data[i] / 0xffffffff;
33
+ }
34
+ break;
35
+ case Uint16Array:
36
+ for (let i = 0; i < value_count; i++) {
37
+ denormalized[i] = raw_data[i] / 0xffff;
38
+ }
39
+ break;
40
+ case Uint8Array:
41
+ for (let i = 0; i < value_count; i++) {
42
+ denormalized[i] = raw_data[i] / 0xff;
43
+ }
44
+ break;
45
+ case Int32Array:
46
+ for (let i = 0; i < value_count; i++) {
47
+ denormalized[i] = Math.max(raw_data[i] / 0x7fffffff, -1);
48
+ }
49
+ break;
50
+ case Int16Array:
51
+ for (let i = 0; i < value_count; i++) {
52
+ denormalized[i] = Math.max(raw_data[i] / 0x7fff, -1);
53
+ }
54
+ break;
55
+ case Int8Array:
56
+ for (let i = 0; i < value_count; i++) {
57
+ denormalized[i] = Math.max(raw_data[i] / 0x7f, -1);
58
+ }
59
+ break;
60
+ default:
61
+ throw new Error(`Unsupported data type ${input_array_type}`);
62
+ }
63
+
64
+ return new BufferAttribute(denormalized, attribute.itemSize, false);
65
+
66
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"GeometrySpatialQueryAccelerator.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/geometry/buffered/query/GeometrySpatialQueryAccelerator.js"],"names":[],"mappings":"AAgBA;IACI,iCAyBC;IArBG;;;OAGG;IACH,cAeE;IAIN;;;OAGG;IACH,4BAEC;IAED;;;OAGG;IACH,yBAEC;IAED;;;;;OAKG;IACH,4CAJW,MAAM,cAAc,UACpB,OAAO,GACL,OAAO,CAuCnB;IAED;;;;;;OAMG;IACH,gEAJW,MAAM,cAAc,OACpB,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,GAAC,YAAY,GACtC,OAAO,CASlB;IAED;;;;;;;;;;;OAWG;IACH,oEATW,MAAM,cAAc,gBACpB,MAAM,gBACN,MAAM,gBACN,MAAM,mBACN,MAAM,mBACN,MAAM,mBACN,MAAM,GACL,OAAO,CAwDlB;IAED;;;;;;;OAOG;IACH,0DALW,MAAM,cAAc,gDAGlB,OAAO,CAcnB;IAED;;;;OAIG;IACH,gCAHW,MAAM,cAAc,GAClB,OAAO,CAMnB;IAED;;;;OAIG;IACH,sBAHW,MAAM,cAAc,GAClB,eAAe,CAiB3B;IAED;;;;OAIG;IACH,oBAoBC;CAEJ;;kBAIS,+BAA+B;;gCAlRT,sDAAsD"}
1
+ {"version":3,"file":"GeometrySpatialQueryAccelerator.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/geometry/buffered/query/GeometrySpatialQueryAccelerator.js"],"names":[],"mappings":"AAiBA;IACI,iCAyBC;IArBG;;;OAGG;IACH,cAeE;IAIN;;;OAGG;IACH,4BAEC;IAED;;;OAGG;IACH,yBAEC;IAED;;;;;OAKG;IACH,4CAJW,MAAM,cAAc,UACpB,OAAO,GACL,OAAO,CAuCnB;IAED;;;;;;OAMG;IACH,gEAJW,MAAM,cAAc,OACpB,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,GAAC,YAAY,GACtC,OAAO,CASlB;IAED;;;;;;;;;;;OAWG;IACH,oEATW,MAAM,cAAc,gBACpB,MAAM,gBACN,MAAM,gBACN,MAAM,mBACN,MAAM,mBACN,MAAM,mBACN,MAAM,GACL,OAAO,CA8ClB;IAED;;;;;;;OAOG;IACH,0DALW,MAAM,cAAc,gDAGlB,OAAO,CAcnB;IAED;;;;OAIG;IACH,gCAHW,MAAM,cAAc,GAClB,OAAO,CAMnB;IAED;;;;OAIG;IACH,sBAHW,MAAM,cAAc,GAClB,eAAe,CAiB3B;IAED;;;;OAIG;IACH,oBAwBC;CAEJ;;kBAIS,+BAA+B;;gCA7QT,sDAAsD"}
@@ -4,6 +4,7 @@ import { Cache } from "../../../../../core/cache/Cache.js";
4
4
  import { read_three_planes_to_array } from "../../../../../core/geom/3d/frustum/read_three_planes_to_array.js";
5
5
  import { bvh32_from_indexed_geometry } from "../../bvh/buffered/bvh32_from_indexed_geometry.js";
6
6
  import { bvh32_from_unindexed_geometry } from "../../bvh/buffered/bvh32_from_unindexed_geometry.js";
7
+ import { buffer_attribute_denormalize } from "../buffer_attribute_denormalize.js";
7
8
  import { deinterleaveBufferAttribute } from "../deinterleaveBufferAttribute.js";
8
9
  import { bvh32_geometry_overlap_clipping_volume } from "./bvh32_geometry_overlap_clipping_volume.js";
9
10
  import { bvh32_geometry_raycast } from "./bvh32_geometry_raycast.js";
@@ -97,7 +98,7 @@ export class GeometrySpatialQueryAccelerator {
97
98
 
98
99
  return bvh32_geometry_overlap_clipping_volume(
99
100
  bvh,
100
- position_data, position_data_offset, stride,
101
+ position_data, position_data_offset, stride, position_attribute.normalized,
101
102
  geometryIndices,
102
103
  scratch_planes, 0, planes.length
103
104
  );
@@ -173,17 +174,7 @@ export class GeometrySpatialQueryAccelerator {
173
174
 
174
175
  }
175
176
 
176
- return bvh32_geometry_raycast(
177
- destination, bvh,
178
- position_data, position_data_offset, stride,
179
- geometryIndices,
180
- ray_origin_x,
181
- ray_origin_y,
182
- ray_origin_z,
183
- ray_direction_x,
184
- ray_direction_y,
185
- ray_direction_z
186
- );
177
+ return bvh32_geometry_raycast(destination, bvh, position_data, position_data_offset, stride, position_attribute.normalized, geometryIndices, ray_origin_x, ray_origin_y, ray_origin_z, ray_direction_x, ray_direction_y, ray_direction_z);
187
178
 
188
179
  }
189
180
 
@@ -254,10 +245,14 @@ export class GeometrySpatialQueryAccelerator {
254
245
  const index_attribute = geometry.getIndex();
255
246
 
256
247
  const de_interleaved_position_attribute = deinterleaveBufferAttribute(position_attribute);
257
- const vertices = de_interleaved_position_attribute.array;
248
+ const de_normalized_position_attribute = buffer_attribute_denormalize(de_interleaved_position_attribute);
249
+
250
+ const vertices = de_normalized_position_attribute.array;
258
251
 
259
252
  if (index_attribute === undefined || index_attribute === null) {
253
+
260
254
  bvh32_from_unindexed_geometry(bvh, vertices);
255
+
261
256
  } else {
262
257
 
263
258
  const de_interleaved_index_attribute = deinterleaveBufferAttribute(index_attribute);
@@ -4,11 +4,12 @@
4
4
  * @param {number[]|ArrayLike<number>} vertices
5
5
  * @param {number} vertex_offset Unless you're using an interleaved buffer of some kind, this will be 0
6
6
  * @param {number} vertex_stride Unless you're using an interleaved buffer, this should be 3
7
+ * @param {boolean} vertex_data_normalized do we need to denormalize vertex data?
7
8
  * @param {number[]|ArrayLike<number>|undefined} indices if this is set to undefined - implicit indexing will be used
8
9
  * @param {number[]|Float32Array} planes
9
10
  * @param {number} planes_offset
10
11
  * @param {number} plane_count
11
12
  * @returns {boolean}
12
13
  */
13
- export function bvh32_geometry_overlap_clipping_volume(bvh: BinaryUint32BVH, vertices: number[] | ArrayLike<number>, vertex_offset: number, vertex_stride: number, indices: number[] | ArrayLike<number> | undefined, planes: number[] | Float32Array, planes_offset: number, plane_count: number): boolean;
14
+ export function bvh32_geometry_overlap_clipping_volume(bvh: BinaryUint32BVH, vertices: number[] | ArrayLike<number>, vertex_offset: number, vertex_stride: number, vertex_data_normalized: boolean, indices: number[] | ArrayLike<number> | undefined, planes: number[] | Float32Array, planes_offset: number, plane_count: number): boolean;
14
15
  //# sourceMappingURL=bvh32_geometry_overlap_clipping_volume.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bvh32_geometry_overlap_clipping_volume.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/geometry/buffered/query/bvh32_geometry_overlap_clipping_volume.js"],"names":[],"mappings":"AAUA;;;;;;;;;;;GAWG;AACH,uFATW,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,iBAC1B,MAAM,iBACN,MAAM,WACN,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,GAAC,SAAS,UACpC,MAAM,EAAE,GAAC,YAAY,iBACrB,MAAM,eACN,MAAM,GACJ,OAAO,CAmEnB"}
1
+ {"version":3,"file":"bvh32_geometry_overlap_clipping_volume.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/geometry/buffered/query/bvh32_geometry_overlap_clipping_volume.js"],"names":[],"mappings":"AAaA;;;;;;;;;;;;GAYG;AACH,uFAVW,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,iBAC1B,MAAM,iBACN,MAAM,0BACN,OAAO,WACP,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,GAAC,SAAS,UACpC,MAAM,EAAE,GAAC,YAAY,iBACrB,MAAM,eACN,MAAM,GACJ,OAAO,CAmFnB"}
@@ -2,6 +2,9 @@ import { assert } from "../../../../../core/assert.js";
2
2
  import {
3
3
  bvh32_query_user_data_overlaps_clipping_volume
4
4
  } from "../../../../../core/bvh2/binary/2/bvh32_query_user_data_overlaps_clipping_volume.js";
5
+ import {
6
+ typed_array_value_denormalize
7
+ } from "../../../../../core/collection/array/typed/typed_array_value_denormalize.js";
5
8
  import {
6
9
  triangle_intersects_clipping_volume
7
10
  } from "../../../../../core/geom/3d/triangle/triangle_intersects_clipping_volume.js";
@@ -14,6 +17,7 @@ const scratch_array = []
14
17
  * @param {number[]|ArrayLike<number>} vertices
15
18
  * @param {number} vertex_offset Unless you're using an interleaved buffer of some kind, this will be 0
16
19
  * @param {number} vertex_stride Unless you're using an interleaved buffer, this should be 3
20
+ * @param {boolean} vertex_data_normalized do we need to denormalize vertex data?
17
21
  * @param {number[]|ArrayLike<number>|undefined} indices if this is set to undefined - implicit indexing will be used
18
22
  * @param {number[]|Float32Array} planes
19
23
  * @param {number} planes_offset
@@ -23,6 +27,7 @@ const scratch_array = []
23
27
  export function bvh32_geometry_overlap_clipping_volume(
24
28
  bvh,
25
29
  vertices, vertex_offset, vertex_stride,
30
+ vertex_data_normalized,
26
31
  indices,
27
32
  planes, planes_offset, plane_count
28
33
  ) {
@@ -61,17 +66,32 @@ export function bvh32_geometry_overlap_clipping_volume(
61
66
  assert.lessThan(b_address + 2, vertices.length, 'b-vertex overflow');
62
67
  assert.lessThan(c_address + 2, vertices.length, 'c-vertex overflow');
63
68
 
64
- const ax = vertices[a_address];
65
- const ay = vertices[a_address + 1];
66
- const az = vertices[a_address + 2];
69
+ let ax = vertices[a_address];
70
+ let ay = vertices[a_address + 1];
71
+ let az = vertices[a_address + 2];
72
+
73
+ let bx = vertices[b_address];
74
+ let by = vertices[b_address + 1];
75
+ let bz = vertices[b_address + 2];
76
+
77
+ let cx = vertices[c_address];
78
+ let cy = vertices[c_address + 1];
79
+ let cz = vertices[c_address + 2];
67
80
 
68
- const bx = vertices[b_address];
69
- const by = vertices[b_address + 1];
70
- const bz = vertices[b_address + 2];
81
+ // denormalize if necessary
82
+ if(vertex_data_normalized) {
83
+ ax = typed_array_value_denormalize(ax, vertices);
84
+ ay = typed_array_value_denormalize(ay, vertices);
85
+ az = typed_array_value_denormalize(az, vertices);
71
86
 
72
- const cx = vertices[c_address];
73
- const cy = vertices[c_address + 1];
74
- const cz = vertices[c_address + 2];
87
+ bx = typed_array_value_denormalize(bx, vertices);
88
+ by = typed_array_value_denormalize(by, vertices);
89
+ bz = typed_array_value_denormalize(bz, vertices);
90
+
91
+ cx = typed_array_value_denormalize(cx, vertices);
92
+ cy = typed_array_value_denormalize(cy, vertices);
93
+ cz = typed_array_value_denormalize(cz, vertices);
94
+ }
75
95
 
76
96
  if (triangle_intersects_clipping_volume(
77
97
  planes, planes_offset, plane_count,
@@ -5,6 +5,7 @@
5
5
  * @param {number[]|ArrayLike<number>} vertices
6
6
  * @param {number} vertex_offset Unless you're using an interleaved buffer of some kind, this will be 0
7
7
  * @param {number} vertex_stride Unless you're using an interleaved buffer, this should be 3
8
+ * @param {boolean} vertex_data_normalized do we need to denormalize vertex data?
8
9
  * @param {number[]|ArrayLike<number>|undefined} indices if this is set to undefined - implicit indexing will be used
9
10
  * @param {number} originX
10
11
  * @param {number} originY
@@ -14,6 +15,6 @@
14
15
  * @param {number} directionZ
15
16
  * @returns {boolean}
16
17
  */
17
- export function bvh32_geometry_raycast(result: SurfacePoint3, bvh: BinaryUint32BVH, vertices: number[] | ArrayLike<number>, vertex_offset: number, vertex_stride: number, indices: number[] | ArrayLike<number> | undefined, originX: number, originY: number, originZ: number, directionX: number, directionY: number, directionZ: number): boolean;
18
+ export function bvh32_geometry_raycast(result: SurfacePoint3, bvh: BinaryUint32BVH, vertices: number[] | ArrayLike<number>, vertex_offset: number, vertex_stride: number, vertex_data_normalized: boolean, indices: number[] | ArrayLike<number> | undefined, originX: number, originY: number, originZ: number, directionX: number, directionY: number, directionZ: number): boolean;
18
19
  import { SurfacePoint3 } from "../../../../../core/geom/3d/SurfacePoint3.js";
19
20
  //# sourceMappingURL=bvh32_geometry_raycast.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bvh32_geometry_raycast.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/geometry/buffered/query/bvh32_geometry_raycast.js"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;GAeG;AACH,+CAdW,aAAa,kCAEb,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,iBAC1B,MAAM,iBACN,MAAM,WACN,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,GAAC,SAAS,WACpC,MAAM,WACN,MAAM,WACN,MAAM,cACN,MAAM,cACN,MAAM,cACN,MAAM,GACJ,OAAO,CAqFnB;8BAzG6B,8CAA8C"}
1
+ {"version":3,"file":"bvh32_geometry_raycast.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/geometry/buffered/query/bvh32_geometry_raycast.js"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;;;;GAgBG;AACH,+CAfW,aAAa,kCAEb,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,iBAC1B,MAAM,iBACN,MAAM,0BACN,OAAO,WACP,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,GAAC,SAAS,WACpC,MAAM,WACN,MAAM,WACN,MAAM,cACN,MAAM,cACN,MAAM,cACN,MAAM,GACJ,OAAO,CAwGnB;8BA7H6B,8CAA8C"}
@@ -1,5 +1,8 @@
1
1
  import { assert } from "../../../../../core/assert.js";
2
2
  import { bvh32_query_user_data_ray } from "../../../../../core/bvh2/binary/2/bvh32_query_user_data_ray.js";
3
+ import {
4
+ typed_array_value_denormalize
5
+ } from "../../../../../core/collection/array/typed/typed_array_value_denormalize.js";
3
6
  import { SurfacePoint3 } from "../../../../../core/geom/3d/SurfacePoint3.js";
4
7
  import { computeTriangleRayIntersection } from "../../../../../core/geom/3d/triangle/computeTriangleRayIntersection.js";
5
8
 
@@ -13,6 +16,7 @@ const scratch_hit = new SurfacePoint3()
13
16
  * @param {number[]|ArrayLike<number>} vertices
14
17
  * @param {number} vertex_offset Unless you're using an interleaved buffer of some kind, this will be 0
15
18
  * @param {number} vertex_stride Unless you're using an interleaved buffer, this should be 3
19
+ * @param {boolean} vertex_data_normalized do we need to denormalize vertex data?
16
20
  * @param {number[]|ArrayLike<number>|undefined} indices if this is set to undefined - implicit indexing will be used
17
21
  * @param {number} originX
18
22
  * @param {number} originY
@@ -26,10 +30,14 @@ export function bvh32_geometry_raycast(
26
30
  result,
27
31
  bvh,
28
32
  vertices, vertex_offset, vertex_stride,
33
+ vertex_data_normalized,
29
34
  indices,
30
35
  originX, originY, originZ,
31
36
  directionX, directionY, directionZ
32
37
  ) {
38
+
39
+ assert.isBoolean(vertex_data_normalized, 'vertex_data_normalized');
40
+
33
41
  let hit_found = false;
34
42
 
35
43
  const hit_count = bvh32_query_user_data_ray(
@@ -69,17 +77,32 @@ export function bvh32_geometry_raycast(
69
77
  assert.lessThan(b_address + 2, vertices.length, 'b-vertex overflow');
70
78
  assert.lessThan(c_address + 2, vertices.length, 'c-vertex overflow');
71
79
 
72
- const ax = vertices[a_address];
73
- const ay = vertices[a_address + 1];
74
- const az = vertices[a_address + 2];
80
+ let ax = vertices[a_address];
81
+ let ay = vertices[a_address + 1];
82
+ let az = vertices[a_address + 2];
83
+
84
+ let bx = vertices[b_address];
85
+ let by = vertices[b_address + 1];
86
+ let bz = vertices[b_address + 2];
75
87
 
76
- const bx = vertices[b_address];
77
- const by = vertices[b_address + 1];
78
- const bz = vertices[b_address + 2];
88
+ let cx = vertices[c_address];
89
+ let cy = vertices[c_address + 1];
90
+ let cz = vertices[c_address + 2];
79
91
 
80
- const cx = vertices[c_address];
81
- const cy = vertices[c_address + 1];
82
- const cz = vertices[c_address + 2];
92
+ // denormalize if necessary
93
+ if(vertex_data_normalized) {
94
+ ax = typed_array_value_denormalize(ax, vertices);
95
+ ay = typed_array_value_denormalize(ay, vertices);
96
+ az = typed_array_value_denormalize(az, vertices);
97
+
98
+ bx = typed_array_value_denormalize(bx, vertices);
99
+ by = typed_array_value_denormalize(by, vertices);
100
+ bz = typed_array_value_denormalize(bz, vertices);
101
+
102
+ cx = typed_array_value_denormalize(cx, vertices);
103
+ cy = typed_array_value_denormalize(cy, vertices);
104
+ cz = typed_array_value_denormalize(cz, vertices);
105
+ }
83
106
 
84
107
  const triangle_hit_found = computeTriangleRayIntersection(
85
108
  scratch_hit,
@@ -1 +1 @@
1
- {"version":3,"file":"ParticleBillboardMaterial.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/engine/graphics/particles/particular/engine/renderers/billboard/ParticleBillboardMaterial.js"],"names":[],"mappings":"AA8ZA;;;;;;;GAOG;AACH,4DAFW,OAAO,kBA2EjB;+BApeM,OAAO"}
1
+ {"version":3,"file":"ParticleBillboardMaterial.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/engine/graphics/particles/particular/engine/renderers/billboard/ParticleBillboardMaterial.js"],"names":[],"mappings":"AA+ZA;;;;;;;GAOG;AACH,4DAFW,OAAO,kBA2EjB;+BAreM,OAAO"}
@@ -113,6 +113,7 @@ vec3 directLightColor_Diffuse;
113
113
  `;
114
114
 
115
115
  function make_vertex_shader() {
116
+ //language=GLSL
116
117
  return `
117
118
  uniform float cameraNear;
118
119
  uniform float cameraFar;
@@ -191,7 +192,7 @@ function make_vertex_shader() {
191
192
 
192
193
  #ifdef DEPTH_SOFT_ENABLED
193
194
 
194
- vFadeDistance = 1.0 / radius;
195
+ vFadeDistance = 1.0 / radius;
195
196
 
196
197
  #endif
197
198