@woosh/meep-engine 2.43.9 → 2.43.12

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 (29) hide show
  1. package/core/binary/is_data_url.js +12 -0
  2. package/core/binary/url_to_data_url.js +28 -0
  3. package/core/collection/queue/Deque.js +2 -2
  4. package/core/geom/3d/shape/AbstractShape3D.js +9 -0
  5. package/core/geom/3d/shape/TransformedShape3D.js +8 -0
  6. package/core/geom/3d/shape/UnionShape3D.js +35 -0
  7. package/core/geom/3d/shape/UnitCubeShape3D.js +10 -0
  8. package/core/geom/3d/shape/UnitSphereShape3D.js +10 -0
  9. package/editor/ecs/component/editors/ImagePathEditor.js +15 -66
  10. package/editor/ecs/component/editors/LargeStrongEditor.js +107 -0
  11. package/engine/graphics/ecs/path/PathDisplaySystem.js +92 -4
  12. package/engine/graphics/ecs/path/tube/build/{GeometryOutput.js → StreamGeometryBuilder.js} +1 -1
  13. package/engine/graphics/ecs/path/tube/build/TubePathBuilder.js +16 -14
  14. package/engine/graphics/ecs/path/tube/build/build_geometry_catmullrom.spec.js +32 -0
  15. package/engine/graphics/ecs/path/tube/build/computeFrenetFrames.js +6 -1
  16. package/engine/graphics/ecs/path/tube/build/makeTubeGeometry.js +6 -4
  17. package/engine/graphics/ecs/path/tube/build/make_cap.js +10 -10
  18. package/engine/graphics/ecs/path/tube/build/make_ring_faces.js +1 -1
  19. package/engine/graphics/ecs/path/tube/build/make_ring_vertices.js +1 -1
  20. package/engine/graphics/impostors/octahedral/shader/ImpostorShaderV0.js +143 -27
  21. package/engine/graphics/micron/plugin/shaded_geometry/MicronShadedGeometryRenderAdapter.js +5 -0
  22. package/engine/graphics/particles/particular/engine/utils/volume/ParticleVolume.d.ts +3 -1
  23. package/engine/graphics/particles/particular/engine/utils/volume/ParticleVolume.js +148 -5
  24. package/engine/graphics/particles/particular/engine/utils/volume/SamplingFunctionKind.d.ts +4 -0
  25. package/engine/graphics/particles/particular/engine/utils/volume/SamplingFunctionKind.js +8 -0
  26. package/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +7 -4
  27. package/engine/navigation/ecs/components/Path.spec.js +21 -0
  28. package/package.json +1 -1
  29. package/samples/terrain/from_image_2.js +33 -0
@@ -79,6 +79,8 @@ import { MicronRenderPlugin } from "../../../../../micron/plugin/MicronRenderPlu
79
79
  import { obtainTerrain } from "../../../../../../ecs/terrain/util/obtainTerrain.js";
80
80
  import { pick } from "../../../../../../../ecs/grid/pick.js";
81
81
  import { clamp01 } from "../../../../../../../core/math/clamp01.js";
82
+ import { randomFromArray } from "../../../../../../../core/math/random/randomFromArray.js";
83
+ import { SamplingFunctionKind } from "./SamplingFunctionKind.js";
82
84
 
83
85
  const engineHarness = new EngineHarness();
84
86
 
