@woosh/meep-engine 2.39.2 → 2.39.3

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 (47) hide show
  1. package/core/bvh2/{traversal/__detailed_box_volume_intersection.js → aabb3/aabb3_detailed_volume_intersection.js} +47 -27
  2. package/core/bvh2/bvh3/query/compute_tight_near_far_clipping_planes.js +13 -0
  3. package/core/bvh2/traversal/ThreeClippingPlaneComputingBVHVisitor.js +5 -3
  4. package/core/bvh2/traversal/__process_point_if_within_planes.js +1 -0
  5. package/core/bvh2/traversal/aabb3_detailed_volume_intersection_callback_based.js +60 -0
  6. package/core/geom/3d/plane/is_point_within_planes.js +46 -0
  7. package/editor/actions/concrete/ActionUpdateTexture.js +21 -0
  8. package/editor/actions/concrete/ArrayCopyAction.js +39 -0
  9. package/editor/actions/concrete/ModifyPatchTextureArray2DAction.js +182 -0
  10. package/editor/enableEditor.js +30 -2
  11. package/editor/tools/paint/TerrainPaintTool.js +19 -3
  12. package/editor/tools/paint/TerrainTexturePaintTool.js +19 -57
  13. package/editor/tools/paint/prototypeTerrainEditor.js +67 -0
  14. package/editor/view/ecs/ComponentControlView.js +105 -10
  15. package/editor/view/ecs/EntityEditor.js +1 -1
  16. package/engine/ecs/fow/FogOfWarSystem.js +6 -3
  17. package/engine/ecs/terrain/ecs/Terrain.js +57 -47
  18. package/engine/ecs/terrain/ecs/layers/TerrainLayer.js +16 -2
  19. package/engine/ecs/terrain/ecs/layers/TerrainLayers.js +17 -0
  20. package/engine/ecs/terrain/ecs/splat/SplatMapping.js +24 -78
  21. package/engine/ecs/terrain/ecs/splat/loadLegacyTerrainSplats.js +73 -0
  22. package/engine/graphics/camera/camera_compute_distance_to_fit_length.d.ts +1 -0
  23. package/engine/graphics/camera/camera_compute_distance_to_fit_length.js +16 -0
  24. package/engine/graphics/camera/testClippingPlaneComputation.js +7 -4
  25. package/engine/graphics/ecs/camera/Camera.js +2 -2
  26. package/engine/graphics/ecs/camera/CameraClippingPlaneComputer.js +5 -8
  27. package/engine/graphics/ecs/camera/CameraSystem.js +18 -184
  28. package/engine/graphics/ecs/camera/auto_set_camera_clipping_planes.js +32 -0
  29. package/engine/graphics/ecs/camera/build_three_camera_object.js +29 -0
  30. package/engine/graphics/ecs/camera/compute_perspective_camera_focal_position.js +27 -0
  31. package/engine/graphics/ecs/camera/frustum_from_camera.js +20 -0
  32. package/engine/graphics/ecs/camera/is_valid_distance_value.js +11 -0
  33. package/engine/graphics/ecs/camera/set_camera_aspect_ratio.js +46 -0
  34. package/engine/graphics/ecs/camera/update_camera_transform.js +17 -0
  35. package/engine/graphics/ecs/path/testPathDisplaySystem.js +19 -15
  36. package/engine/graphics/ecs/path/tube/TubePathStyle.js +1 -0
  37. package/engine/graphics/{Utils.js → makeModelView.js} +1 -10
  38. package/engine/graphics/particles/particular/engine/emitter/ParticleEmitter.js +2 -2
  39. package/engine/graphics/render/forward_plus/LightManager.js +2 -2
  40. package/engine/graphics/render/view/CameraView.js +2 -2
  41. package/engine/graphics/texture/sampler/Sampler2D.js +1293 -1267
  42. package/engine/graphics/texture/texture_array_2d_copy.js +45 -0
  43. package/engine/graphics/util/makeMeshPreviewScene.js +2 -2
  44. package/package.json +1 -1
  45. package/view/renderModel.js +1 -1
  46. package/view/string_tag_to_css_class_name.js +12 -0
  47. package/engine/graphics/util/computeMeshPreviewCameraDistance.js +0 -10
