@woosh/meep-engine 2.97.0 → 2.98.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 (163) hide show
  1. package/build/bundle-worker-terrain.js +1 -1
  2. package/build/meep.cjs +861 -670
  3. package/build/meep.min.js +1 -1
  4. package/build/meep.module.js +861 -670
  5. package/package.json +1 -1
  6. package/src/core/bvh2/bvh3/query/bvh_query_leaves_ray.js +1 -1
  7. package/src/core/bvh2/bvh3/query/bvh_query_user_data_generic.js +1 -1
  8. package/src/core/bvh2/bvh3/query/bvh_query_user_data_ray.d.ts.map +1 -1
  9. package/src/core/bvh2/bvh3/query/bvh_query_user_data_ray.js +3 -2
  10. package/src/core/collection/array/arrayQuickSort.js +2 -2
  11. package/src/core/collection/array/array_compute_max.d.ts +9 -0
  12. package/src/core/collection/array/array_compute_max.d.ts.map +1 -0
  13. package/src/core/collection/array/{computeArrayMax.js → array_compute_max.js} +1 -1
  14. package/src/core/collection/array/array_compute_min.d.ts +9 -0
  15. package/src/core/collection/array/array_compute_min.d.ts.map +1 -0
  16. package/src/core/collection/array/{computeArrayMin.js → array_compute_min.js} +1 -1
  17. package/src/core/collection/array/array_compute_min_max.d.ts.map +1 -1
  18. package/src/core/collection/array/array_compute_min_max.js +1 -0
  19. package/src/core/collection/array/array_swap.d.ts.map +1 -1
  20. package/src/core/collection/array/array_swap.js +11 -8
  21. package/src/core/collection/array/array_swap_one.d.ts +8 -0
  22. package/src/core/collection/array/array_swap_one.d.ts.map +1 -0
  23. package/src/core/collection/array/{arraySwapElements.js → array_swap_one.js} +1 -1
  24. package/src/core/collection/array/iterator/AbstractArrayIterator.d.ts.map +1 -0
  25. package/src/core/collection/array/iterator/ArrayIteratorRandom.d.ts.map +1 -0
  26. package/src/core/collection/array/{ArrayIteratorRandom.js → iterator/ArrayIteratorRandom.js} +2 -2
  27. package/src/core/collection/array/iterator/ArrayIteratorSequential.d.ts.map +1 -0
  28. package/src/core/collection/array/randomizeArrayElementOrder.js +2 -2
  29. package/src/core/collection/map/HashMap.js +10 -10
  30. package/src/core/collection/map/ObservedMap.d.ts +7 -4
  31. package/src/core/collection/map/ObservedMap.d.ts.map +1 -1
  32. package/src/core/collection/map/ObservedMap.js +4 -1
  33. package/src/core/collection/queue/Deque.d.ts.map +1 -1
  34. package/src/core/collection/queue/Deque.js +82 -36
  35. package/src/core/collection/set/compute_set_difference.d.ts.map +1 -1
  36. package/src/core/collection/set/compute_set_difference.js +8 -0
  37. package/src/core/collection/set/compute_set_difference.spec.d.ts +2 -0
  38. package/src/core/collection/set/compute_set_difference.spec.d.ts.map +1 -0
  39. package/src/core/collection/set/compute_set_difference.spec.js +45 -0
  40. package/src/core/collection/set/compute_set_intersection.d.ts +1 -0
  41. package/src/core/collection/set/compute_set_intersection.d.ts.map +1 -1
  42. package/src/core/collection/set/compute_set_intersection.js +9 -0
  43. package/src/core/collection/set/compute_set_intersection.spec.d.ts +2 -0
  44. package/src/core/collection/set/compute_set_intersection.spec.d.ts.map +1 -0
  45. package/src/core/collection/set/compute_set_intersection.spec.js +45 -0
  46. package/src/core/collection/set/set_remove.d.ts +2 -0
  47. package/src/core/collection/set/set_remove.d.ts.map +1 -1
  48. package/src/core/collection/set/set_remove.js +2 -0
  49. package/src/core/color/oklab/XYZ.spec.d.ts +2 -0
  50. package/src/core/color/oklab/XYZ.spec.d.ts.map +1 -0
  51. package/src/core/color/oklab/XYZ.spec.js +17 -0
  52. package/src/core/color/oklab/oklab_to_xyz.d.ts +9 -0
  53. package/src/core/color/oklab/oklab_to_xyz.d.ts.map +1 -0
  54. package/src/core/color/oklab/oklab_to_xyz.js +32 -0
  55. package/src/core/color/oklab/oklab_to_xyz.spec.d.ts +2 -0
  56. package/src/core/color/oklab/oklab_to_xyz.spec.d.ts.map +1 -0
  57. package/src/core/color/oklab/oklab_to_xyz.spec.js +31 -0
  58. package/src/core/color/oklab/xyz_to_oklab.d.ts +8 -0
  59. package/src/core/color/oklab/xyz_to_oklab.d.ts.map +1 -0
  60. package/src/core/color/oklab/xyz_to_oklab.js +29 -0
  61. package/src/core/color/oklab/xyz_to_oklab.spec.d.ts +2 -0
  62. package/src/core/color/oklab/xyz_to_oklab.spec.d.ts.map +1 -0
  63. package/src/core/color/oklab/xyz_to_oklab.spec.js +31 -0
  64. package/src/core/color/sRGB/linear_to_sRGB.d.ts.map +1 -1
  65. package/src/core/color/sRGB/linear_to_sRGB.js +16 -5
  66. package/src/core/color/sRGB/sRGB_to_linear.d.ts.map +1 -1
  67. package/src/core/color/sRGB/sRGB_to_linear.js +17 -5
  68. package/src/core/color/xyz/rgb_to_xyz.d.ts +1 -0
  69. package/src/core/color/xyz/rgb_to_xyz.d.ts.map +1 -1
  70. package/src/core/color/xyz/rgb_to_xyz.js +4 -3
  71. package/src/core/color/xyz/xyz_to_rgb.d.ts +1 -1
  72. package/src/core/color/xyz/xyz_to_rgb.js +4 -4
  73. package/src/core/geom/3d/aabb/aabb3_intersects_ray.js +10 -10
  74. package/src/core/parser/simple/ParserError.d.ts +11 -6
  75. package/src/core/parser/simple/ParserError.d.ts.map +1 -1
  76. package/src/core/parser/simple/ParserError.js +51 -4
  77. package/src/core/parser/simple/Token.d.ts.map +1 -1
  78. package/src/core/parser/simple/Token.js +8 -2
  79. package/src/core/parser/simple/TokenType.d.ts +1 -5
  80. package/src/core/parser/simple/TokenType.d.ts.map +1 -1
  81. package/src/core/parser/simple/TokenType.js +1 -1
  82. package/src/core/parser/simple/readBooleanToken.d.ts.map +1 -1
  83. package/src/core/parser/simple/readBooleanToken.js +6 -1
  84. package/src/core/parser/simple/readHexToken.d.ts.map +1 -1
  85. package/src/core/parser/simple/readHexToken.js +7 -2
  86. package/src/core/parser/simple/readIdentifierToken.d.ts.map +1 -1
  87. package/src/core/parser/simple/readIdentifierToken.js +6 -1
  88. package/src/core/parser/simple/readLiteralToken.d.ts.map +1 -1
  89. package/src/core/parser/simple/readLiteralToken.js +8 -3
  90. package/src/core/parser/simple/readNumberToken.d.ts.map +1 -1
  91. package/src/core/parser/simple/readNumberToken.js +7 -2
  92. package/src/core/parser/simple/readReferenceToken.d.ts.map +1 -1
  93. package/src/core/parser/simple/readReferenceToken.js +6 -1
  94. package/src/core/parser/simple/readStringToken.d.ts.map +1 -1
  95. package/src/core/parser/simple/readStringToken.js +6 -1
  96. package/src/core/parser/simple/readUnsignedIntegerToken.d.ts.map +1 -1
  97. package/src/core/parser/simple/readUnsignedIntegerToken.js +7 -2
  98. package/src/core/parser/simple/skipWhitespace.d.ts.map +1 -1
  99. package/src/core/parser/simple/skipWhitespace.js +8 -0
  100. package/src/core/primitives/strings/string_repeat.d.ts +9 -0
  101. package/src/core/primitives/strings/string_repeat.d.ts.map +1 -0
  102. package/src/core/primitives/strings/string_repeat.js +26 -0
  103. package/src/engine/asset/AssetManager.d.ts.map +1 -1
  104. package/src/engine/development/performance/RingBufferMetric.d.ts.map +1 -1
  105. package/src/engine/development/performance/RingBufferMetric.js +5 -5
  106. package/src/engine/ecs/terrain/ecs/BuildLightTexture.d.ts.map +1 -1
  107. package/src/engine/ecs/terrain/ecs/BuildLightTexture.js +15 -22
  108. package/src/engine/graphics/ecs/camera/Camera.d.ts.map +1 -1
  109. package/src/engine/graphics/ecs/camera/Camera.js +23 -16
  110. package/src/engine/graphics/filter/ImageFilter.d.ts +2 -2
  111. package/src/engine/graphics/filter/ImageFilter.d.ts.map +1 -1
  112. package/src/engine/graphics/filter/ImageFilter.js +3 -3
  113. package/src/engine/graphics/render/RendererPool.d.ts +14 -1
  114. package/src/engine/graphics/render/RendererPool.d.ts.map +1 -1
  115. package/src/engine/graphics/render/RendererPool.js +43 -1
  116. package/src/engine/graphics/render/forward_plus/LightManager.js +2 -2
  117. package/src/engine/graphics/sh3/path_tracer/PathTracer.d.ts +2 -1
  118. package/src/engine/graphics/sh3/path_tracer/PathTracer.d.ts.map +1 -1
  119. package/src/engine/graphics/sh3/path_tracer/PathTracer.js +23 -50
  120. package/src/engine/graphics/sh3/path_tracer/getBiasedNormalSample.d.ts +9 -0
  121. package/src/engine/graphics/sh3/path_tracer/getBiasedNormalSample.d.ts.map +1 -1
  122. package/src/engine/graphics/sh3/path_tracer/getBiasedNormalSample.js +53 -3
  123. package/src/engine/graphics/sh3/path_tracer/prototypePathTracer.js +3 -3
  124. package/src/engine/graphics/texture/sampler/convertTexture2Sampler2D.d.ts +1 -1
  125. package/src/engine/graphics/texture/sampler/convertTexture2Sampler2D.d.ts.map +1 -1
  126. package/src/engine/graphics/texture/sampler/convertTexture2Sampler2D.js +42 -36
  127. package/src/engine/graphics/texture/sampler/debug/debug_draw_sampler.d.ts +3 -0
  128. package/src/engine/graphics/texture/sampler/debug/debug_draw_sampler.d.ts.map +1 -0
  129. package/src/engine/graphics/texture/sampler/debug/debug_draw_sampler.js +34 -0
  130. package/src/engine/graphics/texture/sampler/debug/debug_draw_sampler_grid.d.ts +10 -0
  131. package/src/engine/graphics/texture/sampler/debug/debug_draw_sampler_grid.d.ts.map +1 -0
  132. package/src/engine/graphics/texture/sampler/debug/debug_draw_sampler_grid.js +89 -0
  133. package/src/engine/graphics/texture/sampler/debug/prototypeSamplerFiltering.d.ts.map +1 -0
  134. package/src/engine/graphics/texture/sampler/{prototypeSamplerFiltering.js → debug/prototypeSamplerFiltering.js} +105 -113
  135. package/src/generation/grid/generation/GridTaskDensityMarkerDistribution.d.ts.map +1 -1
  136. package/src/generation/grid/generation/GridTaskDensityMarkerDistribution.js +8 -8
  137. package/src/generation/markers/GridActionRuleSet.d.ts.map +1 -1
  138. package/src/generation/markers/GridActionRuleSet.js +5 -5
  139. package/src/core/binary/byteArrayToString.d.ts +0 -9
  140. package/src/core/binary/byteArrayToString.d.ts.map +0 -1
  141. package/src/core/binary/byteArrayToString.js +0 -28
  142. package/src/core/collection/array/AbstractArrayIterator.d.ts.map +0 -1
  143. package/src/core/collection/array/ArrayIteratorRandom.d.ts.map +0 -1
  144. package/src/core/collection/array/ArrayIteratorSequential.d.ts.map +0 -1
  145. package/src/core/collection/array/arrayPickMinElement.d.ts +0 -8
  146. package/src/core/collection/array/arrayPickMinElement.d.ts.map +0 -1
  147. package/src/core/collection/array/arrayPickMinElement.js +0 -43
  148. package/src/core/collection/array/arraySwapElements.d.ts +0 -8
  149. package/src/core/collection/array/arraySwapElements.d.ts.map +0 -1
  150. package/src/core/collection/array/computeArrayMax.d.ts +0 -9
  151. package/src/core/collection/array/computeArrayMax.d.ts.map +0 -1
  152. package/src/core/collection/array/computeArrayMin.d.ts +0 -9
  153. package/src/core/collection/array/computeArrayMin.d.ts.map +0 -1
  154. package/src/core/color/hsluv/HSLuv.d.ts +0 -13
  155. package/src/core/color/hsluv/HSLuv.d.ts.map +0 -1
  156. package/src/core/color/hsluv/HSLuv.js +0 -187
  157. package/src/engine/graphics/texture/sampler/prototypeSamplerFiltering.d.ts.map +0 -1
  158. /package/src/core/collection/array/{AbstractArrayIterator.d.ts → iterator/AbstractArrayIterator.d.ts} +0 -0
  159. /package/src/core/collection/array/{AbstractArrayIterator.js → iterator/AbstractArrayIterator.js} +0 -0
  160. /package/src/core/collection/array/{ArrayIteratorRandom.d.ts → iterator/ArrayIteratorRandom.d.ts} +0 -0
  161. /package/src/core/collection/array/{ArrayIteratorSequential.d.ts → iterator/ArrayIteratorSequential.d.ts} +0 -0
  162. /package/src/core/collection/array/{ArrayIteratorSequential.js → iterator/ArrayIteratorSequential.js} +0 -0
  163. /package/src/engine/graphics/texture/sampler/{prototypeSamplerFiltering.d.ts → debug/prototypeSamplerFiltering.d.ts} +0 -0
