@woosh/meep-engine 2.109.6 → 2.109.8
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/TetrahedralMesh.d.ts +3 -3
- package/src/core/geom/3d/tetrahedra/TetrahedralMesh.d.ts.map +1 -1
- package/src/core/geom/3d/tetrahedra/TetrahedralMesh.js +10 -5
- 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/DataType.d.ts.map +1 -1
- package/src/core/model/node-graph/DataType.js +16 -10
- package/src/core/model/node-graph/ParametricDataType.d.ts +34 -0
- package/src/core/model/node-graph/ParametricDataType.d.ts.map +1 -0
- package/src/core/model/node-graph/ParametricDataType.js +63 -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 +59 -37
- package/src/engine/graphics/sh3/gi/material/common.glsl +484 -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 +51 -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 +26 -9
- package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.d.ts +11 -1
- package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.js +27 -61
- package/src/engine/graphics/sh3/lpv/build_probes_for_scene.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/build_probes_for_scene.js +8 -6
- 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 +149 -0
- package/src/engine/graphics/sh3/lpv/depth/octahedral/v2/visualise.frag.glsl +161 -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/find_max_depth_radius_for_point.d.ts +8 -0
- package/src/engine/graphics/sh3/lpv/find_max_depth_radius_for_point.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpv/find_max_depth_radius_for_point.js +50 -0
- 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 +41 -8
- 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
|
@@ -36,11 +36,12 @@ export class DataType {
|
|
|
36
36
|
&& this.name === other.name;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
/**
|
|
40
|
+
*
|
|
41
|
+
* @param {number} id
|
|
42
|
+
* @param {string} name
|
|
43
|
+
*/
|
|
44
|
+
set(id, name) {
|
|
44
45
|
assert.isNonNegativeInteger(id, 'id');
|
|
45
46
|
assert.isString(name, 'name');
|
|
46
47
|
|
|
@@ -48,6 +49,14 @@ export class DataType {
|
|
|
48
49
|
this.name = name;
|
|
49
50
|
}
|
|
50
51
|
|
|
52
|
+
toJSON() {
|
|
53
|
+
return { ...this };
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
fromJSON({ id, name }) {
|
|
57
|
+
this.set(id, name);
|
|
58
|
+
}
|
|
59
|
+
|
|
51
60
|
/**
|
|
52
61
|
*
|
|
53
62
|
* @param {*} j
|
|
@@ -61,6 +70,7 @@ export class DataType {
|
|
|
61
70
|
return r;
|
|
62
71
|
}
|
|
63
72
|
|
|
73
|
+
|
|
64
74
|
/**
|
|
65
75
|
*
|
|
66
76
|
* @param {number} id
|
|
@@ -68,13 +78,9 @@ export class DataType {
|
|
|
68
78
|
* @returns {DataType}
|
|
69
79
|
*/
|
|
70
80
|
static from(id, name) {
|
|
71
|
-
assert.isNonNegativeInteger(id, 'id');
|
|
72
|
-
assert.isString(name, 'name');
|
|
73
|
-
|
|
74
81
|
const r = new DataType();
|
|
75
82
|
|
|
76
|
-
r.id
|
|
77
|
-
r.name = name;
|
|
83
|
+
r.set(id, name);
|
|
78
84
|
|
|
79
85
|
return r;
|
|
80
86
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Loosely can be thought as implementing generics, allows creation of types that reference other types
|
|
3
|
+
* Useful for collection types, like lists
|
|
4
|
+
*/
|
|
5
|
+
export class ParametricDataType extends DataType {
|
|
6
|
+
/**
|
|
7
|
+
* @param {number} id
|
|
8
|
+
* @param {string} name
|
|
9
|
+
* @param {DataType[]} [parameters]
|
|
10
|
+
*/
|
|
11
|
+
static from(id: number, name: string, parameters?: DataType[]): ParametricDataType;
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @type {DataType[]}
|
|
15
|
+
*/
|
|
16
|
+
parameters: DataType[];
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
* @param {number} id
|
|
20
|
+
* @param {string} name
|
|
21
|
+
* @param {DataType[]} [parameters]
|
|
22
|
+
*/
|
|
23
|
+
set(id: number, name: string, parameters?: DataType[]): void;
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
* @param {ParametricDataType} other
|
|
27
|
+
* @returns {boolean}
|
|
28
|
+
*/
|
|
29
|
+
equals(other: ParametricDataType): boolean;
|
|
30
|
+
toJSON(): void;
|
|
31
|
+
fromJSON(j: any): void;
|
|
32
|
+
}
|
|
33
|
+
import { DataType } from "./DataType.js";
|
|
34
|
+
//# sourceMappingURL=ParametricDataType.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ParametricDataType.d.ts","sourceRoot":"","sources":["../../../../../src/core/model/node-graph/ParametricDataType.js"],"names":[],"mappings":"AAGA;;;GAGG;AACH;IAyCI;;;;OAIG;IACH,gBAJW,MAAM,QACN,MAAM,eACN,QAAQ,EAAE,sBAUpB;IArDD;;;OAGG;IACH,YAFU,QAAQ,EAAE,CAEJ;IAGhB;;;;;OAKG;IACH,QAJW,MAAM,QACN,MAAM,eACN,QAAQ,EAAE,QAMpB;IAED;;;;OAIG;IACH,cAHW,kBAAkB,GAChB,OAAO,CAQnB;IAED,eAEC;IAED,uBAEC;CAgBJ;yBA7DwB,eAAe"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { isArrayEqual } from "../../collection/array/isArrayEqual.js";
|
|
2
|
+
import { DataType } from "./DataType.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Loosely can be thought as implementing generics, allows creation of types that reference other types
|
|
6
|
+
* Useful for collection types, like lists
|
|
7
|
+
*/
|
|
8
|
+
export class ParametricDataType extends DataType {
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
* @type {DataType[]}
|
|
12
|
+
*/
|
|
13
|
+
parameters = [];
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
* @param {number} id
|
|
19
|
+
* @param {string} name
|
|
20
|
+
* @param {DataType[]} [parameters]
|
|
21
|
+
*/
|
|
22
|
+
set(id, name, parameters = []) {
|
|
23
|
+
super.set(id, name);
|
|
24
|
+
|
|
25
|
+
this.parameters = parameters;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
*
|
|
30
|
+
* @param {ParametricDataType} other
|
|
31
|
+
* @returns {boolean}
|
|
32
|
+
*/
|
|
33
|
+
equals(other) {
|
|
34
|
+
if (!(other instanceof ParametricDataType)) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return super.equals(other) && isArrayEqual(this.parameters, other.parameters);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
toJSON() {
|
|
42
|
+
throw new Error('Unsupported Operation');
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
fromJSON(j) {
|
|
46
|
+
throw new Error('Unsupported Operation');
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* @param {number} id
|
|
51
|
+
* @param {string} name
|
|
52
|
+
* @param {DataType[]} [parameters]
|
|
53
|
+
*/
|
|
54
|
+
static from(id, name, parameters = []) {
|
|
55
|
+
|
|
56
|
+
const r = new ParametricDataType();
|
|
57
|
+
|
|
58
|
+
r.set(id, name, parameters);
|
|
59
|
+
|
|
60
|
+
return r;
|
|
61
|
+
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -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
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computeTextureEquality.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/asset/loaders/material/computeTextureEquality.js"],"names":[],"mappings":"AAMA;;;;;GAKG;AACH,gEAFa,OAAO,CAoDnB;AAGD;;;;;GAKG;AACH,sCAJW,8DAAM,EAAE,GAAC;IAAC,KAAK,EAAC,MAAM,CAAC;IAAC,MAAM,EAAC,MAAM,CAAA;CAAC,KACtC,8DAAM,EAAE,GAAC;IAAC,KAAK,EAAC,MAAM,CAAC;IAAC,MAAM,EAAC,MAAM,CAAA;CAAC,GACpC,OAAO,
|
|
1
|
+
{"version":3,"file":"computeTextureEquality.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/asset/loaders/material/computeTextureEquality.js"],"names":[],"mappings":"AAMA;;;;;GAKG;AACH,gEAFa,OAAO,CAoDnB;AAGD;;;;;GAKG;AACH,sCAJW,8DAAM,EAAE,GAAC;IAAC,KAAK,EAAC,MAAM,CAAC;IAAC,MAAM,EAAC,MAAM,CAAA;CAAC,KACtC,8DAAM,EAAE,GAAC;IAAC,KAAK,EAAC,MAAM,CAAC;IAAC,MAAM,EAAC,MAAM,CAAA;CAAC,GACpC,OAAO,CAmEnB"}
|
|
@@ -93,7 +93,12 @@ export function textureImagesEqual(a, b) {
|
|
|
93
93
|
return false;
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
if (
|
|
96
|
+
if (
|
|
97
|
+
// check that browser/environment has the class at all to avoid potential exceptions
|
|
98
|
+
// Required for Safari below version 15.6
|
|
99
|
+
ImageBitmap !== undefined
|
|
100
|
+
&& (a instanceof ImageBitmap && b instanceof ImageBitmap)
|
|
101
|
+
) {
|
|
97
102
|
return computeImageBitmapEquality(a, b);
|
|
98
103
|
}
|
|
99
104
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computeTextureHash.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/asset/loaders/material/computeTextureHash.js"],"names":[],"mappings":"AAuBA;;;;GAIG;AACH;;WAHoD,MAAM;YAAQ,MAAM;IAC5D,MAAM,
|
|
1
|
+
{"version":3,"file":"computeTextureHash.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/asset/loaders/material/computeTextureHash.js"],"names":[],"mappings":"AAuBA;;;;GAIG;AACH;;WAHoD,MAAM;YAAQ,MAAM;IAC5D,MAAM,CAuCjB;AA4CD;;;;GAIG;AACH,sCAHW,UAAQ,MAAM,OAAO,GACnB,MAAM,CAiClB"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { computeImageBitmapHash } from "./computeImageBitmapHash.js";
|
|
2
1
|
import { computeHashIntegerArray } from "../../../../core/collection/array/computeHashIntegerArray.js";
|
|
3
|
-
import { computeHashFloat } from "../../../../core/primitives/numbers/computeHashFloat.js";
|
|
4
2
|
import { murmur3_32 } from "../../../../core/math/hash/murmur3_32.js";
|
|
3
|
+
import { computeHashFloat } from "../../../../core/primitives/numbers/computeHashFloat.js";
|
|
5
4
|
import { computeStringHash } from "../../../../core/primitives/strings/computeStringHash.js";
|
|
5
|
+
import { computeImageBitmapHash } from "./computeImageBitmapHash.js";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
*
|
|
@@ -35,7 +35,12 @@ export function computeImageDataHash(image) {
|
|
|
35
35
|
|
|
36
36
|
let result = 0;
|
|
37
37
|
|
|
38
|
-
if (
|
|
38
|
+
if (
|
|
39
|
+
// check that browser/environment has the class at all to avoid potential exceptions
|
|
40
|
+
// Required for Safari below version 15.6
|
|
41
|
+
ImageBitmap !== undefined
|
|
42
|
+
&& (image instanceof ImageBitmap)
|
|
43
|
+
) {
|
|
39
44
|
result = computeImageBitmapHash(image);
|
|
40
45
|
} else if (image instanceof HTMLImageElement) {
|
|
41
46
|
result = computeStringHash(image.src);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InstancedMeshGroup.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/geometry/instancing/InstancedMeshGroup.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"InstancedMeshGroup.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/geometry/instancing/InstancedMeshGroup.js"],"names":[],"mappings":"AAuCA;IAqiBI;;;;;OAKG;IACH,sBAJW,oBAAoB,uBAElB,kBAAkB,CAS9B;IA5iBG;;;;OAIG;IACH,wBAA2B;IAE3B;;;;OAIG;IACH,gCAAmC;IAEnC;;;OAGG;IACH,cAAc;IAEd;;;OAGG;IACH,UAFU,MAAM,CAEC;IAEjB;;;OAGG;IACH,YAFU,MAAM,CAEK;IACrB;;;OAGG;IACH,cAFU,MAAM,CAEM;IAEtB;;;OAGG;IACH,cAFU,MAAM,CAEO;IAEvB;;;OAGG;IACH,gBAFU,MAAM,CAEQ;IAExB;;;;OAIG;IACH,6BAAgC;IAEhC;;;;OAIG;IACH,kCAAqC;IAGrC;;;;;OAKG;IACH,yBAA4B;IAE5B;;;;OAIG;IACH,8BAAiC;IAEjC;;;;OAIG;IACH,wBAAuC;IAEvC;;;;OAIG;IACH,mBAAsB;IAEtB,eAAiB;IACjB,kBAAoB;IAEpB;;;;OAIG;IACH,oBAAqC;IAErC,kFAAqC;IAErC,mBAAqB;IAGzB,qBA8BC;IAED;;;OAGG;IACH,6BAUC;IAED;;;OAGG;IACH,+BAcC;IAED;;;OAGG;IACH,4BAEC;IAED,gBAIC;IAED;;;OAGG;IACH,sBAFW,oBAAoB,QAU9B;IA4CD;;;OAGG;IACH,4BAFW,MAAM,QAAQ,GAAC,MAAM,cAAc,QAS7C;IAED;;;OAGG;IACH,kBAFW,MAAM,QAWhB;IAED;;;OAGG;IACH,qBAFW,MAAM,QA6BhB;IAED;;;;OAIG;IACH,sBAHW,MAAM,aACN,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,GAAC,YAAY,QAIjD;IAED;;;;OAIG;IACH,kBAHW,MAAM,SACN,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,GAAC,YAAY,QAIjD;IAED;;;;;;;OAOG;IACH,6BANW,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,QAWhB;IAED,+BAMC;IAED;;;;OAIG;IACH,qCAEC;IAED;;;OAGG;IACH,0BAKC;IAED;;;OAGG;IACH,YAFY,MAAM,MAAI,CAIrB;IAED;;;;OAIG;IACH,yBAUC;IAED;;;;OAIG;IACH,sDAcC;IAED;;;OAGG;IACH,6BAoDC;IAED,cAiEC;;CAgBJ;;;;;+BAhlBM,OAAO;qBAAP,OAAO;yBAQW,+BAA+B"}
|
|
@@ -9,17 +9,18 @@ import {
|
|
|
9
9
|
MeshDepthMaterial,
|
|
10
10
|
RGBADepthPacking
|
|
11
11
|
} from 'three';
|
|
12
|
-
import
|
|
13
|
-
import {
|
|
14
|
-
import { composeCompile } from "../../material/composeCompile.js";
|
|
12
|
+
import { Cache } from "../../../../core/cache/Cache.js";
|
|
13
|
+
import { array_copy } from "../../../../core/collection/array/array_copy.js";
|
|
15
14
|
import { typed_array_copy } from "../../../../core/collection/array/typed/typed_array_copy.js";
|
|
16
|
-
import { rewriteMaterial } from "./rewriteMaterial.js";
|
|
17
15
|
import { max3 } from "../../../../core/math/max3.js";
|
|
18
16
|
import { min2 } from "../../../../core/math/min2.js";
|
|
19
|
-
import { DrawMode } from "../../ecs/mesh-v2/DrawMode.js";
|
|
20
|
-
import { array_copy } from "../../../../core/collection/array/array_copy.js";
|
|
21
|
-
import { Cache } from "../../../../core/cache/Cache.js";
|
|
22
17
|
import { computeMaterialHash } from "../../../asset/loaders/material/computeMaterialHash.js";
|
|
18
|
+
import { StaticMaterialCache } from "../../../asset/loaders/material/StaticMaterialCache.js";
|
|
19
|
+
import { DrawMode } from "../../ecs/mesh-v2/DrawMode.js";
|
|
20
|
+
import { composeCompile } from "../../material/composeCompile.js";
|
|
21
|
+
import ThreeFactory from "../../three/ThreeFactory.js";
|
|
22
|
+
import { geometry_copy } from "./geometry_copy.js";
|
|
23
|
+
import { rewriteMaterial } from "./rewriteMaterial.js";
|
|
23
24
|
|
|
24
25
|
/**
|
|
25
26
|
* @typedef {Object} CacheKey
|
|
@@ -533,14 +534,7 @@ export class InstancedMeshGroup {
|
|
|
533
534
|
geometry.dynamic = true;
|
|
534
535
|
|
|
535
536
|
//copy instance attributes
|
|
536
|
-
geometry
|
|
537
|
-
for (let attributeName in instance.attributes) {
|
|
538
|
-
if (!instance.attributes.hasOwnProperty(attributeName)) {
|
|
539
|
-
continue;
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
geometry.attributes[attributeName] = instance.attributes[attributeName];
|
|
543
|
-
}
|
|
537
|
+
geometry_copy(geometry, instance);
|
|
544
538
|
|
|
545
539
|
//build instanced attributes
|
|
546
540
|
const newTransformArray = new Float32Array(this.capacity * 16);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geometry_copy.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/geometry/instancing/geometry_copy.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,oFASC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {BufferGeometry} target
|
|
4
|
+
* @param {BufferGeometry} source
|
|
5
|
+
*/
|
|
6
|
+
export function geometry_copy(target, source) {
|
|
7
|
+
target.index = source.index;
|
|
8
|
+
for (let attributeName in source.attributes) {
|
|
9
|
+
if (!source.attributes.hasOwnProperty(attributeName)) {
|
|
10
|
+
continue;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
target.attributes[attributeName] = source.attributes[attributeName];
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImpostorBaker.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/impostors/octahedral/ImpostorBaker.js"],"names":[],"mappings":";AAoBA;IAEI;;;;OAIG;IACH,kBAAiB;IAEjB;;;OAGG;IACH,iDAEC;IAGD;;;;;;;OAOG;IACH,yEANW,MAAM,EAAE,OAAK,
|
|
1
|
+
{"version":3,"file":"ImpostorBaker.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/impostors/octahedral/ImpostorBaker.js"],"names":[],"mappings":";AAoBA;IAEI;;;;OAIG;IACH,kBAAiB;IAEjB;;;OAGG;IACH,iDAEC;IAGD;;;;;;;OAOG;IACH,yEANW,MAAM,EAAE,OAAK,uBAgPvB;IAED;;;;;;;OAOG;IACH,4CANW;QAAC,IAAI,iBAAgB;QAAC,WAAU,IAAI,CAAA;KAAC,EAAE,GAIrC,mBAAmB,CAmE/B;CACJ;oCApVmC,0BAA0B;qBAhBnC,WAAW"}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { ImpostorCaptureType } from "./ImpostorCaptureType.js";
|
|
2
|
-
import { assert } from "../../../../core/assert.js";
|
|
3
|
-
import { isPowerOfTwo } from "../../../../core/math/isPowerOrTwo.js";
|
|
4
|
-
import { Mesh, OrthographicCamera, Scene, Vector4, WebGLMultipleRenderTargets } from "three";
|
|
5
|
-
import { ImpostorDescription } from "./ImpostorDescription.js";
|
|
6
1
|
import { mat4, vec3 } from "gl-matrix";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
2
|
+
import { Mesh, OrthographicCamera, Scene, Vector4, WebGLMultipleRenderTargets } from "three";
|
|
3
|
+
import { assert } from "../../../../core/assert.js";
|
|
4
|
+
import { collectIteratorValueToArray } from "../../../../core/collection/collectIteratorValueToArray.js";
|
|
10
5
|
import { HashMap } from "../../../../core/collection/map/HashMap.js";
|
|
11
|
-
import
|
|
6
|
+
import Signal from "../../../../core/events/signal/Signal.js";
|
|
7
|
+
import { isPowerOfTwo } from "../../../../core/math/isPowerOrTwo.js";
|
|
12
8
|
import { computeMaterialEquality } from "../../../asset/loaders/material/computeMaterialEquality.js";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { HemiOctahedralUvEncoder } from "./grid/HemiOctahedralUvEncoder.js";
|
|
16
|
-
import { prepare_bake_material } from "./bake/prepare_bake_material.js";
|
|
17
|
-
import { collectIteratorValueToArray } from "../../../../core/collection/collectIteratorValueToArray.js";
|
|
9
|
+
import { computeMaterialHash } from "../../../asset/loaders/material/computeMaterialHash.js";
|
|
10
|
+
import { Sampler2D } from "../../texture/sampler/Sampler2D.js";
|
|
18
11
|
import { compute_bounding_sphere } from "./bake/compute_bounding_sphere.js";
|
|
12
|
+
import { prepare_bake_material } from "./bake/prepare_bake_material.js";
|
|
13
|
+
import { HemiOctahedralUvEncoder } from "./grid/HemiOctahedralUvEncoder.js";
|
|
14
|
+
import { OctahedralUvEncoder } from "./grid/OctahedralUvEncoder.js";
|
|
15
|
+
import { UvEncoder } from "./grid/UvEncoder.js";
|
|
16
|
+
import { ImpostorCaptureType } from "./ImpostorCaptureType.js";
|
|
17
|
+
import { ImpostorDescription } from "./ImpostorDescription.js";
|
|
18
|
+
import { BakeShaderStandard } from "./shader/BakeShaderStandard.js";
|
|
19
19
|
import { build_cutout_from_atlas_by_alpha } from "./util/build_cutout_from_atlas_by_alpha.js";
|
|
20
20
|
|
|
21
21
|
export class ImpostorBaker {
|
|
@@ -62,6 +62,7 @@ export class ImpostorBaker {
|
|
|
62
62
|
|
|
63
63
|
const cam = new OrthographicCamera();
|
|
64
64
|
const rt = new WebGLMultipleRenderTargets(resolution, resolution, 3);
|
|
65
|
+
|
|
65
66
|
rt.scissorTest = false;
|
|
66
67
|
rt.stencilBuffer = false;
|
|
67
68
|
|
|
@@ -185,14 +186,14 @@ export class ImpostorBaker {
|
|
|
185
186
|
const max_frame_index = frames - 1;
|
|
186
187
|
|
|
187
188
|
for (let i = 0; i < frames; i++) {
|
|
188
|
-
const
|
|
189
|
+
const frame_u = max_frame_index > 0 ? (i / max_frame_index) : 0;
|
|
189
190
|
|
|
190
191
|
for (let j = 0; j < frames; j++) {
|
|
191
192
|
|
|
192
|
-
const
|
|
193
|
+
const frame_v = max_frame_index > 0 ? (j / max_frame_index) : 0;
|
|
193
194
|
|
|
194
195
|
// compute vector direction where to place camera
|
|
195
|
-
encoder.uv_to_unit(unit_sphere_direction, [
|
|
196
|
+
encoder.uv_to_unit(unit_sphere_direction, [frame_u, frame_v]);
|
|
196
197
|
|
|
197
198
|
// offset by the radius of the sphere
|
|
198
199
|
const camera_px = distance * unit_sphere_direction[0] + bounding_sphere[0];
|
|
@@ -206,6 +207,7 @@ export class ImpostorBaker {
|
|
|
206
207
|
cam.right = distance;
|
|
207
208
|
cam.top = distance;
|
|
208
209
|
cam.bottom = -distance;
|
|
210
|
+
|
|
209
211
|
cam.near = 0;
|
|
210
212
|
cam.far = distance * 2;
|
|
211
213
|
|
|
@@ -265,7 +267,15 @@ export class ImpostorBaker {
|
|
|
265
267
|
id.rt = rt;
|
|
266
268
|
|
|
267
269
|
// build cutout
|
|
268
|
-
id.cutout = build_cutout_from_atlas_by_alpha(
|
|
270
|
+
id.cutout = build_cutout_from_atlas_by_alpha({
|
|
271
|
+
impostor: id,
|
|
272
|
+
renderer,
|
|
273
|
+
vertex_limit: 5
|
|
274
|
+
});
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
id.sphere_radius = bounding_sphere[3];
|
|
278
|
+
vec3.copy(id.offset, bounding_sphere);
|
|
269
279
|
|
|
270
280
|
return id;
|
|
271
281
|
}
|
|
@@ -339,8 +349,6 @@ export class ImpostorBaker {
|
|
|
339
349
|
});
|
|
340
350
|
|
|
341
351
|
r.capture_type = type;
|
|
342
|
-
r.sphere_radius = bounding_sphere[3];
|
|
343
|
-
vec3.copy(r.offset, bounding_sphere);
|
|
344
352
|
|
|
345
353
|
console.timeEnd('bake');
|
|
346
354
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImpostorCaptureType.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/impostors/octahedral/ImpostorCaptureType.js"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"ImpostorCaptureType.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/impostors/octahedral/ImpostorCaptureType.js"],"names":[],"mappings":"kCAEU,MAAM"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { vec3 } from "gl-matrix";
|
|
2
2
|
import { v3_dot } from "../../../../../core/geom/vec3/v3_dot.js";
|
|
3
|
-
import {
|
|
3
|
+
import { sign_not_zero } from "../../../../../core/math/sign_not_zero.js";
|
|
4
4
|
import { UvEncoder } from "./UvEncoder.js";
|
|
5
5
|
|
|
6
6
|
export class OctahedralUvEncoder extends UvEncoder {
|
|
@@ -13,8 +13,8 @@ export class OctahedralUvEncoder extends UvEncoder {
|
|
|
13
13
|
const py = 1 - abs_x - abs_z;
|
|
14
14
|
|
|
15
15
|
if (py < 0) {
|
|
16
|
-
px =
|
|
17
|
-
pz =
|
|
16
|
+
px = sign_not_zero(px) * (1 - abs_z);
|
|
17
|
+
pz = sign_not_zero(pz) * (1 - abs_x);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
output[0] = px;
|
|
@@ -30,9 +30,9 @@ export class OctahedralUvEncoder extends UvEncoder {
|
|
|
30
30
|
const input_y = input[1];
|
|
31
31
|
const input_z = input[2];
|
|
32
32
|
|
|
33
|
-
const octant_x =
|
|
34
|
-
const octant_y =
|
|
35
|
-
const octant_z =
|
|
33
|
+
const octant_x = sign_not_zero(input_x);
|
|
34
|
+
const octant_y = sign_not_zero(input_y);
|
|
35
|
+
const octant_z = sign_not_zero(input_z);
|
|
36
36
|
|
|
37
37
|
// |x| + |y| + |z| = 1
|
|
38
38
|
const sum = v3_dot(input_x, input_y, input_z, octant_x, octant_y, octant_z);
|
|
@@ -38,7 +38,14 @@ async function main(engine) {
|
|
|
38
38
|
engine,
|
|
39
39
|
enableWater: false,
|
|
40
40
|
cameraFieldOfView: 45,
|
|
41
|
-
showFps: false
|
|
41
|
+
showFps: false,
|
|
42
|
+
enableLights: false
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
await EngineHarness.buildLights({
|
|
46
|
+
engine,
|
|
47
|
+
sunIntensity: 0,
|
|
48
|
+
ambientIntensity: 1
|
|
42
49
|
});
|
|
43
50
|
|
|
44
51
|
const ecd = engine.entityManager.dataset;
|
|
@@ -47,13 +54,15 @@ async function main(engine) {
|
|
|
47
54
|
const renderer = engine.graphics.renderer;
|
|
48
55
|
baker.renderer = renderer;
|
|
49
56
|
|
|
50
|
-
|
|
51
57
|
// const path = 'data/models/LowPolyTownshipSet/Small_house/Small_house.gltf';
|
|
58
|
+
// const path = 'data/models/samples/textured_unit_cube.gltf';
|
|
59
|
+
// const path = 'data/models/samples/teapot.gltf';
|
|
60
|
+
const path = 'data/models/samples/just_a_girl/scene.gltf';
|
|
52
61
|
// const path = 'data/models/road_bike/road_bike.gltf'; //large CAD-type model
|
|
53
62
|
// const path = 'data/models/LowPolyTownshipSet/Barrel/model.gltf';
|
|
54
63
|
// const path = 'data/models/LowPolyTownshipSet/Town_Hall/model.gltf';
|
|
55
64
|
// const path = 'data/models/RTS_Buildings_Humans/18/Building_R_18_out/Building_R_18.gltf';
|
|
56
|
-
const path = 'data/models/MOBA and Tower Defense/Tree_01.gltf';
|
|
65
|
+
// const path = 'data/models/MOBA and Tower Defense/Tree_01.gltf';
|
|
57
66
|
// const path = 'data/models/samples/transform-hierarchy.glb';
|
|
58
67
|
// const path = 'data/models/sponza-pbr/gltf/sponza.glb';
|
|
59
68
|
// const path = 'data/models/snaps/cube_blue.gltf';
|
|
@@ -66,9 +75,9 @@ async function main(engine) {
|
|
|
66
75
|
// console.profile('bake');
|
|
67
76
|
const id = baker.bake({
|
|
68
77
|
objects,
|
|
69
|
-
frames:
|
|
78
|
+
frames: 8,
|
|
70
79
|
resolution: 1024,
|
|
71
|
-
type: ImpostorCaptureType.
|
|
80
|
+
type: ImpostorCaptureType.FullSphere
|
|
72
81
|
});
|
|
73
82
|
// console.profileEnd('bake');
|
|
74
83
|
|
|
@@ -80,14 +89,14 @@ async function main(engine) {
|
|
|
80
89
|
mode: 'diffuse'
|
|
81
90
|
});
|
|
82
91
|
|
|
83
|
-
ctrl.scale.setScalar(
|
|
92
|
+
ctrl.scale.setScalar(1);
|
|
84
93
|
|
|
85
94
|
new Entity()
|
|
86
95
|
.add(ViewportPosition.fromJSON({
|
|
87
96
|
offset: new Vector2(0, 0)
|
|
88
97
|
}))
|
|
89
98
|
.add(GUIElement.fromView(ctrl))
|
|
90
|
-
|
|
99
|
+
.build(ecd);
|
|
91
100
|
|
|
92
101
|
// build out preview scene with impostor and the original
|
|
93
102
|
const t0 = Transform.fromJSON({
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* A circle is a lot easier to quantize (as long as we make sure we place edges outside of the circle)
|
|
4
4
|
* @param {ImpostorDescription} impostor
|
|
5
5
|
* @param {THREE.WebGLRenderer} renderer
|
|
6
|
-
* @
|
|
6
|
+
* @param {number} vertex_limit how many vertices to use for the billboard, more vertices will provide better fit and lower area reducing overdraw at the cost of extra triangles. Prefer values between 4 and 16
|
|
7
|
+
* @returns {number[]}
|
|
7
8
|
*/
|
|
8
|
-
export function build_cutout_from_atlas_by_alpha(impostor
|
|
9
|
+
export function build_cutout_from_atlas_by_alpha({ impostor, renderer, vertex_limit }: ImpostorDescription): number[];
|
|
9
10
|
//# sourceMappingURL=build_cutout_from_atlas_by_alpha.d.ts.map
|
package/src/engine/graphics/impostors/octahedral/util/build_cutout_from_atlas_by_alpha.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build_cutout_from_atlas_by_alpha.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/impostors/octahedral/util/build_cutout_from_atlas_by_alpha.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"build_cutout_from_atlas_by_alpha.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/impostors/octahedral/util/build_cutout_from_atlas_by_alpha.js"],"names":[],"mappings":"AAeA;;;;;;;GAOG;AACH,6GAFa,MAAM,EAAE,CAqHpB"}
|