simulationjsv2 0.10.4 → 0.10.6

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/README.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  SimulationJS is a graphics library with simple easy to use APIs. Version 2 hopes to improve 3d graphics and boost performance by using webgpu under the hood.
4
4
 
5
+ Watch a quick demo
6
+
7
+ [![Watch a quick demo](https://img.youtube.com/vi/RkgLstvSNGI/hqdefault.jpg)](https://www.youtube.com/watch?v=RkgLstvSNGI)
8
+
5
9
  **Documentation at 1.0.0**
6
10
 
7
11
  By _Jackson Otto_
package/dist/buffers.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="@webgpu/types" />
2
1
  import { ArrayTypes } from './types.js';
3
2
  export declare class MemoBuffer {
4
3
  private buffer;
package/dist/globals.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="@webgpu/types" />
2
1
  import { Shader } from './shaders.js';
3
2
  import { Simulation } from './simulation.js';
4
3
  import { Color } from './utils.js';
@@ -1,4 +1,3 @@
1
- /// <reference types="@webgpu/types" />
2
1
  import type { Vector2, Vector3, LerpFunc, Mat4 } from './types.js';
3
2
  import { Vertex, Color } from './utils.js';
4
3
  import { BlankGeometry, CircleGeometry, CubeGeometry, Geometry, Line2dGeometry, Line3dGeometry, PlaneGeometry, PolygonGeometry, Spline2dGeometry, SquareGeometry, TraceLinesGeometry as TraceLinesGeometry } from './geometry.js';
@@ -82,8 +81,8 @@ export declare abstract class SimulationElement3d {
82
81
  getTreeVertexCount(): number;
83
82
  getIndexCount(): number;
84
83
  writeBuffers(): void;
85
- getVertexBuffer(): Float32Array;
86
- getIndexBuffer(): Uint32Array;
84
+ getVertexBuffer(): Float32Array<ArrayBufferLike>;
85
+ getIndexBuffer(): Uint32Array<ArrayBuffer>;
87
86
  }
88
87
  export declare class EmptyElement extends SimulationElement3d {
89
88
  protected geometry: BlankGeometry;
@@ -208,7 +207,7 @@ export declare class Spline2d extends SimulationElement2d {
208
207
  private length;
209
208
  constructor(pos: Vertex, points: SplinePoint2d[], thickness?: number, detail?: number);
210
209
  private setVertexColors;
211
- getVertexBuffer(): Float32Array;
210
+ getVertexBuffer(): Float32Array<ArrayBufferLike>;
212
211
  isTransparent(): boolean;
213
212
  private estimateLength;
214
213
  getLength(): number;
@@ -239,8 +238,8 @@ export declare class Instance<T extends SimulationElement3d> extends SimulationE
239
238
  getTreeVertexCount(): number;
240
239
  getIndexCount(): number;
241
240
  getGeometryTopology(): "list" | "strip";
242
- getVertexBuffer(): Float32Array;
243
- getIndexBuffer(): Uint32Array;
241
+ getVertexBuffer(): Float32Array<ArrayBufferLike>;
242
+ getIndexBuffer(): Uint32Array<ArrayBuffer>;
244
243
  getModelMatrix(): Mat4;
245
244
  }
246
245
  export declare class TraceLines2d extends SimulationElement2d {
package/dist/graphics.js CHANGED
@@ -118,11 +118,13 @@ export class SimulationElement3d {
118
118
  this.geometry.setSubdivisions(divisions, vertexLimit);
119
119
  this.vertexCache.updated();
120
120
  this.geometry.compute();
121
+ this.geometry.triangulate();
121
122
  }
122
123
  clearSubdivisions() {
123
124
  this.geometry.clearSubdivisions();
124
125
  this.vertexCache.updated();
125
126
  this.geometry.compute();
127
+ this.geometry.triangulate();
126
128
  }
127
129
  setSubdivisionVertexLimit(limit) {
128
130
  this.geometry.setSubdivisionVertexLimit(limit);
@@ -163,7 +165,7 @@ export class SimulationElement3d {
163
165
  const mat = this.getModelMatrix();
164
166
  const device = globalInfo.errorGetDevice();
165
167
  const buffer = this.uniformBuffer.getBuffer();
166
- device.queue.writeBuffer(buffer, modelProjMatOffset, mat);
168
+ device.queue.writeBuffer(buffer, modelProjMatOffset, mat.buffer);
167
169
  return buffer;
168
170
  }
169
171
  getPipeline() {
@@ -1,4 +1,3 @@
1
- /// <reference types="@webgpu/types" />
2
1
  import { Mat4, Vector3 } from './types.js';
3
2
  import { Shader } from './shaders.js';
4
3
  import { SimulationElement3d } from './graphics.js';
@@ -7,7 +6,7 @@ export declare class Float32ArrayCache {
7
6
  private hasUpdated;
8
7
  constructor();
9
8
  setCache(vertices: Float32Array | number[]): void;
10
- getCache(): Float32Array;
9
+ getCache(): Float32Array<ArrayBufferLike>;
11
10
  updated(): void;
12
11
  shouldUpdate(): boolean;
13
12
  getVertexCount(stride?: number): number;
package/dist/shaders.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="@webgpu/types" />
2
1
  import { SimulationElement3d } from './graphics.js';
3
2
  import { BindGroupGenerator, BufferInfo, BufferWriter, Vector3, VertexBufferWriter, VertexParamInfo } from './types.js';
4
3
  export declare const uniformBufferSize: number;
package/dist/types.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="@webgpu/types" />
2
1
  import { MemoBuffer } from './buffers.js';
3
2
  import { CubicBezierCurve2d, SimulationElement3d, SplinePoint2d } from './graphics.js';
4
3
  import { Color } from './utils.js';
package/dist/utils.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="@webgpu/types" />
2
1
  import { SimulationElement3d, SplinePoint2d } from './graphics.js';
3
2
  import { FloatArray, LerpFunc, Mat4, Vector2, Vector2m, Vector3, Vector3m, Vector4 } from './types.js';
4
3
  import { Shader } from './shaders.js';
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.4",
8
+ "version": "0.10.6",
9
9
  "exports": {
10
10
  ".": {
11
11
  "import": "./dist/index.js",
@@ -0,0 +1,2 @@
1
+ onlyBuiltDependencies:
2
+ - esbuild