@woosh/meep-engine 2.93.2 → 2.94.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.
Files changed (110) hide show
  1. package/build/bundle-worker-terrain.js +1 -1
  2. package/build/meep.cjs +296 -233
  3. package/build/meep.min.js +1 -1
  4. package/build/meep.module.js +296 -233
  5. package/package.json +1 -1
  6. package/src/core/bvh2/bvh3/BVH.d.ts.map +1 -1
  7. package/src/core/bvh2/bvh3/BVH.js +4 -2
  8. package/src/core/bvh2/bvh3/build_triangle_morton_codes.d.ts.map +1 -1
  9. package/src/core/bvh2/bvh3/build_triangle_morton_codes.js +2 -1
  10. package/src/core/bvh2/bvh3/ebvh_build_for_geometry_morton.d.ts.map +1 -1
  11. package/src/core/bvh2/bvh3/ebvh_build_for_geometry_morton.js +12 -1
  12. package/src/core/bvh2/bvh3/ebvh_build_hierarchy.d.ts.map +1 -1
  13. package/src/core/bvh2/bvh3/ebvh_build_hierarchy.js +11 -1
  14. package/src/core/bvh2/bvh3/ebvh_geometry_query_nearest_triangle_ray.d.ts +14 -0
  15. package/src/core/bvh2/bvh3/ebvh_geometry_query_nearest_triangle_ray.d.ts.map +1 -0
  16. package/src/core/bvh2/bvh3/ebvh_geometry_query_nearest_triangle_ray.js +146 -0
  17. package/src/core/bvh2/bvh3/query/bvh_query_user_data_ray.d.ts +16 -0
  18. package/src/core/bvh2/bvh3/query/bvh_query_user_data_ray.d.ts.map +1 -0
  19. package/src/core/bvh2/bvh3/query/bvh_query_user_data_ray.js +90 -0
  20. package/src/core/color/Color.d.ts.map +1 -1
  21. package/src/core/color/Color.js +17 -7
  22. package/src/core/geom/2d/bvh/BVH2D.d.ts.map +1 -1
  23. package/src/core/geom/2d/bvh/BVH2D.js +24 -29
  24. package/src/core/geom/2d/bvh/BVH2D.spec.js +10 -9
  25. package/src/core/geom/2d/bvh/bvh2d_query_all_data_by_circle.spec.d.ts +2 -0
  26. package/src/core/geom/2d/bvh/bvh2d_query_all_data_by_circle.spec.d.ts.map +1 -0
  27. package/src/core/geom/2d/bvh/bvh2d_query_all_data_by_circle.spec.js +89 -0
  28. package/src/core/geom/2d/quad-tree/QuadTreeNode.spec.js +1 -1
  29. package/src/core/geom/3d/aabb/AABB3.d.ts.map +1 -1
  30. package/src/core/geom/3d/aabb/AABB3.js +8 -1
  31. package/src/core/geom/3d/aabb/aabb3_array_combine.d.ts.map +1 -1
  32. package/src/core/geom/3d/aabb/aabb3_array_combine.js +5 -0
  33. package/src/core/geom/3d/triangle/computeTriangleRayIntersectionBarycentric.js +2 -0
  34. package/src/core/geom/3d/triangle/computeTriangleRayIntersectionBarycentricEdge.d.ts.map +1 -1
  35. package/src/core/geom/3d/triangle/computeTriangleRayIntersectionBarycentricEdge.js +9 -1
  36. package/src/core/geom/3d/triangle/computeTriangleRayIntersectionBarycentricGeometry.d.ts +16 -0
  37. package/src/core/geom/3d/triangle/computeTriangleRayIntersectionBarycentricGeometry.d.ts.map +1 -0
  38. package/src/core/geom/3d/triangle/computeTriangleRayIntersectionBarycentricGeometry.js +55 -0
  39. package/src/core/math/build_gaussian_kernel_1d.d.ts +8 -0
  40. package/src/core/math/build_gaussian_kernel_1d.d.ts.map +1 -0
  41. package/src/core/math/build_gaussian_kernel_1d.js +26 -0
  42. package/src/core/math/build_gaussian_kernel_2d.d.ts +10 -0
  43. package/src/core/math/build_gaussian_kernel_2d.d.ts.map +1 -0
  44. package/src/core/math/build_gaussian_kernel_2d.js +55 -0
  45. package/src/core/math/nextOdd.d.ts +8 -0
  46. package/src/core/math/nextOdd.d.ts.map +1 -0
  47. package/src/core/math/nextOdd.js +15 -0
  48. package/src/core/math/nextOdd.spec.d.ts +2 -0
  49. package/src/core/math/nextOdd.spec.d.ts.map +1 -0
  50. package/src/core/math/nextOdd.spec.js +9 -0
  51. package/src/engine/animation/clip/ecd_bind_animation_curve.d.ts.map +1 -1
  52. package/src/engine/animation/clip/ecd_bind_animation_curve.js +7 -3
  53. package/src/engine/animation/curve/prototypeGLTF.js +18 -11
  54. package/src/engine/ecs/Entity.js +1 -1
  55. package/src/engine/ecs/EntityComponentDataset.js +0 -14
  56. package/src/engine/ecs/computeComponentClassName.d.ts +2 -0
  57. package/src/engine/ecs/computeComponentClassName.d.ts.map +1 -0
  58. package/src/engine/ecs/computeComponentClassName.js +13 -0
  59. package/src/engine/graphics/ecs/light/binding/LightBinding.d.ts +2 -0
  60. package/src/engine/graphics/ecs/light/binding/LightBinding.d.ts.map +1 -1
  61. package/src/engine/graphics/ecs/light/binding/LightBinding.js +16 -0
  62. package/src/engine/graphics/ecs/light/binding/fp/FPLightBinding.d.ts +13 -2
  63. package/src/engine/graphics/ecs/light/binding/fp/FPLightBinding.d.ts.map +1 -1
  64. package/src/engine/graphics/ecs/light/binding/fp/FPLightBinding.js +37 -4
  65. package/src/engine/graphics/ecs/light/binding/three/ThreeLightBinding.d.ts.map +1 -1
  66. package/src/engine/graphics/ecs/light/binding/three/ThreeLightBinding.js +12 -8
  67. package/src/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +1 -1
  68. package/src/engine/graphics/sh3/path_tracer/GeometryBVHBatched.d.ts +0 -9
  69. package/src/engine/graphics/sh3/path_tracer/GeometryBVHBatched.d.ts.map +1 -1
  70. package/src/engine/graphics/sh3/path_tracer/GeometryBVHBatched.js +100 -129
  71. package/src/engine/graphics/sh3/path_tracer/PathTracer.d.ts.map +1 -1
  72. package/src/engine/graphics/sh3/path_tracer/PathTracer.js +6 -4
  73. package/src/engine/graphics/sh3/path_tracer/prototypePathTracer.js +11 -4
  74. package/src/engine/graphics/sh3/path_tracer/sample_triangle_attribute.d.ts +2 -2
  75. package/src/engine/graphics/sh3/path_tracer/sample_triangle_attribute.js +2 -2
  76. package/src/engine/graphics/texture/sampler/Sampler2D.d.ts.map +1 -1
  77. package/src/engine/graphics/texture/sampler/Sampler2D.js +6 -4
  78. package/src/engine/graphics/texture/sampler/convertSampler2D2DataURL.d.ts.map +1 -1
  79. package/src/engine/graphics/texture/sampler/convertSampler2D2DataURL.js +1 -2
  80. package/src/engine/graphics/texture/sampler/downloadSamplerAsPNG.d.ts +2 -2
  81. package/src/engine/graphics/texture/sampler/downloadSamplerAsPNG.d.ts.map +1 -1
  82. package/src/engine/graphics/texture/sampler/downloadSamplerAsPNG.js +3 -3
  83. package/src/engine/graphics/texture/sampler/filter/sampler2d_blur_gaussian.d.ts.map +1 -1
  84. package/src/engine/graphics/texture/sampler/filter/sampler2d_blur_gaussian.js +5 -31
  85. package/src/engine/graphics/texture/virtual/VirtualTextureMaterial.d.ts +3 -6
  86. package/src/engine/graphics/texture/virtual/VirtualTextureMaterial.d.ts.map +1 -1
  87. package/src/engine/graphics/texture/virtual/VirtualTextureMaterial.js +8 -27
  88. package/src/engine/graphics/texture/virtual/VirtualTextureMemoryMapping.d.ts +4 -0
  89. package/src/engine/graphics/texture/virtual/VirtualTextureMemoryMapping.d.ts.map +1 -1
  90. package/src/engine/graphics/texture/virtual/VirtualTextureMemoryMapping.js +12 -0
  91. package/src/engine/graphics/texture/virtual/VirtualTextureSystem.d.ts +29 -0
  92. package/src/engine/graphics/texture/virtual/VirtualTextureSystem.d.ts.map +1 -0
  93. package/src/engine/graphics/texture/virtual/VirtualTextureSystem.js +102 -0
  94. package/src/engine/graphics/texture/virtual/VirtualTextureUsageUpdater.js +1 -1
  95. package/src/engine/graphics/texture/virtual/prototype.js +221 -79
  96. package/src/generation/filtering/numeric/CellFilterCache.d.ts.map +1 -1
  97. package/src/generation/filtering/numeric/CellFilterCache.js +7 -7
  98. package/src/generation/filtering/numeric/complex/CellFilterFXAA.d.ts.map +1 -1
  99. package/src/generation/filtering/numeric/complex/CellFilterFXAA.js +9 -6
  100. package/src/generation/filtering/numeric/complex/CellFilterGaussianBlur.d.ts +1 -13
  101. package/src/generation/filtering/numeric/complex/CellFilterGaussianBlur.d.ts.map +1 -1
  102. package/src/generation/filtering/numeric/complex/CellFilterGaussianBlur.js +39 -111
  103. package/src/generation/grid/generation/discrete/GridTaskConnectRooms.d.ts.map +1 -1
  104. package/src/generation/grid/generation/discrete/GridTaskConnectRooms.js +6 -5
  105. package/src/generation/grid/generation/util/buildDistanceMapToObjective.d.ts +1 -1
  106. package/src/generation/grid/generation/util/buildDistanceMapToObjective.d.ts.map +1 -1
  107. package/src/generation/grid/generation/util/buildDistanceMapToObjective.js +5 -12
  108. package/src/core/math/makeNextOdd.d.ts +0 -8
  109. package/src/core/math/makeNextOdd.d.ts.map +0 -1
  110. package/src/core/math/makeNextOdd.js +0 -15
