@woosh/meep-engine 2.110.10 → 2.110.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/editor/ecs/component/editors/Sampler2DEditor.js +9 -9
- package/editor/ecs/component/editors/three/BufferGeometryEditor.js +4 -4
- package/editor/ecs/component/editors/three/MaterialEditor.js +3 -3
- package/editor/ecs/component/editors/three/MeshEditor.js +4 -4
- package/editor/ecs/component/editors/three/TextureEditor.js +1 -1
- package/editor/tools/paint/TerrainPaintTool.js +7 -7
- package/editor/tools/paint/TerrainTexturePaintTool.js +5 -5
- package/editor/view/ecs/components/GridObstacleController.js +6 -6
- package/editor/view/ecs/components/TerrainController.js +2 -2
- package/package.json +1 -1
- package/samples/terrain/editor.js +2 -2
- package/src/core/color/kelvin/prototype_kelvin_to_rgb.js +3 -3
- package/src/core/geom/3d/Ray3.d.ts +1 -1
- package/src/core/geom/3d/Ray3.js +1 -1
- package/src/core/geom/3d/normal/octahedron/prototype.js +1 -1
- package/src/core/geom/3d/sphere/harmonics/README.md +1 -1
- package/src/core/geom/3d/tetrahedra/compute_tetrahedron_volume.d.ts +9 -0
- package/src/core/geom/3d/tetrahedra/compute_tetrahedron_volume.d.ts.map +1 -0
- package/src/core/geom/3d/tetrahedra/{get_tetrahedron_volume.js → compute_tetrahedron_volume.js} +1 -1
- package/src/core/geom/3d/tetrahedra/delaunay/compute_delaunay_tetrahedral_mesh.spec.js +17 -3
- package/src/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_build_from_grid.spec.js +2 -2
- package/src/core/geom/3d/tetrahedra/tetrahedron_compute_signed_volume.d.ts +2 -1
- package/src/core/geom/3d/tetrahedra/tetrahedron_compute_signed_volume.d.ts.map +1 -1
- package/src/core/geom/3d/tetrahedra/tetrahedron_compute_signed_volume.js +2 -1
- package/src/core/geom/3d/tetrahedra/triangle/prototype.js +1 -1
- package/src/core/geom/3d/tetrahedra/validate_tetrahedral_mesh.d.ts.map +1 -1
- package/src/core/geom/3d/tetrahedra/validate_tetrahedral_mesh.js +32 -2
- package/src/core/math/linalg/solve_linear_system.d.ts +3 -3
- package/src/core/math/linalg/solve_linear_system.d.ts.map +1 -1
- package/src/core/math/linalg/solve_linear_system.js +8 -3
- package/src/core/math/noise/create_simplex_noise_2d.d.ts.map +1 -1
- package/src/core/math/noise/create_simplex_noise_2d.js +5 -7
- package/src/core/math/spline/spline_hermite3.spec.d.ts +2 -0
- package/src/core/math/spline/spline_hermite3.spec.d.ts.map +1 -0
- package/src/core/math/spline/spline_hermite3.spec.js +18 -0
- package/src/core/process/task/Task.d.ts.map +1 -1
- package/src/core/process/task/Task.js +2 -0
- package/src/core/process/task/util/actionTask.d.ts +2 -2
- package/src/core/process/task/util/actionTask.d.ts.map +1 -1
- package/src/core/process/task/util/actionTask.js +5 -2
- package/src/core/process/task/util/ignoreFailureTask.d.ts +8 -0
- package/src/core/process/task/util/ignoreFailureTask.d.ts.map +1 -0
- package/src/core/process/task/util/{wrapTaskIgnoreFailure.js → ignoreFailureTask.js} +9 -4
- package/src/core/process/task/util/task_tree_compute_leaf_tasks.d.ts +1 -1
- package/src/core/process/task/util/task_tree_compute_leaf_tasks.js +1 -1
- package/src/engine/asset/loaders/image/png/prototypePNG.js +1 -1
- package/src/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +2 -2
- package/src/engine/graphics/sh3/path_tracer/prototypePathTracer.js +1 -1
- package/src/engine/graphics/sh3/sky/hosek/prototype_hosek.js +3 -3
- package/src/engine/graphics/texture/sampler/debug/debug_draw_sampler.js +1 -1
- package/src/engine/graphics/texture/sampler/downloadSamplerAsPNG.js +2 -2
- package/src/engine/graphics/texture/sampler/sampler2d_to_data_url.d.ts +8 -0
- package/src/engine/graphics/texture/sampler/sampler2d_to_data_url.d.ts.map +1 -0
- package/src/engine/graphics/texture/sampler/sampler2d_to_data_url.js +22 -0
- package/src/engine/graphics/texture/sampler/sampler2d_to_data_url.spec.d.ts +2 -0
- package/src/engine/graphics/texture/sampler/sampler2d_to_data_url.spec.d.ts.map +1 -0
- package/src/engine/graphics/texture/sampler/{convertSampler2D2DataURL.spec.js → sampler2d_to_data_url.spec.js} +2 -2
- package/src/engine/graphics/texture/sampler/{Sampler2D2Canvas.d.ts → sampler2d_to_html_canvas.d.ts} +3 -3
- package/src/engine/graphics/texture/sampler/sampler2d_to_html_canvas.d.ts.map +1 -0
- package/src/engine/graphics/texture/sampler/{Sampler2D2Canvas.js → sampler2d_to_html_canvas.js} +7 -7
- package/src/engine/graphics/texture/sampler/util/drawSamplerHTML.d.ts.map +1 -1
- package/src/engine/graphics/texture/sampler/util/drawSamplerHTML.js +3 -3
- package/src/engine/graphics/texture/sprite/prototypeSpriteCutoutGeometry.js +1 -1
- package/src/engine/scene/transitionToScene.js +3 -3
- package/src/generation/filtering/numeric/util/visualise_filters_as_grid.js +3 -3
- package/src/misc/makeMatcapSelectionOption.js +2 -2
- package/src/core/geom/3d/tetrahedra/get_tetrahedron_volume.d.ts +0 -9
- package/src/core/geom/3d/tetrahedra/get_tetrahedron_volume.d.ts.map +0 -1
- package/src/core/process/task/util/wrapTaskIgnoreFailure.d.ts +0 -8
- package/src/core/process/task/util/wrapTaskIgnoreFailure.d.ts.map +0 -1
- package/src/engine/graphics/texture/sampler/Sampler2D2Canvas.d.ts.map +0 -1
- package/src/engine/graphics/texture/sampler/convertSampler2D2DataURL.d.ts +0 -7
- package/src/engine/graphics/texture/sampler/convertSampler2D2DataURL.d.ts.map +0 -1
- package/src/engine/graphics/texture/sampler/convertSampler2D2DataURL.js +0 -23
- package/src/engine/graphics/texture/sampler/convertSampler2D2DataURL.spec.d.ts +0 -2
- package/src/engine/graphics/texture/sampler/convertSampler2D2DataURL.spec.d.ts.map +0 -1
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { TypeEditor } from "../TypeEditor.js";
|
|
2
|
-
import { CanvasView } from "../../../../src/view/elements/CanvasView.js";
|
|
3
|
-
import sampler2D2Canvas from "../../../../src/engine/graphics/texture/sampler/Sampler2D2Canvas.js";
|
|
4
|
-
import { sampler2d_scale } from "../../../../src/engine/graphics/texture/sampler/resize/sampler2d_scale.js";
|
|
5
|
-
import { Sampler2D } from "../../../../src/engine/graphics/texture/sampler/Sampler2D.js";
|
|
6
|
-
import {
|
|
7
|
-
typedArrayConstructorByInstance
|
|
8
|
-
} from "../../../../src/engine/graphics/texture/sampler/typedArrayConstructorByInstance.js";
|
|
9
1
|
import { FrameRunner } from "../../../../src/engine/graphics/FrameRunner.js";
|
|
10
2
|
import canvas2Sampler2D from "../../../../src/engine/graphics/texture/Canvas2Sampler2D.js";
|
|
11
3
|
import {
|
|
12
4
|
copy_Sampler2D_channel_data
|
|
13
5
|
} from "../../../../src/engine/graphics/texture/sampler/copy_Sampler2D_channel_data.js";
|
|
14
|
-
import { MouseEvents } from "../../../../src/engine/input/devices/events/MouseEvents.js";
|
|
15
6
|
import { downloadSampler2DAsPNG } from "../../../../src/engine/graphics/texture/sampler/downloadSamplerAsPNG.js";
|
|
7
|
+
import { sampler2d_scale } from "../../../../src/engine/graphics/texture/sampler/resize/sampler2d_scale.js";
|
|
8
|
+
import { Sampler2D } from "../../../../src/engine/graphics/texture/sampler/Sampler2D.js";
|
|
16
9
|
import {
|
|
17
10
|
sampler2d_compute_texel_value_conversion_scale_to_uint8
|
|
18
11
|
} from "../../../../src/engine/graphics/texture/sampler/sampler2d_compute_texel_value_conversion_scale_to_uint8.js";
|
|
12
|
+
import sampler2D2Canvas from "../../../../src/engine/graphics/texture/sampler/sampler2d_to_html_canvas.js";
|
|
13
|
+
import {
|
|
14
|
+
typedArrayConstructorByInstance
|
|
15
|
+
} from "../../../../src/engine/graphics/texture/sampler/typedArrayConstructorByInstance.js";
|
|
16
|
+
import { MouseEvents } from "../../../../src/engine/input/devices/events/MouseEvents.js";
|
|
17
|
+
import { CanvasView } from "../../../../src/view/elements/CanvasView.js";
|
|
19
18
|
import EmptyView from "../../../../src/view/elements/EmptyView.js";
|
|
19
|
+
import { TypeEditor } from "../TypeEditor.js";
|
|
20
20
|
|
|
21
21
|
const UPDATE_DELAY = 200;
|
|
22
22
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { TypeEditor } from "../../TypeEditor.js";
|
|
2
|
-
import { Sampler2D } from "../../../../../src/engine/graphics/texture/sampler/Sampler2D.js";
|
|
3
|
-
import { renderObjectToSampler2D } from "../../../../../src/engine/graphics/util/renderObjectToSampler2D.js";
|
|
4
1
|
import { Mesh, MeshPhongMaterial } from "three";
|
|
5
2
|
import AABB2 from "../../../../../src/core/geom/2d/aabb/AABB2.js";
|
|
3
|
+
import { Sampler2D } from "../../../../../src/engine/graphics/texture/sampler/Sampler2D.js";
|
|
4
|
+
import sampler2D2Canvas from "../../../../../src/engine/graphics/texture/sampler/sampler2d_to_html_canvas.js";
|
|
5
|
+
import { renderObjectToSampler2D } from "../../../../../src/engine/graphics/util/renderObjectToSampler2D.js";
|
|
6
6
|
import { CanvasView } from "../../../../../src/view/elements/CanvasView.js";
|
|
7
|
-
import
|
|
7
|
+
import { TypeEditor } from "../../TypeEditor.js";
|
|
8
8
|
|
|
9
9
|
export class BufferGeometryEditor extends TypeEditor {
|
|
10
10
|
build(parent, field, registry) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Mesh, SphereBufferGeometry } from "three";
|
|
2
2
|
import { Sampler2D } from "../../../../../src/engine/graphics/texture/sampler/Sampler2D.js";
|
|
3
|
+
import sampler2D2Canvas from "../../../../../src/engine/graphics/texture/sampler/sampler2d_to_html_canvas.js";
|
|
3
4
|
import { renderObjectToSampler2D } from "../../../../../src/engine/graphics/util/renderObjectToSampler2D.js";
|
|
4
|
-
import { Mesh, SphereBufferGeometry } from "three";
|
|
5
5
|
import { CanvasView } from "../../../../../src/view/elements/CanvasView.js";
|
|
6
|
-
import
|
|
6
|
+
import { TypeEditor } from "../../TypeEditor.js";
|
|
7
7
|
|
|
8
8
|
export class MaterialEditor extends TypeEditor {
|
|
9
9
|
build(parent, field, registry) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import AABB2 from "../../../../../src/core/geom/2d/aabb/AABB2.js";
|
|
2
2
|
import { Sampler2D } from "../../../../../src/engine/graphics/texture/sampler/Sampler2D.js";
|
|
3
|
+
import sampler2D2Canvas from "../../../../../src/engine/graphics/texture/sampler/sampler2d_to_html_canvas.js";
|
|
3
4
|
import { renderObjectToSampler2D } from "../../../../../src/engine/graphics/util/renderObjectToSampler2D.js";
|
|
4
|
-
import AABB2 from "../../../../../src/core/geom/2d/aabb/AABB2.js";
|
|
5
|
-
import { CanvasView } from "../../../../../src/view/elements/CanvasView.js";
|
|
6
|
-
import sampler2D2Canvas from "../../../../../src/engine/graphics/texture/sampler/Sampler2D2Canvas.js";
|
|
7
5
|
import { threeUpdateTransform } from "../../../../../src/engine/graphics/util/threeUpdateTransform.js";
|
|
6
|
+
import { CanvasView } from "../../../../../src/view/elements/CanvasView.js";
|
|
7
|
+
import { TypeEditor } from "../../TypeEditor.js";
|
|
8
8
|
|
|
9
9
|
export class MeshEditor extends TypeEditor {
|
|
10
10
|
build(parent, field, registry) {
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "../../../../../src/engine/graphics/texture/sampler/convertTexture2Sampler2D.js";
|
|
5
5
|
import { downloadSampler2DAsPNG } from "../../../../../src/engine/graphics/texture/sampler/downloadSamplerAsPNG.js";
|
|
6
6
|
import { Sampler2D } from "../../../../../src/engine/graphics/texture/sampler/Sampler2D.js";
|
|
7
|
-
import sampler2D2Canvas from "../../../../../src/engine/graphics/texture/sampler/
|
|
7
|
+
import sampler2D2Canvas from "../../../../../src/engine/graphics/texture/sampler/sampler2d_to_html_canvas.js";
|
|
8
8
|
import { MouseEvents } from "../../../../../src/engine/input/devices/events/MouseEvents.js";
|
|
9
9
|
import { CanvasView } from "../../../../../src/view/elements/CanvasView.js";
|
|
10
10
|
import EmptyView from "../../../../../src/view/elements/EmptyView.js";
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { max2 } from "../../../src/core/math/max2.js";
|
|
2
|
-
import Tool from "../engine/Tool.js";
|
|
3
1
|
import { Color } from "../../../src/core/color/Color.js";
|
|
4
|
-
import
|
|
2
|
+
import Vector1 from "../../../src/core/geom/Vector1.js";
|
|
5
3
|
import Vector2 from "../../../src/core/geom/Vector2.js";
|
|
6
|
-
import
|
|
4
|
+
import { max2 } from "../../../src/core/math/max2.js";
|
|
7
5
|
import ObservedString from "../../../src/core/model/ObservedString.js";
|
|
8
6
|
import { GameAssetType } from "../../../src/engine/asset/GameAssetType.js";
|
|
9
|
-
import Vector1 from "../../../src/core/geom/Vector1.js";
|
|
10
|
-
import { obtainTerrain } from "../../../src/engine/ecs/terrain/util/obtainTerrain.js";
|
|
11
7
|
import { pick } from "../../../src/engine/ecs/grid/pick.js";
|
|
8
|
+
import { obtainTerrain } from "../../../src/engine/ecs/terrain/util/obtainTerrain.js";
|
|
9
|
+
import { Sampler2D } from "../../../src/engine/graphics/texture/sampler/Sampler2D.js";
|
|
10
|
+
import sampler2d_to_html_canvas from "../../../src/engine/graphics/texture/sampler/sampler2d_to_html_canvas.js";
|
|
11
|
+
import Tool from "../engine/Tool.js";
|
|
12
12
|
|
|
13
13
|
export class TerrainPaintTool extends Tool {
|
|
14
14
|
constructor() {
|
|
@@ -103,7 +103,7 @@ export class TerrainPaintTool extends Tool {
|
|
|
103
103
|
|
|
104
104
|
const brushImage = this.__brushImage;
|
|
105
105
|
|
|
106
|
-
|
|
106
|
+
sampler2d_to_html_canvas(temp, 1, 0, brushImage);
|
|
107
107
|
|
|
108
108
|
}
|
|
109
109
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { TerrainPaintTool } from "./TerrainPaintTool.js";
|
|
2
|
-
import { convertSampler2D2DataURL } from "../../../src/engine/graphics/texture/sampler/convertSampler2D2DataURL.js";
|
|
3
1
|
import { obtainTerrain } from "../../../src/engine/ecs/terrain/util/obtainTerrain.js";
|
|
4
|
-
import {
|
|
5
|
-
import { ArrayCopyAction } from "../../actions/concrete/ArrayCopyAction.js";
|
|
2
|
+
import { sampler2d_to_data_url } from "../../../src/engine/graphics/texture/sampler/sampler2d_to_data_url.js";
|
|
6
3
|
import { ActionUpdateTexture } from "../../actions/concrete/ActionUpdateTexture.js";
|
|
4
|
+
import { ArrayCopyAction } from "../../actions/concrete/ArrayCopyAction.js";
|
|
5
|
+
import { ModifyPatchTextureArray2DAction } from "../../actions/concrete/ModifyPatchTextureArray2DAction.js";
|
|
6
|
+
import { TerrainPaintTool } from "./TerrainPaintTool.js";
|
|
7
7
|
|
|
8
8
|
export class TerrainTexturePaintTool extends TerrainPaintTool {
|
|
9
9
|
constructor() {
|
|
@@ -76,7 +76,7 @@ export class TerrainTexturePaintTool extends TerrainPaintTool {
|
|
|
76
76
|
|
|
77
77
|
if (url === null) {
|
|
78
78
|
// no URL, try to sample texture directly
|
|
79
|
-
url =
|
|
79
|
+
url = sampler2d_to_data_url(layer.diffuse);
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
this.icon.set(url);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import Vector2 from "../../../../src/core/geom/Vector2.js";
|
|
1
2
|
import ObservedValue from "../../../../src/core/model/ObservedValue.js";
|
|
2
|
-
import
|
|
3
|
+
import { sampler2d_scale } from "../../../../src/engine/graphics/texture/sampler/resize/sampler2d_scale.js";
|
|
4
|
+
import { Sampler2D } from "../../../../src/engine/graphics/texture/sampler/Sampler2D.js";
|
|
5
|
+
import sampler2d_to_html_canvas from "../../../../src/engine/graphics/texture/sampler/sampler2d_to_html_canvas.js";
|
|
3
6
|
import { CanvasView } from "../../../../src/view/elements/CanvasView.js";
|
|
7
|
+
import View from "../../../../src/view/View.js";
|
|
4
8
|
import DatGuiController from "./DatGuiController.js";
|
|
5
|
-
import convertSampler2D2Canvas from "../../../../src/engine/graphics/texture/sampler/Sampler2D2Canvas.js";
|
|
6
|
-
import { Sampler2D } from "../../../../src/engine/graphics/texture/sampler/Sampler2D.js";
|
|
7
|
-
import { sampler2d_scale } from "../../../../src/engine/graphics/texture/sampler/resize/sampler2d_scale.js";
|
|
8
|
-
import Vector2 from "../../../../src/core/geom/Vector2.js";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
*
|
|
@@ -19,7 +19,7 @@ export function buildGridObstaclePreview(grid, canvas) {
|
|
|
19
19
|
|
|
20
20
|
sampler2d_scale(source, target);
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
sampler2d_to_html_canvas(target, 255, 0, canvas);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
export class GridObstacleController extends View {
|
|
@@ -5,7 +5,7 @@ import { TerrainLayer } from "../../../../src/engine/ecs/terrain/ecs/layers/Terr
|
|
|
5
5
|
import CheckersTextureURI from "../../../../src/engine/graphics/texture/CheckersTextureURI.js";
|
|
6
6
|
import { sampler2d_scale } from "../../../../src/engine/graphics/texture/sampler/resize/sampler2d_scale.js";
|
|
7
7
|
import { Sampler2D } from "../../../../src/engine/graphics/texture/sampler/Sampler2D.js";
|
|
8
|
-
import
|
|
8
|
+
import sampler2d_to_html_canvas from "../../../../src/engine/graphics/texture/sampler/sampler2d_to_html_canvas.js";
|
|
9
9
|
import LabelView from "../../../../src/view/common/LabelView.js";
|
|
10
10
|
import { NativeListController } from "../../../../src/view/controller/controls/NativeListController.js";
|
|
11
11
|
import Vector2Control from "../../../../src/view/controller/controls/Vector2Control.js";
|
|
@@ -94,7 +94,7 @@ class LayersController extends View {
|
|
|
94
94
|
|
|
95
95
|
sampler2d_scale(layer.diffuse, t);
|
|
96
96
|
|
|
97
|
-
|
|
97
|
+
sampler2d_to_html_canvas(t, 1, 0, vCanvas.el);
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
update();
|
package/package.json
CHANGED
|
@@ -19,7 +19,7 @@ import CheckersTextureURI from "../../src/engine/graphics/texture/CheckersTextur
|
|
|
19
19
|
import { copy_Sampler2D_channel_data } from "../../src/engine/graphics/texture/sampler/copy_Sampler2D_channel_data.js";
|
|
20
20
|
import { sampler2d_scale } from "../../src/engine/graphics/texture/sampler/resize/sampler2d_scale.js";
|
|
21
21
|
import { Sampler2D } from "../../src/engine/graphics/texture/sampler/Sampler2D.js";
|
|
22
|
-
import
|
|
22
|
+
import sampler2d_to_html_canvas from "../../src/engine/graphics/texture/sampler/sampler2d_to_html_canvas.js";
|
|
23
23
|
import { NativeListController } from "../../src/view/controller/controls/NativeListController.js";
|
|
24
24
|
import { CanvasView } from "../../src/view/elements/CanvasView.js";
|
|
25
25
|
import EmptyView from "../../src/view/elements/EmptyView.js";
|
|
@@ -157,7 +157,7 @@ function makeTextureSlotView({ slot }) {
|
|
|
157
157
|
|
|
158
158
|
|
|
159
159
|
function update() {
|
|
160
|
-
|
|
160
|
+
sampler2d_to_html_canvas(slot.sampler, 1, 0, preview.el);
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
preview.on.linked.add(update);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { Sampler2D } from "../../../engine/graphics/texture/sampler/Sampler2D.js";
|
|
2
|
+
import sampler2D2Canvas from "../../../engine/graphics/texture/sampler/sampler2d_to_html_canvas.js";
|
|
1
3
|
import { CanvasView } from "../../../view/elements/CanvasView.js";
|
|
2
|
-
import { kelvin_to_rgb } from "./kelvin_to_rgb.js";
|
|
3
4
|
import { lerp } from "../../math/lerp.js";
|
|
4
|
-
import { Sampler2D } from "../../../engine/graphics/texture/sampler/Sampler2D.js";
|
|
5
|
-
import sampler2D2Canvas from "../../../engine/graphics/texture/sampler/Sampler2D2Canvas.js";
|
|
6
5
|
import { sRGB_to_linear } from "../sRGB/sRGB_to_linear.js";
|
|
6
|
+
import { kelvin_to_rgb } from "./kelvin_to_rgb.js";
|
|
7
7
|
|
|
8
8
|
const view = new CanvasView();
|
|
9
9
|
|
package/src/core/geom/3d/Ray3.js
CHANGED
|
@@ -9,7 +9,7 @@ import { ray3_interval_array_apply_matrix4 } from "./ray/ray3_interval_array_app
|
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* 3D ray
|
|
12
|
-
*
|
|
12
|
+
* Optimized representation for faster memory access
|
|
13
13
|
*/
|
|
14
14
|
export class Ray3 extends Float32Array {
|
|
15
15
|
constructor() {
|
|
@@ -13,7 +13,7 @@ import { OrbitControls } from "three/examples/jsm/controls/OrbitControls.js";
|
|
|
13
13
|
import { makeSolidArrowGeometry } from "../../../../../../editor/process/symbolic/makeSolidArrowGeometry.js";
|
|
14
14
|
import { AssetManager } from "../../../../../engine/asset/AssetManager.js";
|
|
15
15
|
import { ImageRGBADataLoader } from "../../../../../engine/asset/loaders/image/ImageRGBADataLoader.js";
|
|
16
|
-
import sampler2D2Canvas from "../../../../../engine/graphics/texture/sampler/
|
|
16
|
+
import sampler2D2Canvas from "../../../../../engine/graphics/texture/sampler/sampler2d_to_html_canvas.js";
|
|
17
17
|
import { MouseEvents } from "../../../../../engine/input/devices/events/MouseEvents.js";
|
|
18
18
|
import { CSS_ABSOLUTE_POSITIONING } from "../../../../../view/CSS_ABSOLUTE_POSITIONING.js";
|
|
19
19
|
import { CanvasView } from "../../../../../view/elements/CanvasView.js";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {TetrahedralMesh} mesh
|
|
4
|
+
* @param {ArrayLike<number>|number[]} points
|
|
5
|
+
* @param {number} tet_index
|
|
6
|
+
* @return {number}
|
|
7
|
+
*/
|
|
8
|
+
export function compute_tetrahedron_volume(mesh: TetrahedralMesh, points: ArrayLike<number> | number[], tet_index: number): number;
|
|
9
|
+
//# sourceMappingURL=compute_tetrahedron_volume.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compute_tetrahedron_volume.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/tetrahedra/compute_tetrahedron_volume.js"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,0EAJW,UAAU,MAAM,CAAC,GAAC,MAAM,EAAE,aAC1B,MAAM,GACL,MAAM,CAUjB"}
|
package/src/core/geom/3d/tetrahedra/{get_tetrahedron_volume.js → compute_tetrahedron_volume.js}
RENAMED
|
@@ -7,7 +7,7 @@ import { tetrahedron_compute_signed_volume } from "./tetrahedron_compute_signed_
|
|
|
7
7
|
* @param {number} tet_index
|
|
8
8
|
* @return {number}
|
|
9
9
|
*/
|
|
10
|
-
export function
|
|
10
|
+
export function compute_tetrahedron_volume(mesh, points, tet_index) {
|
|
11
11
|
|
|
12
12
|
const a = mesh.getVertexIndex(tet_index, 0);
|
|
13
13
|
const b = mesh.getVertexIndex(tet_index, 1);
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
* @jest-environment jsdom
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import { compute_delaunay_tetrahedral_mesh } from "./compute_delaunay_tetrahedral_mesh.js";
|
|
6
5
|
import { TetrahedralMesh } from "../TetrahedralMesh.js";
|
|
6
|
+
import { validate_tetrahedral_mesh } from "../validate_tetrahedral_mesh.js";
|
|
7
|
+
import { compute_delaunay_tetrahedral_mesh } from "./compute_delaunay_tetrahedral_mesh.js";
|
|
7
8
|
|
|
8
9
|
test('single point', () => {
|
|
9
10
|
const mesh = new TetrahedralMesh();
|
|
@@ -13,10 +14,23 @@ test('single point', () => {
|
|
|
13
14
|
|
|
14
15
|
test('exactly 4 points', () => {
|
|
15
16
|
const mesh = new TetrahedralMesh();
|
|
16
|
-
|
|
17
|
+
const points = [
|
|
17
18
|
-1, 0, 0,
|
|
18
19
|
1, 0, 0,
|
|
19
20
|
0.5, 1, 0,
|
|
20
21
|
0.5, 0, 1
|
|
21
|
-
]
|
|
22
|
+
];
|
|
23
|
+
compute_delaunay_tetrahedral_mesh(mesh, points, 4);
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
// do full validation
|
|
27
|
+
const problems = [];
|
|
28
|
+
|
|
29
|
+
const is_valid = validate_tetrahedral_mesh(mesh, points, (problem) => problems.push(problem));
|
|
30
|
+
|
|
31
|
+
if (!is_valid) {
|
|
32
|
+
console.error(problems.join('\n'));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
expect(is_valid).toBe(true);
|
|
22
36
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AABB3 } from "../../aabb/AABB3.js";
|
|
2
|
-
import {
|
|
2
|
+
import { compute_tetrahedron_volume } from "../compute_tetrahedron_volume.js";
|
|
3
3
|
import { TetrahedralMesh } from "../TetrahedralMesh.js";
|
|
4
4
|
import { validate_tetrahedral_mesh } from "../validate_tetrahedral_mesh.js";
|
|
5
5
|
import { tetrahedral_mesh_build_from_grid } from "./tetrahedral_mesh_build_from_grid.js";
|
|
@@ -42,7 +42,7 @@ test("Single cube", () => {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
// tetrahedrons should have positive volume
|
|
45
|
-
const volume =
|
|
45
|
+
const volume = compute_tetrahedron_volume(mesh, points, tet_index);
|
|
46
46
|
|
|
47
47
|
expect(volume).toBeGreaterThan(0);
|
|
48
48
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tetrahedron_compute_signed_volume.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/tetrahedra/tetrahedron_compute_signed_volume.js"],"names":[],"mappings":"AAkCA
|
|
1
|
+
{"version":3,"file":"tetrahedron_compute_signed_volume.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/tetrahedra/tetrahedron_compute_signed_volume.js"],"names":[],"mappings":"AAkCA;;;;;;;;;;GAUG;AACH,0DAPW,UAAU,MAAM,CAAC,GAAC,MAAM,EAAE,GAAC,YAAY,KACvC,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,GACJ,MAAM,CA0ClB"}
|
|
@@ -33,8 +33,9 @@ function triangle_compute_signed_volume(
|
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
|
+
* Uses counter-clock-wise winding rule
|
|
37
|
+
* Very similar to "orient3d" method
|
|
36
38
|
* @see https://en.wikipedia.org/wiki/Tetrahedron
|
|
37
|
-
*
|
|
38
39
|
* @param {ArrayLike<number>|number[]|Float32Array} points
|
|
39
40
|
* @param {number} a
|
|
40
41
|
* @param {number} b
|
|
@@ -2,7 +2,7 @@ import { BoxBufferGeometry, MeshStandardMaterial } from "three";
|
|
|
2
2
|
import { Transform } from "../../../../../engine/ecs/transform/Transform.js";
|
|
3
3
|
import { PathTracedScene } from "../../../../../engine/graphics/sh3/path_tracer/PathTracedScene.js";
|
|
4
4
|
import { Sampler2D } from "../../../../../engine/graphics/texture/sampler/Sampler2D.js";
|
|
5
|
-
import sampler2D2Canvas from "../../../../../engine/graphics/texture/sampler/
|
|
5
|
+
import sampler2D2Canvas from "../../../../../engine/graphics/texture/sampler/sampler2d_to_html_canvas.js";
|
|
6
6
|
import { CanvasView } from "../../../../../view/elements/CanvasView.js";
|
|
7
7
|
import { Color } from "../../../../color/Color.js";
|
|
8
8
|
import { halton_sequence } from "../../../../math/statistics/halton_sequence.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate_tetrahedral_mesh.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/tetrahedra/validate_tetrahedral_mesh.js"],"names":[],"mappings":"AAKA;;;;;;;GAOG;AACH,+DALW,MAAM,gBACN,MAAM,mBACG,MAAM,WACd,OAAO,CA6DlB;AAGD;;;;;GAKG;AACH,+EAHW,MAAM,mCAehB;
|
|
1
|
+
{"version":3,"file":"validate_tetrahedral_mesh.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/tetrahedra/validate_tetrahedral_mesh.js"],"names":[],"mappings":"AAKA;;;;;;;GAOG;AACH,+DALW,MAAM,gBACN,MAAM,mBACG,MAAM,WACd,OAAO,CA6DlB;AAGD;;;;;GAKG;AACH,+EAHW,MAAM,mCAehB;AA0BD;;;;;;GAMG;AACH,yEAJW,UAAU,MAAM,CAAC,GAAC,MAAM,EAAE,GAAC,YAAY,2BAErC,OAAO,CAkCnB;qBA9JoB,2BAA2B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { noop } from "../../../function/noop.js";
|
|
2
|
-
import {
|
|
2
|
+
import { compute_tetrahedron_volume } from "./compute_tetrahedron_volume.js";
|
|
3
3
|
import { is_tetrahedron_degenerate } from "./is_tetrahedron_degenerate.js";
|
|
4
4
|
import { INVALID_NEIGHBOUR } from "./TetrahedralMesh.js";
|
|
5
5
|
|
|
@@ -93,6 +93,30 @@ export function validate_tetrahedron_neighbourhood(mesh, tet, consumer = noop) {
|
|
|
93
93
|
return valid;
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
+
/**
|
|
97
|
+
*
|
|
98
|
+
* @param {TetrahedralMesh} mesh
|
|
99
|
+
* @param {number} tet
|
|
100
|
+
* @param {number} max_index
|
|
101
|
+
* @param {function(problem:string):*} consumer
|
|
102
|
+
*/
|
|
103
|
+
function validate_tetrahedron_point_index_range(mesh, tet, max_index, consumer) {
|
|
104
|
+
let valid = true;
|
|
105
|
+
|
|
106
|
+
for (let i = 0; i < 4; i++) {
|
|
107
|
+
|
|
108
|
+
const vertex_index = mesh.getVertexIndex(tet, i);
|
|
109
|
+
|
|
110
|
+
if (vertex_index > max_index) {
|
|
111
|
+
consumer(`Tetrahedron ${tet} points to non-existing vertex ${vertex_index} as it's ordinal vertex ${i}. Maximum allowed vertex index is ${max_index}`);
|
|
112
|
+
valid = false;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return valid;
|
|
118
|
+
}
|
|
119
|
+
|
|
96
120
|
/**
|
|
97
121
|
*
|
|
98
122
|
* @param {TetrahedralMesh} mesh
|
|
@@ -103,9 +127,15 @@ export function validate_tetrahedron_neighbourhood(mesh, tet, consumer = noop) {
|
|
|
103
127
|
export function validate_tetrahedral_mesh(mesh, points, consumer = noop) {
|
|
104
128
|
let is_valid = true;
|
|
105
129
|
|
|
130
|
+
const max_point_index = (points.length / 3) - 1;
|
|
131
|
+
|
|
106
132
|
mesh.forEach((tet, mesh) => {
|
|
107
133
|
|
|
108
|
-
|
|
134
|
+
if (!validate_tetrahedron_point_index_range(mesh, tet, max_point_index, consumer)) {
|
|
135
|
+
is_valid = false;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const volume = compute_tetrahedron_volume(mesh, points, tet);
|
|
109
139
|
if (volume < 0) {
|
|
110
140
|
is_valid = false;
|
|
111
141
|
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @see https://github.com/Kitware/VTK/blob/af928016f4041ad8a6a193d032355b909721fc95/Common/Core/vtkMath.cxx
|
|
7
7
|
*
|
|
8
|
-
* @param {number[]|Float32Array|Float64Array} A
|
|
9
|
-
* @param {number[]|Float32Array|Float64Array} x
|
|
10
|
-
* @param {number} size
|
|
8
|
+
* @param {number[]|Float32Array|Float64Array} A Matrix of coefficients
|
|
9
|
+
* @param {number[]|Float32Array|Float64Array} x Vector of right-hand constants for each equation, resulting solution for variables will also be written here
|
|
10
|
+
* @param {number} size size of the system. Size 1 means a single variable and a single equation, 2 means a 2 variable equation system etc
|
|
11
11
|
* @returns {boolean} true if solution found, false if factorization fails
|
|
12
12
|
*/
|
|
13
13
|
export function solve_linear_system(A: number[] | Float32Array | Float64Array, x: number[] | Float32Array | Float64Array, size: number): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"solve_linear_system.d.ts","sourceRoot":"","sources":["../../../../../src/core/math/linalg/solve_linear_system.js"],"names":[],"mappings":"AAQA;;;;;;;;;;;GAWG;AACH,uCALW,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,KAClC,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,QAClC,MAAM,GACJ,OAAO,
|
|
1
|
+
{"version":3,"file":"solve_linear_system.d.ts","sourceRoot":"","sources":["../../../../../src/core/math/linalg/solve_linear_system.js"],"names":[],"mappings":"AAQA;;;;;;;;;;;GAWG;AACH,uCALW,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,KAClC,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,QAClC,MAAM,GACJ,OAAO,CAqCnB"}
|
|
@@ -13,9 +13,9 @@ const scratch = new Uint32Array(SCRATCH_SIZE);
|
|
|
13
13
|
*
|
|
14
14
|
* @see https://github.com/Kitware/VTK/blob/af928016f4041ad8a6a193d032355b909721fc95/Common/Core/vtkMath.cxx
|
|
15
15
|
*
|
|
16
|
-
* @param {number[]|Float32Array|Float64Array} A
|
|
17
|
-
* @param {number[]|Float32Array|Float64Array} x
|
|
18
|
-
* @param {number} size
|
|
16
|
+
* @param {number[]|Float32Array|Float64Array} A Matrix of coefficients
|
|
17
|
+
* @param {number[]|Float32Array|Float64Array} x Vector of right-hand constants for each equation, resulting solution for variables will also be written here
|
|
18
|
+
* @param {number} size size of the system. Size 1 means a single variable and a single equation, 2 means a 2 variable equation system etc
|
|
19
19
|
* @returns {boolean} true if solution found, false if factorization fails
|
|
20
20
|
*/
|
|
21
21
|
export function solve_linear_system(A, x, size) {
|
|
@@ -35,6 +35,8 @@ export function solve_linear_system(A, x, size) {
|
|
|
35
35
|
|
|
36
36
|
} else if (size === 2) {
|
|
37
37
|
|
|
38
|
+
// special fast path for 2 variable systems
|
|
39
|
+
|
|
38
40
|
return solve_linear_system_GEPP_2x2(A, x, x);
|
|
39
41
|
|
|
40
42
|
}
|
|
@@ -42,6 +44,9 @@ export function solve_linear_system(A, x, size) {
|
|
|
42
44
|
const index = size <= SCRATCH_SIZE ? scratch : new Uint32Array(size);
|
|
43
45
|
|
|
44
46
|
if (lu_factor_linear_system(A, index, size) === false) {
|
|
47
|
+
|
|
48
|
+
// can not factorize system
|
|
49
|
+
|
|
45
50
|
return false;
|
|
46
51
|
}
|
|
47
52
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create_simplex_noise_2d.d.ts","sourceRoot":"","sources":["../../../../../src/core/math/noise/create_simplex_noise_2d.js"],"names":[],"mappings":"AAyDA;;;;GAIG;AACH,6EAFwB,MAAM,CAwG7B
|
|
1
|
+
{"version":3,"file":"create_simplex_noise_2d.d.ts","sourceRoot":"","sources":["../../../../../src/core/math/noise/create_simplex_noise_2d.js"],"names":[],"mappings":"AAyDA;;;;GAIG;AACH,6EAFwB,MAAM,CAwG7B"}
|
|
@@ -57,7 +57,7 @@ const grad4 = /*#__PURE__*/ new Float64Array([0, 1, 1, 1, 0, 1, 1, -1, 0, 1, -1,
|
|
|
57
57
|
|
|
58
58
|
/**
|
|
59
59
|
* Creates a 2D noise function
|
|
60
|
-
* @param random the random function that will be used to build the permutation table
|
|
60
|
+
* @param [random] the random function that will be used to build the permutation table
|
|
61
61
|
* @returns {function(x:number, y:number):number} producing values in range -1 .. 1
|
|
62
62
|
*/
|
|
63
63
|
export function create_simplex_noise_2d(random = Math.random) {
|
|
@@ -165,14 +165,11 @@ export function create_simplex_noise_2d(random = Math.random) {
|
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
/**
|
|
168
|
-
* Builds a random permutation table
|
|
169
|
-
* This is exported only for (internal) testing purposes.
|
|
170
|
-
* Do not rely on this export.
|
|
168
|
+
* Builds a random permutation table
|
|
171
169
|
* @param {function} random
|
|
172
|
-
* @param {Uint8Array} p
|
|
173
|
-
* @private
|
|
170
|
+
* @param {Uint8Array} p result will be written here
|
|
174
171
|
*/
|
|
175
|
-
|
|
172
|
+
function buildPermutationTable(random, p) {
|
|
176
173
|
const table_size = 512;
|
|
177
174
|
|
|
178
175
|
const half_table_size = table_size >>> 1;
|
|
@@ -190,6 +187,7 @@ export function buildPermutationTable(random, p) {
|
|
|
190
187
|
}
|
|
191
188
|
|
|
192
189
|
for (let i = 256; i < table_size; i++) {
|
|
190
|
+
// second half of the table just repeats the first half
|
|
193
191
|
p[i] = p[i - 256];
|
|
194
192
|
}
|
|
195
193
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spline_hermite3.spec.d.ts","sourceRoot":"","sources":["../../../../../src/core/math/spline/spline_hermite3.spec.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { spline_hermite3 } from "./spline_hermite3.js";
|
|
2
|
+
|
|
3
|
+
test("basics", () => {
|
|
4
|
+
|
|
5
|
+
// extremes
|
|
6
|
+
expect(spline_hermite3(0, -3, 7, 0, 0)).toBe(-3);
|
|
7
|
+
|
|
8
|
+
expect(spline_hermite3(1, -3, 7, 0, 0)).toBe(7);
|
|
9
|
+
|
|
10
|
+
expect(spline_hermite3(0, -3, 7, 10, 10)).toBe(-3);
|
|
11
|
+
|
|
12
|
+
expect(spline_hermite3(1, -3, 7, 10, 10)).toBe(7);
|
|
13
|
+
|
|
14
|
+
// midpoint on linear
|
|
15
|
+
|
|
16
|
+
expect(spline_hermite3(0.5, -3, 7, 10, 10)).toBe(2);
|
|
17
|
+
|
|
18
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Task.d.ts","sourceRoot":"","sources":["../../../../../src/core/process/task/Task.js"],"names":[],"mappings":";AAeA;
|
|
1
|
+
{"version":3,"file":"Task.d.ts","sourceRoot":"","sources":["../../../../../src/core/process/task/Task.js"],"names":[],"mappings":";AAeA;IA+MI;;;;OAIG;IACH,yBAHW,MAAM,CAAC,IAAI,YAAU,CAAC,CAAC,gBAOjC;IAED;;;OAGG;IACH,qBAFW,IAAI,YAAU,gBAIxB;IAED;;;;;OAKG;IACH,kBAJW,IAAI,6CAkBd;IAED;;;;;OAKG;IACH,sBAJW,IAAI,EAAE,6CAgChB;IA1PD;;;;;;;;;OASG;IACH,qGARW,MAAM,EA6DhB;IA9FD;;;OAGG;IACH,aAFU,MAAM,CAEE;IAElB;;;;MAIE;IAEF;;;OAGG;IACH,OAFU,eAAe,CAEsB;IAE/C;;;;OAIG;IACH,0BAHU,MAAM,CAGM;IACtB;;;;OAIG;IACH,6BAHU,MAAM,CAGS;IA4BrB;;;OAGG;IACH,cAFU,IAAI,EAAE,CAEgB;IAEhC;;;OAGG;IACH,mBAFU,MAAM,CAE0B;IAE1C;;;OAGG;IACH,MAFU,MAAM,CAEA;IAEhB;;;OAGG;IACH,aAFsB,UAAU,CAEN;IAE1B;;;OAGG;IACH,mBAFmB,IAAI,wCAEM;IAWjC,0BAUC;IAED;;;OAGG;IACH,sBAFa,MAAM,CAIlB;IAED,+BAEC;IAED;;;;OAIG;IACH,oBAHW,IAAI,YAAU,QAuBxB;IAED;;;OAGG;IACH,uBAFW,MAAM,CAAC,IAAI,YAAU,CAAC,CAAC,QAWjC;IAED,mBAEC;IAED;;;;OAIG;IACH,gDAEC;IAED;;OAEG;IACH,6DAkBC;IAED;;;OAGG;IACH,wBAEC;IAgFL;;;OAGG;IACH,iBAFU,OAAO,CAEI;CANpB;mBAxSkB,+BAA+B;4BAGtB,gCAAgC;2BACjC,iBAAiB"}
|
|
@@ -65,8 +65,10 @@ class Task {
|
|
|
65
65
|
estimatedDuration = 1
|
|
66
66
|
}
|
|
67
67
|
) {
|
|
68
|
+
assert.isString(name, 'name');
|
|
68
69
|
|
|
69
70
|
assert.isFunction(cycleFunction, 'cycleFunction');
|
|
71
|
+
assert.isFunction(initializer, 'initializer');
|
|
70
72
|
assert.isNumber(estimatedDuration, 'estimatedDuration');
|
|
71
73
|
|
|
72
74
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actionTask.d.ts","sourceRoot":"","sources":["../../../../../../src/core/process/task/util/actionTask.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"actionTask.d.ts","sourceRoot":"","sources":["../../../../../../src/core/process/task/util/actionTask.js"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,oDAHW,MAAM,GACL,IAAI,CAaf;iBApBgB,YAAY"}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
+
import { assert } from "../../../assert.js";
|
|
1
2
|
import Task from "../Task.js";
|
|
2
3
|
import { TaskSignal } from "../TaskSignal.js";
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
|
-
*
|
|
6
|
+
* Single-shot task. Executes supplied function once and resolved so success
|
|
6
7
|
* @param {function} action
|
|
7
|
-
* @param {string} name
|
|
8
|
+
* @param {string} [name]
|
|
8
9
|
* @return {Task}
|
|
9
10
|
*/
|
|
10
11
|
export function actionTask(action, name = "unnamed") {
|
|
12
|
+
assert.isString(name, 'name');
|
|
13
|
+
|
|
11
14
|
return new Task({
|
|
12
15
|
name,
|
|
13
16
|
cycleFunction() {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Produces a new task that wraps input, will execute input task but if input task fails - this wrapper task will still resolve in success
|
|
3
|
+
* @param {Task} task
|
|
4
|
+
* @returns {Task}
|
|
5
|
+
*/
|
|
6
|
+
export function ignoreFailureTask(task: Task): Task;
|
|
7
|
+
import Task from "../Task.js";
|
|
8
|
+
//# sourceMappingURL=ignoreFailureTask.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ignoreFailureTask.d.ts","sourceRoot":"","sources":["../../../../../../src/core/process/task/util/ignoreFailureTask.js"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,wCAHW,IAAI,GACF,IAAI,CA4ChB;iBAlDgB,YAAY"}
|
|
@@ -1,19 +1,24 @@
|
|
|
1
|
+
import { assert } from "../../../assert.js";
|
|
1
2
|
import Task from "../Task.js";
|
|
2
3
|
import { TaskSignal } from "../TaskSignal.js";
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
|
-
*
|
|
6
|
+
* Produces a new task that wraps input, will execute input task but if input task fails - this wrapper task will still resolve in success
|
|
6
7
|
* @param {Task} task
|
|
7
8
|
* @returns {Task}
|
|
8
9
|
*/
|
|
9
|
-
export function
|
|
10
|
+
export function ignoreFailureTask(task) {
|
|
11
|
+
assert.defined(task, 'task');
|
|
12
|
+
assert.isObject(task, 'task');
|
|
13
|
+
assert.equal(task.isTask, true, 'task.isTask !== true');
|
|
14
|
+
|
|
10
15
|
let initializationFailed = false;
|
|
11
16
|
|
|
12
17
|
const wrapper = new Task({
|
|
13
18
|
name: `Ignore Failure of [${task.name}]`,
|
|
14
|
-
initializer() {
|
|
19
|
+
initializer(me, executor) {
|
|
15
20
|
try {
|
|
16
|
-
task.initialize();
|
|
21
|
+
task.initialize(task, executor);
|
|
17
22
|
} catch (e) {
|
|
18
23
|
initializationFailed = true;
|
|
19
24
|
console.warn(e);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
*
|
|
3
3
|
* @param {TaskGroup|Task} root
|
|
4
|
-
* @return {number}
|
|
4
|
+
* @return {number} number of leaf tasks below supplied root
|
|
5
5
|
*/
|
|
6
6
|
export function task_tree_compute_leaf_tasks(root: TaskGroup | Task): number;
|
|
7
7
|
//# sourceMappingURL=task_tree_compute_leaf_tasks.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Sampler2D } from "../../../../graphics/texture/sampler/Sampler2D.js";
|
|
2
|
-
import sampler2D2Canvas from "../../../../graphics/texture/sampler/
|
|
2
|
+
import sampler2D2Canvas from "../../../../graphics/texture/sampler/sampler2d_to_html_canvas.js";
|
|
3
3
|
import { AssetRequestScope } from "../../../AssetRequestScope.js";
|
|
4
4
|
import { ArrayBufferLoader } from "../../ArrayBufferLoader.js";
|
|
5
5
|
import { PNGReader } from "./PNGReader.js";
|
package/src/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js
CHANGED
|
@@ -70,7 +70,7 @@ import { load_and_set_cubemap_v0 } from "../../../../../load_and_set_cubemap_v0.
|
|
|
70
70
|
import {
|
|
71
71
|
AmbientOcclusionPostProcessEffect
|
|
72
72
|
} from "../../../../../render/buffer/simple-fx/ao/AmbientOcclusionPostProcessEffect.js";
|
|
73
|
-
import
|
|
73
|
+
import sampler2d_to_html_canvas from "../../../../../texture/sampler/sampler2d_to_html_canvas.js";
|
|
74
74
|
import { threeUpdateTransform } from "../../../../../util/threeUpdateTransform.js";
|
|
75
75
|
import { ParticleEmitterSystem } from "../../../../ecs/ParticleEmitterSystem.js";
|
|
76
76
|
import { ParameterLookupTable } from "../../parameter/ParameterLookupTable.js";
|
|
@@ -1103,7 +1103,7 @@ function make_symbol_view({
|
|
|
1103
1103
|
|
|
1104
1104
|
const sampler_lut = lut_to_sampler(lut, view_lut.size.x, view_lut.size.y);
|
|
1105
1105
|
|
|
1106
|
-
|
|
1106
|
+
sampler2d_to_html_canvas(sampler_lut, 1, 0, view_lut.el);
|
|
1107
1107
|
|
|
1108
1108
|
symbol_view.addChild(view_lut)
|
|
1109
1109
|
|
|
@@ -31,7 +31,7 @@ import { makeGeometryIndexed } from "../../geometry/buffered/makeGeometryIndexed
|
|
|
31
31
|
import { DirectionalLight } from "../../render/forward_plus/model/DirectionalLight.js";
|
|
32
32
|
import { sampler2d_scale } from "../../texture/sampler/resize/sampler2d_scale.js";
|
|
33
33
|
import { Sampler2D } from "../../texture/sampler/Sampler2D.js";
|
|
34
|
-
import sampler2D2Canvas from "../../texture/sampler/
|
|
34
|
+
import sampler2D2Canvas from "../../texture/sampler/sampler2d_to_html_canvas.js";
|
|
35
35
|
import { PathTracedScene } from "./PathTracedScene.js";
|
|
36
36
|
import { PathTracer } from "./PathTracer.js";
|
|
37
37
|
import { make_sun, prepare_scene_gltf } from "./prepare_scene_gltf.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Sampler2D } from "../../../texture/sampler/Sampler2D.js";
|
|
2
|
-
import { CanvasView } from "../../../../../view/elements/CanvasView.js";
|
|
3
|
-
import sampler2D2Canvas from "../../../texture/sampler/Sampler2D2Canvas.js";
|
|
4
1
|
import { vec3 } from "gl-matrix";
|
|
2
|
+
import { CanvasView } from "../../../../../view/elements/CanvasView.js";
|
|
3
|
+
import { Sampler2D } from "../../../texture/sampler/Sampler2D.js";
|
|
4
|
+
import sampler2D2Canvas from "../../../texture/sampler/sampler2d_to_html_canvas.js";
|
|
5
5
|
import { make_sky_hosek } from "../../path_tracer/make_sky_hosek.js";
|
|
6
6
|
|
|
7
7
|
const view = new CanvasView();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CanvasView } from "../../../../../view/elements/CanvasView.js";
|
|
2
2
|
import EmptyView from "../../../../../view/elements/EmptyView.js";
|
|
3
|
-
import sampler2D2Canvas from "../
|
|
3
|
+
import sampler2D2Canvas from "../sampler2d_to_html_canvas.js";
|
|
4
4
|
|
|
5
5
|
export function debug_draw_sampler(engine, sampler, x = 0, y = 0) {
|
|
6
6
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { downloadUrlAsFile } from "../../../../core/binary/downloadUrlAsFile.js";
|
|
2
|
-
import {
|
|
2
|
+
import { sampler2d_to_data_url } from "./sampler2d_to_data_url.js";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
*
|
|
@@ -8,7 +8,7 @@ import { convertSampler2D2DataURL } from "./convertSampler2D2DataURL.js";
|
|
|
8
8
|
*/
|
|
9
9
|
export function downloadSampler2DAsPNG(sampler, file_name = 'image') {
|
|
10
10
|
|
|
11
|
-
const dataURL =
|
|
11
|
+
const dataURL = sampler2d_to_data_url(sampler);
|
|
12
12
|
|
|
13
13
|
downloadUrlAsFile(dataURL, `${file_name}.png`);
|
|
14
14
|
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts an input image to a data url string
|
|
3
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs
|
|
4
|
+
* @param {Sampler2D} sampler
|
|
5
|
+
* @returns {string}
|
|
6
|
+
*/
|
|
7
|
+
export function sampler2d_to_data_url(sampler: Sampler2D): string;
|
|
8
|
+
//# sourceMappingURL=sampler2d_to_data_url.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sampler2d_to_data_url.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/texture/sampler/sampler2d_to_data_url.js"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,2DAFa,MAAM,CAYlB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {
|
|
2
|
+
sampler2d_compute_texel_value_conversion_scale_to_uint8
|
|
3
|
+
} from "./sampler2d_compute_texel_value_conversion_scale_to_uint8.js";
|
|
4
|
+
import sampler2d_to_html_canvas from "./sampler2d_to_html_canvas.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Converts an input image to a data url string
|
|
8
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs
|
|
9
|
+
* @param {Sampler2D} sampler
|
|
10
|
+
* @returns {string}
|
|
11
|
+
*/
|
|
12
|
+
export function sampler2d_to_data_url(sampler) {
|
|
13
|
+
|
|
14
|
+
const canvas = document.createElement('canvas');
|
|
15
|
+
|
|
16
|
+
const { scale, offset } = sampler2d_compute_texel_value_conversion_scale_to_uint8(sampler);
|
|
17
|
+
|
|
18
|
+
sampler2d_to_html_canvas(sampler, scale, offset, canvas);
|
|
19
|
+
|
|
20
|
+
return canvas.toDataURL('image/png');
|
|
21
|
+
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sampler2d_to_data_url.spec.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/texture/sampler/sampler2d_to_data_url.spec.js"],"names":[],"mappings":""}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { convertSampler2D2DataURL } from "./convertSampler2D2DataURL.js";
|
|
2
1
|
import { Sampler2D } from "./Sampler2D.js";
|
|
2
|
+
import { sampler2d_to_data_url } from "./sampler2d_to_data_url.js";
|
|
3
3
|
|
|
4
4
|
// currently does not run in Node.js context due to reliance on HTMLCanvasElement that is absent in Node.js
|
|
5
5
|
test.skip("result is a data URL", () => {
|
|
6
|
-
const result =
|
|
6
|
+
const result = sampler2d_to_data_url(Sampler2D.uint8(4, 1, 1));
|
|
7
7
|
|
|
8
8
|
expect(typeof result).toBe('string');
|
|
9
9
|
expect(result.startsWith("data://")).toBe(true);
|
package/src/engine/graphics/texture/sampler/{Sampler2D2Canvas.d.ts → sampler2d_to_html_canvas.d.ts}
RENAMED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export default convertSampler2D2Canvas;
|
|
2
1
|
/**
|
|
3
2
|
*
|
|
4
3
|
* @param {Sampler2D} sampler
|
|
@@ -7,6 +6,7 @@ export default convertSampler2D2Canvas;
|
|
|
7
6
|
* @param {HTMLCanvasElement} [canvas] if no canvas is supplied, a new one will be created
|
|
8
7
|
* @returns {HTMLCanvasElement} canvas
|
|
9
8
|
*/
|
|
10
|
-
|
|
9
|
+
export function sampler2d_to_html_canvas(sampler: Sampler2D, scale?: number, offset?: number, canvas?: HTMLCanvasElement): HTMLCanvasElement;
|
|
10
|
+
export default sampler2d_to_html_canvas;
|
|
11
11
|
import { Sampler2D } from "./Sampler2D.js";
|
|
12
|
-
//# sourceMappingURL=
|
|
12
|
+
//# sourceMappingURL=sampler2d_to_html_canvas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sampler2d_to_html_canvas.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/texture/sampler/sampler2d_to_html_canvas.js"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,kDANW,SAAS,4CAGT,iBAAiB,GACf,iBAAiB,CA2E7B;;0BApFyB,gBAAgB"}
|
package/src/engine/graphics/texture/sampler/{Sampler2D2Canvas.js → sampler2d_to_html_canvas.js}
RENAMED
|
@@ -9,14 +9,14 @@ import { sampler2d_write_to_canvas_raw } from "./sampler2d_write_to_canvas_raw.j
|
|
|
9
9
|
* @param {HTMLCanvasElement} [canvas] if no canvas is supplied, a new one will be created
|
|
10
10
|
* @returns {HTMLCanvasElement} canvas
|
|
11
11
|
*/
|
|
12
|
-
function
|
|
12
|
+
export function sampler2d_to_html_canvas(
|
|
13
|
+
sampler,
|
|
14
|
+
scale = 255,
|
|
15
|
+
offset = 0,
|
|
16
|
+
canvas= document.createElement("canvas")
|
|
17
|
+
) {
|
|
13
18
|
const source_data = sampler.data;
|
|
14
19
|
|
|
15
|
-
//generate canvas
|
|
16
|
-
if (canvas === undefined) {
|
|
17
|
-
canvas = document.createElement("canvas");
|
|
18
|
-
}
|
|
19
|
-
|
|
20
20
|
const converted_sampler = Sampler2D.uint8clamped(4, sampler.width, sampler.height);
|
|
21
21
|
|
|
22
22
|
const width = sampler.width;
|
|
@@ -84,4 +84,4 @@ function convertSampler2D2Canvas(sampler, scale = 255, offset = 0, canvas) {
|
|
|
84
84
|
return canvas;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
export default
|
|
87
|
+
export default sampler2d_to_html_canvas;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawSamplerHTML.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/texture/sampler/util/drawSamplerHTML.js"],"names":[],"mappings":"AAKA;;;;;;;;;GASG;AACH,4CARW,WAAW,WACX,SAAS,KACT,MAAM,KACN,MAAM,SACN,MAAM,UACN,MAAM,QACN,MAAM,QA6BhB;
|
|
1
|
+
{"version":3,"file":"drawSamplerHTML.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/texture/sampler/util/drawSamplerHTML.js"],"names":[],"mappings":"AAKA;;;;;;;;;GASG;AACH,4CARW,WAAW,WACX,SAAS,KACT,MAAM,KACN,MAAM,SACN,MAAM,UACN,MAAM,QACN,MAAM,QA6BhB;0BAzCyB,iBAAiB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Sampler2D } from "../Sampler2D.js";
|
|
2
1
|
import { sampler2d_scale } from "../resize/sampler2d_scale.js";
|
|
3
|
-
import
|
|
2
|
+
import { Sampler2D } from "../Sampler2D.js";
|
|
3
|
+
import sampler2d_to_html_canvas from "../sampler2d_to_html_canvas.js";
|
|
4
4
|
import { typedArrayConstructorByInstance } from "../typedArrayConstructorByInstance.js";
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -33,7 +33,7 @@ export function drawSamplerHTML(parentNode, sampler, x, y, scale, offset, size)
|
|
|
33
33
|
|
|
34
34
|
sampler2d_scale(sampler, target);
|
|
35
35
|
|
|
36
|
-
const c =
|
|
36
|
+
const c = sampler2d_to_html_canvas(target, scale, offset);
|
|
37
37
|
c.style.zIndex = 1000;
|
|
38
38
|
c.style.position = "absolute";
|
|
39
39
|
c.style.left = `${x}px`;
|
|
@@ -13,7 +13,7 @@ import ViewportPositionSystem from "../../../ecs/gui/position/ViewportPositionSy
|
|
|
13
13
|
import { EngineHarness } from "../../../EngineHarness.js";
|
|
14
14
|
import { canvas2d_draw_path } from "../../canvas/canvas2d_draw_path.js";
|
|
15
15
|
import { Sampler2D } from "../sampler/Sampler2D.js";
|
|
16
|
-
import sampler2D2Canvas from "../sampler/
|
|
16
|
+
import sampler2D2Canvas from "../sampler/sampler2d_to_html_canvas.js";
|
|
17
17
|
import { make_edge_condition_channel_threshold } from "../sampler/search/make_edge_condition_channel_threshold.js";
|
|
18
18
|
import { sampler2d_find_pixels } from "../sampler/search/sampler2d_find_pixels.js";
|
|
19
19
|
|
|
@@ -6,7 +6,7 @@ import TaskGroup from "../../core/process/task/TaskGroup.js";
|
|
|
6
6
|
import TaskState from "../../core/process/task/TaskState.js";
|
|
7
7
|
import { actionTask } from "../../core/process/task/util/actionTask.js";
|
|
8
8
|
import { delayTask } from "../../core/process/task/util/delayTask.js";
|
|
9
|
-
import {
|
|
9
|
+
import { ignoreFailureTask } from "../../core/process/task/util/ignoreFailureTask.js";
|
|
10
10
|
import { TaskLoadingScreen } from "../../view/task/TaskLoadingScreen.js";
|
|
11
11
|
import { loadVisibleTerrainTiles } from "../ecs/terrain/util/loadVisibleTerrainTiles.js";
|
|
12
12
|
import { compileAllMaterials } from "../graphics/ecs/compileAllMaterials.js";
|
|
@@ -43,7 +43,7 @@ export function transitionToScene({
|
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|
//wait for visible terrain tiles to be loaded
|
|
46
|
-
const tWaitForVisibleTerrainTiles =
|
|
46
|
+
const tWaitForVisibleTerrainTiles = ignoreFailureTask(loadVisibleTerrainTiles({
|
|
47
47
|
em: engine.entityManager,
|
|
48
48
|
ecd: scene.dataset
|
|
49
49
|
}));
|
|
@@ -51,7 +51,7 @@ export function transitionToScene({
|
|
|
51
51
|
|
|
52
52
|
tWaitForVisibleTerrainTiles.addDependencies(tasks);
|
|
53
53
|
|
|
54
|
-
const tWaitForMeshes =
|
|
54
|
+
const tWaitForMeshes = ignoreFailureTask(createTaskWaitForMeshesToLoad(scene.dataset, engine, 7000));
|
|
55
55
|
|
|
56
56
|
tWaitForMeshes.addDependencies(tasks);
|
|
57
57
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { assert } from "../../../../core/assert.js";
|
|
2
|
-
import
|
|
2
|
+
import sampler2D2Canvas from "../../../../engine/graphics/texture/sampler/sampler2d_to_html_canvas.js";
|
|
3
|
+
import LabelView from "../../../../view/common/LabelView.js";
|
|
3
4
|
import { CanvasView } from "../../../../view/elements/CanvasView.js";
|
|
5
|
+
import EmptyView from "../../../../view/elements/EmptyView.js";
|
|
4
6
|
import { sampler_from_filter } from "./sampler_from_filter.js";
|
|
5
|
-
import sampler2D2Canvas from "../../../../engine/graphics/texture/sampler/Sampler2D2Canvas.js";
|
|
6
|
-
import LabelView from "../../../../view/common/LabelView.js";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MeshMatcapMaterial } from "three";
|
|
2
|
-
import
|
|
2
|
+
import sampler2d_to_html_canvas from "../engine/graphics/texture/sampler/sampler2d_to_html_canvas.js";
|
|
3
3
|
import { RadialMenuElementDefinition } from "../view/elements/radial/RadialMenuElementDefinition.js";
|
|
4
4
|
import View from "../view/View.js";
|
|
5
5
|
import { makeMaterialIconCached } from "./makeMaterialIconCached.js";
|
|
@@ -34,7 +34,7 @@ export async function makeMatcapSelectionOption(
|
|
|
34
34
|
material.dispose();
|
|
35
35
|
texture_object.dispose();
|
|
36
36
|
|
|
37
|
-
const canvasElement =
|
|
37
|
+
const canvasElement = sampler2d_to_html_canvas(icon, 1, 0);
|
|
38
38
|
|
|
39
39
|
const icon_view = new View();
|
|
40
40
|
icon_view.el = canvasElement;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* @param {TetrahedralMesh} mesh
|
|
4
|
-
* @param {ArrayLike<number>|number[]} points
|
|
5
|
-
* @param {number} tet_index
|
|
6
|
-
* @return {number}
|
|
7
|
-
*/
|
|
8
|
-
export function get_tetrahedron_volume(mesh: TetrahedralMesh, points: ArrayLike<number> | number[], tet_index: number): number;
|
|
9
|
-
//# sourceMappingURL=get_tetrahedron_volume.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get_tetrahedron_volume.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/tetrahedra/get_tetrahedron_volume.js"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,sEAJW,UAAU,MAAM,CAAC,GAAC,MAAM,EAAE,aAC1B,MAAM,GACL,MAAM,CAUjB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wrapTaskIgnoreFailure.d.ts","sourceRoot":"","sources":["../../../../../../src/core/process/task/util/wrapTaskIgnoreFailure.js"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,4CAHW,IAAI,GACF,IAAI,CAwChB;iBA9CgB,YAAY"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Sampler2D2Canvas.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/texture/sampler/Sampler2D2Canvas.js"],"names":[],"mappings":";AAGA;;;;;;;GAOG;AACH,kDANW,SAAS,4CAGT,iBAAiB,GACf,iBAAiB,CA2E7B;0BApFyB,gBAAgB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"convertSampler2D2DataURL.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/texture/sampler/convertSampler2D2DataURL.js"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,8DAFa,MAAM,CAclB"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import convertSampler2D2Canvas from "./Sampler2D2Canvas.js";
|
|
2
|
-
import {
|
|
3
|
-
sampler2d_compute_texel_value_conversion_scale_to_uint8
|
|
4
|
-
} from "./sampler2d_compute_texel_value_conversion_scale_to_uint8.js";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
*
|
|
8
|
-
* @param {Sampler2D} sampler
|
|
9
|
-
* @returns {string}
|
|
10
|
-
*/
|
|
11
|
-
export function convertSampler2D2DataURL(sampler) {
|
|
12
|
-
|
|
13
|
-
const canvasElement = document.createElement('canvas');
|
|
14
|
-
|
|
15
|
-
const ctx = canvasElement.getContext("2d");
|
|
16
|
-
|
|
17
|
-
const { scale, offset } = sampler2d_compute_texel_value_conversion_scale_to_uint8(sampler);
|
|
18
|
-
|
|
19
|
-
convertSampler2D2Canvas(sampler, scale, offset, canvasElement);
|
|
20
|
-
|
|
21
|
-
return ctx.canvas.toDataURL('image/png');
|
|
22
|
-
|
|
23
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"convertSampler2D2DataURL.spec.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/texture/sampler/convertSampler2D2DataURL.spec.js"],"names":[],"mappings":""}
|