@woosh/meep-engine 2.75.4 → 2.75.6

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 (49) hide show
  1. package/build/bundle-worker-image-decoder.js +1 -1
  2. package/build/meep.cjs +91 -74
  3. package/build/meep.min.js +1 -1
  4. package/build/meep.module.js +91 -74
  5. package/editor/ecs/component/editors/ecs/ParameterLookupTableEditor.js +35 -21
  6. package/package.json +2 -2
  7. package/src/core/collection/array/array_compute_min_max.js +20 -0
  8. package/src/core/collection/map/HashMap.js +16 -14
  9. package/src/core/geom/2d/convex-hull/fixed_convex_hull_humus.js +23 -13
  10. package/src/core/geom/2d/intersect_ray_2d.js +7 -14
  11. package/src/core/geom/3d/aabb/AABB3.js +13 -0
  12. package/src/core/geom/3d/topology/samples/sampleFloodFill.js +21 -21
  13. package/src/core/geom/3d/topology/tm_face_area.js +1 -1
  14. package/src/core/geom/3d/triangle/computeTriangleSurfaceArea.js +39 -0
  15. package/src/core/process/task/util/countTask.js +1 -2
  16. package/src/engine/EngineBootstrapper.js +15 -7
  17. package/src/engine/animation/curve/AnimationCurve.js +50 -31
  18. package/src/engine/animation/curve/AnimationCurve.spec.js +9 -1
  19. package/src/engine/animation/curve/compression/prototypeCurveCompression.js +20 -11
  20. package/src/engine/animation/curve/compute_curve_aabb.js +26 -0
  21. package/src/engine/animation/curve/draw/build_curve_editor.js +82 -42
  22. package/src/engine/animation/curve/draw/build_plot_entity_from_array.js +5 -5
  23. package/src/engine/animation/curve/preset/CURVE_EASE_IN.js +8 -0
  24. package/src/engine/animation/curve/preset/CURVE_EASE_IN_OUT.js +7 -0
  25. package/src/engine/animation/curve/preset/CURVE_EASE_OUT.js +7 -0
  26. package/src/engine/asset/loaders/image/png/PNGReader.js +119 -1
  27. package/src/engine/graphics/GraphicsEngine.d.ts +6 -3
  28. package/src/engine/graphics/canvas/canvas2d_draw_grid.js +42 -0
  29. package/src/engine/{animation/curve/draw/draw_label.js → graphics/canvas/canvas2d_draw_label.js} +6 -1
  30. package/src/engine/graphics/canvas/canvas2d_draw_linear_scale.js +64 -0
  31. package/src/engine/graphics/canvas/canvas2d_draw_path.js +60 -0
  32. package/src/engine/graphics/canvas/canvas2d_plot_data_line.js +84 -0
  33. package/src/engine/{animation/curve/draw/plot_array.js → graphics/canvas/canvas2d_plot_line_array.js} +8 -25
  34. package/src/engine/graphics/geometry/computeMeshSurfaceArea.js +2 -37
  35. package/src/engine/graphics/impostors/octahedral/bake/prepare_bake_material.js +8 -26
  36. package/src/engine/graphics/material/manager/MaterialManager.d.ts +6 -0
  37. package/src/engine/graphics/sh3/LightProbeVolume.js +38 -17
  38. package/src/engine/graphics/sh3/path_tracer/prototypePathTracer.js +26 -35
  39. package/src/engine/graphics/sh3/prototypeSH3Probe.js +166 -100
  40. package/src/engine/graphics/texture/makeOnePixelTexture.js +19 -0
  41. package/src/engine/graphics/texture/sprite/prototypeSpriteCutoutGeometry.js +5 -68
  42. package/src/engine/input/devices/PointerDevice.js +6 -3
  43. package/src/engine/makeSimpleTaskProgressView.js +33 -0
  44. package/src/engine/scene/transitionToScene.js +9 -10
  45. package/src/view/task/TaskLoadingScreen.js +5 -12
  46. package/src/view/task/TaskProgressView.js +9 -9
  47. package/src/engine/animation/curve/draw/draw_grid.js +0 -27
  48. package/src/engine/animation/curve/draw/plot_data.js +0 -49
  49. package/src/engine/graphics/geometry/QuadGeometry.js +0 -13
