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 +4 -0
- package/dist/buffers.d.ts +0 -1
- package/dist/globals.d.ts +0 -1
- package/dist/graphics.d.ts +5 -6
- package/dist/graphics.js +3 -1
- package/dist/internalUtils.d.ts +1 -2
- package/dist/shaders.d.ts +0 -1
- package/dist/types.d.ts +0 -1
- package/dist/utils.d.ts +0 -1
- package/package.json +1 -1
- package/pnpm-workspace.yaml +2 -0
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
|
+
[](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
package/dist/globals.d.ts
CHANGED
package/dist/graphics.d.ts
CHANGED
|
@@ -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() {
|
package/dist/internalUtils.d.ts
CHANGED
|
@@ -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
package/dist/types.d.ts
CHANGED
package/dist/utils.d.ts
CHANGED
package/package.json
CHANGED