simulationjsv2 0.10.3 → 0.10.4

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/TODO.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # TODO
2
2
 
3
+ - [ ] hex to color
3
4
  - [ ] Materials for planes
4
5
  - [ ] Transform vertex colors on material
5
6
  - [x] Morph objects into other objects
@@ -27,6 +27,7 @@ export declare abstract class SimulationElement3d {
27
27
  is3d: boolean;
28
28
  isEmpty: boolean;
29
29
  constructor(pos: Vector3, rotation: Vector3, color?: Color);
30
+ emptyShallow(): void;
30
31
  empty(): void;
31
32
  getId(): string | null;
32
33
  setId(id: string): void;
package/dist/graphics.js CHANGED
@@ -44,7 +44,13 @@ export class SimulationElement3d {
44
44
  this.cullMode = 'none';
45
45
  this.id = null;
46
46
  }
47
+ emptyShallow() {
48
+ this.children = [];
49
+ }
47
50
  empty() {
51
+ for (let i = 0; i < this.children.length; i++) {
52
+ this.children[i].empty();
53
+ }
48
54
  this.children = [];
49
55
  }
50
56
  getId() {
@@ -45,6 +45,7 @@ export declare class Simulation extends Settings {
45
45
  add(el: SimulationElement3d, id?: string): void;
46
46
  remove(el: SimulationElement3d): void;
47
47
  removeId(id: string): void;
48
+ empty(): void;
48
49
  private applyCanvasSize;
49
50
  setCanvasSize(width: number, height: number): void;
50
51
  start(): void;
@@ -214,6 +214,12 @@ export class Simulation extends Settings {
214
214
  removeId(id) {
215
215
  removeSceneId(this.scene, id);
216
216
  }
217
+ empty() {
218
+ for (let i = 0; i < this.scene.length; i++) {
219
+ this.scene[i].empty();
220
+ }
221
+ this.scene = [];
222
+ }
217
223
  applyCanvasSize(width, height) {
218
224
  if (this.canvasRef === null)
219
225
  return;
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "types": "./dist/index.d.ts",
6
6
  "author": "Jackson Otto",
7
7
  "description": "A simple graphics library using WebGPU",
8
- "version": "0.10.3",
8
+ "version": "0.10.4",
9
9
  "exports": {
10
10
  ".": {
11
11
  "import": "./dist/index.js",