@@ -9,6 +9,25 @@ import { crc } from "./crc.js";
9
9
  import { PNG } from './PNG.js';
10
10
  import { PNG_HEADER_BYTES } from "./PNG_HEADER_BYTES.js";
11
11
 
12
+ /**
13
+ *
14
+ * @param {Uint8Array} encoded_chunk
15
+ * @returns {ArrayBuffer}
16
+ */
17
+ function inflate(encoded_chunk) {
18
+ const inflator = new zlib.Inflate();
19
+
20
+
21
+ inflator.push(encoded_chunk);
22
+
23
+ if (inflator.err) {
24
+ throw new Error(inflator.err);
25
+ }
26
+
27
+
28
+ return inflator.result.buffer;
29
+ }
30
+
12
31
  /**
13
32
  *
14
33
  * @param {Uint8Array} buffer
@@ -162,8 +181,18 @@ PNGReader.prototype.decodeChunk = function () {
162
181
  case 'sRGB':
163
182
  this.decodesRGB(chunk);
164
183
  break;
184
+ case 'tIME':
185
+ this.decodetIME(chunk);
186
+ break;
187
+ case 'zTXt':
188
+ this.decodezTXt(chunk);
189
+ break;
190
+ case 'iTXt':
191
+ this.decodeiTXt(chunk);
192
+ break;
165
193
  default:
166
- console.warn(`Unsupported block ${type}`);
194
+ // skip unknown block
195
+ // console.warn(`Unsupported block ${type}`);
167
196
  break;
168
197
  }
169
198
 
@@ -183,6 +212,95 @@ PNGReader.prototype.decodesRGB = function (chunk) {
183
212
  // TODO add metadata to the PNG representation
184
213
  }
185
214
 
215
+ /**
216
+ * https://www.w3.org/TR/2003/REC-PNG-20031110/#11tIME
217
+ * @param {Uint8Array} chunk
218
+ */
219
+ PNGReader.prototype.decodetIME = function (chunk) {
220
+ const year_high = readUInt8(chunk, 0);
221
+ const year_low = readUInt8(chunk, 1);
222
+
223
+ const year = (year_high << 8) | year_low;
224
+
225
+ const month = readUInt8(chunk, 2);
226
+ const day = readUInt8(chunk, 3);
227
+ const hour = readUInt8(chunk, 4);
228
+ const minute = readUInt8(chunk, 5);
229
+ const second = readUInt8(chunk, 6);
230
+ }
231
+
232
+ /**
233
+ * International textual data
234
+ * @see https://www.w3.org/TR/2003/REC-PNG-20031110/
235
+ * @param {Uint8Array} chunk
236
+ */
237
+ PNGReader.prototype.decodeiTXt = function (chunk) {
238
+ const buffer = BinaryBuffer.fromArrayBuffer(chunk.buffer);
239
+ const keyword = buffer.readASCIICharacters(79, true);
240
+ const compression_flag = buffer.readUint8();
241
+ const compression_method = buffer.readUint8();
242
+
243
+ const language_tag = buffer.readASCIICharacters(Infinity, true);
244
+ const translated_keyword = buffer.readASCIICharacters(Infinity, true);
245
+
246
+ const remaining_bytes = buffer.data.length - buffer.position;
247
+
248
+ let text;
249
+
250
+ if (compression_flag === 0) {
251
+ text = buffer.readASCIICharacters(remaining_bytes);
252
+ } else if (compression_flag === 1) {
253
+ const decoded = inflate(new Uint8Array(buffer.data, buffer.position, remaining_bytes));
254
+
255
+ buffer.fromArrayBuffer(decoded);
256
+
257
+ text = buffer.readASCIICharacters(decoded.byteLength);
258
+ } else {
259
+ throw new Error(`Invalid compression flag value '${compression_flag}'`);
260
+ }
261
+
262
+ return {
263
+ keyword,
264
+ language_tag,
265
+ translated_keyword,
266
+ text
267
+ }
268
+ }
269
+
270
+
271
+ /**
272
+ * Compressed textual data
273
+ * @see https://www.w3.org/TR/2003/REC-PNG-20031110/#11zTXt
274
+ * @param {Uint8Array} chunk
275
+ */
276
+ PNGReader.prototype.decodezTXt = function (chunk) {
277
+ const buffer = BinaryBuffer.fromArrayBuffer(chunk.buffer);
278
+
279
+ const keyword = buffer.readASCIICharacters(79, true);
280
+
281
+ const compression_method = buffer.readUint8();
282
+
283
+ let value;
284
+
285
+ if (compression_method === 0) {
286
+ // deflate method
287
+
288
+ const encoded_chunk = new Uint8Array(chunk.buffer, buffer.position);
289
+
290
+ const decompressed_data = inflate(encoded_chunk);
291
+
292
+ buffer.fromArrayBuffer(decompressed_data);
293
+
294
+ value = buffer.readASCIICharacters(decompressed_data.length);
295
+ } else {
296
+ throw new Error(`Unsupported compression method '${compression_method}'`);
297
+ }
298
+
299
+ return {
300
+ keyword: keyword,
301
+ text: value
302
+ }
303
+ }
186
304
 
