@woosh/meep-engine 2.109.6 → 2.109.7
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/build/bundle-worker-terrain.js +1 -1
- package/build/meep.cjs +203 -174
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +203 -174
- package/editor/tools/v2/TransformControls.js +39 -33
- package/package.json +1 -1
- package/src/core/bvh2/bvh3/BVH.d.ts.map +1 -1
- package/src/core/bvh2/bvh3/BVH.js +8 -0
- package/src/core/bvh2/bvh3/ebvh_build_for_geometry_morton.d.ts.map +1 -1
- package/src/core/bvh2/bvh3/ebvh_build_for_geometry_morton.js +11 -9
- package/src/core/geom/3d/Ray3.js +1 -1
- package/src/core/geom/3d/aabb/AABB3.js +1 -1
- package/src/core/geom/3d/normal/octahedron/decode_octahedron_to_unit.d.ts +4 -4
- package/src/core/geom/3d/normal/octahedron/decode_octahedron_to_unit.d.ts.map +1 -1
- package/src/core/geom/3d/normal/octahedron/decode_octahedron_to_unit.js +15 -11
- package/src/core/geom/3d/normal/octahedron/encode_unit_to_octahedron.d.ts.map +1 -1
- package/src/core/geom/3d/normal/octahedron/encode_unit_to_octahedron.js +13 -7
- package/src/core/geom/3d/normal/octahedron/encoding.spec.js +26 -1
- package/src/core/geom/3d/normal/octahedron/prototype.d.ts +2 -0
- package/src/core/geom/3d/normal/octahedron/prototype.d.ts.map +1 -0
- package/src/core/geom/3d/normal/octahedron/prototype.js +226 -0
- package/src/core/geom/3d/sphere/harmonics/sh3_rotate_bl.d.ts +1 -1
- package/src/core/geom/3d/sphere/harmonics/sh3_rotate_bl.js +4 -4
- package/src/core/geom/3d/tetrahedra/triangle/triangle_encode_rasterized_depth.d.ts +7 -1
- package/src/core/geom/3d/tetrahedra/triangle/triangle_encode_rasterized_depth.d.ts.map +1 -1
- package/src/core/geom/3d/tetrahedra/triangle/triangle_encode_rasterized_depth.js +6 -0
- package/src/core/geom/vec3/v3_distance.d.ts.map +1 -1
- package/src/core/geom/vec3/v3_distance.js +5 -5
- package/src/core/geometry/3d/tetrahedra/tetrahedral_mesh_find_tets_attached_to_vertex.d.ts +10 -0
- package/src/core/geometry/3d/tetrahedra/tetrahedral_mesh_find_tets_attached_to_vertex.d.ts.map +1 -0
- package/src/core/geometry/3d/tetrahedra/tetrahedral_mesh_find_tets_attached_to_vertex.js +34 -0
- package/src/core/model/node-graph/json/serializeNodeGraphToJSON.d.ts +5 -1
- package/src/core/model/node-graph/json/serializeNodeGraphToJSON.d.ts.map +1 -1
- package/src/core/model/node-graph/json/serializeNodeGraphToJSON.js +11 -6
- package/src/engine/asset/loaders/AssetLoader.d.ts.map +1 -1
- package/src/engine/asset/loaders/AssetLoader.js +1 -1
- package/src/engine/asset/loaders/material/computeTextureEquality.d.ts.map +1 -1
- package/src/engine/asset/loaders/material/computeTextureEquality.js +6 -1
- package/src/engine/asset/loaders/material/computeTextureHash.d.ts.map +1 -1
- package/src/engine/asset/loaders/material/computeTextureHash.js +8 -3
- package/src/engine/graphics/geometry/instancing/InstancedMeshGroup.d.ts.map +1 -1
- package/src/engine/graphics/geometry/instancing/InstancedMeshGroup.js +9 -15
- package/src/engine/graphics/geometry/instancing/geometry_copy.d.ts +7 -0
- package/src/engine/graphics/geometry/instancing/geometry_copy.d.ts.map +1 -0
- package/src/engine/graphics/geometry/instancing/geometry_copy.js +15 -0
- package/src/engine/graphics/impostors/octahedral/ImpostorBaker.d.ts.map +1 -1
- package/src/engine/graphics/impostors/octahedral/ImpostorBaker.js +28 -20
- package/src/engine/graphics/impostors/octahedral/ImpostorCaptureType.d.ts +1 -0
- package/src/engine/graphics/impostors/octahedral/ImpostorCaptureType.d.ts.map +1 -1
- package/src/engine/graphics/impostors/octahedral/ImpostorCaptureType.js +4 -0
- package/src/engine/graphics/impostors/octahedral/grid/OctahedralUvEncoder.js +6 -6
- package/src/engine/graphics/impostors/octahedral/prototypeBaker.js +16 -7
- package/src/engine/graphics/impostors/octahedral/util/build_cutout_from_atlas_by_alpha.d.ts +3 -2
- package/src/engine/graphics/impostors/octahedral/util/build_cutout_from_atlas_by_alpha.d.ts.map +1 -1
- package/src/engine/graphics/impostors/octahedral/util/build_cutout_from_atlas_by_alpha.js +25 -14
- package/src/engine/graphics/render/visibility/hiz/buildCanvasViewFromTexture.js +1 -0
- package/src/engine/graphics/sh3/gi/material/MaterialTransformer.d.ts.map +1 -1
- package/src/engine/graphics/sh3/gi/material/MaterialTransformer.js +48 -33
- package/src/engine/graphics/sh3/gi/material/common.glsl +434 -0
- package/src/engine/graphics/sh3/gi/material/makeLookupTexture3D.d.ts +8 -0
- package/src/engine/graphics/sh3/gi/material/makeLookupTexture3D.d.ts.map +1 -0
- package/src/engine/graphics/sh3/gi/material/makeLookupTexture3D.js +35 -0
- package/src/engine/graphics/sh3/gi/material/makeOctahedralDepthAtlas.d.ts +8 -0
- package/src/engine/graphics/sh3/gi/material/makeOctahedralDepthAtlas.d.ts.map +1 -0
- package/src/engine/graphics/sh3/gi/material/makeOctahedralDepthAtlas.js +28 -0
- package/src/engine/graphics/sh3/gi/material/space_fragment/build_fragment_shader.d.ts.map +1 -0
- package/src/engine/graphics/sh3/gi/material/space_fragment/build_fragment_shader.js +53 -0
- package/src/engine/graphics/sh3/gi/material/space_fragment/build_vertex_shader.d.ts.map +1 -0
- package/src/engine/graphics/sh3/gi/material/space_fragment/build_vertex_shader.js +29 -0
- package/src/engine/graphics/sh3/gi/material/space_fragment/space_fragment_transform_shader.d.ts +9 -0
- package/src/engine/graphics/sh3/gi/material/space_fragment/space_fragment_transform_shader.d.ts.map +1 -0
- package/src/engine/graphics/sh3/gi/material/space_fragment/space_fragment_transform_shader.js +12 -0
- package/src/engine/graphics/sh3/gi/material/space_vertex/build_fragment_shader.d.ts +6 -0
- package/src/engine/graphics/sh3/gi/material/space_vertex/build_fragment_shader.d.ts.map +1 -0
- package/src/engine/graphics/sh3/gi/material/space_vertex/build_fragment_shader.js +26 -0
- package/src/engine/graphics/sh3/gi/material/space_vertex/build_vertex_shader.d.ts +6 -0
- package/src/engine/graphics/sh3/gi/material/space_vertex/build_vertex_shader.d.ts.map +1 -0
- package/src/engine/graphics/sh3/gi/material/space_vertex/build_vertex_shader.js +62 -0
- package/src/engine/graphics/sh3/gi/material/space_vertex/preable.frag.glsl +43 -0
- package/src/engine/graphics/sh3/gi/material/space_vertex/preable.vert.glsl +9 -0
- package/src/engine/graphics/sh3/gi/material/space_vertex/space_vertex_transform_shader.d.ts +9 -0
- package/src/engine/graphics/sh3/gi/material/space_vertex/space_vertex_transform_shader.d.ts.map +1 -0
- package/src/engine/graphics/sh3/gi/material/space_vertex/space_vertex_transform_shader.js +12 -0
- package/src/engine/graphics/sh3/lpv/LightProbeVolume.d.ts +2 -0
- package/src/engine/graphics/sh3/lpv/LightProbeVolume.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/LightProbeVolume.js +35 -3
- package/src/engine/graphics/sh3/lpv/LightProbeVolumeBaker.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/LightProbeVolumeBaker.js +67 -8
- package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.d.ts +10 -0
- package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.js +27 -41
- package/src/engine/graphics/sh3/lpv/depth/octahedral/OctahedralDepthDebuggerWidget.d.ts +17 -0
- package/src/engine/graphics/sh3/lpv/depth/octahedral/OctahedralDepthDebuggerWidget.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpv/depth/octahedral/OctahedralDepthDebuggerWidget.js +100 -0
- package/src/engine/graphics/sh3/lpv/depth/octahedral/bake_octahedral_depth_map.d.ts +12 -0
- package/src/engine/graphics/sh3/lpv/depth/octahedral/bake_octahedral_depth_map.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpv/depth/octahedral/bake_octahedral_depth_map.js +58 -0
- package/src/engine/graphics/sh3/lpv/depth/octahedral/shader/OctahedralDepthVisualizationMaterial.d.ts +11 -0
- package/src/engine/graphics/sh3/lpv/depth/octahedral/shader/OctahedralDepthVisualizationMaterial.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpv/depth/octahedral/shader/OctahedralDepthVisualizationMaterial.js +45 -0
- package/src/engine/graphics/sh3/lpv/depth/octahedral/shader/visualize.frag.glsl +126 -0
- package/src/engine/graphics/sh3/lpv/depth/octahedral/shader/visualize.vert.glsl +10 -0
- package/src/engine/graphics/sh3/lpv/depth/octahedral/v2/VLPDepthMapVisualisation.d.ts +13 -0
- package/src/engine/graphics/sh3/lpv/depth/octahedral/v2/VLPDepthMapVisualisation.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpv/depth/octahedral/v2/VLPDepthMapVisualisation.js +146 -0
- package/src/engine/graphics/sh3/lpv/depth/octahedral/v2/visualise.frag.glsl +159 -0
- package/src/engine/graphics/sh3/lpv/depth/octahedral/v2/visualise.vert.glsl +13 -0
- package/src/engine/graphics/sh3/lpv/depth/sh3_bake_depth.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpv/{sh3_bake_depth.js → depth/sh3_bake_depth.js} +7 -7
- package/src/engine/graphics/sh3/lpv/probe_volume_to_textures.d.ts +3 -6
- package/src/engine/graphics/sh3/lpv/probe_volume_to_textures.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/probe_volume_to_textures.js +34 -58
- package/src/engine/graphics/sh3/lpv/serialization/LightProbeVolumeSerializationAdapter.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/serialization/LightProbeVolumeSerializationAdapter.js +8 -0
- package/src/engine/graphics/sh3/path_tracer/BufferedGeometryBVH.d.ts +2 -2
- package/src/engine/graphics/sh3/path_tracer/BufferedGeometryBVH.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/BufferedGeometryBVH.js +8 -5
- package/src/engine/graphics/sh3/path_tracer/populate_path_traced_scene_from_ecd.d.ts +7 -0
- package/src/engine/graphics/sh3/path_tracer/populate_path_traced_scene_from_ecd.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/populate_path_traced_scene_from_ecd.js +50 -0
- package/src/engine/graphics/sh3/path_tracer/prototypePathTracer.js +40 -3
- package/src/engine/graphics/sh3/path_tracer/sorting/build_bvh_nodes_distances_along_ray.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/{build_bvh_nodes_distances_along_ray.js → sorting/build_bvh_nodes_distances_along_ray.js} +2 -2
- package/src/engine/graphics/sh3/path_tracer/sorting/build_bvh_nodes_distances_sqr_to_point.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/{build_bvh_nodes_distances_sqr_to_point.js → sorting/build_bvh_nodes_distances_sqr_to_point.js} +2 -2
- package/src/engine/graphics/sh3/path_tracer/sorting/sort_bvh_nodes_by_distance_to_point.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/{sort_bvh_nodes_by_distance_to_point.js → sorting/sort_bvh_nodes_by_distance_to_point.js} +3 -3
- package/src/engine/graphics/sh3/prototypeSH3Probe.js +40 -7
- package/src/engine/graphics/sh3/shader/SH3VisualisationMaterial.d.ts.map +1 -0
- package/src/engine/graphics/sh3/shader/SH3VisualisationMaterial.js +29 -0
- package/src/engine/graphics/sh3/shader/visualize.frag.glsl +41 -0
- package/src/engine/graphics/sh3/shader/visualize.vert.glsl +9 -0
- package/src/engine/graphics/sh3/visualise_spherical_harmonic_sphere.js +1 -1
- package/src/engine/graphics/texture/debug_preview_texture.d.ts +8 -0
- package/src/engine/graphics/texture/debug_preview_texture.d.ts.map +1 -0
- package/src/engine/graphics/texture/debug_preview_texture.js +38 -0
- package/src/view/View.d.ts.map +1 -1
- package/src/view/View.js +2 -0
- package/src/core/geom/3d/sphere/harmonics/sh3_rotate_filament.d.ts +0 -8
- package/src/core/geom/3d/sphere/harmonics/sh3_rotate_filament.d.ts.map +0 -1
- package/src/core/geom/3d/sphere/harmonics/sh3_rotate_filament.js +0 -32
- package/src/core/geom/3d/sphere/harmonics/sh_rotate_band1.d.ts +0 -8
- package/src/core/geom/3d/sphere/harmonics/sh_rotate_band1.d.ts.map +0 -1
- package/src/core/geom/3d/sphere/harmonics/sh_rotate_band1.js +0 -44
- package/src/core/geom/3d/sphere/harmonics/sh_rotate_band2.d.ts +0 -8
- package/src/core/geom/3d/sphere/harmonics/sh_rotate_band2.d.ts.map +0 -1
- package/src/core/geom/3d/sphere/harmonics/sh_rotate_band2.js +0 -86
- package/src/engine/graphics/sh3/SH3VisualisationMaterial.d.ts.map +0 -1
- package/src/engine/graphics/sh3/SH3VisualisationMaterial.js +0 -83
- package/src/engine/graphics/sh3/gi/material/build_fragment_shader.d.ts.map +0 -1
- package/src/engine/graphics/sh3/gi/material/build_fragment_shader.js +0 -71
- package/src/engine/graphics/sh3/gi/material/build_vertex_shader.d.ts.map +0 -1
- package/src/engine/graphics/sh3/gi/material/build_vertex_shader.js +0 -256
- package/src/engine/graphics/sh3/lpv/sh3_bake_depth.d.ts.map +0 -1
- package/src/engine/graphics/sh3/path_tracer/build_bvh_nodes_distances_along_ray.d.ts.map +0 -1
- package/src/engine/graphics/sh3/path_tracer/build_bvh_nodes_distances_sqr_to_point.d.ts.map +0 -1
- package/src/engine/graphics/sh3/path_tracer/ray_reflect.d.ts +0 -2
- package/src/engine/graphics/sh3/path_tracer/ray_reflect.d.ts.map +0 -1
- package/src/engine/graphics/sh3/path_tracer/ray_reflect.js +0 -27
- package/src/engine/graphics/sh3/path_tracer/sort_bvh_nodes_by_distance_to_point.d.ts.map +0 -1
- /package/src/engine/graphics/sh3/gi/material/{build_fragment_shader.d.ts → space_fragment/build_fragment_shader.d.ts} +0 -0
- /package/src/engine/graphics/sh3/gi/material/{build_vertex_shader.d.ts → space_fragment/build_vertex_shader.d.ts} +0 -0
- /package/src/engine/graphics/sh3/lpv/{sh3_bake_depth.d.ts → depth/sh3_bake_depth.d.ts} +0 -0
- /package/src/engine/graphics/sh3/path_tracer/{build_bvh_nodes_distances_along_ray.d.ts → sorting/build_bvh_nodes_distances_along_ray.d.ts} +0 -0
- /package/src/engine/graphics/sh3/path_tracer/{build_bvh_nodes_distances_sqr_to_point.d.ts → sorting/build_bvh_nodes_distances_sqr_to_point.d.ts} +0 -0
- /package/src/engine/graphics/sh3/path_tracer/{sort_bvh_nodes_by_distance_to_point.d.ts → sorting/sort_bvh_nodes_by_distance_to_point.d.ts} +0 -0
- /package/src/engine/graphics/sh3/{SH3VisualisationMaterial.d.ts → shader/SH3VisualisationMaterial.d.ts} +0 -0
|
@@ -6,7 +6,7 @@ import { aabb3_from_v3_array } from "../../geom/3d/aabb/aabb3_from_v3_array.js";
|
|
|
6
6
|
import { aabb3_compute_from_triangle } from "../../geom/3d/aabb3_compute_from_triangle.js";
|
|
7
7
|
import { max2 } from "../../math/max2.js";
|
|
8
8
|
import { build_triangle_morton_codes } from "./build_triangle_morton_codes.js";
|
|
9
|
-
import { ELEMENT_WORD_COUNT, NULL_NODE } from "./BVH.js";
|
|
9
|
+
import { COLUMN_CHILD_1, COLUMN_HEIGHT, COLUMN_USER_DATA, ELEMENT_WORD_COUNT, NULL_NODE } from "./BVH.js";
|
|
10
10
|
import { ebvh_build_hierarchy } from "./ebvh_build_hierarchy.js";
|
|
11
11
|
|
|
12
12
|
/**
|
|
@@ -75,6 +75,10 @@ export function ebvh_build_for_geometry_morton(
|
|
|
75
75
|
// sort leaves by morton codes
|
|
76
76
|
array_quick_sort_by_lookup_uint(sorted_triangle_order, morton_codes, 0, tri_count - 1);
|
|
77
77
|
|
|
78
|
+
|
|
79
|
+
const bvh_float32 = bvh.__data_float32;
|
|
80
|
+
const bvh_uint32 = bvh.__data_uint32;
|
|
81
|
+
|
|
78
82
|
// assign leaves
|
|
79
83
|
for (let i = 0; i < tri_count; i++) {
|
|
80
84
|
const node = nodes[i];
|
|
@@ -87,17 +91,15 @@ export function ebvh_build_for_geometry_morton(
|
|
|
87
91
|
const b_index = index_array[triangle_index3 + 1];
|
|
88
92
|
const c_index = index_array[triangle_index3 + 2];
|
|
89
93
|
|
|
90
|
-
const
|
|
91
|
-
|
|
94
|
+
const node_address = ELEMENT_WORD_COUNT * node;
|
|
92
95
|
aabb3_compute_from_triangle(
|
|
93
|
-
|
|
96
|
+
bvh_float32, node_address,
|
|
94
97
|
position_array, a_index, b_index, c_index
|
|
95
98
|
);
|
|
96
99
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
bvh.node_set_height(node, 0);
|
|
100
|
+
bvh_uint32[node_address + COLUMN_CHILD_1] = NULL_NODE; //mark node as a leaf
|
|
101
|
+
bvh_uint32[node_address + COLUMN_USER_DATA] = triangle_index;
|
|
102
|
+
bvh_uint32[node_address + COLUMN_HEIGHT] = 0;
|
|
101
103
|
}
|
|
102
104
|
|
|
103
105
|
// record newly generated nodes as "unprocessed"
|
|
@@ -105,5 +107,5 @@ export function ebvh_build_for_geometry_morton(
|
|
|
105
107
|
array_copy(nodes, 0, unprocessed_nodes, 0, tri_count);
|
|
106
108
|
|
|
107
109
|
// assign root
|
|
108
|
-
bvh.
|
|
110
|
+
bvh.root = ebvh_build_hierarchy(bvh, unprocessed_nodes, tri_count, nodes, tri_count);
|
|
109
111
|
}
|
package/src/core/geom/3d/Ray3.js
CHANGED
|
@@ -629,7 +629,7 @@ export class AABB3 {
|
|
|
629
629
|
|
|
630
630
|
/**
|
|
631
631
|
* Get center position of the box
|
|
632
|
-
* @param {Vector3} target where to write result
|
|
632
|
+
* @param {Vector3} [target] where to write result
|
|
633
633
|
*/
|
|
634
634
|
getCenter(target = new Vector3()) {
|
|
635
635
|
const x = this.getCenterX();
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @see A Survey of Efficient Representations for Independent Unit Vectors (Journal of Computer Graphics Techniques Vol. 3, No. 2, 2014) - page 13
|
|
3
3
|
* @see https://gamedev.stackexchange.com/questions/169508/octahedral-impostors-octahedral-mapping
|
|
4
|
-
* @param {number[]|Vector3} output
|
|
4
|
+
* @param {number[]|Vector3|Float32Array} output
|
|
5
5
|
* @param {number} output_offset
|
|
6
|
-
* @param {number}
|
|
7
|
-
* @param {number}
|
|
6
|
+
* @param {number} u range [-1,1]
|
|
7
|
+
* @param {number} v range [-1,1]
|
|
8
8
|
*/
|
|
9
|
-
export function decode_octahedron_to_unit(output: number[] | Vector3, output_offset: number,
|
|
9
|
+
export function decode_octahedron_to_unit(output: number[] | Vector3 | Float32Array, output_offset: number, u: number, v: number): void;
|
|
10
10
|
//# sourceMappingURL=decode_octahedron_to_unit.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decode_octahedron_to_unit.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/normal/octahedron/decode_octahedron_to_unit.js"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,kDALW,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"decode_octahedron_to_unit.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/normal/octahedron/decode_octahedron_to_unit.js"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,kDALW,MAAM,EAAE,aAAS,YAAY,iBAC7B,MAAM,KACN,MAAM,KACN,MAAM,QA0BhB"}
|
|
@@ -3,23 +3,27 @@ import { sign_not_zero } from "../../../../math/sign_not_zero.js";
|
|
|
3
3
|
/**
|
|
4
4
|
* @see A Survey of Efficient Representations for Independent Unit Vectors (Journal of Computer Graphics Techniques Vol. 3, No. 2, 2014) - page 13
|
|
5
5
|
* @see https://gamedev.stackexchange.com/questions/169508/octahedral-impostors-octahedral-mapping
|
|
6
|
-
* @param {number[]|Vector3} output
|
|
6
|
+
* @param {number[]|Vector3|Float32Array} output
|
|
7
7
|
* @param {number} output_offset
|
|
8
|
-
* @param {number}
|
|
9
|
-
* @param {number}
|
|
8
|
+
* @param {number} u range [-1,1]
|
|
9
|
+
* @param {number} v range [-1,1]
|
|
10
10
|
*/
|
|
11
|
-
export function decode_octahedron_to_unit(
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
export function decode_octahedron_to_unit(
|
|
12
|
+
output, output_offset,
|
|
13
|
+
u, v
|
|
14
|
+
) {
|
|
15
|
+
let v_x = u;
|
|
16
|
+
let v_z = v;
|
|
14
17
|
|
|
15
18
|
const abs_x = Math.abs(v_x);
|
|
16
|
-
const
|
|
19
|
+
const abs_z = Math.abs(v_z);
|
|
17
20
|
|
|
18
|
-
let
|
|
21
|
+
let v_y = 1 - abs_x - abs_z;
|
|
19
22
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
// Handle octahedron's fold
|
|
24
|
+
if (v_y < 0) {
|
|
25
|
+
v_x = (1 - abs_z) * sign_not_zero(v_x);
|
|
26
|
+
v_z = (1 - abs_x) * sign_not_zero(v_z);
|
|
23
27
|
}
|
|
24
28
|
|
|
25
29
|
// normalize
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encode_unit_to_octahedron.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/normal/octahedron/encode_unit_to_octahedron.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH,kDANW,MAAM,EAAE,iBACR,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,
|
|
1
|
+
{"version":3,"file":"encode_unit_to_octahedron.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/normal/octahedron/encode_unit_to_octahedron.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH,kDANW,MAAM,EAAE,iBACR,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,QA0BhB"}
|
|
@@ -12,20 +12,26 @@ import { sign_not_zero } from "../../../../math/sign_not_zero.js";
|
|
|
12
12
|
* @param {number} y range [-1,1]
|
|
13
13
|
* @param {number} z range [-1,1]
|
|
14
14
|
*/
|
|
15
|
-
export function encode_unit_to_octahedron(
|
|
15
|
+
export function encode_unit_to_octahedron(
|
|
16
|
+
output, output_offset,
|
|
17
|
+
x, y, z
|
|
18
|
+
) {
|
|
19
|
+
|
|
16
20
|
// Project the sphere onto the octahedron, and then onto the xy plane
|
|
17
|
-
const
|
|
21
|
+
const abs_sum = Math.abs(x) + Math.abs(y) + Math.abs(z);
|
|
22
|
+
|
|
23
|
+
const inverse_sum = 1 / abs_sum;
|
|
18
24
|
|
|
19
|
-
let p_x = x *
|
|
20
|
-
let p_y = y *
|
|
25
|
+
let p_x = x * inverse_sum;
|
|
26
|
+
let p_y = y * inverse_sum;
|
|
21
27
|
|
|
22
28
|
// Reflect the folds of the lower hemisphere over the diagonals
|
|
23
|
-
if (z
|
|
29
|
+
if (z < 0) {
|
|
24
30
|
const abs_x = Math.abs(p_x);
|
|
25
31
|
const abs_y = Math.abs(p_y);
|
|
26
32
|
|
|
27
|
-
p_x =
|
|
28
|
-
p_y =
|
|
33
|
+
p_x = (1 - abs_y) * sign_not_zero(p_x);
|
|
34
|
+
p_y = (1 - abs_x) * sign_not_zero(p_y);
|
|
29
35
|
}
|
|
30
36
|
|
|
31
37
|
output[output_offset] = p_x;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { encode_unit_to_octahedron } from "./encode_unit_to_octahedron.js";
|
|
2
1
|
import { decode_octahedron_to_unit } from "./decode_octahedron_to_unit.js";
|
|
2
|
+
import { encode_unit_to_octahedron } from "./encode_unit_to_octahedron.js";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
*
|
|
@@ -26,4 +26,29 @@ test("encoding/decoding consistency", () => {
|
|
|
26
26
|
|
|
27
27
|
// center
|
|
28
28
|
try_one(0.5, 0.5);
|
|
29
|
+
|
|
30
|
+
// sweep
|
|
31
|
+
try_one(0.1, 0);
|
|
32
|
+
try_one(0.1, 0.1);
|
|
33
|
+
try_one(0.1, 0.4);
|
|
34
|
+
try_one(0.1, 0.6);
|
|
35
|
+
try_one(0.1, 0.9);
|
|
36
|
+
|
|
37
|
+
try_one(0.4, 0);
|
|
38
|
+
try_one(0.4, 0.1);
|
|
39
|
+
try_one(0.4, 0.4);
|
|
40
|
+
try_one(0.4, 0.6);
|
|
41
|
+
try_one(0.4, 0.9);
|
|
42
|
+
|
|
43
|
+
try_one(0.6, 0);
|
|
44
|
+
try_one(0.6, 0.1);
|
|
45
|
+
try_one(0.6, 0.4);
|
|
46
|
+
try_one(0.6, 0.6);
|
|
47
|
+
try_one(0.6, 0.9);
|
|
48
|
+
|
|
49
|
+
try_one(0.9, 0);
|
|
50
|
+
try_one(0.9, 0.1);
|
|
51
|
+
try_one(0.9, 0.4);
|
|
52
|
+
try_one(0.9, 0.6);
|
|
53
|
+
try_one(0.9, 0.9);
|
|
29
54
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prototype.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/normal/octahedron/prototype.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AmbientLight,
|
|
3
|
+
Mesh,
|
|
4
|
+
MeshStandardMaterial,
|
|
5
|
+
OctahedronBufferGeometry,
|
|
6
|
+
PerspectiveCamera,
|
|
7
|
+
Scene,
|
|
8
|
+
TextureLoader,
|
|
9
|
+
Vector3,
|
|
10
|
+
WebGLRenderer
|
|
11
|
+
} from "three";
|
|
12
|
+
import { OrbitControls } from "three/examples/jsm/controls/OrbitControls.js";
|
|
13
|
+
import { makeSolidArrowGeometry } from "../../../../../../editor/process/symbolic/makeSolidArrowGeometry.js";
|
|
14
|
+
import { AssetManager } from "../../../../../engine/asset/AssetManager.js";
|
|
15
|
+
import { ImageRGBADataLoader } from "../../../../../engine/asset/loaders/image/ImageRGBADataLoader.js";
|
|
16
|
+
import sampler2D2Canvas from "../../../../../engine/graphics/texture/sampler/Sampler2D2Canvas.js";
|
|
17
|
+
import { MouseEvents } from "../../../../../engine/input/devices/events/MouseEvents.js";
|
|
18
|
+
import { CSS_ABSOLUTE_POSITIONING } from "../../../../../view/CSS_ABSOLUTE_POSITIONING.js";
|
|
19
|
+
import { CanvasView } from "../../../../../view/elements/CanvasView.js";
|
|
20
|
+
import EmptyView from "../../../../../view/elements/EmptyView.js";
|
|
21
|
+
import { Color } from "../../../../color/Color.js";
|
|
22
|
+
import { decode_octahedron_to_unit } from "./decode_octahedron_to_unit.js";
|
|
23
|
+
|
|
24
|
+
const renderer = new WebGLRenderer();
|
|
25
|
+
|
|
26
|
+
const scene = new Scene();
|
|
27
|
+
|
|
28
|
+
const camera = new PerspectiveCamera();
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
function onWindowResize() {
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
camera.aspect = window.innerWidth / window.innerHeight;
|
|
35
|
+
camera.updateProjectionMatrix();
|
|
36
|
+
renderer.setSize(window.innerWidth, window.innerHeight);
|
|
37
|
+
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
onWindowResize();
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
window.addEventListener('resize', onWindowResize, false);
|
|
45
|
+
|
|
46
|
+
const vContainer = new EmptyView({
|
|
47
|
+
css: {
|
|
48
|
+
...CSS_ABSOLUTE_POSITIONING
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const vCanvas = new CanvasView();
|
|
53
|
+
vCanvas.size.set(512, 512);
|
|
54
|
+
|
|
55
|
+
vContainer.addChild(vCanvas);
|
|
56
|
+
|
|
57
|
+
const assetManager = new AssetManager();
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
function placeMarker(u, v, color = "rgba(255,0,0,1)") {
|
|
61
|
+
|
|
62
|
+
const direciton_0 = new Vector3(0, 1, 0);
|
|
63
|
+
|
|
64
|
+
const encoded = [];
|
|
65
|
+
decode_octahedron_to_unit(encoded, 0, u, v);
|
|
66
|
+
|
|
67
|
+
direciton_0.fromArray(encoded);
|
|
68
|
+
|
|
69
|
+
const arrow_mesh_0 = new Mesh(
|
|
70
|
+
makeSolidArrowGeometry(),
|
|
71
|
+
new MeshStandardMaterial({
|
|
72
|
+
color: color
|
|
73
|
+
})
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
arrow_mesh_0.position.copy(direciton_0).multiplyScalar(1);
|
|
77
|
+
|
|
78
|
+
arrow_mesh_0.lookAt(
|
|
79
|
+
arrow_mesh_0.position.clone().add(direciton_0)
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
scene.add(arrow_mesh_0);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function canvasPlaceDot(u, v, color = "rgba(255,0,0,1)") {
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
const marker_0 = new EmptyView({
|
|
89
|
+
css: {
|
|
90
|
+
...CSS_ABSOLUTE_POSITIONING,
|
|
91
|
+
borderRadius: "5px",
|
|
92
|
+
width: "5px",
|
|
93
|
+
height: "5px",
|
|
94
|
+
background: color,
|
|
95
|
+
boxShadow: "0 0 4px 2px black"
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
marker_0.position.set(u * vCanvas.size.x, v * vCanvas.size.y);
|
|
100
|
+
|
|
101
|
+
vContainer.addChild(marker_0);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
async function init_debug() {
|
|
105
|
+
|
|
106
|
+
const ctx2d = vCanvas.context2d;
|
|
107
|
+
|
|
108
|
+
ctx2d.fillStyle = 'rgba(0,0,0,0.5)';
|
|
109
|
+
ctx2d.fillRect(0, 0, vCanvas.size.x, vCanvas.size.y);
|
|
110
|
+
|
|
111
|
+
const asset = await assetManager.promise("data/textures/utility/uv_map_reference.png", 'image');
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
*
|
|
115
|
+
* @type {Sampler2D}
|
|
116
|
+
*/
|
|
117
|
+
const sampler = asset.create();
|
|
118
|
+
|
|
119
|
+
sampler2D2Canvas(sampler, 1, 0, vCanvas.el);
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
const marker_0 = new EmptyView({
|
|
123
|
+
css: {
|
|
124
|
+
...CSS_ABSOLUTE_POSITIONING,
|
|
125
|
+
borderRadius: "5px",
|
|
126
|
+
width: "5px",
|
|
127
|
+
height: "5px",
|
|
128
|
+
background: "rgba(255,0,0,1)",
|
|
129
|
+
boxShadow: "0 0 4px 2px black"
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
function make_grid(RESOLUTION = 16) {
|
|
134
|
+
|
|
135
|
+
const color = new Color();
|
|
136
|
+
|
|
137
|
+
const sample_color = [255, 255, 255];
|
|
138
|
+
|
|
139
|
+
const pixel_size = 1 / RESOLUTION;
|
|
140
|
+
|
|
141
|
+
for (let i = 0; i < RESOLUTION; i++) {
|
|
142
|
+
|
|
143
|
+
for (let j = 0; j < RESOLUTION; j++) {
|
|
144
|
+
|
|
145
|
+
const u = (i) / (RESOLUTION);
|
|
146
|
+
const v = (j) / (RESOLUTION);
|
|
147
|
+
|
|
148
|
+
sampler.sampleBicubicUV(u + pixel_size * 0.1, v + pixel_size * 0.1, sample_color);
|
|
149
|
+
|
|
150
|
+
color.setRGBUint8(sample_color[0], sample_color[1], sample_color[2]);
|
|
151
|
+
|
|
152
|
+
const color_string = color.toCssRGBAString();
|
|
153
|
+
|
|
154
|
+
const centered_u = u + pixel_size * 0.5;
|
|
155
|
+
const centered_v = v + pixel_size * 0.5;
|
|
156
|
+
|
|
157
|
+
canvasPlaceDot(centered_u, centered_v, color_string);
|
|
158
|
+
placeMarker(centered_u * 2 - 1, centered_v * 2 - 1, color_string);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
make_grid(16);
|
|
165
|
+
|
|
166
|
+
vContainer.addChild(marker_0);
|
|
167
|
+
|
|
168
|
+
vCanvas.el.addEventListener(MouseEvents.Down,
|
|
169
|
+
/**
|
|
170
|
+
*
|
|
171
|
+
* @param {MouseEvent} mouseEvent
|
|
172
|
+
*/
|
|
173
|
+
(mouseEvent) => {
|
|
174
|
+
|
|
175
|
+
const x = mouseEvent.clientX;
|
|
176
|
+
const y = mouseEvent.clientY;
|
|
177
|
+
marker_0.position.set(x, y);
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
function animate() {
|
|
182
|
+
requestAnimationFrame(animate);
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
renderer.render(scene, camera);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
async function init() {
|
|
189
|
+
await assetManager.registerLoader('image', new ImageRGBADataLoader());
|
|
190
|
+
|
|
191
|
+
assetManager.startup();
|
|
192
|
+
|
|
193
|
+
document.body.appendChild(renderer.domElement);
|
|
194
|
+
document.body.appendChild(vContainer.el);
|
|
195
|
+
vContainer.link();
|
|
196
|
+
|
|
197
|
+
await init_debug();
|
|
198
|
+
|
|
199
|
+
// camera
|
|
200
|
+
|
|
201
|
+
camera.position.set(0, 0, -3);
|
|
202
|
+
camera.lookAt(0, 0, 0);
|
|
203
|
+
|
|
204
|
+
// meshes
|
|
205
|
+
|
|
206
|
+
const geometry = new OctahedronBufferGeometry(1, 3);
|
|
207
|
+
|
|
208
|
+
const texture = new TextureLoader().load("data/textures/utility/uv_map_reference.png");
|
|
209
|
+
texture.flipY = true;
|
|
210
|
+
|
|
211
|
+
const mesh = new Mesh(geometry, new MeshStandardMaterial({
|
|
212
|
+
map: texture
|
|
213
|
+
}));
|
|
214
|
+
|
|
215
|
+
scene.add(mesh);
|
|
216
|
+
|
|
217
|
+
// lights
|
|
218
|
+
|
|
219
|
+
scene.add(new AmbientLight(0x333333));
|
|
220
|
+
|
|
221
|
+
const controls = new OrbitControls(camera, document.body);
|
|
222
|
+
|
|
223
|
+
animate();
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
init();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const scratch_mat_5x5 = new Float64Array(25);
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Rotate spherical harmonics
|
|
5
5
|
* @param {number[]|Float32Array} result sh3
|
|
6
6
|
* @param {number[]} sh input
|
|
7
7
|
* @param {number[]} rotation 3x3 rotation matrix
|
|
@@ -22,15 +22,15 @@ export function sh3_rotate_bl(result, sh, rotation) {
|
|
|
22
22
|
const r22 = rotation[8];
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
// Constant
|
|
25
|
+
// band-0 : Constant
|
|
26
26
|
result[0] = sh[0];
|
|
27
27
|
|
|
28
|
-
// Linear
|
|
28
|
+
// band-1: Linear
|
|
29
29
|
result[1] = r11 * sh[1] - r12 * sh[2] + r10 * sh[3];
|
|
30
30
|
result[2] = -r21 * sh[1] + r22 * sh[2] - r20 * sh[3];
|
|
31
31
|
result[3] = r01 * sh[1] - r02 * sh[2] + r00 * sh[3];
|
|
32
32
|
|
|
33
|
-
// Quadratic
|
|
33
|
+
// band-2: Quadratic
|
|
34
34
|
const t41 = r01 * r00;
|
|
35
35
|
const t43 = r11 * r10;
|
|
36
36
|
const t48 = r11 * r12;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {number} barycentric_x
|
|
4
|
+
* @param {number} barycentric_y
|
|
5
|
+
* @returns {number}
|
|
6
|
+
*/
|
|
7
|
+
export function triangle_encode_rasterized_depth(barycentric_x: number, barycentric_y: number): number;
|
|
2
8
|
export function triangle_decode_depth(encodedDepth: any, input_offset: any, barycentric_x: any, barycentric_y: any): number;
|
|
3
9
|
//# sourceMappingURL=triangle_encode_rasterized_depth.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"triangle_encode_rasterized_depth.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/tetrahedra/triangle/triangle_encode_rasterized_depth.js"],"names":[],"mappings":"AAEA,
|
|
1
|
+
{"version":3,"file":"triangle_encode_rasterized_depth.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/tetrahedra/triangle/triangle_encode_rasterized_depth.js"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,gEAJW,MAAM,iBACN,MAAM,GACJ,MAAM,CA+ClB;AAkBD,4HAwCC"}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { uint8_to_float } from "../../../../binary/uint8_to_float.js";
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param {number} barycentric_x
|
|
6
|
+
* @param {number} barycentric_y
|
|
7
|
+
* @returns {number}
|
|
8
|
+
*/
|
|
3
9
|
export function triangle_encode_rasterized_depth(barycentric_x, barycentric_y) {
|
|
4
10
|
const sampleY = (barycentric_y * 4.0) >>> 0;
|
|
5
11
|
const sampleX = (barycentric_x * 4.0) >>> 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"v3_distance.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/vec3/v3_distance.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"v3_distance.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/vec3/v3_distance.js"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,gCARW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACJ,MAAM,CAOlB"}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { v3_distance_sqr } from "./v3_distance_sqr.js";
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
*
|
|
5
3
|
* @param {number} x0
|
|
@@ -10,7 +8,9 @@ import { v3_distance_sqr } from "./v3_distance_sqr.js";
|
|
|
10
8
|
* @param {number} z1
|
|
11
9
|
* @returns {number}
|
|
12
10
|
*/
|
|
13
|
-
export function v3_distance(
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
export function v3_distance(
|
|
12
|
+
x0, y0, z0,
|
|
13
|
+
x1, y1, z1
|
|
14
|
+
) {
|
|
15
|
+
return Math.hypot(x1 - x0, y1 - y0, z1 - z0);
|
|
16
16
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {number[]} result
|
|
4
|
+
* @param {number} result_offset
|
|
5
|
+
* @param {TetrahedralMesh} mesh
|
|
6
|
+
* @param {number} vertex_index
|
|
7
|
+
* @returns {number}
|
|
8
|
+
*/
|
|
9
|
+
export function tetrahedral_mesh_find_tets_attached_to_vertex(result: number[], result_offset: number, mesh: TetrahedralMesh, vertex_index: number): number;
|
|
10
|
+
//# sourceMappingURL=tetrahedral_mesh_find_tets_attached_to_vertex.d.ts.map
|
package/src/core/geometry/3d/tetrahedra/tetrahedral_mesh_find_tets_attached_to_vertex.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tetrahedral_mesh_find_tets_attached_to_vertex.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geometry/3d/tetrahedra/tetrahedral_mesh_find_tets_attached_to_vertex.js"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,sEANW,MAAM,EAAE,iBACR,MAAM,uCAEN,MAAM,GACJ,MAAM,CAyBlB"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { assert } from "../../../assert.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param {number[]} result
|
|
6
|
+
* @param {number} result_offset
|
|
7
|
+
* @param {TetrahedralMesh} mesh
|
|
8
|
+
* @param {number} vertex_index
|
|
9
|
+
* @returns {number}
|
|
10
|
+
*/
|
|
11
|
+
export function tetrahedral_mesh_find_tets_attached_to_vertex(
|
|
12
|
+
result, result_offset,
|
|
13
|
+
mesh, vertex_index
|
|
14
|
+
) {
|
|
15
|
+
|
|
16
|
+
assert.isNonNegativeInteger(vertex_index, "vertex_index");
|
|
17
|
+
|
|
18
|
+
let offset = result_offset;
|
|
19
|
+
|
|
20
|
+
mesh.forEach((tet) => {
|
|
21
|
+
|
|
22
|
+
for (let i = 0; i < 4; i++) {
|
|
23
|
+
const vert = mesh.getVertexIndex(tet, i);
|
|
24
|
+
|
|
25
|
+
if (vert === vertex_index) {
|
|
26
|
+
result[offset++] = tet;
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
return offset - result_offset;
|
|
34
|
+
}
|
|
@@ -5,7 +5,11 @@
|
|
|
5
5
|
* @param {Map<*,string>} [classNames]
|
|
6
6
|
*/
|
|
7
7
|
export function serializeNodeGraphToJSON({ graph, serializers, classNames }: NodeGraph): {
|
|
8
|
-
nodes:
|
|
8
|
+
nodes: {
|
|
9
|
+
id: any;
|
|
10
|
+
description: number;
|
|
11
|
+
parameters: {};
|
|
12
|
+
}[];
|
|
9
13
|
connections: any[];
|
|
10
14
|
descriptions: any[];
|
|
11
15
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serializeNodeGraphToJSON.d.ts","sourceRoot":"","sources":["../../../../../../src/core/model/node-graph/json/serializeNodeGraphToJSON.js"],"names":[],"mappings":"AA0BA;;;;;GAKG;AACH
|
|
1
|
+
{"version":3,"file":"serializeNodeGraphToJSON.d.ts","sourceRoot":"","sources":["../../../../../../src/core/model/node-graph/json/serializeNodeGraphToJSON.js"],"names":[],"mappings":"AA0BA;;;;;GAKG;AACH;;;;;;;;EA6EC"}
|
|
@@ -49,7 +49,9 @@ export function serializeNodeGraphToJSON({ graph, serializers = new Map(), class
|
|
|
49
49
|
const descriptions = [];
|
|
50
50
|
|
|
51
51
|
// extract node descriptions
|
|
52
|
-
graph.
|
|
52
|
+
const node_instances = graph.getNodes();
|
|
53
|
+
for (let i = 0; i < node_instances.length; i++) {
|
|
54
|
+
const node = node_instances[i];
|
|
53
55
|
|
|
54
56
|
const description = node.description;
|
|
55
57
|
|
|
@@ -57,7 +59,7 @@ export function serializeNodeGraphToJSON({ graph, serializers = new Map(), class
|
|
|
57
59
|
|
|
58
60
|
if (index !== -1) {
|
|
59
61
|
// already recorded
|
|
60
|
-
|
|
62
|
+
continue;
|
|
61
63
|
}
|
|
62
64
|
|
|
63
65
|
index = description_objects.length;
|
|
@@ -66,19 +68,22 @@ export function serializeNodeGraphToJSON({ graph, serializers = new Map(), class
|
|
|
66
68
|
description_to_index_map.set(description, index);
|
|
67
69
|
|
|
68
70
|
descriptions[index] = abstractJSONSerializer(description, serializers, classNames);
|
|
69
|
-
}
|
|
71
|
+
}
|
|
70
72
|
|
|
71
73
|
const nodes = [];
|
|
72
74
|
|
|
73
|
-
|
|
75
|
+
for (let i = 0; i < node_instances.length; i++) {
|
|
76
|
+
const node = node_instances[i];
|
|
77
|
+
|
|
78
|
+
const parameters = nodeParametersToJSON(node, serializers, classNames);
|
|
74
79
|
|
|
75
80
|
nodes.push({
|
|
76
81
|
id: node.id,
|
|
77
82
|
description: description_to_index_map.get(node.description),
|
|
78
|
-
parameters:
|
|
83
|
+
parameters: parameters
|
|
79
84
|
});
|
|
80
85
|
|
|
81
|
-
}
|
|
86
|
+
}
|
|
82
87
|
|
|
83
88
|
const connections = [];
|
|
84
89
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssetLoader.d.ts","sourceRoot":"","sources":["../../../../../src/engine/asset/loaders/AssetLoader.js"],"names":[],"mappings":"AAAA;;;GAGG;AACH;IACI;;;OAGG;IACH,2BAAoB;IAEpB;;;OAGG;IACH,SAFU,GAAG,CAEE;IAEf;;;;OAIG;IACH,0CAFW,GAAG,iBAKb;IAED;;OAEG;IACH,wBAEC;IAED;;;;;;;OAOG;IACH,qCALW,MAAM,
|
|
1
|
+
{"version":3,"file":"AssetLoader.d.ts","sourceRoot":"","sources":["../../../../../src/engine/asset/loaders/AssetLoader.js"],"names":[],"mappings":"AAAA;;;GAGG;AACH;IACI;;;OAGG;IACH,2BAAoB;IAEpB;;;OAGG;IACH,SAFU,GAAG,CAEE;IAEf;;;;OAIG;IACH,0CAFW,GAAG,iBAKb;IAED;;OAEG;IACH,wBAEC;IAED;;;;;;;OAOG;IACH,qCALW,MAAM,wDAOhB;CACJ"}
|
|
@@ -36,7 +36,7 @@ export class AssetLoader {
|
|
|
36
36
|
*
|
|
37
37
|
* @param {AssetRequestScope} scope
|
|
38
38
|
* @param {string} path
|
|
39
|
-
* @param {function(Asset)} success
|
|
39
|
+
* @param {function(asset:Asset)} success
|
|
40
40
|
* @param {function} failure
|
|
41
41
|
* @param {function(current:number, total:number)} progress
|
|
42
42
|
*/
|