@@ -7,21 +7,22 @@ import {
7
7
  PerspectiveCamera,
8
8
  PlaneBufferGeometry,
9
9
  Scene,
10
- Vector2,
11
10
  WebGLRenderer
12
11
  } from "three";
13
12
  import { OrbitControls } from "three/examples/jsm/controls/OrbitControls.js";
13
+ import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader.js";
14
+ import "../../../../../../../../css/main.scss";
14
15
  import Signal from "../../../../core/events/signal/Signal.js";
16
+ import { computePathDirectory } from "../../../../core/path/computePathDirectory.js";
17
+ import LabelView from "../../../../view/common/LabelView.js";
15
18
  import { CSS_ABSOLUTE_POSITIONING } from "../../../../view/CSS_ABSOLUTE_POSITIONING.js";
16
19
  import EmptyView from "../../../../view/elements/EmptyView.js";
20
+ import SmoothProgressBar from "../../../../view/elements/progress/SmoothProgressBar.js";
17
21
  import { AssetManager } from "../../../asset/AssetManager.js";
18
22
  import { GameAssetType } from "../../../asset/GameAssetType.js";
19
23
  import { ImageRGBADataLoader } from "../../../asset/loaders/image/ImageRGBADataLoader.js";
20
24
  import { buildCanvasViewFromTexture } from "../../render/visibility/hiz/buildCanvasViewFromTexture.js";