187
305
  /**
188
306
  * https://www.w3.org/TR/PNG/#11tEXt
@@ -1,9 +1,10 @@
1
1
  import {PerspectiveCamera, Scene, WebGLRenderer} from "three";
2
- import {RenderLayerManager} from "./render/layers/RenderLayerManager";
3
- import Vector3 from "../../core/geom/Vector3";
2
+ import Signal from "../../core/events/signal/Signal";
4
3
  import Vector2 from "../../core/geom/Vector2";
4
+ import Vector3 from "../../core/geom/Vector3";
5
5
  import View from "../../view/View";
6
- import Signal from "../../core/events/signal/Signal";
6
+ import {MaterialManager} from "./material/manager/MaterialManager";
7
+ import {RenderLayerManager} from "./render/layers/RenderLayerManager";
7
8
 
8
9
  interface IGraphicsEngineSignals {
9
10
  readonly preRender: Signal
@@ -35,4 +36,6 @@ export class GraphicsEngine {
35
36
  viewportProjectionRay(x: number, y: number, source: Vector3, direction: Vector3): void
36
37
 
37
38
  getRenderer(): WebGLRenderer
39
+
40
+ getMaterialManager():MaterialManager
38
41
  }
@@ -0,0 +1,42 @@
1
+ /**
2
+ *
3
+ * @param {CanvasRenderingContext2D} ctx
4
+ * @param {number} width
5
+ * @param {number} height
6
+ * @param {string} [color] CSS color specification
7
+ * @param {number} [spacing] distance between grid lines
8
+ * @param {number} [offset_x]
9
+ * @param {number} [offset_y]
10
+ * @param {number} [thickness] Like thickness
11
+ */
12
+ export function canvas2d_draw_grid({
13
+ ctx,
14
+ width,
15
+ height,
16
+ color = 'red',
17
+ spacing = 10,
18
+ offset_x = 0,
19
+ offset_y = 0,
20
+ thickness = 1
21
+ }) {
22
+ ctx.fillStyle = 'none';
23
+ ctx.lineWidth = thickness;
24
+ ctx.strokeStyle = color;
25
+
26
+
27
+ ctx.beginPath();
28
+
29
+ for (let x = offset_x; x < width; x += spacing) {
30
+ // horizontal
31
+ ctx.moveTo(x, 0);
32
+ ctx.lineTo(x, height);
33
+ }
34
+
35
+ for (let y = offset_y; y < width; y += spacing) {
36
+ // vertical
37
+ ctx.moveTo(0, y);
38
+ ctx.lineTo(width, y);
39
+ }
40
+
41
+ ctx.stroke();
42
+ }
@@ -5,7 +5,12 @@
5
5
  * @param {number} x
