simulationjsv2 0.5.0 → 0.5.2
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/dist/graphics.js +6 -3
- package/dist/simulation.js +3 -4
- package/dist/types.d.ts +1 -0
- package/package.json +1 -1
package/dist/graphics.js
CHANGED
|
@@ -546,15 +546,18 @@ export class Line2d extends SimulationElement2d {
|
|
|
546
546
|
return this.moveTo(pos, t, f);
|
|
547
547
|
}
|
|
548
548
|
setEnd(pos, t = 0, f) {
|
|
549
|
+
const tempPos = cloneBuf(pos);
|
|
550
|
+
vector2ToPixelRatio(tempPos);
|
|
551
|
+
vec2.sub(tempPos, this.getPos(), tempPos);
|
|
549
552
|
const diff = vector3();
|
|
550
|
-
vec2.sub(
|
|
553
|
+
vec2.sub(tempPos, this.to, diff);
|
|
551
554
|
return transitionValues((p) => {
|
|
552
555
|
this.to[0] += diff[0] * p;
|
|
553
556
|
this.to[1] += diff[1] * p;
|
|
554
557
|
this.vertexCache.updated();
|
|
555
558
|
}, () => {
|
|
556
|
-
this.to[0] =
|
|
557
|
-
this.to[1] =
|
|
559
|
+
this.to[0] = tempPos[0];
|
|
560
|
+
this.to[1] = tempPos[1];
|
|
558
561
|
this.vertexCache.updated();
|
|
559
562
|
}, t, f);
|
|
560
563
|
}
|
package/dist/simulation.js
CHANGED
|
@@ -807,20 +807,19 @@ export class ShaderGroup extends SceneCollection {
|
|
|
807
807
|
return null;
|
|
808
808
|
const values = this.bindGroup.values();
|
|
809
809
|
if (this.valueBuffers === null) {
|
|
810
|
-
|
|
810
|
+
this.valueBuffers = [];
|
|
811
811
|
for (let i = 0; i < values.length; i++) {
|
|
812
812
|
const buffer = this.createBuffer(this.device, values[i]);
|
|
813
|
-
|
|
813
|
+
this.valueBuffers.push(buffer);
|
|
814
814
|
}
|
|
815
|
-
this.valueBuffers = buffers;
|
|
816
815
|
}
|
|
817
816
|
else {
|
|
818
817
|
for (let i = 0; i < values.length; i++) {
|
|
819
818
|
const arrayConstructor = values[i].array;
|
|
820
819
|
const array = new arrayConstructor(values[i].value);
|
|
821
820
|
if (array.byteLength > this.valueBuffers[i].size) {
|
|
822
|
-
this.valueBuffers[i].destroy();
|
|
823
821
|
const newBuffer = this.createBuffer(this.device, values[i]);
|
|
822
|
+
this.valueBuffers[i].destroy();
|
|
824
823
|
this.valueBuffers[i] = newBuffer;
|
|
825
824
|
}
|
|
826
825
|
else {
|
package/dist/types.d.ts
CHANGED
|
@@ -100,6 +100,7 @@ export type BindGroupEntry = {
|
|
|
100
100
|
buffer: GPUBindGroupLayoutEntry['buffer'];
|
|
101
101
|
};
|
|
102
102
|
export type ArrayConstructors = Float32ArrayConstructor | Float64ArrayConstructor | Int8ArrayConstructor | Int16ArrayConstructor | Int32ArrayConstructor;
|
|
103
|
+
export type ArrayTypes = Float32Array | Float64Array | Int8Array | Int16Array | Int32Array;
|
|
103
104
|
export type BindGroupValue = {
|
|
104
105
|
value: number[];
|
|
105
106
|
usage: GPUBufferDescriptor['usage'];
|