simulationjsv2 0.5.1 → 0.6.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/TODO.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # TODO
2
2
 
3
- - [ ] Make input position vec3 not vec4
4
- - [ ] Change position/rotation to be matrix transform on gpu
5
- - [ ] Make getBuffer return cached Float32Array
3
+ - [ ] Add animation status handle to transition values
4
+ - [x] Change position/rotation to be matrix transform on gpu
5
+ - [x] Add update square center offset position in-place + not
6
+ - [x] Make getBuffer return cached Float32Array
7
+ - [x] Make input buffer position vec3 not vec4
8
+ - [x] Use line strip vertices for polygon buffers
9
+ - [x] Scene collection wireframe
10
+
11
+ ## Not Yet
12
+
13
+ - [ ] Add rotateAround and rotateToAround methods to simulation element for absolute positioned vectors
@@ -1,6 +1,11 @@
1
- export declare const vertexSize = 44;
1
+ export declare const vertexSize = 40;
2
2
  export declare const positionOffset = 0;
3
- export declare const colorOffset = 16;
4
- export declare const uvOffset = 32;
5
- export declare const drawingInstancesOffset = 40;
3
+ export declare const colorOffset = 12;
4
+ export declare const uvOffset = 28;
5
+ export declare const drawingInstancesOffset = 36;
6
6
  export declare const BUF_LEN: number;
7
+ export declare const worldProjMatOffset = 0;
8
+ export declare const modelProjMatOffset: number;
9
+ export declare const xAxis: import("./types.js").Vector3;
10
+ export declare const yAxis: import("./types.js").Vector3;
11
+ export declare const zAxis: import("./types.js").Vector3;
package/dist/constants.js CHANGED
@@ -1,6 +1,12 @@
1
- export const vertexSize = 44; // 4 * 10
1
+ import { vector3 } from './utils.js';
2
+ export const vertexSize = 40; // 4 * 10
2
3
  export const positionOffset = 0;
3
- export const colorOffset = 16; // 4 * 4
4
- export const uvOffset = 32; // 4 * 8
5
- export const drawingInstancesOffset = 40;
4
+ export const colorOffset = 12; // 4 * 3
5
+ export const uvOffset = 28; // 4 * 8
6
+ export const drawingInstancesOffset = 36;
6
7
  export const BUF_LEN = vertexSize / 4;
8
+ export const worldProjMatOffset = 0;
9
+ export const modelProjMatOffset = 4 * 16;
10
+ export const xAxis = vector3(1);
11
+ export const yAxis = vector3(0, 1);
12
+ export const zAxis = vector3(0, 0, 1);
@@ -1,4 +1,4 @@
1
- import { VertexParamGeneratorInfo, CircleGeometryParams, CubeGeometryParams, EmptyParams, Line2dGeometryParams, Line3dGeometryParams, Mat4, PolygonGeometryParams, Spline2dGeometryParams, SquareGeometryParams, Vector2, Vector3, VertexColorMap } from './types.js';
1
+ import { VertexParamGeneratorInfo, CircleGeometryParams, CubeGeometryParams, EmptyParams, PolygonGeometryParams, Spline2dGeometryParams, SquareGeometryParams, Vector2, Vector3, VertexColorMap, LineGeometryParams } from './types.js';
2
2
  import { Color, Vertex } from './utils.js';
3
3
  import { CubicBezierCurve2d, SplinePoint2d } from './graphics.js';