6
6
  * @param {number} y
7
7
  */
8
- export function draw_label(ctx, text, x, y) {
8
+ export function canvas2d_draw_label({
9
+ ctx,
10
+ text,
11
+ x,
12
+ y
13
+ }) {
9
14
 
10
15
  ctx.fillStyle = 'white';
11
16
  ctx.font = '10px Tahoma';
@@ -0,0 +1,64 @@
1
+ import { lerp } from "../../../core/math/lerp.js";
2
+ import { number_pretty_print } from "../../../core/primitives/numbers/number_pretty_print.js";
3
+ import { canvas2d_draw_label } from "./canvas2d_draw_label.js";
4
+
5
+ /**
6
+ *
7
+ * @param {CanvasRenderingContext2D} ctx
8
+ * @param {number} position_x0
9
+ * @param {number} position_y0
10
+ * @param {number} position_x1
11
+ * @param {number} position_y1
12
+ * @param {number} spacing
13
+ * @param {number} value_0
14
+ * @param {number} value_1
15
+ * @param {string} [align] which side of the point should the text appear on
16
+ */
17
+ export function canvas2d_draw_linear_scale({
18
+ ctx,
19
+ position_x0, position_y0,
20
+ position_x1, position_y1,
21
+ spacing = 10,
22
+ value_0, value_1,
23
+ align
24
+ }) {
25
+
26
+ if (spacing <= 0) {
27
+ throw new Error(`Spacing must be greater than 0`);
28
+ }
29
+
30
+ // figure out direction vector
31
+ const delta_x = position_x1 - position_x0;
32
+ const delta_y = position_y1 - position_y0;
33
+
34
+ const distance = Math.hypot(delta_x, delta_y);
35
+
36
+ if (distance === 0) {
37
+ throw new Error(`Distance must be greater than 0`);
38
+ }
39
+
40
+ const direction_x = delta_x / distance;
41
+ const direction_y = delta_y / distance;
42
+
43
+ const mark_count = Math.ceil(distance / spacing);
44
+
45
+ for (let i = 0; i <= mark_count; i++) {
46
+
47
+ const offset = spacing * i;
48
+
49
+ const f = offset / distance;
50
+
51
+ const point_x = position_x0 + direction_x * offset;
52
+ const point_y = position_y0 + direction_y * spacing * i;
53
+
54
+ const value = lerp(value_0, value_1, f);
55
+
56
+ canvas2d_draw_label({
57
+ ctx,
58
+ text: number_pretty_print(value),
59
+ x: point_x,
60
+ y: point_y
61
+ });
62
+ }
63
+
64
+ }
@@ -0,0 +1,60 @@
1
+ /**
2
+ *
3
+ * @param {number[]} vertices
4
+ * @param {CanvasRenderingContext2D} ctx
5
+ * @param [fillColor]
6
+ * @param [strokeColor]
7
+ * @param [highlight_vertices]
8
+ * @param [vertex_draw_size]
9
+ * @param {number} [offset] in pixels
10
+ */
11
+ export function canvas2d_draw_path({
12
+ vertices,
13
+ ctx,
14
+ fillColor = 'transparent',
15
+ strokeColor = 'red',
16
+ highlight_vertices = true,
17
+ vertex_draw_size = 8,
18
+ offset = [0, 0]
19
+ }) {
20
+
21
+ function draw_point(x, y) {
22
+ ctx.fillStyle = 'rgba(255,255,255,0.8)';
23
+ ctx.strokeStyle = 'black';
24
+ ctx.lineWidth = "1px";
25
+
26
+ const x1 = x - vertex_draw_size / 2 + offset[0];
27
+ const y1 = y - vertex_draw_size / 2 + offset[1];
28
+
29
+ ctx.fillRect(x1, y1, vertex_draw_size, vertex_draw_size);
30
+
31
+ ctx.strokeRect(x1, y1, vertex_draw_size, vertex_draw_size);
32
+ }
33
+
34
+ if (highlight_vertices) {
35
+ for (let i = 0; i < vertices.length / 2; i++) {
36
+ draw_point(vertices[i * 2], vertices[i * 2 + 1]);
37
+ }
38
+ }
39
+
40
+ ctx.fillStyle = fillColor;
41
+ ctx.strokeStyle = strokeColor;
42
+ ctx.lineWidth = "1px";
43
+
44
+ ctx.beginPath();
45
+
46
+ ctx.moveTo(vertices[0] + offset[0], vertices[1] + offset[1]);
47
+ // drawPoint(jarvis_vertices[0].x, jarvis_vertices[0].y, jarvis_vertices[0].z, 'red');
48
+
49
+ for (let i = 1; i < vertices.length / 2; i++) {
50
+
51
+ ctx.lineTo(vertices[i * 2] + offset[0], vertices[i * 2 + 1] + offset[1]);
52
+
53
+ // drawPoint(last.x, last.y, last.z, 'red');
54
+ }
55
+
56
+ ctx.closePath();
57
+ ctx.stroke();
58
+ ctx.fill();
59
+
60
+ }
@@ -0,0 +1,84 @@
1
+ import Vector2 from "../../../core/geom/Vector2.js";
2
+ import { canvas2d_draw_grid } from "./canvas2d_draw_grid.js";
3
+ import { canvas2d_draw_linear_scale } from "./canvas2d_draw_linear_scale.js";
4
+ import { canvas2d_plot_line_array } from "./canvas2d_plot_line_array.js";
5
+
6
+ /**
7
+ *
8
+ * @param {CanvasRenderingContext2D} ctx
9
+ * @param {number[]|Float32Array} data
10
+ * @param {Vector2} [margin]
11
+ * @param {number} width
12
+ * @param {number} height
13
+ * @param {number[]} [range_y]
14
+ * @param {number[]} range_x
15
+ */
16
+ export function canvas2d_plot_data_line({
17
+ ctx,
18
+ data,
19
+ margin = Vector2.zero,
20
+ width,
21
+ height,
22
+ range_y,
23
+ range_x
24
+ }) {
25
+
26
+ ctx.fillStyle = '#222222';
27
+ ctx.fillRect(0, 0, width, height);
28
+
29
+ const data_x0 = range_x[0];
30
+ const data_x1 = range_x[1];
31
+ const data_y0 = range_y[0];
32
+ const data_y1 = range_y[1];
33
+
34
+ const plot_area_width = width - margin.x * 2;
35
+ const plot_area_height = height - margin.y * 2;
36
+
37
+ canvas2d_draw_grid({
38
+ ctx,
39
+ width,
40
+ height,
41
+ color: '#262626',
42
+ spacing: 32,
43
+ offset_x: 0
44
+ });
45
+
46
+ canvas2d_draw_grid({
47
+ ctx,
48
+ width,
49
+ height,
50
+ color: '#303030',
51
+ spacing: 32,
52
+ offset_x: 16,
53
+ offset_y: 16
54
+ });
55
+
56
+ canvas2d_draw_linear_scale({
57
+ ctx,
58
+ position_x0: margin.x,
59
+ position_x1: width - margin.x,
60
+ position_y0: height - 4,
61
+ position_y1: height - 4,
62
+ value_0: data_x0,
63
+ value_1: data_x1,
64
+ spacing: 64
65
+ });
66
+ canvas2d_draw_linear_scale({
67
+ ctx,
68
+ position_x0: 4,
69
+ position_x1: 4,
70
+ position_y0: height - margin.y,
71
+ position_y1: margin.y,
72
+ value_0: data_y0,
73
+ value_1: data_y1,
74
+ spacing: 64
75
+ });
76
+
77
+ ctx.fillStyle = 'none';
78
+ ctx.strokeStyle = '#00ff00';
79
+ ctx.lineWidth = 1;
80
+ canvas2d_plot_line_array(
81
+ ctx, plot_area_width, plot_area_height, margin.x, margin.y, data, range_y
82
+ );
83
+
84
+ }
@@ -1,23 +1,4 @@
1
- import { min2 } from "../../../../core/math/min2.js";
2
- import { max2 } from "../../../../core/math/max2.js";
3
-
4
- /**
5
- *
6
- * @param {number[]} data
7
- * @return {number[]}
8
- */
9
- export function array_compute_min_max(data) {
10
- const point_count = data.length;
11
-
12
- let min = Number.POSITIVE_INFINITY;
13
- let max = Number.NEGATIVE_INFINITY;
14
- for (let i = 0; i < point_count; i++) {
15
- min = min2(data[i], min);
16
- max = max2(data[i], max);
17
- }
18
-
19
- return [min, max];
20
- }
1
+ import { array_compute_min_max } from "../../../core/collection/array/array_compute_min_max.js";
21
2
 
22
3
  /**
23
4
  *
@@ -27,9 +8,9 @@ export function array_compute_min_max(data) {
27
8
  * @param {number} x_offset
28
9
  * @param {number} y_offset
29
10
  * @param {number[]} data
30
- * @param {number[]} data_range_y
11
+ * @param {number[]} [data_range_y]
31
12
  */
32
- export function plot_array(
13
+ export function canvas2d_plot_line_array(
33
14
  ctx,
34
15
  width,
35
16
  height,
@@ -40,11 +21,13 @@ export function plot_array(
40
21
  ) {
41
22
  const point_count = data.length;
42
23
 
43
- if (data_range_y === undefined) {
44
- data_range_y = array_compute_min_max(data)
24
+ let _data_range_y = data_range_y;
25
+
26
+ if (_data_range_y === undefined) {
27
+ _data_range_y = array_compute_min_max(data)
45
28
  }
46
29
 
47
- const [min, max] = data_range_y;
30
+ const [min, max] = _data_range_y;
48
31
 
49
32
  const value_span = max - min;
50
33
  const normalization_multiplier = value_span !== 0 ? 1 / value_span : 0;
@@ -1,4 +1,5 @@
1
1
  import { assert } from "../../../core/assert.js";
2
+ import { computeTriangleSurfaceArea } from "../../../core/geom/3d/triangle/computeTriangleSurfaceArea.js";
2
3
 
3
4
  /**
4
5
  *
@@ -49,40 +50,4 @@ export function computeMeshSurfaceArea(result, points, indices, polygon_count =
49
50
  }
50
51
 
51
52
  return total;
52
- }
53
-
54
-
55
- /**
56
- * Based on: https://gamedev.stackexchange.com/questions/165643/how-to-calculate-the-surface-area-of-a-mesh
57
- * @param {number} x0
58
- * @param {number} y0
59
- * @param {number} z0
60
- * @param {number} x1
61
- * @param {number} y1
62
- * @param {number} z1
63
- * @param {number} x2
64
- * @param {number} y2
65
- * @param {number} z2
66
- * @returns {number}
67
- */
68
- export function computeTriangleSurfaceArea(x0, y0, z0, x1, y1, z1, x2, y2, z2) {
69
- const ax = x1 - x0;
70
- const ay = y1 - y0;
71
- const az = z1 - z0;
72
-
73
- const bx = x2 - x0;
74
- const by = y2 - y0;
75
- const bz = z2 - z0;
76
-
77
- //compute cross product
78
- const x = ay * bz - az * by;
79
- const y = az * bx - ax * bz;
80
- const z = ax * by - ay * bx;
81
-
82
- //area is equal to half-magnitude of the cross-product
83
- const magnitude = Math.sqrt(x * x + y * y + z * z);
84
-
85
- const area = magnitude / 2;
86
-
87
- return area;
88
- }
53
+ }
@@ -1,24 +1,6 @@
1
- import { DataTexture, UnsignedByteType } from "three";
2
1
  import { float2uint8 } from "../../../../../core/binary/float2uint8.js";
3
2
  import { clamp01 } from "../../../../../core/math/clamp01.js";
4
-
5
- /**
6
- *
7
- * @param contents
8
- * @param {Signal} cleanup_signal
9
- * @returns {DataTexture}
10
- */
11
- function onePixelTexture(contents, cleanup_signal) {
12
- const t = new DataTexture(new Uint8Array(contents), 1, 1);
13
-
14
- t.generateMipmaps = false;
15
- t.needsUpdate = true;
16
- t.type = UnsignedByteType;
17
-
18
- cleanup_signal.addOne(t.dispose, t);
19
-
20
- return t;
21
- }
3
+ import { makeOnePixelTexture } from "../../../texture/makeOnePixelTexture.js";
22
4
 
23
5
 
24
6
  /**
@@ -57,13 +39,13 @@ export function prepare_bake_material({
57
39
 
58
40
  if (texture_metalness === null) {
59
41
  const m = float2uint8(clamp01(source_material.metalness));
60
- texture_metalness = onePixelTexture([m, m, m, 255], cleanup_signal);
42
+ texture_metalness = makeOnePixelTexture([m, m, m, 255], cleanup_signal);
61
43
  }
62
44
 
63
45
  if (texture_roughness === null) {
64
46
  const r = float2uint8(clamp01(source_material.roughness));
65
47
 
66
- texture_roughness = onePixelTexture([r, r, r, 255], cleanup_signal);
48
+ texture_roughness = makeOnePixelTexture([r, r, r, 255], cleanup_signal);
67
49
  }
68
50
 
69
51
  } else {
@@ -74,22 +56,22 @@ export function prepare_bake_material({
74
56
 
75
57
  if (texture_diffuse === null) {
76
58
  // plug white texture
77
- texture_diffuse = onePixelTexture([255, 255, 255, 255], cleanup_signal);
59
+ texture_diffuse = makeOnePixelTexture([255, 255, 255, 255], cleanup_signal);
78
60
  }
79
61
  if (texture_roughness === null) {
80
- texture_roughness = onePixelTexture([255, 255, 255, 255], cleanup_signal);
62
+ texture_roughness = makeOnePixelTexture([255, 255, 255, 255], cleanup_signal);
81
63
  }
82
64
 
83
65
  if (texture_metalness === null) {
84
- texture_metalness = onePixelTexture([0, 0, 0, 0], cleanup_signal);
66
+ texture_metalness = makeOnePixelTexture([0, 0, 0, 0], cleanup_signal);
85
67
  }
86
68
 
87
69
  if (texture_occlusion === null) {
88
- texture_occlusion = onePixelTexture([255, 255, 255, 255], cleanup_signal);
70
+ texture_occlusion = makeOnePixelTexture([255, 255, 255, 255], cleanup_signal);
89
71
  }
90
72
 
91
73
  if (texture_emissive === null) {
92
- texture_emissive = onePixelTexture([0, 0, 0, 0], cleanup_signal);
74
+ texture_emissive = makeOnePixelTexture([0, 0, 0, 0], cleanup_signal);
93
75
  }
94
76
 
95
77
  // set rendering parameters on textures
@@ -0,0 +1,6 @@
1
+ import {Material} from "three";
2
+ import {Reference} from "../../../reference/v2/Reference";
3
+
4
+ export class MaterialManager{
5
+ obtain(source:Material):Reference<Material>
6
+ }