@@ -1,7 +1,54 @@
1
- function ParserError(position, message, input) {
2
- this.position = position;
3
- this.message = message;
4
- this.input = input;
1
+ import { assert } from "../../assert.js";
2
+ import { max2 } from "../../math/max2.js";
3
+ import { min2 } from "../../math/min2.js";
4
+ import { string_repeat } from "../../primitives/strings/string_repeat.js";
5
+
6
+ class ParserError extends Error {
7
+ /**
8
+ *
9
+ * @param {number} position
10
+ * @param {string} message
11
+ * @param {string} input
12
+ */
13
+ constructor(
14
+ position,
15
+ message,
16
+ input
17
+ ) {
18
+
19
+ super();
20
+
21
+ assert.isNonNegativeInteger(position, 'position');
22
+ assert.isString(message, 'message');
23
+ assert.isString(input, 'input');
24
+
25
+ this.position = position;
26
+ this.message = message;
27
+ this.input = input;
28
+ }
29
+
30
+ getDetails() {
31
+ const input = this.input;
32
+ const position = this.position;
33
+
34
+ // get snippet around where the problem has occurred
35
+ const input_start = max2(0, position - 10);
36
+
37
+ const input_end = min2(input.length, position + 10);
38
+
39
+ const snippet = input.slice(input_start, input_end);
40
+
41
+ const offset_into_snippet = position - input_start;
42
+
43
+ // a piece of text with marker to show where the error occurs
44
+ const arrow_text = string_repeat(" ", offset_into_snippet) + "^"
45
+
46
+ return snippet + "\n" + arrow_text;
47
+ }
48
+
49
+ toString() {
50
+ return `[ParseError] ${this.message}. Error at position ${this.position} near:\n${this.getDetails()}`
51
+ }
5
52
  }
6
53
 
7
54
  export default ParserError;
@@ -1 +1 @@
1
- {"version":3,"file":"Token.d.ts","sourceRoot":"","sources":["../../../../../src/core/parser/simple/Token.js"],"names":[],"mappings":";AAAA;IACI;;;;;;;OAOG;IACH,6BALW,MAAM,OACN,MAAM,QACN,MAAM,WAgChB;IA5BG;;;OAGG;IACH,kBAAkB;IAClB;;;;OAIG;IACH,gBAFU,MAAM,CAEE;IAClB;;;;OAIG;IACH,cAFU,MAAM,CAEF;IACd;;;OAGG;IACH,eAFU,MAAM,CAEA;IAChB;;;;OAIG;IACH,iBAAgB;IAGpB;;;;OAIG;IACH,cAHW,KAAK,GACH,OAAO,CASnB;IAED;;;OAGG;IACH,QAFY,MAAM,CAKjB;CACJ"}
1
+ {"version":3,"file":"Token.d.ts","sourceRoot":"","sources":["../../../../../src/core/parser/simple/Token.js"],"names":[],"mappings":";AAEA;IACI;;;;;;;OAOG;IACH,6BALW,MAAM,OACN,MAAM,QACN,MAAM,WAqChB;IA5BG;;;OAGG;IACH,kBAAkB;IAClB;;;;OAIG;IACH,gBAFU,MAAM,CAEE;IAClB;;;;OAIG;IACH,cAFU,MAAM,CAEF;IACd;;;OAGG;IACH,eAFU,MAAM,CAEA;IAChB;;;;OAIG;IACH,iBAAgB;IAGpB;;;;OAIG;IACH,cAHW,KAAK,GACH,OAAO,CASnB;IAED;;;OAGG;IACH,QAFY,MAAM,CAIjB;CACJ"}
@@ -1,3 +1,5 @@
1
+ import { assert } from "../../assert.js";
2
+
1
3
  class Token {
2
4
  /**
3
5
  * @template V,T
@@ -8,6 +10,11 @@ class Token {
8
10
  * @param {T} type
9
11
  */
10
12
  constructor(value, start, end, name, type) {
13
+
14
+ assert.isNonNegativeInteger(start, 'start');
15
+ assert.isNonNegativeInteger(end, 'end');
16
+ assert.isString(name, 'name');
17
+
11
18
  /**
12
19
  * @readonly
13
20
  * @type {V}
@@ -57,8 +64,7 @@ class Token {
57
64
  * @return {number}
58
65
  */
59
66
  hash() {
60
- // TODO make an actual hash
61
- return 0;
67
+ return this.start ^ (this.end << 16);
62
68
  }
63
69
  }
64
70
 
@@ -1,9 +1,5 @@
1
1
  export default TokenType;
2
- type TokenType = {
3
- LiteralString: string;
4
- LiteralNumber: string;
5
- LiteralBoolean: string;
6
- };
2
+ type TokenType = string;
7
3
  declare namespace TokenType {
8
4
  let LiteralString: string;
9
5
  let LiteralNumber: string;
@@ -1 +1 @@
1
- {"version":3,"file":"TokenType.d.ts","sourceRoot":"","sources":["../../../../../src/core/parser/simple/TokenType.js"],"names":[],"mappings":";iBACU;IAAC,aAAa,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAAC"}
1
+ {"version":3,"file":"TokenType.d.ts","sourceRoot":"","sources":["../../../../../src/core/parser/simple/TokenType.js"],"names":[],"mappings":";iBACU,MAAM"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @enum {{LiteralString: string, LiteralNumber: string, LiteralBoolean: string}}
2
+ * @enum {string}
3
3
  */
4
4
  const TokenType = {
5
5
  LiteralString: "literal-string",
@@ -1 +1 @@
1
- {"version":3,"file":"readBooleanToken.d.ts","sourceRoot":"","sources":["../../../../../src/core/parser/simple/readBooleanToken.js"],"names":[],"mappings":"AAKA;;;;;;GAMG;AACH,uCALW,MAAM,UACN,MAAM,UACN,MAAM,SA4BhB"}
1
+ {"version":3,"file":"readBooleanToken.d.ts","sourceRoot":"","sources":["../../../../../src/core/parser/simple/readBooleanToken.js"],"names":[],"mappings":"AAMA;;;;;;GAMG;AACH,uCALW,MAAM,UACN,MAAM,UACN,MAAM,SAgChB"}
@@ -1,7 +1,8 @@
1
+ import { assert } from "../../assert.js";
2
+ import DataType from "./DataType.js";
1
3
  import ParserError from "./ParserError.js";
2
4
  import Token from "./Token.js";
3
5
  import TokenType from "./TokenType.js";
4
- import DataType from "./DataType.js";
5
6
 
6
7
  /**
7
8
  *
@@ -11,6 +12,10 @@ import DataType from "./DataType.js";
11
12
  * @returns {Token}
12
13
  */
13
14
  export function readBooleanToken(text, cursor, length) {
15
+ assert.isString(text, 'text');
16
+ assert.isNonNegativeInteger(cursor, 'cursor');
17
+ assert.isNonNegativeInteger(length, 'length');
18
+
14
19
  const firstChar = text.charAt(cursor);
15
20
 
16
21
  let value;
@@ -1 +1 @@
1
- {"version":3,"file":"readHexToken.d.ts","sourceRoot":"","sources":["../../../../../src/core/parser/simple/readHexToken.js"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,mCALW,MAAM,UACN,MAAM,UACN,MAAM,SAsFhB"}
1
+ {"version":3,"file":"readHexToken.d.ts","sourceRoot":"","sources":["../../../../../src/core/parser/simple/readHexToken.js"],"names":[],"mappings":"AAKA;;;;;;GAMG;AACH,mCALW,MAAM,UACN,MAAM,UACN,MAAM,SA0FhB"}
@@ -1,6 +1,7 @@
1
+ import { assert } from "../../assert.js";
2
+ import DataType from "./DataType.js";
1
3
  import ParserError from "./ParserError.js";
2
4
  import Token from "./Token.js";
3
- import DataType from "./DataType.js";
4
5
 
5
6
  /**
6
7
  *
@@ -10,6 +11,10 @@ import DataType from "./DataType.js";
10
11
  * @returns {Token}
11
12
  */
12
13
  export function readHexToken(text, cursor, length) {
14
+ assert.isString(text, 'text');
15
+ assert.isNonNegativeInteger(cursor, 'cursor');
16
+ assert.isNonNegativeInteger(length, 'length');
17
+
13
18
  const c0 = text.charAt(cursor);
14
19
  const c1 = text.charAt(cursor + 1);
15
20
 
@@ -91,5 +96,5 @@ export function readHexToken(text, cursor, length) {
91
96
  }
92
97
 
93
98
 
94
- return new Token(value, cursor, i, null, DataType.Number);
99
+ return new Token(value, cursor, i, "uint", DataType.Number);
95
100
  }
@@ -1 +1 @@
1
- {"version":3,"file":"readIdentifierToken.d.ts","sourceRoot":"","sources":["../../../../../src/core/parser/simple/readIdentifierToken.js"],"names":[],"mappings":"AAYA;;;;;;GAMG;AACH,0CALW,MAAM,UACN,MAAM,UACN,MAAM,SA0BhB;AApCD;;;GAGG;AACH,uCAFU,MAAM,CAEqC"}
1
+ {"version":3,"file":"readIdentifierToken.d.ts","sourceRoot":"","sources":["../../../../../src/core/parser/simple/readIdentifierToken.js"],"names":[],"mappings":"AAaA;;;;;;GAMG;AACH,0CALW,MAAM,UACN,MAAM,UACN,MAAM,SA8BhB;AAxCD;;;GAGG;AACH,uCAFU,MAAM,CAEqC"}
@@ -1,7 +1,8 @@
1
+ import { assert } from "../../assert.js";
2
+ import DataType from "./DataType.js";
1
3
  import ParserError from "./ParserError.js";
2
4
  import Token from "./Token.js";
3
5
  import TokenType from "./TokenType.js";
4
- import DataType from "./DataType.js";
5
6
 
6
7
  const RX_IDENTIFIER_CHAR = /^[a-zA-Z0-9_]/;
7
8
  /**
@@ -18,6 +19,10 @@ export const RX_IDENTIFIER_FIRST_CHAR = /^[a-zA-Z_]/;
18
19
  * @returns {Token}
19
20
  */
20
21
  export function readIdentifierToken(text, cursor, length) {
22
+ assert.isString(text, 'text');
23
+ assert.isNonNegativeInteger(cursor, 'cursor');
24
+ assert.isNonNegativeInteger(length, 'length');
25
+
21
26
  let i = cursor;
22
27
 
23
28
 
@@ -1 +1 @@
1
- {"version":3,"file":"readLiteralToken.d.ts","sourceRoot":"","sources":["../../../../../src/core/parser/simple/readLiteralToken.js"],"names":[],"mappings":"AA0DA;;;;;;GAMG;AACH,uCALW,MAAM,UACN,MAAM,UACN,MAAM,SA+BhB"}
1
+ {"version":3,"file":"readLiteralToken.d.ts","sourceRoot":"","sources":["../../../../../src/core/parser/simple/readLiteralToken.js"],"names":[],"mappings":"AA2DA;;;;;;GAMG;AACH,uCALW,MAAM,UACN,MAAM,UACN,MAAM,SAmChB"}
@@ -1,10 +1,11 @@
1
- import { skipWhitespace } from "./skipWhitespace.js";
2
- import Token from "./Token.js";
1
+ import { assert } from "../../assert.js";
3
2
  import DataType from "./DataType.js";
4
3
  import ParserError from "./ParserError.js";
5
4
  import { readBooleanToken } from "./readBooleanToken.js";
6
- import { readStringToken } from "./readStringToken.js";
7
5
  import { readNumberToken } from "./readNumberToken.js";
6
+ import { readStringToken } from "./readStringToken.js";
7
+ import { skipWhitespace } from "./skipWhitespace.js";
8
+ import Token from "./Token.js";
8
9
 
9
10
  /**
10
11
  *
@@ -64,6 +65,10 @@ function readArrayLiteral(text, cursor, length) {
64
65
  * @returns {Token}
65
66
  */
66
67
  function readLiteralToken(text, cursor, length) {
68
+ assert.isString(text, 'text');
69
+ assert.isNonNegativeInteger(cursor, 'cursor');
70
+ assert.isNonNegativeInteger(length, 'length');
71
+
67
72
  const firstChar = text.charAt(cursor);
68
73
 
69
74
  switch (firstChar) {
@@ -1 +1 @@
1
- {"version":3,"file":"readNumberToken.d.ts","sourceRoot":"","sources":["../../../../../src/core/parser/simple/readNumberToken.js"],"names":[],"mappings":"AAOA;;;;;;GAMG;AACH,sCALW,MAAM,UACN,MAAM,UACN,MAAM,SA6DhB"}
1
+ {"version":3,"file":"readNumberToken.d.ts","sourceRoot":"","sources":["../../../../../src/core/parser/simple/readNumberToken.js"],"names":[],"mappings":"AAQA;;;;;;GAMG;AACH,sCALW,MAAM,UACN,MAAM,UACN,MAAM,SAiEhB"}
@@ -1,9 +1,10 @@
1
- import { skipWhitespace } from "./skipWhitespace.js";
1
+ import { assert } from "../../assert.js";
2
+ import DataType from "./DataType.js";
2
3
  import { readHexToken } from "./readHexToken.js";
3
4
  import { readUnsignedIntegerToken } from "./readUnsignedIntegerToken.js";
5
+ import { skipWhitespace } from "./skipWhitespace.js";
4
6
  import Token from "./Token.js";
5
7
  import TokenType from "./TokenType.js";
6
- import DataType from "./DataType.js";
7
8
 
8
9
  /**
9
10
  *
@@ -13,6 +14,10 @@ import DataType from "./DataType.js";
13
14
  * @returns {Token}
14
15
  */
15
16
  export function readNumberToken(text, cursor, length) {
17
+ assert.isString(text, 'text');
18
+ assert.isNonNegativeInteger(cursor, 'cursor');
19
+ assert.isNonNegativeInteger(length, 'length');
20
+
16
21
  let i = cursor;
17
22
 
18
23
  //read optional sign
@@ -1 +1 @@
1
- {"version":3,"file":"readReferenceToken.d.ts","sourceRoot":"","sources":["../../../../../src/core/parser/simple/readReferenceToken.js"],"names":[],"mappings":"AAMA;;;;;;GAMG;AACH,yDAJW,MAAM,UACN,MAAM,SAmChB"}
1
+ {"version":3,"file":"readReferenceToken.d.ts","sourceRoot":"","sources":["../../../../../src/core/parser/simple/readReferenceToken.js"],"names":[],"mappings":"AAOA;;;;;;GAMG;AACH,yDAJW,MAAM,UACN,MAAM,SAuChB"}
@@ -1,7 +1,8 @@
1
+ import { assert } from "../../assert.js";
1
2
  import DataType from "./DataType.js";
3
+ import { readIdentifierToken } from "./readIdentifierToken.js";
2
4
  import Token from "./Token.js";
3
5
  import TokenType from "./TokenType.js";
4
- import { readIdentifierToken } from "./readIdentifierToken.js";
5
6
 
6
7
 
7
8
  /**
@@ -12,6 +13,10 @@ import { readIdentifierToken } from "./readIdentifierToken.js";
12
13
  * @returns {Token}
13
14
  */
14
15
  export function readReferenceToken(text, cursor, length) {
16
+ assert.isString(text, 'text');
17
+ assert.isNonNegativeInteger(cursor, 'cursor');
18
+ assert.isNonNegativeInteger(length, 'length');
19
+
15
20
  let i = cursor;
16
21
 
17
22
  const identifiers = [];
@@ -1 +1 @@
1
- {"version":3,"file":"readStringToken.d.ts","sourceRoot":"","sources":["../../../../../src/core/parser/simple/readStringToken.js"],"names":[],"mappings":"AAqBA;;;;;;GAMG;AACH,sCALW,MAAM,UACN,MAAM,UACN,MAAM,SAoEhB"}
1
+ {"version":3,"file":"readStringToken.d.ts","sourceRoot":"","sources":["../../../../../src/core/parser/simple/readStringToken.js"],"names":[],"mappings":"AAsBA;;;;;;GAMG;AACH,sCALW,MAAM,UACN,MAAM,UACN,MAAM,SAwEhB"}
@@ -1,7 +1,8 @@
1
+ import { assert } from "../../assert.js";
2
+ import DataType from "./DataType.js";
1
3
  import ParserError from "./ParserError.js";
2
4
  import Token from "./Token.js";
3
5
  import TokenType from "./TokenType.js";
4
- import DataType from "./DataType.js";
5
6
 
6
7
  /**
7
8
  *
@@ -27,6 +28,10 @@ function readQuote(text, cursor) {
27
28
  * @returns {Token}
28
29
  */
29
30
  export function readStringToken(text, cursor, length) {
31
+ assert.isString(text, 'text');
32
+ assert.isNonNegativeInteger(cursor, 'cursor');
33
+ assert.isNonNegativeInteger(length, 'length');
34
+
30
35
  let i = cursor;
31
36
 
32
37
  const openingQuote = readQuote(text, i);
@@ -1 +1 @@
1
- {"version":3,"file":"readUnsignedIntegerToken.d.ts","sourceRoot":"","sources":["../../../../../src/core/parser/simple/readUnsignedIntegerToken.js"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,+CALW,MAAM,UACN,MAAM,UACN,MAAM,SAwDhB"}
1
+ {"version":3,"file":"readUnsignedIntegerToken.d.ts","sourceRoot":"","sources":["../../../../../src/core/parser/simple/readUnsignedIntegerToken.js"],"names":[],"mappings":"AAKA;;;;;;GAMG;AACH,+CALW,MAAM,UACN,MAAM,UACN,MAAM,SA4DhB"}
@@ -1,6 +1,7 @@
1
+ import { assert } from "../../assert.js";
2
+ import DataType from "./DataType.js";
1
3
  import ParserError from "./ParserError.js";
2
4
  import Token from "./Token.js";
3
- import DataType from "./DataType.js";
4
5
 
5
6
  /**
6
7
  *
@@ -10,6 +11,10 @@ import DataType from "./DataType.js";
10
11
  * @returns {Token}
11
12
  */
12
13
  export function readUnsignedIntegerToken(text, cursor, length) {
14
+ assert.isString(text, 'text');
15
+ assert.isNonNegativeInteger(cursor, 'cursor');
16
+ assert.isNonNegativeInteger(length, 'length');
17
+
13
18
  let i = cursor;
14
19
 
15
20
  let value = 0;
@@ -61,6 +66,6 @@ export function readUnsignedIntegerToken(text, cursor, length) {
61
66
  }
62
67
 
63
68
 
64
- return new Token(value, cursor, i, null, DataType.Number);
69
+ return new Token(value, cursor, i, "uint", DataType.Number);
65
70
  }
66
71
 
@@ -1 +1 @@
1
- {"version":3,"file":"skipWhitespace.d.ts","sourceRoot":"","sources":["../../../../../src/core/parser/simple/skipWhitespace.js"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,qCALW,MAAM,UACN,MAAM,UACN,MAAM,GACJ,MAAM,CAelB"}
1
+ {"version":3,"file":"skipWhitespace.d.ts","sourceRoot":"","sources":["../../../../../src/core/parser/simple/skipWhitespace.js"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,qCALW,MAAM,UACN,MAAM,UACN,MAAM,GACJ,MAAM,CAqBlB"}
@@ -1,3 +1,5 @@
1
+ import { assert } from "../../assert.js";
2
+
1
3
  /**
2
4
  *
3
5
  * @param {string} text
@@ -6,8 +8,13 @@
6
8
  * @returns {number}
7
9
  */
8
10
  export function skipWhitespace(text, cursor, length) {
11
+ assert.isString(text, 'text');
12
+ assert.isNonNegativeInteger(cursor, 'cursor');
13
+ assert.isNonNegativeInteger(length, 'length');
14
+
9
15
  let i = cursor;
10
16
  let char;
17
+
11
18
  while (i < length) {
12
19
  char = text.charAt(i);
13
20
 
@@ -17,5 +24,6 @@ export function skipWhitespace(text, cursor, length) {
17
24
  break;
18
25
  }
19
26
  }
27
+
20
28
  return i;
21
29
  }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Repeat a given piece of text a {@link count} times
3
+ * @example "ABC_" repeated 2 times results in "ABC_ABC_"
4
+ * @param {string} what
5
+ * @param {number} count
6
+ * @return {string}
7
+ */
8
+ export function string_repeat(what: string, count: number): string;
9
+ //# sourceMappingURL=string_repeat.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"string_repeat.d.ts","sourceRoot":"","sources":["../../../../../src/core/primitives/strings/string_repeat.js"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,oCAJW,MAAM,SACN,MAAM,GACL,MAAM,CAkBjB"}
@@ -0,0 +1,26 @@
1
+ import { assert } from "../../assert.js";
2
+
3
+ /**
4
+ * Repeat a given piece of text a {@link count} times
5
+ * @example "ABC_" repeated 2 times results in "ABC_ABC_"
6
+ * @param {string} what
7
+ * @param {number} count
8
+ * @return {string}
9
+ */
10
+ export function string_repeat(what, count) {
11
+ assert.isString(what, 'what');
12
+ assert.isNonNegativeInteger(count, 'count');
13
+
14
+ if (count <= 0) {
15
+ // special case
16
+ return "";
17
+ }
18
+
19
+ let out = what;
20
+
21
+ for (let i = 1; i < count; i++) {
22
+ out += what;
23
+ }
24
+
25
+ return out;
26
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"AssetManager.d.ts","sourceRoot":"","sources":["../../../../src/engine/asset/AssetManager.js"],"names":[],"mappings":"AAiDA;;;;GAIG;AACH;IAgII;;;;;OAKG;IACH,oCAJW,GAAG,EAYb;IA7ID;;;;OAIG;IACH,eAEG;IAEH;;;OAGG;IACH,iBAA6C;IAe7C;;;;;;OAMG;IACH,kBAFU,MAAM,CAEY;IAyB5B;;;;OAIG;IACH,iBAAc;IAEd;;;OAGG;IACH,mBAFU,iBAAiB,CAEiB;IAwE5C,gBAQC;IAED;;;;OAIG;IACH,qBAHW,MAAM,GACL,QAAQ,IAAI,CAAC,CAexB;IAED;;;;;OAKG;IACH,oCAFa,OAAO,CAOnB;IAED;;OAEG;IACH,cAEC;IAED,8BAEC;IAED;;;;;;OAMG;IACH,4DAJW,iBAAiB,GAEf,cAAc,CAY1B;IAED;;;;;;;;;OASG;IACH,qFAsCC;IAED;;;;;OAKG;IACH,aAJW,MAAM,QACN,MAAM,sBAehB;IAsQD;;;;;OAKG;IACH,sBA2BC;IAGD;;;;OAIG;IACH,uBAHW,MAAM,GACL,OAAO,CAIlB;IAED;;;;OAIG;IACH,sBAHW,MAAM,GACJ,wBAAY,SAAS,CAMjC;IAaD;;;;OAIG;IACH,+BAHW,MAAM,4CAqBhB;IAED;;;;OAIG;IACH,iCAHW,MAAM,+CAyBhB;IAED;;;;;OAKG;IACH,0BAJW,MAAM,iEAwChB;IAED;;;OAGG;IACH,uBAFW,MAAM,iBAkBhB;IAED;;;;;;OAMG;IACH,yCAFa,aAAS,IAAI,CAYzB;IAED;;;;;OAKG;IACH,eAJW,MAAM,QACN,MAAM,GACJ,OAAO,CAMnB;IAED;;;;OAIG;IACH,2BAHW,MAAM,GACL,mBAAiB,CAa5B;IAED;;;;OAIG;IACH,oBAHW,MAAM,GACL,gBAAgB,GAAC,SAAS,CAQrC;IAED;;;;;OAKG;IACH,mBAJW,MAAM,QACN,MAAM,QACN,MAAM,QAUhB;IAGL;;;OAGG;IACH,yBAFU,OAAO,CAEoB;;CANpC;kCA50BiC,6BAA6B;kCAD7B,wBAAwB;4BAE9B,0BAA0B;iCALrB,uBAAuB"}
1
+ {"version":3,"file":"AssetManager.d.ts","sourceRoot":"","sources":["../../../../src/engine/asset/AssetManager.js"],"names":[],"mappings":"AAiDA;;;;GAIG;AACH;IAgII;;;;;OAKG;IACH,oCAJW,GAAG,EAYb;IA7ID;;;;OAIG;IACH,eAEG;IAEH;;;OAGG;IACH,aAFU,YAAY,gBAAgB,EAAE,YAAY,CAAC,CAER;IAe7C;;;;;;OAMG;IACH,kBAFU,MAAM,CAEY;IAyB5B;;;;OAIG;IACH,iBAAc;IAEd;;;OAGG;IACH,mBAFU,iBAAiB,CAEiB;IAwE5C,gBAQC;IAED;;;;OAIG;IACH,qBAHW,MAAM,GACL,QAAQ,IAAI,CAAC,CAexB;IAED;;;;;OAKG;IACH,oCAFa,OAAO,CAOnB;IAED;;OAEG;IACH,cAEC;IAED,8BAEC;IAED;;;;;;OAMG;IACH,4DAJW,iBAAiB,GAEf,cAAc,CAY1B;IAED;;;;;;;;;OASG;IACH,qFAsCC;IAED;;;;;OAKG;IACH,aAJW,MAAM,QACN,MAAM,sBAehB;IAsQD;;;;;OAKG;IACH,sBA2BC;IAGD;;;;OAIG;IACH,uBAHW,MAAM,GACL,OAAO,CAIlB;IAED;;;;OAIG;IACH,sBAHW,MAAM,GACJ,wBAAY,SAAS,CAMjC;IAaD;;;;OAIG;IACH,+BAHW,MAAM,4CAqBhB;IAED;;;;OAIG;IACH,iCAHW,MAAM,+CAyBhB;IAED;;;;;OAKG;IACH,0BAJW,MAAM,iEAwChB;IAED;;;OAGG;IACH,uBAFW,MAAM,iBAkBhB;IAED;;;;;;OAMG;IACH,yCAFa,aAAS,IAAI,CAYzB;IAED;;;;;OAKG;IACH,eAJW,MAAM,QACN,MAAM,GACJ,OAAO,CAMnB;IAED;;;;OAIG;IACH,2BAHW,MAAM,GACL,mBAAiB,CAa5B;IAED;;;;OAIG;IACH,oBAHW,MAAM,GACL,gBAAgB,GAAC,SAAS,CAQrC;IAED;;;;;OAKG;IACH,mBAJW,MAAM,QACN,MAAM,QACN,MAAM,QAUhB;IAGL;;;OAGG;IACH,yBAFU,OAAO,CAEoB;;CANpC;4BAv1B2B,0CAA0C;iCAOrC,uBAAuB;6BAM3B,mBAAmB;kCAFd,6BAA6B;kCAD7B,wBAAwB;4BAE9B,0BAA0B"}
@@ -1 +1 @@
1
- {"version":3,"file":"RingBufferMetric.d.ts","sourceRoot":"","sources":["../../../../../src/engine/development/performance/RingBufferMetric.js"],"names":[],"mappings":"AAOA;IACI,2BAUC;IAPG;;;;;OAKG;IACH,wBAAkC;IAGtC;;;OAGG;IACH,aAFW,MAAM,QAIhB;IAED,mBAEC;IAED,yBAEC;CAsCJ;+BAxE8B,qBAAqB"}
1
+ {"version":3,"file":"RingBufferMetric.d.ts","sourceRoot":"","sources":["../../../../../src/engine/development/performance/RingBufferMetric.js"],"names":[],"mappings":"AAOA;IACI,2BAUC;IAPG;;;;;OAKG;IACH,wBAAkC;IAGtC;;;OAGG;IACH,aAFW,MAAM,QAIhB;IAED,mBAEC;IAED,yBAEC;CAsCJ;+BAnE8B,qBAAqB"}
@@ -1,9 +1,9 @@
1
- import { AbstractMetric } from "./AbstractMetric.js";
1
+ import { array_compute_max } from "../../../core/collection/array/array_compute_max.js";
2
+ import { array_compute_min } from "../../../core/collection/array/array_compute_min.js";
2
3
  import { RingBuffer } from "../../../core/collection/RingBuffer.js";
3
4
  import { computeStatisticalMean } from "../../../core/math/statistics/computeStatisticalMean.js";
4
5
  import { computeStatisticalPartialMedian } from "../../../core/math/statistics/computeStatisticalPartialMedian.js";
5
- import { computeArrayMax } from "../../../core/collection/array/computeArrayMax.js";
6
- import { computeArrayMin } from "../../../core/collection/array/computeArrayMin.js";
6
+ import { AbstractMetric } from "./AbstractMetric.js";
7
7
 
8
8
  export class RingBufferMetric extends AbstractMetric {
9
9
  constructor(size = 100) {
@@ -59,8 +59,8 @@ export class RingBufferMetric extends AbstractMetric {
59
59
 
60
60
  result.mean = computeStatisticalMean(array, 0, data_count);
61
61
  result.median = computeStatisticalPartialMedian(array, 0, data_count - 1);
62
- result.max = computeArrayMax(array, 0, data_count);
63
- result.min = computeArrayMin(array, 0, data_count);
62
+ result.max = array_compute_max(array, 0, data_count);
63
+ result.min = array_compute_min(array, 0, data_count);
64
64
 
65
65
  return true;
66
66
 
@@ -1 +1 @@
1
- {"version":3,"file":"BuildLightTexture.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/ecs/terrain/ecs/BuildLightTexture.js"],"names":[],"mappings":"AAmEA;;;;;;;;GAQG;AACH,gGAPW,MAAM,WAAW,gBAoC3B"}
1
+ {"version":3,"file":"BuildLightTexture.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/ecs/terrain/ecs/BuildLightTexture.js"],"names":[],"mappings":"AAmEA;;;;;;;;GAQG;AACH,gGAPW,MAAM,WAAW,gBA6B3B"}
@@ -1,8 +1,8 @@
1
- import normalMap2AOMap from "../../grid/NormalMap2AOMap.js";
2
- import heightMap2NormalMap from "../../grid/HeightMap2NormalMap.js";
3
- import { WebGLRendererPool } from "../../../graphics/render/RendererPool.js";
4
1
  import Vector2 from "../../../../core/geom/Vector2.js";
2
+ import { WebGLRendererPool } from "../../../graphics/render/RendererPool.js";
5
3
  import { writeSample2DDataToDataTexture } from "../../../graphics/texture/sampler/writeSampler2DDataToDataTexture.js";
4
+ import heightMap2NormalMap from "../../grid/HeightMap2NormalMap.js";
5
+ import normalMap2AOMap from "../../grid/NormalMap2AOMap.js";
6
6
 
7
7
  /**
8
8
  *
@@ -77,30 +77,23 @@ function promiseSamplerAO(
77
77
  export function buildLightTexture({
78
78
  texture,
79
79
  heightSampler,
80
- resolution= new Vector2(texture.image.width, texture.image.height),
80
+ resolution = new Vector2(texture.image.width, texture.image.height),
81
81
  rayLength = 11,
82
82
  worldSize = resolution
83
83
  }) {
84
84
 
85
- const renderer = WebGLRendererPool.global.get();
85
+ return WebGLRendererPool.global.useAsync(async renderer => {
86
+ const normal = promiseSamplerNormal(renderer, heightSampler);
86
87
 
87
- const normal = promiseSamplerNormal(renderer, heightSampler);
88
- const ao = promiseSamplerAO({
89
- renderer: renderer,
90
- pSamplerNormal: normal,
91
- samplerHeight: heightSampler,
92
- resolution: resolution,
93
- rayLength: rayLength,
94
- worldSize
95
- });
88
+ const ao = await promiseSamplerAO({
89
+ renderer: renderer,
90
+ pSamplerNormal: normal,
91
+ samplerHeight: heightSampler,
92
+ resolution: resolution,
93
+ rayLength: rayLength,
94
+ worldSize
95
+ });
96
96
 
97
- const promise = ao.then(sampler => {
98
- writeSample2DDataToDataTexture(sampler, texture);
97
+ writeSample2DDataToDataTexture(ao, texture);
99
98
  });
100
-
101
- Promise.all([normal, ao]).finally(() => {
102
- WebGLRendererPool.global.release(renderer);
103
- });
104
-
105
- return promise;
106
99
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Camera.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/ecs/camera/Camera.js"],"names":[],"mappings":"AAkBA;;GAEG;AACH;IA4II;;;;;;;OAOG;IACH,0BANW,MAAM,GAAC,MAAM,iBAAiB,GAAC,MAAM,kBAAkB,KACvD,MAAM,KACN,MAAM,UACN,OAAO,aACP,OAAO,QAwCjB;IAxLG;;;OAGG;IACH,UAFU,OAAO,CAEI;IAErB;;;OAGG;IACH,oBAFU,MAAM,CAEc;IAE9B,YAAkB;IAElB;;;OAGG;IACH,KAFU,OAAO,CAES;IAE1B;;;OAGG;IACH,gBAFU,aAAa,cAAc,CAAC,CAE4C;IAElF;;;OAGG;IACH,QAFU,eAAe,CAEc;IAEvC;;;;OAIG;IACH,mBAAqB;IAErB;;;;OAIG;IACH,oBAAsB;IAG1B;;;;OAIG;IACH,mEAEC;IAMD,0BAMC;IAVD,uBAEC;IAcD,2BAMC;IAVD,wBAEC;IAUD,uBAaC;IAED,2DAEC;IAED;;;OAGG;IACH,YAFW,MAAM,QAMhB;IAED;;;OAGG;IACH,SAFa,MAAM,CAQlB;IAED;;;MAKC;IAED,0BAQC;IAkDD;;;OAGG;IACH,kDAUC;IAED;;;;;;;;;;OAUG;IACH,0BATW,OAAO,YACP,MAAM,YACN,MAAM,YACN,MAAM,eACN,MAAM,eACN,MAAM,eACN,MAAM,eACN,MAAM,QAyBhB;IAED;;;;;;OAMG;IACH,kCALW,MAAM,KACN,MAAM,KACN,MAAM,UACN,OAAO,QAqBjB;CACJ;;;;;oBAvRmB,kCAAkC;yBAG7B,wCAAwC;+BAGpC,qBAAqB;4BAJtB,2CAA2C;oBADnD,kCAAkC"}
1
+ {"version":3,"file":"Camera.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/ecs/camera/Camera.js"],"names":[],"mappings":"AAkBA;;GAEG;AACH;IA4II;;;;;;;OAOG;IACH,0BANW,MAAM,GAAC,MAAM,iBAAiB,GAAC,MAAM,kBAAkB,KACvD,MAAM,KACN,MAAM,cACN,OAAO,iBACP,OAAO,QA+CjB;IA/LG;;;OAGG;IACH,UAFU,OAAO,CAEI;IAErB;;;OAGG;IACH,oBAFU,MAAM,CAEc;IAE9B,YAAkB;IAElB;;;OAGG;IACH,KAFU,OAAO,CAES;IAE1B;;;OAGG;IACH,gBAFU,aAAa,cAAc,CAAC,CAE4C;IAElF;;;OAGG;IACH,QAFU,eAAe,CAEc;IAEvC;;;;OAIG;IACH,mBAAqB;IAErB;;;;OAIG;IACH,oBAAsB;IAG1B;;;;OAIG;IACH,mEAEC;IAMD,0BAMC;IAVD,uBAEC;IAcD,2BAMC;IAVD,wBAEC;IAUD,uBAaC;IAED,2DAEC;IAED;;;OAGG;IACH,YAFW,MAAM,QAMhB;IAED;;;OAGG;IACH,SAFa,MAAM,CAQlB;IAED;;;MAKC;IAED,0BAQC;IAyDD;;;OAGG;IACH,kDAUC;IAED;;;;;;;;;;OAUG;IACH,0BATW,OAAO,YACP,MAAM,YACN,MAAM,YACN,MAAM,eACN,MAAM,eACN,MAAM,eACN,MAAM,eACN,MAAM,QAyBhB;IAED;;;;;;OAMG;IACH,kCALW,MAAM,KACN,MAAM,KACN,MAAM,UACN,OAAO,QAqBjB;CACJ;;;;;oBA9RmB,kCAAkC;yBAG7B,wCAAwC;+BAGlC,qBAAqB;4BAJxB,2CAA2C;oBADnD,kCAAkC"}
@@ -3,18 +3,18 @@
3
3
  */
4
4
 
5
5
 
6
- import {Frustum} from 'three';
7
- import {assert} from "../../../../core/assert.js";
8
- import {plane3_compute_ray_intersection} from "../../../../core/geom/3d/plane/plane3_compute_ray_intersection.js";
9
- import {v3_distance_above_plane} from "../../../../core/geom/vec3/v3_distance_above_plane.js";
6
+ import { Frustum } from 'three';
7
+ import { assert } from "../../../../core/assert.js";
8
+ import { plane3_compute_ray_intersection } from "../../../../core/geom/3d/plane/plane3_compute_ray_intersection.js";
9
+ import { v3_distance_above_plane } from "../../../../core/geom/vec3/v3_distance_above_plane.js";
10
10
  import Vector1 from "../../../../core/geom/Vector1.js";
11
11
  import Vector3 from "../../../../core/geom/Vector3.js";
12
12
  import ObservedBoolean from "../../../../core/model/ObservedBoolean.js";
13
13
  import ObservedEnum from "../../../../core/model/ObservedEnum.js";
14
- import {frustum_from_camera} from "./frustum_from_camera.js";
15
- import {invertQuaternionOrientation} from "./InvertQuaternionOrientation.js";
16
- import {ProjectionType} from "./ProjectionType.js";
17
- import {unprojectPoint} from "./unprojectPoint.js";
14
+ import { frustum_from_camera } from "./frustum_from_camera.js";
15
+ import { invertQuaternionOrientation } from "./InvertQuaternionOrientation.js";
16
+ import { ProjectionType } from "./ProjectionType.js";
17
+ import { unprojectPoint } from "./unprojectPoint.js";
18
18
 
19
19
  /**
20
20
  * @class
@@ -164,10 +164,14 @@ export class Camera {
164
164
  * @param {Camera|THREE.PerspectiveCamera|THREE.OrthographicCamera} camera
165
165
  * @param {number} x
166
166
  * @param {number} y
167
- * @param {Vector3} source
168
- * @param {Vector3} direction
167
+ * @param {Vector3} out_source
168
+ * @param {Vector3} out_direction
169
169
  */
170
- static projectRay(camera, x, y, source, direction) {
170
+ static projectRay(
171
+ camera,
172
+ x, y,
173
+ out_source, out_direction
174
+ ) {
171
175
  assert.defined(camera, "camera");
172
176
  assert.defined(camera.position, "Camera.position");
173
177
 
@@ -182,7 +186,10 @@ export class Camera {
182
186
  // assert.ok(y <= 1, `Y(=${y}) must be less than or equal to 1.0, not a clip-space coordinate`);
183
187
 
184
188
  if (camera.isPerspectiveCamera || camera.isOrthographicCamera) {
185
- scratch_v3_1.setFromMatrixPosition(camera.matrixWorld.elements);
189
+ const m4_world = camera.matrixWorld.elements;
190
+ const m4_projection_inverse = camera.projectionMatrixInverse.elements;
191
+
192
+ scratch_v3_1.setFromMatrixPosition(m4_world);
186
193
 
187
194
  scratch_v3_0.set(x, y, 0.5);
188
195
 
@@ -191,16 +198,16 @@ export class Camera {
191
198
  unprojectPoint(
192
199
  scratch_v3_0,
193
200
  scratch_v3_0,
194
- camera.projectionMatrixInverse.elements,
195
- camera.matrixWorld.elements
201
+ m4_projection_inverse,
202
+ m4_world
196
203
  );
197
204
 
198
205
  //get direction
199
206
  scratch_v3_0.sub(scratch_v3_1);
200
207
  scratch_v3_0.normalize();
201
208
 
202
- source.copy(scratch_v3_1);
203
- direction.copy(scratch_v3_0);
209
+ out_source.copy(scratch_v3_1);
210
+ out_direction.copy(scratch_v3_0);
204
211
 
205
212
  } else {
206
213
  throw new Error('Unsupported camera type');
@@ -5,7 +5,7 @@ export default processTexture;
5
5
  * @param {number} width
6
6
  * @param {number} height
7
7
  * @param {{vertexShader?:string,fragmentShader:string, uniforms?:Object, defines?:Object}} processShader
8
- * @param {Uint8Array} [destination]
8
+ * @param {Uint8Array|Uint8ClampedArray} [destination]
9
9
  * @return {{array: Uint8Array, renderer: WebGLRenderer}}
10
10
  */
11
11
  declare function processTexture(renderer: WebGLRenderer, width: number, height: number, processShader: {
@@ -13,7 +13,7 @@ declare function processTexture(renderer: WebGLRenderer, width: number, height:
13
13
  fragmentShader: string;
14
14
  uniforms?: any;
15
15
  defines?: any;
16
- }, destination?: Uint8Array): {
16
+ }, destination?: Uint8Array | Uint8ClampedArray): {
17
17
  array: Uint8Array;
18
18
  renderer: WebGLRenderer;
19
19
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ImageFilter.d.ts","sourceRoot":"","sources":["../../../../../src/engine/graphics/filter/ImageFilter.js"],"names":[],"mappings":";AASA;;;;;;;;GAQG;AACH,gEANW,MAAM,UACN,MAAM,iBACN;IAAC,YAAY,CAAC,EAAC,MAAM,CAAC;IAAA,cAAc,EAAC,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAQ;IAAC,OAAO,CAAC,MAAO;CAAC,gBAC/E,UAAU,GACT;IAAC,KAAK,EAAE,UAAU,CAAC;IAAC,QAAQ,gBAAe;CAAC,CAiEvD"}
1
+ {"version":3,"file":"ImageFilter.d.ts","sourceRoot":"","sources":["../../../../../src/engine/graphics/filter/ImageFilter.js"],"names":[],"mappings":";AASA;;;;;;;;GAQG;AACH,gEANW,MAAM,UACN,MAAM,iBACN;IAAC,YAAY,CAAC,EAAC,MAAM,CAAC;IAAA,cAAc,EAAC,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAQ;IAAC,OAAO,CAAC,MAAO;CAAC,gBAC/E,UAAU,GAAC,iBAAiB,GAC3B;IAAC,KAAK,EAAE,UAAU,CAAC;IAAC,QAAQ,gBAAe;CAAC,CAiEvD"}