@@ -0,0 +1,45 @@
1
+ /**
2
+ *
3
+ * @param {number[]|ArrayLike<number>|Float32Array} source
4
+ * @param {number} source_x
5
+ * @param {number} source_y
6
+ * @param {number} source_width
7
+ * @param {number} source_height
8
+ * @param {number[]|ArrayLike<number>|Float32Array} destination
9
+ * @param {number} destination_x
10
+ * @param {number} destination_y
11
+ * @param {number} destination_width
12
+ * @param {number} destination_height
13
+ * @param {number} width
14
+ * @param {number} height
15
+ * @param {number} depth
16
+ */
17
+ export function texture_array_2d_copy(
18
+ source, source_x, source_y, source_width, source_height,
19
+ destination, destination_x, destination_y, destination_width, destination_height,
20
+ width, height, depth
21
+ ) {
22
+
23
+ const source_layer_size = source_height * source_width;
24
+ const destination_layer_size = destination_width * destination_height;
25
+
26
+ for (let k = 0; k < depth; k++) {
27
+ for (let y = 0; y < height; y++) {
28
+
29
+ const s_y = y + source_y;
30
+ const d_y = y + destination_y;
31
+
32
+ for (let x = 0; x < width; x++) {
33
+
34
+ const s_x = x + source_x;
35
+ const d_x = x + destination_x;
36
+
37
+ const source_address = k * source_layer_size + s_y * source_width + s_x;
38
+ const destination_address = k * destination_layer_size + d_y * destination_width + d_x;
39
+
40
+ destination[destination_address] = source[source_address];
41
+ }
42
+ }
43
+ }
44
+
45
+ }
@@ -8,7 +8,7 @@ import {
8
8
  } from "three";
9
9
  import Vector3 from "../../../core/geom/Vector3.js";
10
10
  import { rootObject3DFastMatrixUpdate } from "../ecs/mesh/rootObject3DFastMatrixUpdate.js";
11
- import { computeMeshPreviewCameraDistance } from "./computeMeshPreviewCameraDistance.js";
11
+ import { camera_compute_distance_to_fit_length } from "../camera/camera_compute_distance_to_fit_length.js";
12
12
  import { scaleObject3ToBox } from "./ScaleObject3ToBox.js";
13
13
  import { DEG_TO_RAD } from "../../../core/math/DEG_TO_RAD.js";
14
14
  import AABB2 from "../../../core/geom/AABB2.js";
@@ -72,7 +72,7 @@ export function makeMeshPreviewScene(mesh, size, focus = new AABB2(0, 0, size.x,
72
72
 
73
73
 
74
74
  const fov = camera.fov * DEG_TO_RAD;
75
- const distance = computeMeshPreviewCameraDistance(focusHeight, fov, bBox.max.z);
75
+ const distance = bBox.max.z + camera_compute_distance_to_fit_length(focusHeight, fov);
76
76
 
77
77
  const cameraPositionX = focus.x0 + (focus.x1 - focus.x0) / 2 - 0.5;
78
78
  const cameraPositionY = 0.5 - (focus.y0 + (focus.y1 - focus.y0) / 2);
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "productName": "Meep",
6
6
  "description": "production-ready JavaScript game engine based on Entity Component System Architecture",
7
7
  "author": "Alexander Goldring",
8
- "version": "2.39.2",
8
+ "version": "2.39.3",
9
9
  "dependencies": {
10
10
  "gl-matrix": "3.4.3",
11
11
  "fast-levenshtein": "2.0.6",
@@ -2,12 +2,12 @@
2
2
  * Created by Alex on 21/03/2016.
3
3
  */
4
4
  import Future from '../core/process/Future.js';
5
- import { makeModelView as _makeModelView } from "../engine/graphics/Utils.js";
6
5
 
7
6
  import ConcurrentExecutor from '../core/process/executor/ConcurrentExecutor.js';
8
7
  import { futureTask } from "../core/process/task/TaskUtils.js";
9
8
  import { promiseMaterialLoaded } from "../engine/graphics/util/promiseMaterialLoaded.js";
10
9
  import { guessAssetType } from "../engine/asset/guessAssetType.js";
10
+ import { makeModelView as _makeModelView } from "../engine/graphics/makeModelView.js";
11
11
 
12
12
 
13
13
  //use an executor to prevent stalling main thread when building previews
@@ -0,0 +1,12 @@
1
+ import { camelToKebab } from "../core/primitives/strings/StringUtils.js";
2
+
3
+ /**
4
+ *
5
+ * @param {string} a
6
+ * @returns {string}
7
+ */
8
+ export function string_tag_to_css_class_name(a) {
9
+ const name = camelToKebab(a);
10
+
11
+ return `tag-${name}`;
12
+ }
@@ -1,10 +0,0 @@
1
- /**
2
- *
3
- * @param {number} focusHeight Height of the focus area in world space
4
- * @param {number} fov Field of View
5
- * @param {number} [offset=0]
6
- * @returns {number}
7
- */
8
- export function computeMeshPreviewCameraDistance(focusHeight, fov, offset = 0) {
9
- return Math.abs((focusHeight / 2) / Math.sin(fov / 2)) + offset;
10
- }