21
- import { VirtualTextureMaterial } from "./VirtualTextureMaterial.js";
22
- import { VirtualTextureMemoryMapping } from "./VirtualTextureMemoryMapping.js";
23
- import { VirtualTexturePage } from "./VirtualTexturePage.js";
24
- import { VirtualTextureUsageUpdater } from "./VirtualTextureUsageUpdater.js";
25
+ import { VirtualTextureSystem } from "./VirtualTextureSystem.js";
25
26
 
26
27
  let camera,
27
28
  /**
@@ -45,18 +46,13 @@ const signal_render = new Signal();
45
46
  // const TEXTURE_URL = "data/textures/utility/TESTIMAGES/SAMPLING/8BIT/RGB/2448x2448/SRC/img_2448x2448_3x8bit_SRC_RGB_cards_a.png";
46
47
  // const TEXTURE_URL = "data/models/LowPolyTownshipSet/Town_Hall//diffuse_2048.png";
47
48
 
48
- const virtualTextureManager = new VirtualTextureUsageUpdater();
49
- const virtualTexturePage = new VirtualTexturePage();
50
- // const residencyDebugView = new ResidencyDebugView({ scale: 1 });
51
- const memoryMapping = new VirtualTextureMemoryMapping();
52
-
53
49
 
54
50
  // const usageDebugView = new UsageDebugView();
55
51
  // usageDebugView.position.set(0,256);
56
-
57
- window.page = virtualTexturePage;
58
- window.mapping = memoryMapping;
59
- window.usage = virtualTextureManager.usage_metadata;
52
+ //
53
+ // window.page = virtualTexturePage;
54
+ // window.mapping = memoryMapping;
55
+ // window.usage = virtualTextureManager.usage_metadata;
60
56
 
61
57
  const container_view = new EmptyView();
62
58
 
@@ -95,25 +91,125 @@ function makeMesh(mat) {
95
91
  return mesh;
96
92
  }
97
93
 
98
- async function init() {
94
+ /**
95
+ *
96
+ * @type {VirtualTextureSystem[]}
97
+ */
98
+ const virtual_texture_managers = [];
99
99
 
