@woosh/meep-engine 2.35.15 → 2.36.0
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/core/binary/BinaryBuffer.js +42 -17
- package/core/bvh2/BinaryNode.js +1 -1
- package/core/bvh2/aabb3/AABB3.js +2 -2
- package/core/bvh2/aabb3/aabb3_array_combine.js +20 -0
- package/core/bvh2/aabb3/aabb3_array_intersects_frustum_array.js +20 -0
- package/core/bvh2/aabb3/aabb3_array_intersects_ray.js +1 -0
- package/core/bvh2/aabb3/aabb3_array_intersects_ray_array.js +14 -0
- package/core/bvh2/{aabb3_combined_surface_area.js → aabb3/aabb3_combined_surface_area.js} +3 -3
- package/core/bvh2/aabb3/aabb3_intersects_frustum_array.js +1 -19
- package/core/bvh2/bvh3/BVHNodeProxy.js +53 -0
- package/core/bvh2/bvh3/ExplicitBinaryBoundingVolumeHierarchy.js +848 -0
- package/core/bvh2/bvh3/ExplicitBinaryBoundingVolumeHierarchy.spec.js +142 -0
- package/core/bvh2/bvh3/bvh_query_leaves_generic.js +79 -0
- package/core/bvh2/bvh3/bvh_query_leaves_ray.js +95 -0
- package/core/bvh2/bvh3/query/BVHQuery.js +11 -0
- package/core/bvh2/bvh3/query/BVHQueryIntersectsFrustum.js +36 -0
- package/core/bvh2/bvh3/query/BVHQueryIntersectsRay.js +36 -0
- package/core/collection/array/copyArray.js +2 -2
- package/core/collection/array/typed/uint_array_for_count.js +17 -0
- package/core/collection/table/RowFirstTable.js +25 -7
- package/core/collection/table/RowFirstTableSpec.js +4 -4
- package/core/geom/3d/aabb/aabb3_matrix4_project.spec.js +1 -1
- package/{engine/graphics/util → core/geom/3d/aabb}/computeBoundingBoxFromVertexData.js +1 -1
- package/core/geom/3d/compose_matrix4_array.js +53 -0
- package/{engine/graphics/util → core/geom/3d}/decompose_matrix_4_array.js +0 -0
- package/core/geom/Vector1.js +2 -3
- package/engine/asset/loaders/GLTFAssetLoader.js +3 -0
- package/engine/asset/loaders/gltf/GLTFAssetTransformMikkTSpaceTangents.js +27 -0
- package/engine/ecs/EntityComponentDataset.js +7 -4
- package/engine/ecs/foliage/InstancedFoliage.js +1 -1
- package/engine/ecs/foliage/ViewState.js +1 -1
- package/engine/ecs/transform/Transform.js +2 -2
- package/engine/graphics/ecs/mesh-v2/ShadedGeometry.d.ts +5 -0
- package/engine/graphics/ecs/mesh-v2/ShadedGeometry.js +46 -12
- package/engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.js +81 -95
- package/engine/graphics/ecs/mesh-v2/render/ShadedGeometryRendererContext.js +16 -5
- package/engine/graphics/ecs/mesh-v2/sample/load_gltf.js +1 -0
- package/engine/graphics/ecs/mesh-v2/sample/prototypeShadedGeometry.js +3 -4
- package/engine/graphics/ecs/path/PathDisplaySystem.js +2 -1
- package/engine/graphics/ecs/path/testPathDisplaySystem.js +8 -8
- package/engine/graphics/ecs/path/tube/CapType.d.ts +5 -0
- package/engine/graphics/ecs/path/tube/CapType.js +9 -0
- package/engine/graphics/ecs/path/tube/TubePathStyle.d.ts +2 -0
- package/engine/graphics/ecs/path/tube/TubePathStyle.js +10 -1
- package/engine/graphics/ecs/path/tube/build/GeometryOutput.js +90 -0
- package/engine/graphics/ecs/path/tube/build/build_geometry_catmullrom.js +3 -2
- package/engine/graphics/ecs/path/tube/build/build_geometry_linear.js +1 -1
- package/engine/graphics/ecs/path/tube/build/computeFrenetFrames.js +1 -2
- package/engine/graphics/ecs/path/tube/build/makeTubeGeometry.js +353 -91
- package/engine/graphics/ecs/path/tube/prototypeAnimatedPathMask.js +390 -0
- package/engine/graphics/geometry/MikkT/MikkTSpace.js +2210 -0
- package/engine/graphics/geometry/MikkT/MikkTSpace.spec.js +22 -0
- package/engine/graphics/geometry/MikkT/buffer_geometry_ensure_tangents.js +34 -0
- package/engine/graphics/geometry/MikkT/buffer_geometry_generate_tangents.js +28 -0
- package/engine/graphics/{compute_geometry_polycount.js → geometry/compute_geometry_polycount.js} +0 -0
- package/engine/graphics/geometry/skining/computeSkinnedMeshBoundingVolumes.js +1 -1
- package/engine/graphics/micron/build/fill_patch_geometry_data.js +1 -18
- package/engine/graphics/micron/format/MicronGeometry.js +7 -4
- package/engine/graphics/micron/format/micron_build_proxy_geometry.js +203 -0
- package/engine/graphics/micron/format/serialization/collection/geometry_collection_serialization.js +83 -0
- package/engine/graphics/micron/plugin/GLTFAssetTransformer.js +63 -19
- package/engine/graphics/micron/plugin/GLTF_MICRON_ID_FIELD.js +5 -0
- package/engine/graphics/micron/plugin/MicronRenderPlugin.js +0 -4
- package/engine/graphics/micron/prototypeMicronProxyBuild.js +227 -0
- package/engine/graphics/micron/render/refinement/ActivePatchList.js +2 -2
- package/engine/graphics/micron/render/refinement/get_geometry_patch_cut.js +2 -2
- package/engine/graphics/render/forward_plus/LightManager.js +5 -5
- package/engine/graphics/render/forward_plus/data/channelCountToThreIntegerTextureType.js +3 -3
- package/engine/graphics/texture/channelCountToThreeTextureFormat.js +2 -2
- package/engine/graphics/util/composeMatrix4.js +1 -53
- package/engine/graphics/util/composeMatrix4RotationScale.js +1 -1
- package/engine/intelligence/behavior/ecs/BehaviorComponent.js +1 -1
- package/engine/intelligence/blackboard/AbstractBlackboard.js +9 -0
- package/engine/navigation/grid/FastBinaryHeap.js +13 -2
- package/engine/notify/Notification.js +1 -1
- package/engine/ui/notification/ViewEmitter.js +7 -1
- package/engine/ui/notification/notificationGenerator.js +1 -1
- package/engine/ui/scene/SceneGUIContext.js +11 -130
- package/engine/ui/scene/initializeNotifications.js +141 -0
- package/package.json +1 -1
- package/view/elements/notify/NotificationView.js +1 -2
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import { PLYLoader } from "three/examples/jsm/loaders/PLYLoader.js";
|
|
2
|
+
import {
|
|
3
|
+
AmbientLight,
|
|
4
|
+
CubeTextureLoader,
|
|
5
|
+
DirectionalLight,
|
|
6
|
+
FrontSide,
|
|
7
|
+
Mesh,
|
|
8
|
+
MeshBasicMaterial,
|
|
9
|
+
MeshStandardMaterial,
|
|
10
|
+
PerspectiveCamera,
|
|
11
|
+
PointLight,
|
|
12
|
+
RepeatWrapping,
|
|
13
|
+
Scene,
|
|
14
|
+
SphereGeometry,
|
|
15
|
+
sRGBEncoding,
|
|
16
|
+
TextureLoader,
|
|
17
|
+
VSMShadowMap,
|
|
18
|
+
WebGLRenderer
|
|
19
|
+
} from "three";
|
|
20
|
+
import Stats from "three/examples/jsm/libs/stats.module.js";
|
|
21
|
+
import { OrbitControls } from "three/examples/jsm/controls/OrbitControls.js";
|
|
22
|
+
import { buildMicronGeometryFromBufferGeometry } from "./build/buildMicronGeometryFromBufferGeometry.js";
|
|
23
|
+
|
|
24
|
+
const background = new TextureLoader().load('data/textures/utility/checkers_white_grey_256x256.png');
|
|
25
|
+
background.repeat.set(50, 30);
|
|
26
|
+
background.wrapS = RepeatWrapping;
|
|
27
|
+
background.wrapT = RepeatWrapping;
|
|
28
|
+
|
|
29
|
+
let container, stats;
|
|
30
|
+
|
|
31
|
+
let camera, scene, renderer;
|
|
32
|
+
let directionalLight;
|
|
33
|
+
let pointLight;
|
|
34
|
+
|
|
35
|
+
let windowHalfX = window.innerWidth / 2;
|
|
36
|
+
let windowHalfY = window.innerHeight / 2;
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
function init() {
|
|
40
|
+
|
|
41
|
+
container = document.createElement("div");
|
|
42
|
+
document.body.appendChild(container);
|
|
43
|
+
|
|
44
|
+
camera = new PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 1000000);
|
|
45
|
+
camera.position.z = -4000;
|
|
46
|
+
|
|
47
|
+
//
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
scene = new Scene();
|
|
51
|
+
|
|
52
|
+
window.scene = scene;
|
|
53
|
+
|
|
54
|
+
// LIGHTS
|
|
55
|
+
|
|
56
|
+
const ambient = new AmbientLight(0xffffff, 0.1);
|
|
57
|
+
scene.add(ambient);
|
|
58
|
+
|
|
59
|
+
pointLight = new PointLight(0x6666ff, 0.5);
|
|
60
|
+
pointLight.position.y = 1000;
|
|
61
|
+
scene.add(pointLight);
|
|
62
|
+
|
|
63
|
+
// light representation
|
|
64
|
+
|
|
65
|
+
const sphere = new SphereGeometry(100, 16, 8);
|
|
66
|
+
|
|
67
|
+
const mesh = new Mesh(sphere, new MeshBasicMaterial({ color: 0xffffff }));
|
|
68
|
+
mesh.scale.set(0.5, 0.5, 0.5);
|
|
69
|
+
pointLight.add(mesh);
|
|
70
|
+
|
|
71
|
+
// add directional light
|
|
72
|
+
directionalLight = new DirectionalLight(0xFFAAAA, 0.8);
|
|
73
|
+
directionalLight.position.set(-500, 1000, 300);
|
|
74
|
+
directionalLight.castShadow = true;
|
|
75
|
+
const shadow_camera = directionalLight.shadow.camera;
|
|
76
|
+
// small bias to prevent shadow acne
|
|
77
|
+
directionalLight.shadow.bias = -0.0001;
|
|
78
|
+
// directionalLight.shadow.mapSize.set(4096, 4096);
|
|
79
|
+
directionalLight.shadow.mapSize.set(1024, 1024);
|
|
80
|
+
directionalLight.shadow.autoUpdate = false;
|
|
81
|
+
|
|
82
|
+
window.light = directionalLight;
|
|
83
|
+
// directionalLight.shadow.autoUpdate = true;
|
|
84
|
+
|
|
85
|
+
shadow_camera.near = 0.1;
|
|
86
|
+
shadow_camera.far = 2000;
|
|
87
|
+
|
|
88
|
+
const shadow_camera_size = 15;
|
|
89
|
+
|
|
90
|
+
shadow_camera.left = -shadow_camera_size / 2;
|
|
91
|
+
shadow_camera.right = shadow_camera_size / 2;
|
|
92
|
+
|
|
93
|
+
shadow_camera.bottom = -shadow_camera_size / 2;
|
|
94
|
+
shadow_camera.top = shadow_camera_size / 2;
|
|
95
|
+
|
|
96
|
+
shadow_camera.updateProjectionMatrix();
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
scene.add(directionalLight);
|
|
100
|
+
// material samples
|
|
101
|
+
|
|
102
|
+
const cubeMaterial1 = new MeshStandardMaterial({
|
|
103
|
+
wireframe: false,
|
|
104
|
+
side: FrontSide,
|
|
105
|
+
color: 0xffffff
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
//
|
|
109
|
+
|
|
110
|
+
renderer = new WebGLRenderer({
|
|
111
|
+
antialias: true,
|
|
112
|
+
preserveDrawingBuffer: true,
|
|
113
|
+
stencil: false
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
renderer.shadowMap.enabled = true;
|
|
117
|
+
renderer.shadowMap.type = VSMShadowMap;
|
|
118
|
+
// renderer.shadowMap.type = BasicShadowMap;
|
|
119
|
+
renderer.sortObjects = false;
|
|
120
|
+
|
|
121
|
+
renderer.setPixelRatio(window.devicePixelRatio);
|
|
122
|
+
renderer.setSize(window.innerWidth, window.innerHeight);
|
|
123
|
+
container.appendChild(renderer.domElement);
|
|
124
|
+
|
|
125
|
+
stats = new Stats();
|
|
126
|
+
container.appendChild(stats.dom);
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
window.addEventListener("resize", onWindowResize);
|
|
130
|
+
|
|
131
|
+
// envmap
|
|
132
|
+
const genCubeUrls = function (prefix, postfix) {
|
|
133
|
+
|
|
134
|
+
return [
|
|
135
|
+
prefix + "posx" + postfix, prefix + "negx" + postfix,
|
|
136
|
+
prefix + "posy" + postfix, prefix + "negy" + postfix,
|
|
137
|
+
prefix + "posz" + postfix, prefix + "negz" + postfix
|
|
138
|
+
];
|
|
139
|
+
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
const urls = genCubeUrls("data/textures/cubemaps/hip_miramar/32/", ".png");
|
|
143
|
+
|
|
144
|
+
new CubeTextureLoader().load(urls, function (cubeTexture) {
|
|
145
|
+
|
|
146
|
+
cubeTexture.encoding = sRGBEncoding;
|
|
147
|
+
|
|
148
|
+
// scene.background = new Color(0.1, 0.1, 0.1);
|
|
149
|
+
// scene.background = new ThreeColor(1, 0.3, 0.3);
|
|
150
|
+
// scene.background = new Color(0.3, 1, 0.3);
|
|
151
|
+
|
|
152
|
+
scene.background = background;
|
|
153
|
+
scene.environment = cubeTexture;
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
// const lightProbe = new LightProbe();
|
|
157
|
+
//
|
|
158
|
+
// lightProbe.copy(LightProbeGenerator.fromCubeTexture(cubeTexture));
|
|
159
|
+
// lightProbe.intensity = 1.2;
|
|
160
|
+
|
|
161
|
+
// scene.add(lightProbe);
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
onWindowResize();
|
|
165
|
+
|
|
166
|
+
new PLYLoader().load("data/models/stanford/Lucy100k.ply", async geometry => {
|
|
167
|
+
geometry.computeVertexNormals();
|
|
168
|
+
|
|
169
|
+
const source = new Mesh(geometry, new MeshStandardMaterial({ color: 0xFFFFFF }));
|
|
170
|
+
|
|
171
|
+
const micron_g = await buildMicronGeometryFromBufferGeometry(geometry);
|
|
172
|
+
|
|
173
|
+
micron_g.buildProxy();
|
|
174
|
+
|
|
175
|
+
const proxy = new Mesh(micron_g.proxy, new MeshStandardMaterial({ color: 0xFF0000 }));
|
|
176
|
+
|
|
177
|
+
source.position.x += 700;
|
|
178
|
+
proxy.position.x -= 700;
|
|
179
|
+
|
|
180
|
+
console.warn(geometry, micron_g);
|
|
181
|
+
|
|
182
|
+
scene.add(source);
|
|
183
|
+
scene.add(proxy);
|
|
184
|
+
})
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
function onWindowResize() {
|
|
188
|
+
|
|
189
|
+
const w = window.innerWidth;
|
|
190
|
+
const h = window.innerHeight;
|
|
191
|
+
|
|
192
|
+
windowHalfX = w / 2;
|
|
193
|
+
windowHalfY = h / 2;
|
|
194
|
+
|
|
195
|
+
camera.aspect = w / h;
|
|
196
|
+
camera.updateProjectionMatrix();
|
|
197
|
+
|
|
198
|
+
renderer.setSize(w, h);
|
|
199
|
+
|
|
200
|
+
background.repeat.set(w / 20, h / 20);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
function animate() {
|
|
204
|
+
|
|
205
|
+
requestAnimationFrame(animate);
|
|
206
|
+
|
|
207
|
+
render();
|
|
208
|
+
stats.update();
|
|
209
|
+
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
function render() {
|
|
213
|
+
if (orbitControls !== undefined) {
|
|
214
|
+
orbitControls.update();
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
const timer = -0.0002 * Date.now();
|
|
218
|
+
|
|
219
|
+
pointLight.position.x = 10000 * Math.cos(timer);
|
|
220
|
+
pointLight.position.z = 10000 * Math.sin(timer);
|
|
221
|
+
|
|
222
|
+
renderer.render(scene, camera);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
init();
|
|
226
|
+
const orbitControls = new OrbitControls(camera, container);
|
|
227
|
+
animate();
|
|
@@ -2,7 +2,7 @@ import { ActivePatchRecord } from "./ActivePatchRecord.js";
|
|
|
2
2
|
import { ActivePatchFlags } from "./ActivePatchFlags.js";
|
|
3
3
|
import { aabb3_project_to_2d } from "../../../../../core/geom/3d/aabb/aabb3_compute_projected_area.js";
|
|
4
4
|
import { BitSet } from "../../../../../core/binary/BitSet.js";
|
|
5
|
-
import {
|
|
5
|
+
import { aabb3_array_intersects_frustum_array } from "../../../../../core/bvh2/aabb3/aabb3_array_intersects_frustum_array.js";
|
|
6
6
|
|
|
7
7
|
export class ActivePatchList {
|
|
8
8
|
constructor() {
|
|
@@ -199,7 +199,7 @@ export class ActivePatchList {
|
|
|
199
199
|
check if node is in view frustum
|
|
200
200
|
NOTE: following suggestion in "FastMesh: Efficient View-dependent Meshing" by Renato Pajarola et al, we can do a more coarse frustum test approximating frustum as a cone initially
|
|
201
201
|
*/
|
|
202
|
-
const in_view_frustum =
|
|
202
|
+
const in_view_frustum = aabb3_array_intersects_frustum_array(node.bounding_box, frustum_planes);
|
|
203
203
|
|
|
204
204
|
if (!in_view_frustum) {
|
|
205
205
|
// outside of view frustum, cull
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BitSet } from "../../../../../core/binary/BitSet.js";
|
|
2
|
-
import {
|
|
2
|
+
import { aabb3_array_intersects_frustum_array } from "../../../../../core/bvh2/aabb3/aabb3_array_intersects_frustum_array.js";
|
|
3
3
|
import { aabb3_estimate_projected_area2 } from "../../../../../core/geom/3d/aabb/aabb3_estimate_projected_area2.js";
|
|
4
4
|
|
|
5
5
|
|
|
@@ -67,7 +67,7 @@ export function get_geometry_patch_cut(
|
|
|
67
67
|
check if node is in view frustum
|
|
68
68
|
NOTE: following suggestion in "FastMesh: Efficient View-dependent Meshing" by Renato Pajarola et al, we can do a more coarse frustum test approximating frustum as a cone initially
|
|
69
69
|
*/
|
|
70
|
-
const in_view_frustum =
|
|
70
|
+
const in_view_frustum = aabb3_array_intersects_frustum_array(patch.bounding_box, frustum_planes);
|
|
71
71
|
|
|
72
72
|
if (!in_view_frustum) {
|
|
73
73
|
continue;
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
LinearMipMapLinearFilter,
|
|
10
10
|
NearestFilter,
|
|
11
11
|
RGBAFormat,
|
|
12
|
-
|
|
12
|
+
RGBAIntegerFormat,
|
|
13
13
|
UnsignedByteType,
|
|
14
14
|
UnsignedShortType
|
|
15
15
|
} from "three";
|
|
@@ -158,8 +158,8 @@ export class LightManager {
|
|
|
158
158
|
this.__cluster_texture.minFilter = NearestFilter;
|
|
159
159
|
|
|
160
160
|
this.__cluster_texture.type = UnsignedShortType;
|
|
161
|
-
this.__cluster_texture.format =
|
|
162
|
-
this.__cluster_texture.internalFormat = "
|
|
161
|
+
this.__cluster_texture.format = RGBAIntegerFormat;
|
|
162
|
+
this.__cluster_texture.internalFormat = "RGBA16UI";
|
|
163
163
|
|
|
164
164
|
/**
|
|
165
165
|
*
|
|
@@ -347,7 +347,7 @@ export class LightManager {
|
|
|
347
347
|
|
|
348
348
|
const texture = this.__cluster_texture;
|
|
349
349
|
|
|
350
|
-
const channelCount =
|
|
350
|
+
const channelCount = 4;
|
|
351
351
|
|
|
352
352
|
texture.dispose();
|
|
353
353
|
|
|
@@ -826,7 +826,7 @@ export class LightManager {
|
|
|
826
826
|
|
|
827
827
|
const tile_index = slice_offset + (i_y_0 * tr_x) + i_x_0;
|
|
828
828
|
|
|
829
|
-
const tile_address = tile_index *
|
|
829
|
+
const tile_address = tile_index * 4;
|
|
830
830
|
|
|
831
831
|
|
|
832
832
|
// construct tile data
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RedIntegerFormat, RGBAIntegerFormat,
|
|
1
|
+
import { RedIntegerFormat, RGBAIntegerFormat, RGIntegerFormat } from "three";
|
|
2
2
|
|
|
3
3
|
export function channelCountToThreIntegerTextureType(channel_count) {
|
|
4
4
|
switch (channel_count) {
|
|
@@ -6,10 +6,10 @@ export function channelCountToThreIntegerTextureType(channel_count) {
|
|
|
6
6
|
return RedIntegerFormat;
|
|
7
7
|
case 2:
|
|
8
8
|
return RGIntegerFormat;
|
|
9
|
-
case 3:
|
|
10
|
-
return RGBIntegerFormat;
|
|
11
9
|
case 4:
|
|
12
10
|
return RGBAIntegerFormat;
|
|
11
|
+
case 3:
|
|
12
|
+
// see https://github.com/mrdoob/three.js/pull/23228
|
|
13
13
|
default:
|
|
14
14
|
throw new Error(`Unsupported channel count '${channel_count}'`);
|
|
15
15
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RedFormat, RGBAFormat,
|
|
1
|
+
import { RedFormat, RGBAFormat, RGFormat } from "three";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
*
|
|
@@ -12,7 +12,7 @@ export function channelCountToThreeTextureFormat(count) {
|
|
|
12
12
|
case 2:
|
|
13
13
|
return RGFormat;
|
|
14
14
|
case 3:
|
|
15
|
-
|
|
15
|
+
// see https://github.com/mrdoob/three.js/pull/23228
|
|
16
16
|
case 4:
|
|
17
17
|
return RGBAFormat;
|
|
18
18
|
default:
|
|
@@ -1,56 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
* @param {number[]|Float32Array|mat4} result
|
|
4
|
-
* @param {Vector3} position
|
|
5
|
-
* @param {Quaternion} rotation
|
|
6
|
-
* @param {Vector3} scale
|
|
7
|
-
*/
|
|
8
|
-
export function compose_matrix4_array(result, position, rotation, scale) {
|
|
9
|
-
const x = rotation.x;
|
|
10
|
-
const y = rotation.y;
|
|
11
|
-
const z = rotation.z;
|
|
12
|
-
const w = rotation.w;
|
|
13
|
-
|
|
14
|
-
const x2 = x + x;
|
|
15
|
-
const y2 = y + y;
|
|
16
|
-
const z2 = z + z;
|
|
17
|
-
|
|
18
|
-
const xx = x * x2;
|
|
19
|
-
const xy = x * y2;
|
|
20
|
-
const xz = x * z2;
|
|
21
|
-
|
|
22
|
-
const yy = y * y2;
|
|
23
|
-
const yz = y * z2;
|
|
24
|
-
const zz = z * z2;
|
|
25
|
-
|
|
26
|
-
const wx = w * x2;
|
|
27
|
-
const wy = w * y2;
|
|
28
|
-
const wz = w * z2;
|
|
29
|
-
|
|
30
|
-
const sx = scale.x;
|
|
31
|
-
const sy = scale.y;
|
|
32
|
-
const sz = scale.z;
|
|
33
|
-
|
|
34
|
-
result[0] = (1 - (yy + zz)) * sx;
|
|
35
|
-
result[1] = (xy + wz) * sx;
|
|
36
|
-
result[2] = (xz - wy) * sx;
|
|
37
|
-
result[3] = 0;
|
|
38
|
-
|
|
39
|
-
result[4] = (xy - wz) * sy;
|
|
40
|
-
result[5] = (1 - (xx + zz)) * sy;
|
|
41
|
-
result[6] = (yz + wx) * sy;
|
|
42
|
-
result[7] = 0;
|
|
43
|
-
|
|
44
|
-
result[8] = (xz + wy) * sz;
|
|
45
|
-
result[9] = (yz - wx) * sz;
|
|
46
|
-
result[10] = (1 - (xx + yy)) * sz;
|
|
47
|
-
result[11] = 0;
|
|
48
|
-
|
|
49
|
-
result[12] = position.x;
|
|
50
|
-
result[13] = position.y;
|
|
51
|
-
result[14] = position.z;
|
|
52
|
-
result[15] = 1;
|
|
53
|
-
}
|
|
1
|
+
import { compose_matrix4_array } from "../../../core/geom/3d/compose_matrix4_array.js";
|
|
54
2
|
|
|
55
3
|
/**
|
|
56
4
|
*
|
|
@@ -48,6 +48,15 @@ export class AbstractBlackboard {
|
|
|
48
48
|
return this.acquire(name, DataType.Number, initialValue);
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
/**
|
|
52
|
+
*
|
|
53
|
+
* @param {string} name
|
|
54
|
+
* @returns {void}
|
|
55
|
+
*/
|
|
56
|
+
incrementNumber(name) {
|
|
57
|
+
this.acquireNumber(name).increment();
|
|
58
|
+
}
|
|
59
|
+
|
|
51
60
|
/**
|
|
52
61
|
*
|
|
53
62
|
* @param {string} name
|
|
@@ -6,12 +6,15 @@ import { assert } from "../../../core/assert.js";
|
|
|
6
6
|
*/
|
|
7
7
|
class BinaryHeap {
|
|
8
8
|
/**
|
|
9
|
-
* @
|
|
10
|
-
* @param {function(T):number} scoreFunction
|
|
9
|
+
* @param {(T)=>number} scoreFunction
|
|
11
10
|
* @constructor
|
|
12
11
|
*/
|
|
13
12
|
constructor(scoreFunction) {
|
|
14
13
|
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
* @type {function(T): number}
|
|
17
|
+
*/
|
|
15
18
|
this.scoreFunction = scoreFunction;
|
|
16
19
|
|
|
17
20
|
/**
|
|
@@ -165,6 +168,14 @@ class BinaryHeap {
|
|
|
165
168
|
}
|
|
166
169
|
}
|
|
167
170
|
|
|
171
|
+
/**
|
|
172
|
+
*
|
|
173
|
+
* @returns {T|undefined}
|
|
174
|
+
*/
|
|
175
|
+
peek() {
|
|
176
|
+
return this.data[0];
|
|
177
|
+
}
|
|
178
|
+
|
|
168
179
|
/**
|
|
169
180
|
*
|
|
170
181
|
* @param {T} node
|
|
@@ -16,7 +16,7 @@ export class Notification {
|
|
|
16
16
|
* @constructor
|
|
17
17
|
*/
|
|
18
18
|
constructor({ title = "", description = "", image = "", classList = [] }) {
|
|
19
|
-
assert.
|
|
19
|
+
assert.isArray(classList, 'classList');
|
|
20
20
|
|
|
21
21
|
this.title = title;
|
|
22
22
|
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import Vector2 from "../../../core/geom/Vector2.js";
|
|
2
2
|
import { AnimatedObjectEmitter } from "./AnimatedObjectEmitter.js";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* @template T
|
|
6
|
+
*/
|
|
5
7
|
class ViewEmitter {
|
|
6
8
|
/**
|
|
7
9
|
*
|
|
@@ -24,6 +26,10 @@ class ViewEmitter {
|
|
|
24
26
|
return view;
|
|
25
27
|
};
|
|
26
28
|
|
|
29
|
+
/**
|
|
30
|
+
*
|
|
31
|
+
* @type {(T)=>View}
|
|
32
|
+
*/
|
|
27
33
|
this.viewFactory = null;
|
|
28
34
|
|
|
29
35
|
/**
|
|
@@ -41,7 +41,7 @@ function notificationGenerator(callback, timeout = 5) {
|
|
|
41
41
|
*
|
|
42
42
|
* @param {NotificationManager} notifications
|
|
43
43
|
*/
|
|
44
|
-
function testNotifications(notifications) {
|
|
44
|
+
export function testNotifications(notifications) {
|
|
45
45
|
notificationGenerator(n => {
|
|
46
46
|
notifications.addNotification(n, NotificationAreaKind.Primary);
|
|
47
47
|
}, 1.3);
|
|
@@ -1,135 +1,7 @@
|
|
|
1
1
|
import { ModalStack } from "../modal/ModalStack.js";
|
|
2
2
|
import LinearModifier from "../../../core/model/stat/LinearModifier.js";
|
|
3
3
|
import { NotificationManager } from "../notification/NotificationManager.js";
|
|
4
|
-
import
|
|
5
|
-
import AnimationTrack from "../../animation/keyed2/AnimationTrack.js";
|
|
6
|
-
import TransitionFunctions from "../../animation/TransitionFunctions.js";
|
|
7
|
-
import { assert } from "../../../core/assert.js";
|
|
8
|
-
import NotificationView from "../../../view/elements/notify/NotificationView.js";
|
|
9
|
-
import { NotificationAreaKind } from "../GUIEngine.js";
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
*
|
|
13
|
-
* @param {NotificationManager} manager
|
|
14
|
-
*/
|
|
15
|
-
function initializeNotifications(manager) {
|
|
16
|
-
function makePrimary() {
|
|
17
|
-
const viewEmitter = new ViewEmitter();
|
|
18
|
-
viewEmitter.setRushThreshold(1);
|
|
19
|
-
|
|
20
|
-
const animationTrack = new AnimationTrack(["alpha", "scale"]);
|
|
21
|
-
animationTrack.addKey(0, [0, 1.3]);
|
|
22
|
-
animationTrack.addKey(0.6, [1, 1]);
|
|
23
|
-
animationTrack.addKey(2.9, [1, 1]);
|
|
24
|
-
animationTrack.addKey(3.4, [0, 1]);
|
|
25
|
-
|
|
26
|
-
animationTrack.addTransition(0, TransitionFunctions.EaseIn);
|
|
27
|
-
animationTrack.addTransition(2, TransitionFunctions.EaseOut);
|
|
28
|
-
|
|
29
|
-
viewEmitter.setAnimation(animationTrack, function (alpha, scale) {
|
|
30
|
-
/**
|
|
31
|
-
* @type View
|
|
32
|
-
*/
|
|
33
|
-
const view = this;
|
|
34
|
-
|
|
35
|
-
view.el.style.opacity = alpha;
|
|
36
|
-
view.scale.set(scale, scale);
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
viewEmitter.viewFactory = function (options) {
|
|
40
|
-
assert.notEqual(options, undefined, 'options is undefined');
|
|
41
|
-
|
|
42
|
-
const notificationView = new NotificationView(options);
|
|
43
|
-
|
|
44
|
-
return notificationView;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
return viewEmitter;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function makeSecondary() {
|
|
52
|
-
const viewEmitter = new ViewEmitter();
|
|
53
|
-
viewEmitter.setRushThreshold(1);
|
|
54
|
-
|
|
55
|
-
const animationTrack = new AnimationTrack(["alpha", "position.y", "scale"]);
|
|
56
|
-
animationTrack.addKey(0, [0.2, 0, 1.1]);
|
|
57
|
-
animationTrack.addKey(0.17, [1, 0, 1]);
|
|
58
|
-
animationTrack.addKey(3.2, [1, -60, 1]);
|
|
59
|
-
animationTrack.addKey(3.7, [0, -70, 1]);
|
|
60
|
-
|
|
61
|
-
animationTrack.addTransition(0, TransitionFunctions.EaseIn);
|
|
62
|
-
animationTrack.addTransition(1, TransitionFunctions.Linear);
|
|
63
|
-
animationTrack.addTransition(2, TransitionFunctions.EaseOut);
|
|
64
|
-
|
|
65
|
-
viewEmitter.setAnimation(animationTrack, function (alpha, positionY, scale) {
|
|
66
|
-
/**
|
|
67
|
-
* @type View
|
|
68
|
-
*/
|
|
69
|
-
const view = this;
|
|
70
|
-
|
|
71
|
-
view.el.style.opacity = alpha;
|
|
72
|
-
view.position.setY(positionY);
|
|
73
|
-
view.scale.set(scale, scale);
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
viewEmitter.viewFactory = function (options) {
|
|
78
|
-
const notificationView = new NotificationView(options);
|
|
79
|
-
|
|
80
|
-
return notificationView;
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
return viewEmitter;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
function makeToast() {
|
|
88
|
-
const displayDuration = 7.5;
|
|
89
|
-
|
|
90
|
-
const viewEmitter = new ViewEmitter();
|
|
91
|
-
viewEmitter.setRushThreshold(5);
|
|
92
|
-
|
|
93
|
-
const animationTrack = new AnimationTrack(["alpha", "position.x"]);
|
|
94
|
-
animationTrack.addKey(0, [0.2, 100]);
|
|
95
|
-
animationTrack.addKey(0.17, [1, 0]);
|
|
96
|
-
animationTrack.addKey(displayDuration, [1, 0]);
|
|
97
|
-
animationTrack.addKey(displayDuration + 0.5, [0, 0]);
|
|
98
|
-
|
|
99
|
-
animationTrack.addTransition(0, TransitionFunctions.EaseIn);
|
|
100
|
-
animationTrack.addTransition(1, TransitionFunctions.Linear);
|
|
101
|
-
animationTrack.addTransition(2, TransitionFunctions.EaseOut);
|
|
102
|
-
|
|
103
|
-
viewEmitter.setAnimation(animationTrack, function (alpha, positionY) {
|
|
104
|
-
/**
|
|
105
|
-
* @type View
|
|
106
|
-
*/
|
|
107
|
-
const view = this;
|
|
108
|
-
|
|
109
|
-
view.el.style.opacity = alpha;
|
|
110
|
-
view.position.setX(positionY);
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
viewEmitter.viewFactory = function (options) {
|
|
115
|
-
const notificationView = new NotificationView(options);
|
|
116
|
-
|
|
117
|
-
return notificationView;
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
return viewEmitter;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
manager.createChannel(NotificationAreaKind.Primary);
|
|
124
|
-
manager.createChannel(NotificationAreaKind.Secondary);
|
|
125
|
-
manager.createChannel(NotificationAreaKind.Toast);
|
|
126
|
-
|
|
127
|
-
manager.addEmitterDisplay(NotificationAreaKind.Primary, makePrimary());
|
|
128
|
-
manager.addEmitterDisplay(NotificationAreaKind.Secondary, makeSecondary());
|
|
129
|
-
manager.addEmitterDisplay(NotificationAreaKind.Toast, makeToast(), 'managed-toast-notifications');
|
|
130
|
-
|
|
131
|
-
// testNotifications(manager);
|
|
132
|
-
}
|
|
4
|
+
import { initializeNotifications } from "./initializeNotifications.js";
|
|
133
5
|
|
|
134
6
|
export class SceneGUIContext {
|
|
135
7
|
constructor() {
|
|
@@ -138,6 +10,11 @@ export class SceneGUIContext {
|
|
|
138
10
|
* @type {Scene}
|
|
139
11
|
*/
|
|
140
12
|
this.scene = null;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
* @type {ModalStack}
|
|
17
|
+
*/
|
|
141
18
|
this.modals = new ModalStack();
|
|
142
19
|
|
|
143
20
|
/**
|
|
@@ -146,6 +23,10 @@ export class SceneGUIContext {
|
|
|
146
23
|
*/
|
|
147
24
|
this.notifications = new NotificationManager();
|
|
148
25
|
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
* @type {LinearModifier}
|
|
29
|
+
*/
|
|
149
30
|
this.clockModifierZero = new LinearModifier(0, 0);
|
|
150
31
|
}
|
|
151
32
|
|
|
@@ -165,7 +46,7 @@ export class SceneGUIContext {
|
|
|
165
46
|
*
|
|
166
47
|
* @param {number} timeDelta
|
|
167
48
|
*/
|
|
168
|
-
tick(timeDelta){
|
|
49
|
+
tick(timeDelta) {
|
|
169
50
|
this.notifications.tick(timeDelta);
|
|
170
51
|
}
|
|
171
52
|
|