@@ -895,7 +897,7 @@ async function sample_scene_moicon_0(engine) {
895
897
  * @param {Engine} engine
896
898
  */
897
899
  async function main(engine) {
898
- EngineHarness.buildBasics({
900
+ await EngineHarness.buildBasics({
899
901
  engine,
900
902
  enableWater: false,
901
903
  enableTerrain: false,
@@ -914,8 +916,8 @@ async function main(engine) {
914
916
  engine.graphics.renderer.setClearColor('rgba(99,99,99,1)');
915
917
 
916
918
  // await sample_scene_nam(engine);
917
- // await sample_scene_0(engine);
918
- await sample_scene_moicon_0(engine);
919
+ await sample_scene_0(engine);
920
+ // await sample_scene_moicon_0(engine);
919
921
  }
920
922
 
921
923
  /**
@@ -1068,7 +1070,8 @@ function create_volume({
1068
1070
  particle_size,
1069
1071
  shape: shape,
1070
1072
  sort,
1071
- sprite
1073
+ sprite,
1074
+ sampling_function: randomFromArray(Math.random, [SamplingFunctionKind.Random, SamplingFunctionKind.Grid])
1072
1075
  });
1073
1076
 
1074
1077
  v.build();
@@ -158,3 +158,24 @@ test("getPosition on a path with 1 point", () => {
158
158
 
159
159
  expect(v.toJSON()).toEqual({ x: 1, y: 3, z: 7 });
160
160
  });
161
+
162
+
163
+ test("sample_catmull_rom with very small offsets",()=>{
164
+ const path = Path.fromJSON({
165
+ points:[3, 1, 1, 3, 1, 3, 7, 1, 3, 7, 1, 7, 3, 1, 7, 3, 1, 8]
166
+ });
167
+
168
+ const v = new Vector3();
169
+
170
+ path.sample_catmull_rom(v,0);
171
+
172
+ expect(v.x).not.toBeNaN();
173
+ expect(v.y).not.toBeNaN();
174
+ expect(v.z).not.toBeNaN();
175
+
176
+ path.sample_catmull_rom(v,0.00005900000113712167);
177
+
178
+ expect(v.x).not.toBeNaN();
179
+ expect(v.y).not.toBeNaN();
180
+ expect(v.z).not.toBeNaN();
181
+ });
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.43.9",
8
+ "version": "2.43.12",
9
9
  "dependencies": {
10
10
  "gl-matrix": "3.4.3",
11
11
  "fast-levenshtein": "2.0.6",
@@ -15,6 +15,9 @@ import { TerrainLayer } from "../../engine/ecs/terrain/ecs/layers/TerrainLayer.j
15
15
  import Mesh from "../../engine/graphics/ecs/mesh/Mesh.js";
16
16
  import { Transform } from "../../engine/ecs/transform/Transform.js";
17
17
  import { MeshSystem } from "../../engine/graphics/ecs/mesh/MeshSystem.js";
18
+ import { downloadAsFile } from "../../core/binary/ByteArrayTools.js";
19
+ import { url_to_data_url } from "../../core/binary/url_to_data_url.js";
20
+ import ButtonView from "../../view/elements/button/ButtonView.js";
18
21
 
19
22
  const HEIGHT_RANGE = 64;
20
23
 
@@ -149,6 +152,36 @@ async function main(engine) {
149
152
  load_gltf("moicon/23_Nov_21_Skogplanter/02/model.gltf", engine, transform);
150
153
  // load_gltf("moicon/23_Nov_21_Skogplanter/03/model.gltf", engine, transform);
151
154
  // load_gltf("moicon/23_Nov_21_Skogplanter/04/model.gltf", engine, transform);
155
+
156
+ engine.gui.view.addChild(new ButtonView({
157
+ name: 'Download',
158
+ async action() {
159
+ for (const layer of terrain.layers.layers.data) {
160
+ // embed textures
161
+ layer.textureDiffuseURL = await url_to_data_url(layer.textureDiffuseURL);
162
+ }
163
+
164
+ // we wrap the terrain data into "component json" format that meep editor recognizes to make this compatible with the standalone terrain editor
165
+ const json_payload = {
166
+ type: "Terrain",
167
+ data: terrain.toJSON()
168
+ };
169
+
170
+ downloadAsFile(
171
+ JSON.stringify(json_payload),
172
+ 'terrain.json'
173
+ );
174
+ },
175
+ css: {
176
+ bottom: '4px',
177
+ left: '4px',
178
+ position: 'absolute',
179
+ background: 'white',
180
+ border: '1px solid black',
181
+ padding: '2px',
182
+ pointerEvents: 'auto'
183
+ }
184
+ }));
152
185
  }
153
186
 
154
187
  /**