4
4
  export declare abstract class Geometry<T extends EmptyParams> {
@@ -6,10 +6,8 @@ export declare abstract class Geometry<T extends EmptyParams> {
6
6
  protected abstract triangleOrder: number[];
7
7
  protected abstract params: T;
8
8
  protected vertices: Vector3[];
9
- protected matrix: Mat4;
10
9
  protected geometryType: 'list' | 'strip';
11
10
  constructor(vertices?: Vector3[], geometryType?: 'list' | 'strip');
12
- updateMatrix(matrix: Mat4): void;
13
11
  getType(): "list" | "strip";
14
12
  abstract recompute(): void;
15
13
  getTriangleVertexCount(): number;
@@ -44,6 +42,8 @@ export declare class SquareGeometry extends Geometry<SquareGeometryParams> {
44
42
  protected triangleOrder: number[];
45
43
  protected params: SquareGeometryParams;
46
44
  constructor(width: number, height: number, centerOffset?: Vector2);
45
+ setOffset(offset: Vector2): void;
46
+ getOffset(): Vector2;
47
47
  setVertexColorMap(colorMap: VertexColorMap): void;
48
48
  setWidth(width: number): void;
49
49
  setHeight(height: number): void;
@@ -86,18 +86,24 @@ export declare class Spline2dGeometry extends Geometry<Spline2dGeometryParams> {
86
86
  getWireframeBuffer(color: Color, vertexParamGenerator?: VertexParamGeneratorInfo): number[];
87
87
  getTriangleBuffer(_: Color, vertexParamGenerator?: VertexParamGeneratorInfo): number[];
88
88
  }
89
- export declare class Line2dGeometry extends Geometry<Line2dGeometryParams> {
89
+ export declare class Line2dGeometry extends Geometry<LineGeometryParams> {
90
90
  protected wireframeOrder: number[];
91
91
  protected triangleOrder: number[];
92
- protected params: Line2dGeometryParams;
93
- constructor(pos: Vector2, to: Vector2, thickness: number);
92
+ protected params: LineGeometryParams;
93
+ constructor(pos: Vector3, to: Vector3, thickness: number, fromColor?: Color | null, toColor?: Color | null);
94
+ private generateBuffer;
95
+ getTriangleBuffer(color: Color, vertexParamGenerator?: VertexParamGeneratorInfo): number[];
96
+ getWireframeBuffer(color: Color, vertexParamGenerator?: VertexParamGeneratorInfo): number[];
94
97
  recompute(): void;
95
98
  }
96
- export declare class Line3dGeometry extends Geometry<Line3dGeometryParams> {
99
+ export declare class Line3dGeometry extends Geometry<LineGeometryParams> {
97
100
  protected wireframeOrder: number[];
98
101
  protected triangleOrder: number[];
99
- protected params: Line3dGeometryParams;
100
- constructor(pos: Vector3, to: Vector3, thickness: number);
102
+ protected params: LineGeometryParams;
103
+ constructor(pos: Vector3, to: Vector3, thickness: number, fromColor?: Color | null, toColor?: Color | null);
104
+ private generateBuffer;
105
+ getTriangleBuffer(color: Color, vertexParamGenerator?: VertexParamGeneratorInfo): number[];
106
+ getWireframeBuffer(color: Color, vertexParamGenerator?: VertexParamGeneratorInfo): number[];
101
107
  recompute(): void;
102
108
  }
103
109
  export declare class PolygonGeometry extends Geometry<PolygonGeometryParams> {
package/dist/geometry.js CHANGED
@@ -2,19 +2,14 @@ import { mat4, vec2, vec3 } from 'wgpu-matrix';
2
2
  import { cloneBuf, interpolateColors, matrix4, vector2, vector2FromVector3, vector3, vector3FromVector2, vertex } from './utils.js';
3
3
  import { CubicBezierCurve2d } from './graphics.js';
4
4
  import { BUF_LEN } from './constants.js';
5
- import { bufferGenerator, lossyTriangulate, triangulateWireFrameOrder } from './internalUtils.js';
5
+ import { bufferGenerator, lossyTriangulate, lossyTriangulateStrip, triangulateWireFrameOrder } from './internalUtils.js';
6
6
  export class Geometry {
7
7
  vertices;
8
- matrix;
9
8
  geometryType;
10
9
  constructor(vertices = [], geometryType = 'list') {
11
10
  this.vertices = vertices;
12
- this.matrix = matrix4();
13
11
  this.geometryType = geometryType;
14
12
  }
15
- updateMatrix(matrix) {
16
- this.matrix = matrix;
17
- }
18
13
  getType() {
19
14
  return this.geometryType;
20
15
  }
@@ -27,8 +22,7 @@ export class Geometry {
27
22
  bufferFromOrder(order, color, vertexParamGenerator) {
28
23
  return order
29
24
  .map((vertexIndex) => {
30
- const pos = cloneBuf(this.vertices[vertexIndex]);
31
- vec3.transformMat4(pos, this.matrix, pos);
25
+ const pos = this.vertices[vertexIndex];
32
26
  return bufferGenerator.generate(pos[0], pos[1], pos[2], color, vector2(), vertexParamGenerator);
33
27
  })
34
28
  .flat();
@@ -65,8 +59,7 @@ export class PlaneGeometry extends Geometry {
65
59
  return this.triangleOrder
66
60
  .map((index) => {
67
61
  const vertex = this.rawVertices[index];
68
- const pos = cloneBuf(vertex.getPos());
69
- vec3.transformMat4(pos, this.matrix, pos);
62
+ const pos = vertex.getPos();
70
63
  return bufferGenerator.generate(pos[0], pos[1], pos[2], vertex.getColor() || color, vector2(), vertexParamGenerator);
71
64
  })
72
65
  .flat();
@@ -137,6 +130,12 @@ export class SquareGeometry extends Geometry {
137
130
  };
138
131
  this.recompute();
139
132
  }
133
+ setOffset(offset) {
134
+ this.params.centerOffset = offset;
135
+ }
136
+ getOffset() {
137
+ return this.params.centerOffset;
138
+ }
140
139
  setVertexColorMap(colorMap) {
141
140
  this.params.colorMap = colorMap;
142
141
  }
@@ -158,8 +157,7 @@ export class SquareGeometry extends Geometry {
158
157
  getTriangleBuffer(color, vertexParamGenerator) {
159
158
  return this.triangleOrder
160
159
  .map((vertexIndex) => {
161
- const pos = cloneBuf(this.vertices[vertexIndex]);
162
- vec3.transformMat4(pos, this.matrix, pos);
160
+ const pos = this.vertices[vertexIndex];
163
161
  return bufferGenerator.generate(pos[0], pos[1], pos[2], this.params.colorMap[vertexIndex] || color, vector2(), vertexParamGenerator);
164
162
  })
165
163
  .flat();
@@ -352,8 +350,7 @@ export class Spline2dGeometry extends Geometry {
352
350
  getWireframeBuffer(color, vertexParamGenerator) {
353
351
  return this.wireframeOrder
354
352
  .map((vertexIndex) => {
355
- const vertex = cloneBuf(this.vertices[vertexIndex]);
356
- vec3.transformMat4(vertex, this.matrix, vertex);
353
+ const vertex = this.vertices[vertexIndex];
357
354
  return bufferGenerator.generate(vertex[0], vertex[1], vertex[2], color, vector2(), vertexParamGenerator);
358
355
  })
359
356
  .flat();
@@ -361,8 +358,7 @@ export class Spline2dGeometry extends Geometry {
361
358
  getTriangleBuffer(_, vertexParamGenerator) {
362
359
  return this.triangleOrder
363
360
  .map((vertexIndex) => {
364
- const vertex = cloneBuf(this.vertices[vertexIndex]);
365
- vec3.transformMat4(vertex, this.matrix, vertex);
361
+ const vertex = this.vertices[vertexIndex];
366
362
  return bufferGenerator.generate(vertex[0], vertex[1], vertex[2], this.params.vertexColors[vertexIndex], vector2(), vertexParamGenerator);
367
363
  })
368
364
  .flat();
@@ -372,14 +368,31 @@ export class Line2dGeometry extends Geometry {
372
368
  wireframeOrder = [0, 1, 2, 3, 0, 2];
373
369
  triangleOrder = [0, 1, 3, 2];
374
370
  params;
375
- constructor(pos, to, thickness) {
371
+ constructor(pos, to, thickness, fromColor, toColor) {
376
372
  super([], 'strip');
377
373
  this.params = {
378
374
  pos,
379
375
  to,
380
- thickness
376
+ thickness,
377
+ fromColor: fromColor || null,
378
+ toColor: toColor || null
381
379
  };
382
380
  }
381
+ generateBuffer(order, color, vertexParamGenerator) {
382
+ return order
383
+ .map((vertexIndex) => {
384
+ const pos = this.vertices[vertexIndex];
385
+ const vertexColor = (vertexIndex > 1 ? this.params.toColor : this.params.fromColor) || color;
386
+ return bufferGenerator.generate(pos[0], pos[1], pos[2], vertexColor, vector2(), vertexParamGenerator);
387
+ })
388
+ .flat();
389
+ }
390
+ getTriangleBuffer(color, vertexParamGenerator) {
391
+ return this.generateBuffer(this.triangleOrder, color, vertexParamGenerator);
392
+ }
393
+ getWireframeBuffer(color, vertexParamGenerator) {
394
+ return this.generateBuffer(this.wireframeOrder, color, vertexParamGenerator);
395
+ }
383
396
  recompute() {
384
397
  const normal = vector2(-this.params.to[1], this.params.to[0]);
385
398
  vec2.normalize(normal, normal);
@@ -396,14 +409,31 @@ export class Line3dGeometry extends Geometry {
396
409
  wireframeOrder = [0, 1, 2, 3, 0, 2];
397
410
  triangleOrder = [0, 1, 2, 3, 0];
398
411
  params;
399
- constructor(pos, to, thickness) {
412
+ constructor(pos, to, thickness, fromColor, toColor) {
400
413
  super([], 'strip');
401
414
  this.params = {
402
415
  pos,
403
416
  to,
404
- thickness
417
+ thickness,
418
+ fromColor: fromColor || null,
419
+ toColor: toColor || null
405
420
  };
406
421
  }
422
+ generateBuffer(order, color, vertexParamGenerator) {
423
+ return order
424
+ .map((vertexIndex) => {
425
+ const pos = this.vertices[vertexIndex];
426
+ const vertexColor = (vertexIndex > 1 ? this.params.toColor : this.params.fromColor) || color;
427
+ return bufferGenerator.generate(pos[0], pos[1], pos[2], vertexColor, vector2(), vertexParamGenerator);
428
+ })
429
+ .flat();
430
+ }
431
+ getTriangleBuffer(color, vertexParamGenerator) {
432
+ return this.generateBuffer(this.triangleOrder, color, vertexParamGenerator);
433
+ }
434
+ getWireframeBuffer(color, vertexParamGenerator) {
435
+ return this.generateBuffer(this.wireframeOrder, color, vertexParamGenerator);
436
+ }
407
437
  recompute() {
408
438
  const normal = vector2(-this.params.to[1], this.params.to[0]);
409
439
  vec2.normalize(normal, normal);
@@ -421,7 +451,7 @@ export class PolygonGeometry extends Geometry {
421
451
  triangleOrder;
422
452
  params;
423
453
  constructor(points) {
424
- super();
454
+ super([], 'strip');
425
455
  this.wireframeOrder = [];
426
456
  this.triangleOrder = [];
427
457
  this.params = {
@@ -431,16 +461,15 @@ export class PolygonGeometry extends Geometry {
431
461
  }
432
462
  recompute() {
433
463
  this.vertices = this.params.points.map((point) => point.getPos());
434
- this.triangleOrder = lossyTriangulate(Array(this.vertices.length)
464
+ this.triangleOrder = lossyTriangulateStrip(Array(this.vertices.length)
435
465
  .fill(0)
436
- .map((_, index) => index)).flat();
466
+ .map((_, index) => index));
437
467
  this.wireframeOrder = triangulateWireFrameOrder(this.vertices.length);
438
468
  }
439
469
  getTriangleBuffer(color) {
440
470
  return this.triangleOrder
441
471
  .map((vertexIndex) => {
442
- const vertex = cloneBuf(this.vertices[vertexIndex]);
443
- vec3.transformMat4(vertex, this.matrix, vertex);
472
+ const vertex = this.vertices[vertexIndex];
444
473
  return bufferGenerator.generate(vertex[0], vertex[1], 0, this.params.points[vertexIndex].getColor() || color);
445
474
  })
446
475
  .flat();
@@ -1,62 +1,59 @@
1
1
  /// <reference types="@webgpu/types" />
2
2
  import { Camera } from './simulation.js';
3
- import type { Vector2, Vector3, LerpFunc, VertexColorMap, ElementRotation, Mat4, AnySimulationElement, VertexParamGeneratorInfo } from './types.js';
3
+ import type { Vector2, Vector3, LerpFunc, VertexColorMap, Mat4, AnySimulationElement, VertexParamGeneratorInfo } from './types.js';
4
4
  import { Vertex, Color } from './utils.js';
5
5
  import { BlankGeometry, CircleGeometry, CubeGeometry, Geometry, Line2dGeometry, Line3dGeometry, PlaneGeometry, PolygonGeometry, Spline2dGeometry, SquareGeometry } from './geometry.js';
6
6
  import { VertexCache } from './internalUtils.js';
7
- export declare abstract class SimulationElement<T extends Vector2 | Vector3 = Vector3> {
8
- protected abstract pos: T;
7
+ export declare abstract class SimulationElement {
8
+ protected pos: Vector3;
9
9
  protected abstract geometry: Geometry<any>;
10
10
  protected color: Color;
11
11
  protected wireframe: boolean;
12
12
  protected vertexCache: VertexCache;
13
- protected rotation: ElementRotation<T>;
13
+ protected rotation: Vector3;
14
+ protected modelMatrix: Mat4;
15
+ private uniformBuffer;
14
16
  isInstanced: boolean;
15
17
  /**
16
18
  * @param pos - Expected to be adjusted to devicePixelRatio before reaching constructor
17
19
  */
18
- constructor(color: Color | undefined, rotation: ElementRotation<T>);
20
+ constructor(pos: Vector3, rotation: Vector3, color?: Color);
21
+ getModelMatrix(_: Camera): Mat4;
22
+ getUniformBuffer(device: GPUDevice, mat: Mat4): GPUBuffer;
23
+ protected updateModelMatrix3d(): void;
19
24
  getGeometryType(): "list" | "strip";
20
25
  setWireframe(wireframe: boolean): void;
21
26
  isWireframe(): boolean;
22
27
  getColor(): Color;
23
- getPos(): T;
24
- getRotation(): ElementRotation<T>;
28
+ getPos(): Vector3;
29
+ getRotation(): Vector3;
25
30
  fill(newColor: Color, t?: number, f?: LerpFunc): Promise<void>;
26
- abstract move(amount: T, t?: number, f?: LerpFunc): Promise<void>;
27
- abstract moveTo(pos: T, t?: number, f?: LerpFunc): Promise<void>;
28
- abstract rotate(amount: ElementRotation<T>, t?: number, f?: LerpFunc): Promise<void>;
29
- abstract rotateTo(rotation: ElementRotation<T>, t?: number, f?: LerpFunc): Promise<void>;
30
- protected abstract updateMatrix(camera: Camera): void;
31
+ move(amount: Vector3, t?: number, f?: LerpFunc): Promise<void>;
32
+ moveTo(pos: Vector3, t?: number, f?: LerpFunc): Promise<void>;
33
+ rotate(amount: Vector3, t?: number, f?: LerpFunc): Promise<void>;
34
+ rotateTo(rot: Vector3, t?: number, f?: LerpFunc): Promise<void>;
31
35
  getVertexCount(): number;
32
- protected defaultUpdateMatrix(camera: Camera): void;
33
- getBuffer(camera: Camera, vertexParamGenerator?: VertexParamGeneratorInfo): number[];
36
+ protected defaultUpdateMatrix(_: Camera): void;
37
+ getBuffer(vertexParamGenerator?: VertexParamGeneratorInfo): Float32Array | number[];
34
38
  }
35
39
  export declare abstract class SimulationElement3d extends SimulationElement {
36
40
  protected pos: Vector3;
37
41
  protected rotation: Vector3;
38
42
  is3d: boolean;
39
43
  constructor(pos: Vector3, rotation?: Vector3, color?: Color);
40
- rotate(amount: Vector3, t?: number, f?: LerpFunc): Promise<void>;
41
- rotateTo(rot: Vector3, t?: number, f?: LerpFunc): Promise<void>;
42
- move(amount: Vector3, t?: number, f?: LerpFunc): Promise<void>;
43
- moveTo(pos: Vector3, t?: number, f?: LerpFunc): Promise<void>;
44
44
  }
45
- export declare abstract class SimulationElement2d extends SimulationElement<Vector2> {
46
- protected pos: Vector2;
47
- rotation: number;
48
- constructor(pos: Vector2, rotation?: number, color?: Color);
49
- rotate(rotation: number, t?: number, f?: LerpFunc): Promise<void>;
50
- rotateTo(newRotation: number, t?: number, f?: LerpFunc): Promise<void>;
51
- move(amount: Vector2, t?: number, f?: LerpFunc): Promise<void>;
52
- moveTo(newPos: Vector2, t?: number, f?: LerpFunc): Promise<void>;
45
+ export declare abstract class SimulationElement2d extends SimulationElement {
46
+ constructor(pos: Vector2, rotation?: Vector3, color?: Color);
47
+ rotate2d(amount: number, t?: number, f?: LerpFunc): Promise<void>;
48
+ rotateTo2d(rot: number, t?: number, f?: LerpFunc): Promise<void>;
49
+ private updateModelMatrix2d;
50
+ getModelMatrix(camera: Camera): Mat4;
53
51
  }
54
52
  export declare class Plane extends SimulationElement3d {
55
53
  protected geometry: PlaneGeometry;
56
54
  points: Vertex[];
57
55
  constructor(pos: Vector3, points: Vertex[], color?: Color, rotation?: Vector3);
58
56
  setPoints(newPoints: Vertex[]): void;
59
- protected updateMatrix(camera: Camera): void;
60
57
  }
61
58
  export declare class Square extends SimulationElement2d {
62
59
  protected geometry: SquareGeometry;
@@ -68,6 +65,8 @@ export declare class Square extends SimulationElement2d {
68
65
  * @param vertexColors{Record<number, Color>} - 0 is top left vertex, numbers increase clockwise
69
66
  */
70
67
  constructor(pos: Vector2, width: number, height: number, color?: Color, rotation?: number, centerOffset?: Vector2, vertexColors?: VertexColorMap);
68
+ setOffset(offset: Vector2): void;
69
+ setOffsetInplace(offset: Vector2): void;
71
70
  private cloneColorMap;
72
71
  setVertexColors(newColorMap: VertexColorMap, t?: number, f?: LerpFunc): Promise<void>;
73
72
  scaleWidth(amount: number, t?: number, f?: LerpFunc): Promise<void>;
@@ -75,7 +74,6 @@ export declare class Square extends SimulationElement2d {
75
74
  scale(amount: number, t?: number, f?: LerpFunc): Promise<void>;
76
75
  setWidth(num: number, t?: number, f?: LerpFunc): Promise<void>;
77
76
  setHeight(num: number, t?: number, f?: LerpFunc): Promise<void>;
78
- protected updateMatrix(camera: Camera): void;
79
77
  }
80
78
  export declare class Circle extends SimulationElement2d {
81
79
  protected geometry: CircleGeometry;
@@ -84,7 +82,6 @@ export declare class Circle extends SimulationElement2d {
84
82
  constructor(pos: Vector2, radius: number, color?: Color, detail?: number);
85
83
  setRadius(num: number, t?: number, f?: LerpFunc): Promise<void>;
86
84
  scale(amount: number, t?: number, f?: LerpFunc): Promise<void>;
87
- protected updateMatrix(camera: Camera): void;
88
85
  }
89
86
  export declare class Polygon extends SimulationElement2d {
90
87
  protected geometry: PolygonGeometry;
@@ -92,7 +89,6 @@ export declare class Polygon extends SimulationElement2d {
92
89
  constructor(pos: Vector2, points: Vertex[], color?: Color, rotation?: number);
93
90
  getVertices(): Vertex[];
94
91
  setVertices(newVertices: Vertex[], t?: number, f?: LerpFunc): Promise<void>;
95
- protected updateMatrix(camera: Camera): void;
96
92
  }
97
93
  export declare class Line3d extends SimulationElement3d {
98
94
  protected geometry: Line3dGeometry;
@@ -101,16 +97,14 @@ export declare class Line3d extends SimulationElement3d {
101
97
  constructor(pos: Vertex, to: Vertex, thickness: number);
102
98
  setStart(pos: Vector3, t?: number, f?: LerpFunc): Promise<void>;
103
99
  setEnd(pos: Vector3, t?: number, f?: LerpFunc): Promise<void>;
104
- protected updateMatrix(camera: Camera): void;
105
100
  }
106
101
  export declare class Line2d extends SimulationElement2d {
107
102
  protected geometry: Line2dGeometry;
108
103
  private to;
109
104
  private thickness;
110
105
  constructor(from: Vertex, to: Vertex, thickness?: number);
111
- setStart(pos: Vector2, t?: number, f?: LerpFunc): Promise<void>;
112
- setEnd(pos: Vector2, t?: number, f?: LerpFunc): Promise<void>;
113
- protected updateMatrix(camera: Camera): void;
106
+ setStart(pos: Vector3, t?: number, f?: LerpFunc): Promise<void>;
107
+ setEnd(pos: Vector3, t?: number, f?: LerpFunc): Promise<void>;
114
108
  }
115
109
  export declare class Cube extends SimulationElement3d {
116
110
  protected geometry: CubeGeometry;
@@ -122,7 +116,6 @@ export declare class Cube extends SimulationElement3d {
122
116
  setHeight(height: number, t?: number, f?: LerpFunc): Promise<void>;
123
117
  setDepth(depth: number, t?: number, f?: LerpFunc): Promise<void>;
124
118
  scale(amount: number, t?: number, f?: LerpFunc): Promise<void>;
125
- protected updateMatrix(camera: Camera): void;
126
119
  }
127
120
  export declare class BezierCurve2d {
128
121
  private points;
@@ -175,7 +168,6 @@ export declare class Spline2d extends SimulationElement2d {
175
168
  setThickness(thickness: number, t?: number, f?: LerpFunc): Promise<void>;
176
169
  interpolateSlope(t: number): Vector2[] | readonly [Vector2, Vector2];
177
170
  interpolate(t: number): Vector2;
178
- protected updateMatrix(camera: Camera): void;
179
171
  }
180
172
  export declare class Instance<T extends AnySimulationElement> extends SimulationElement3d {
181
173
  protected geometry: BlankGeometry;
@@ -184,18 +176,14 @@ export declare class Instance<T extends AnySimulationElement> extends Simulation
184
176
  private matrixBuffer;
185
177
  private device;
186
178
  private baseMat;
187
- private needsRemap;
188
179
  constructor(obj: T, numInstances: number);
189
180
  setNumInstances(numInstances: number): void;
190
181
  setInstance(instance: number, transformation: Mat4): void;
191
182
  private mapBuffer;
192
- private setMatrixBuffer;
193
183
  getInstances(): Mat4[];
194
184
  getNumInstances(): number;
195
- setDevice(device: GPUDevice): void;
196
- getMatrixBuffer(): GPUBuffer | null;
185
+ getMatrixBuffer(device: GPUDevice): GPUBuffer;
197
186
  getVertexCount(): number;
198
187
  getGeometryType(): "list" | "strip";
199
- protected updateMatrix(_: Camera): void;
200
- getBuffer(camera: Camera): number[];
188
+ getBuffer(): Float32Array | number[];
201
189
  }