100
- const am = new AssetManager();
101
- await am.registerLoader(GameAssetType.Image, new ImageRGBADataLoader());
102
- am.startup();
100
+ async function loadGLTF({
101
+ path
102
+ }) {
103
103
 
104
- virtualTextureManager.setTextureParameters(
105
- // 32768,
106
- // 16384,
107
- // 8192,
108
- // 2048,
109
- // 16384,
110
- 512,
111
- 32,
112
- // 128,
113
- 3
114
- );
104
+ const loader = new GLTFLoader();
105
+
106
+ const base_path = computePathDirectory(path);
107
+
108
+ const progress = new SmoothProgressBar();
109
+
110
+ function layout() {
111
+ progress.size.set(100, 20);
112
+ progress.position.set((container_view.size.x - progress.size.x) * 0.5, (container_view.size.y - progress.size.y) * 0.5);
113
+ }
114
+
115
+ layout();
116
+ container_view.size.onChanged.add(layout);
117
+
118
+ container_view.addChild(progress);
119
+
120
+ const gltf = await new Promise((resolve, reject) => {
121
+
122
+ loader.load(path, resolve, event => {
123
+ console.log(event);
124
+
125
+ progress.max = event.total;
126
+ progress.value = event.loaded;
127
+ }, reject);
128
+ })
129
+
130
+ container_view.removeChild(progress);
131
+
132
+
133
+ console.warn(gltf);
134
+
135
+ const materials = new Set();
136
+
137
+ /**
138
+ *
139
+ * @type {Map<Material, Mesh[]>}
140
+ */
141
+ const material_users = new Map();
142
+
143
+ /**
144
+ *
145
+ * @type {Map<Material, Material>}
146
+ */
147
+ const replacement_materials = new Map();
148
+
149
+ gltf.scene.traverse(n => {
150
+ if (!n.isMesh) {
151
+ return;
152
+ }
153
+
154
+ const mat = n.material;
155
+ if (mat === undefined) {
156
+ return;
157
+ }
158
+
159
+ if (materials.has(mat)) {
160
+ return;
161
+ }
162
+
163
+ const extensionVT = mat.userData?.gltfExtensions?.meepVirtualTexture;
164
+ if (extensionVT === undefined) {
165
+ return;
166
+ }
167
+
168
+ materials.add(mat);
169
+
170
+ const vts = {};
171
+
172
+ for (const textureKey in extensionVT) {
173
+ const textureMeta = extensionVT[textureKey];
174
+
175
+ const vt = new VirtualTextureSystem();
176
+
177
+ vt.setTexture({
178
+ path: base_path + '/' + textureMeta.path,
179
+ texture_resolution: textureMeta.texture_resolution,
180
+ tile_resolution: textureMeta.tile_size,
181
+ tile_margin: textureMeta.tile_margin
182
+ });
183
+
184
+ virtual_texture_managers.push(vt);
185
+
186
+ vts[textureKey] = vt;
187
+ }
115
188
 
116
- virtualTexturePage.tile_resolution = virtualTextureManager.tile_resolution;
189
+ if (vts.baseColorTexture !== undefined) {
190
+ replacement_materials.set(mat, vts.baseColorTexture.makeMaterial())
191
+ }
192
+ })
193
+
194
+ // replace materials
195
+ gltf.scene.traverse(n => {
196
+ if (n.isMesh) {
197
+
198
+ const replacement = replacement_materials.get(n.material);
199
+
200
+ if (replacement !== undefined) {
201
+ n.material = replacement;
202
+ }
203
+
204
+ }
205
+ });
206
+
207
+ return gltf.scene;
208
+ }
209
+
210
+ function flatSample({
211
+ am
212
+ }) {
117
213
 
118
214
  // virtualTexturePage.path = "data/textures/utility/maurus_uv_checker_8k/vt-01-32";
119
215
  // virtualTexturePage.path = "data/textures/utility/maurus_uv_checker_8k/vt-01-128";
@@ -121,25 +217,63 @@ async function init() {
121
217
  // virtualTexturePage.path = "data/textures/utility/aco-greece/vt-01-128";
122
218
  // sparseTexture.path = "data/textures/utility/vt/uv_map_reference";
123
219
  // virtualTexturePage.path = "data/textures/utility/vt/Lenna";
124
- virtualTexturePage.path = "data/textures/utility/Lenna/vt-01-32";
220
+ // virtualTexturePage.path = "data/textures/utility/Lenna/vt-01-32";
125
221
  // sparseTexture.path = "data/textures/utility/vt/TexelDensity1";
126
- // virtualTexturePage.page_texture_size = [32, 64];
127
- // virtualTexturePage.page_texture_size = [256, 256];
128
- // virtualTexturePage.page_texture_size = [280, 280];
129
- // virtualTexturePage.page_texture_size = [256,512];
130
- virtualTexturePage.page_texture_size = [512, 512];
131
- // virtualTexturePage.page_texture_size = [480, 480];
132
- // virtualTexturePage.page_texture_size = [384, 1280];
133
- // virtualTexturePage.page_texture_size = [1024, 1024];
134
- // virtualTexturePage.page_texture_size = [2048, 2048];
135
- // virtualTexturePage.page_texture_size = [4096, 4096];
136
- virtualTexturePage.asset_manager = am;
137
222
 
138
- memoryMapping.resolution = virtualTextureManager.texture_resolution / virtualTextureManager.tile_resolution;
223
+ const vts = new VirtualTextureSystem();
224
+
225
+ vts.setTexture({
226
+ path: "data/textures/utility/Lenna/vt-01-32",
227
+ texture_resolution: 512,
228
+ tile_resolution: 32,
229
+ });
230
+ vts.initialize({
231
+ asset_manager: am,
232
+ // page_resolution: 1024
233
+ })
234
+ // console.log(virtualTexturePage);
235
+
236
+ const material = vts.makeMaterial();
139
237
 
238
+ console.log(material.uniforms);
239
+
240
+ const virt = makeMesh(material);
241
+
242
+
243
+ virtual_texture_managers.push(vts);
244
+
245
+ }
246
+
247
+ async function init() {
248
+
249
+ const am = new AssetManager();
250
+ await am.registerLoader(GameAssetType.Image, new ImageRGBADataLoader());
251
+ am.startup();
252
+
253
+ const container = document.body;
254
+
255
+ container.style.margin = "0";
256
+
257
+ container.appendChild(container_view.el);
258
+ container_view.link();
259
+
260
+ scene = new Scene();
261
+
262
+ const gltf = await loadGLTF({ path: "data/models/Scans/green_car_wreck/converted/model.gltf" })
263
+
264
+
265
+ virtual_texture_managers.forEach(vt => {
266
+ vt.initialize({
267
+ asset_manager: am,
268
+ page_resolution: 4096
269
+ })
270
+ });
140
271
 
141
- console.log(virtualTexturePage);
272
+ console.log(virtual_texture_managers);
142
273
 
274
+ const manager = virtual_texture_managers[0];
275
+
276
+ scene.add(gltf);
143
277
 
144
278
  //
145
279
  // usageDebugView.mip_levels = virtualTextureManager.max_mip_level;
@@ -147,29 +281,41 @@ async function init() {
147
281
 
148
282
 
149
283
  // const usagePyramidDebugView = new UsagePyramidDebugView();
150
- // usagePyramidDebugView.setImageURL(TEXTURE_URL);
284
+ // usagePyramidDebugView.setImageURL("data/models/Scans/green_car_wreck/converted/merged_1024.png");
151
285
  // container_view.addChild(usagePyramidDebugView);
286
+ //
287
+ // signal_render.add(()=>{
288
+ //
289
+ // usagePyramidDebugView.setTextureParameters(manager.updater.texture_resolution, manager.updater.tile_resolution);
290
+ // usagePyramidDebugView.usage = manager.updater.usage_metadata;
291
+ // })
152
292
 
153
- // residencyDebugView.texture = virtualTexturePage;
293
+ // const residencyDebugView = new ResidencyDebugView();
294
+ // residencyDebugView.texture = manager.page;
154
295
  // residencyDebugView.css({
155
296
  // bottom: 0,
156
297
  // right: 0
157
298
  // });
158
299
  // container_view.addChild(residencyDebugView);
300
+ //
301
+ // signal_render.add(()=> residencyDebugView.update());
159
302
 
160
303
  // ===================
161
304
 
162
- const container = document.body;
163
-
164
- container.style.margin = "0";
165
-
166
- container.appendChild(container_view.el);
167
- container_view.link();
168
305
 
169
306
  camera = new PerspectiveCamera(35, window.innerWidth / window.innerHeight, 0.1, 100);
170
- camera.position.z = 30;
307
+ camera.position.set(
308
+ 12.022084899129627,
309
+ 9.60952583639588,
310
+ -0.04984304693423923
311
+ );
312
+ camera.rotation.set(
313
+ -1.5687013871667483,
314
+ 0.9201500864954011,
315
+ 1.5681634783563936);
316
+
317
+ window.camera = camera;
171
318
 
172
- scene = new Scene();
173
319
  // scene.background = new Color("#002D62");
174
320
 
175
321
  clock = new Clock();
@@ -183,15 +329,8 @@ async function init() {
183
329
  // side: DoubleSide
184
330
  // });
185
331
 
186
- const material = new VirtualTextureMaterial({
187
- page: virtualTexturePage,
188
- mapping: memoryMapping
189
- })
190
-
191
- console.log(material.uniforms);
192
332
 
193
333
  // makeTorus();
194
- const virt = makeMesh(material);
195
334
  // virt.position.x = -0.4
196
335
 
197
336
  // const original_texture = new TextureLoader().load("data/textures/utility/maurus_uv_checker_8k/UV-CheckerMap_Maurus_01_8K.png");
@@ -216,7 +355,7 @@ async function init() {
216
355
  //
217
356
 
218
357
  renderer = new WebGLRenderer({ antialias: true });
219
- renderer.setClearColor("#002D62",1);
358
+ renderer.setClearColor("#002D62", 1);
220
359
 
221
360
  renderer.setPixelRatio(window.devicePixelRatio);
222
361
  container.appendChild(renderer.domElement);
@@ -242,13 +381,12 @@ async function init() {
242
381
  // gui.add(options, key);
243
382
  // });
244
383
 
245
- virtualTexturePage.renderer = renderer;
246
-
247
384
 
248
385
  animate();
249
386
 
387
+
250
388
  const mappingPreview = buildCanvasViewFromTexture({
251
- texture: virtualTexturePage.texture,
389
+ texture: manager.page.texture,
252
390
  renderer,
253
391
  swizzle: ['r', 'g', 'b', 1],
254
392
  width: 256,
@@ -259,15 +397,29 @@ async function init() {
259
397
  mappingPreview.view.css(CSS_ABSOLUTE_POSITIONING);
260
398
  mappingPreview.view.css({
261
399
  // border: "1px solid red"
262
- boxShadow: "0 0 8px rgba(0,0,0,0.4)"
400
+ boxShadow: "0 0 8px rgba(0,0,0,0.4)",
263
401
  });
264
- mappingPreview.view.position.set(0, 0);
402
+ mappingPreview.view.position.set(4, 4);
403
+
265
404
 
266
405
  signal_render.add(() => {
267
406
  mappingPreview.render();
268
407
  });
269
408
 
270
409
  container_view.addChild(mappingPreview.view);
410
+
411
+ // credits
412
+ container_view.addChild(new LabelView(`MODEL: Green car wreck, by matousekfoto, CC-BY-4.0`, {
413
+ css: {
414
+ position: "absolute",
415
+ bottom: "4px",
416
+ width: "100%",
417
+ textAlign: "center",
418
+ color: "#88e1d2",
419
+ textShadow: "0 0 3px black",
420
+ fontFamily: "monospace"
421
+ }
422
+ }));
271
423
  }
272
424
 
273
425
  function onWindowResize() {
@@ -292,20 +444,13 @@ function animate() {
292
444
  function render() {
293
445
 
294
446
  const delta = 5 * clock.getDelta();
295
- //
447
+
296
448
  // if (options.spin && mesh !== undefined) {
297
449
  // mesh.rotation.y += 0.0125 * delta;
298
450
  // mesh.rotation.x += 0.05 * delta;
299
451
  // }
300
452
 
301
- const view_port_size = renderer.getSize(new Vector2());
302
- view_port_size.multiplyScalar(renderer.getPixelRatio());
303
-
304
-
305
- virtualTextureManager.setViewportResolution(view_port_size.x, view_port_size.y);
306
- virtualTextureManager.updateUsage(renderer, scene, camera);
307
- virtualTexturePage.update_usage(virtualTextureManager.usage_metadata);
308
- memoryMapping.residency = virtualTexturePage;
453
+ virtual_texture_managers.forEach(vts => vts.update(renderer, scene, camera));
309
454
 
310
455
  // renderer.setViewport(0, 0, view_port_size.x, view_port_size.y);
311
456
  renderer.clear();
@@ -313,9 +458,6 @@ function render() {
313
458
 
314
459
  // usageDebugView.usage = virtualTextureManager.usage_metadata;
315
460
 
316
- // usagePyramidDebugView.setTextureParameters(virtualTextureManager.texture_resolution, virtualTextureManager.tile_resolution);
317
- // usagePyramidDebugView.usage = virtualTextureManager.usage_metadata;
318
-
319
461
  // residencyDebugView.update();
320
462
 
321
463
  signal_render.send0();
@@ -1 +1 @@
1
- {"version":3,"file":"CellFilterCache.d.ts","sourceRoot":"","sources":["../../../../../src/generation/filtering/numeric/CellFilterCache.js"],"names":[],"mappings":"AAIA;IAeI;;;;;OAKG;IACH,wCAHW,MAAM,GACJ,eAAe,CAU3B;IA3BD;;;;OAIG;IACH,gBAAqC;IAErC;;;OAGG;IACH,OAFU,MAAM,CAEN;CAyDb;yCA1EwC,qCAAqC"}
1
+ {"version":3,"file":"CellFilterCache.d.ts","sourceRoot":"","sources":["../../../../../src/generation/filtering/numeric/CellFilterCache.js"],"names":[],"mappings":"AAIA;IAeI;;;;;OAKG;IACH,wCAHW,MAAM,GACJ,eAAe,CAU3B;IA3BD;;;;OAIG;IACH,gBAAqC;IAErC;;;OAGG;IACH,OAFU,MAAM,CAEN;CAyDb;yCAxEwC,qCAAqC"}
@@ -1,6 +1,6 @@
1
- import { CellFilterUnaryOperation } from "../core/CellFilterUnaryOperation.js";
2
- import { Sampler2D } from "../../../engine/graphics/texture/sampler/Sampler2D.js";
3
1
  import { assert } from "../../../core/assert.js";
2
+ import { Sampler2D } from "../../../engine/graphics/texture/sampler/Sampler2D.js";
3
+ import { CellFilterUnaryOperation } from "../core/CellFilterUnaryOperation.js";
4
4
 
5
5
  export class CellFilterCache extends CellFilterUnaryOperation {
6
6
 
@@ -49,24 +49,24 @@ export class CellFilterCache extends CellFilterUnaryOperation {
49
49
 
50
50
  const scale_1 = 1 / this.scale;
51
51
 
52
- console.time('Cache filter build');
52
+ // console.time('Cache filter build');
53
53
 
54
54
  let x = 0;
55
55
  let y = 0;
56
56
 
57
57
  for (y = 0; y < target_h; y++) {
58
- const g_y = y * scale_1;
58
+ const grid_y = y * scale_1;
59
59
 
60
60
  for (x = 0; x < target_w; x++) {
61
- const g_x = x * scale_1;
61
+ const grid_x = x * scale_1;
62
62
 
63
- const sampleValue = source.execute(grid, g_x, g_y, 0);
63
+ const sampleValue = source.execute(grid, grid_x, grid_y, 0);
64
64
 
65
65
  cache.writeChannel(x, y, 0, sampleValue);
66
66
  }
67
67
  }
68
68
 
69
- console.timeEnd('Cache filter build');
69
+ // console.timeEnd('Cache filter build');
70
70
  }
71
71
 
72
72
  execute(grid, x, y, rotation) {
@@ -1 +1 @@
1
- {"version":3,"file":"CellFilterFXAA.d.ts","sourceRoot":"","sources":["../../../../../../src/generation/filtering/numeric/complex/CellFilterFXAA.js"],"names":[],"mappings":"AAKA;;GAEG;AACH;IAiCI;;;;OAIG;IACH,oBAHW,UAAU,GACR,cAAc,CAY1B;IA7CD;;;OAGG;IACH,QAFU,UAAU,CAEN;IAEd;;;;OAIG;IACH,gBAFU,MAAM,CAEM;IAEtB;;;;;OAKG;IACH,4BAFU,MAAM,CAEkB;IAElC;;;;;OAKG;IACH,wBAFU,MAAM,CAEW;IAoB3B,uCAMC;IAED,0DAwDC;CACJ;2BAxH0B,qBAAqB"}
1
+ {"version":3,"file":"CellFilterFXAA.d.ts","sourceRoot":"","sources":["../../../../../../src/generation/filtering/numeric/complex/CellFilterFXAA.js"],"names":[],"mappings":"AAQA;;GAEG;AACH;IAiCI;;;;OAIG;IACH,oBAHW,UAAU,GACR,cAAc,CAY1B;IA7CD;;;OAGG;IACH,QAFU,UAAU,CAEN;IAEd;;;;OAIG;IACH,gBAFU,MAAM,CAEM;IAEtB;;;;;OAKG;IACH,4BAFU,MAAM,CAEkB;IAElC;;;;;OAKG;IACH,wBAFU,MAAM,CAEW;IAoB3B,uCAMC;IAED,0DAwDC;CACJ;2BAxH0B,qBAAqB"}
@@ -1,6 +1,9 @@
1
1
  import { assert } from "../../../../core/assert.js";
2
+ import { clamp } from "../../../../core/math/clamp.js";
2
3
  import { max2 } from "../../../../core/math/max2.js";
4
+ import { max3 } from "../../../../core/math/max3.js";
3
5
  import { min2 } from "../../../../core/math/min2.js";
6
+ import { min3 } from "../../../../core/math/min3.js";
4
7
  import { CellFilter } from "../../CellFilter.js";
5
8
 
6
9
  /**
@@ -84,8 +87,8 @@ export class CellFilterFXAA extends CellFilter {
84
87
  const lumaMaxNeSe = max2(lumaNE, lumaSE);
85
88
  const lumaMinNeSe = min2(lumaNE, lumaSE);
86
89
 
87
- const lumaMin = min2(lumaM, min2(lumaMinNeSe, lumaMinNwSw));
88
- const lumaMax = max2(lumaM, max2(lumaMaxNeSe, lumaMaxNwSw));
90
+ const lumaMin = min3(lumaM, lumaMinNeSe, lumaMinNwSw);
91
+ const lumaMax = max3(lumaM, lumaMaxNeSe, lumaMaxNwSw);
89
92
 
90
93
  if (lumaMin === lumaMax) {
91
94
  //no luma difference across the sampled region
@@ -97,13 +100,13 @@ export class CellFilterFXAA extends CellFilter {
97
100
 
98
101
  const dirReduce = max2(
99
102
  (lumaNW + lumaNE + lumaSW + lumaSE) * (0.25 * this.edge_threshold),
100
- this.console_edge_threshold_min);
103
+ this.console_edge_threshold_min
104
+ );
101
105
 
102
106
  const rcpDirMin = 1.0 / (min2(Math.abs(dir_x), Math.abs(dir_y)) + dirReduce);
103
107
 
104
- const dir1_x = min2(this.console_edge_sharpness, max2(-this.console_edge_sharpness, dir_x * rcpDirMin));
105
- const dir1_y = min2(this.console_edge_sharpness, max2(-this.console_edge_sharpness, dir_y * rcpDirMin));
106
-
108
+ const dir1_x = clamp(dir_x * rcpDirMin, -this.console_edge_sharpness, this.console_edge_sharpness);
109
+ const dir1_y = clamp(dir_y * rcpDirMin, -this.console_edge_sharpness, this.console_edge_sharpness);
107
110
 
108
111
  const valueN1 = this.source.execute(grid, x + dir1_x * (1 / 3 - 0.5), y + dir1_y * (1 / 3 - 0.5), rotation);
109
112
  const valueP1 = this.source.execute(grid, x + dir1_x * (2 / 3 - 0.5), y + dir1_y * (2 / 3 - 0.5), rotation);
@@ -21,22 +21,10 @@ export class CellFilterGaussianBlur extends CellFilter {
21
21
  size_y: number;
22
22
  /**
23
23
  *
24
- * @type {number[]|ArrayLike<number>}
24
+ * @type {Float32Array}
25
25
  * @private
26
26
  */
27
27
  private __kernel;
28
- /**
29
- *
30
- * @type {number}
31
- * @private
32
- */
33
- private __kernel_total_power;
34
- /**
35
- *
36
- * @type {number}
37
- * @private
38
- */
39
- private __inv_kernel_total_power;
40
28
  /**
41
29
  * Written by 'initialize' stage
42
30
  * @type {number}
@@ -1 +1 @@
1
- {"version":3,"file":"CellFilterGaussianBlur.d.ts","sourceRoot":"","sources":["../../../../../../src/generation/filtering/numeric/complex/CellFilterGaussianBlur.js"],"names":[],"mappings":"AA6DA;IA8EI;;;;;;;OAOG;IACH,oBANW,UAAU,KACV,MAAM,KACN,MAAM,YACN,MAAM,GACJ,sBAAsB,CAkBlC;IAlGG,kBAAkB;IAClB,kBAAkB;IAElB,gBAAiB;IACjB,gBAAiB;IAEjB;;;OAGG;IACH,QAFU,UAAU,CAEF;IAElB,eAAe;IACf,eAAe;IAEf;;;;OAIG;IACH,iBAAkB;IAElB;;;;OAIG;IACH,6BAA6B;IAE7B;;;;OAIG;IACH,iCAAiC;IAEjC;;;;OAIG;IACH,wBAAwB;IAExB;;;;OAIG;IACH,wBAAwB;IAG5B,uCAoBC;IA6BD,0DA8CC;CACJ;2BAhN0B,qBAAqB"}
1
+ {"version":3,"file":"CellFilterGaussianBlur.d.ts","sourceRoot":"","sources":["../../../../../../src/generation/filtering/numeric/complex/CellFilterGaussianBlur.js"],"names":[],"mappings":"AAMA;IA+DI;;;;;;;OAOG;IACH,oBANW,UAAU,KACV,MAAM,KACN,MAAM,YACN,MAAM,GACJ,sBAAsB,CAkBlC;IAtFD,kBAAc;IACd,kBAAc;IAEd,gBAAa;IACb,gBAAa;IAEb;;;OAGG;IACH,QAFU,UAAU,CAEN;IAEd,eAAW;IACX,eAAW;IAEX;;;;OAIG;IACH,iBAA+B;IAE/B;;;;OAIG;IACH,wBAAoB;IAEpB;;;;OAIG;IACH,wBAAoB;IAEpB,uCAuBC;IA6BD,0DA4CC;CACJ;2BAxI0B,qBAAqB"}