@cyclonium/canvas-3d 0.0.105 → 1.0.1

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/lib/canvas-3d.js CHANGED
@@ -213,8 +213,7 @@ export class Canvas3D {
213
213
  return material;
214
214
  }
215
215
  _canReuseRenderRecord(renderScene) {
216
- return this._renderRecord !== undefined
217
- && this._renderRecord.renderScene === renderScene
216
+ return this._renderRecord?.renderScene === renderScene
218
217
  && this._renderRecord.renderingSubMeshRecords.length === this._drawCommands.length;
219
218
  }
220
219
  _createRenderingDrawCommands(device, reusableSubMeshRecords) {
package/lib/geometry.js CHANGED
@@ -450,7 +450,7 @@ function appendDashedLine3DStroke(geometry, from, to, style, color) {
450
450
  const direction = Vec3.subtract(vec3Cache[pVec3Cache++], to, from).normalize();
451
451
  const dashState = createDashState(style.lineDash, style.lineDashOffset);
452
452
  const startPoint = vec3Cache[pVec3Cache++];
453
- const endPoint = vec3Cache[pVec3Cache++];
453
+ const endPoint = vec3Cache[pVec3Cache];
454
454
  let traveled = 0;
455
455
  while (segmentLength - traveled > epsilon) {
456
456
  const step = Math.min(segmentLength - traveled, dashState.remaining);
@@ -479,7 +479,7 @@ function appendSolidLine3DStroke(geometry, from, to, style, color) {
479
479
  let pVec3Cache = 0;
480
480
  const start = vec3Cache[pVec3Cache++].set(from);
481
481
  const end = vec3Cache[pVec3Cache++].set(to);
482
- const direction = Vec3.subtract(vec3Cache[pVec3Cache++], end, start).normalize();
482
+ const direction = Vec3.subtract(vec3Cache[pVec3Cache], end, start).normalize();
483
483
  const halfWidth = style.lineWidth * 0.5;
484
484
  if (style.lineCap === Canvas3DLineCap.square) {
485
485
  Vec3.scaleAndAdd(start, start, direction, -halfWidth);
@@ -523,7 +523,7 @@ function appendDiscFill(geometry, center, normal, radius, segments, transform, c
523
523
  const vec3Cache = borrowVec3ScratchCache(vec3Caches_appendDiscFill);
524
524
  let pVec3Cache = 0;
525
525
  const point = vec3Cache[pVec3Cache++];
526
- const transformedPoint = vec3Cache[pVec3Cache++];
526
+ const transformedPoint = vec3Cache[pVec3Cache];
527
527
  const basis = createNormalBasis(normal);
528
528
  const centerVertex = appendVertex(geometry, transformPointInto(transformedPoint, center, transform), color);
529
529
  const firstRingVertex = geometry.vertices.length / vertexStrideF;
@@ -567,7 +567,7 @@ function appendRingFill(geometry, center, normal, innerRadius, outerRadius, segm
567
567
  const transformedOuterPoint = vec3Cache[pVec3Cache++];
568
568
  const transformedInnerPoint = vec3Cache[pVec3Cache++];
569
569
  const transformedInnerNextPoint = vec3Cache[pVec3Cache++];
570
- const transformedOuterNextPoint = vec3Cache[pVec3Cache++];
570
+ const transformedOuterNextPoint = vec3Cache[pVec3Cache];
571
571
  for (let iPoint = 0; iPoint < segments; iPoint++) {
572
572
  const nextPoint = (iPoint + 1) % segments;
573
573
  setPlaneCirclePoint(outerPoint, center, outerRadius, basis.axisA, basis.axisB, iPoint, segments);
@@ -593,7 +593,7 @@ function appendSphereFill(geometry, center, radius, latitudeSegments, longitudeS
593
593
  const vec3Cache = borrowVec3ScratchCache(vec3Caches_appendSphereFill);
594
594
  let pVec3Cache = 0;
595
595
  const point = vec3Cache[pVec3Cache++];
596
- const transformedPoint = vec3Cache[pVec3Cache++];
596
+ const transformedPoint = vec3Cache[pVec3Cache];
597
597
  const topology = getSphereTopology(latitudeSegments, longitudeSegments);
598
598
  const baseVertex = geometry.vertices.length / vertexStrideF;
599
599
  for (let pPosition = 0; pPosition < topology.positions.length; pPosition += 3) {
@@ -639,7 +639,7 @@ function appendHemisphereWireStroke(geometry, center, axis, radius, radialSegmen
639
639
  const radialDirection = vec3Cache[pVec3Cache++];
640
640
  const point = vec3Cache[pVec3Cache++];
641
641
  const transformedPoint = vec3Cache[pVec3Cache++];
642
- const ringCenter = vec3Cache[pVec3Cache++];
642
+ const ringCenter = vec3Cache[pVec3Cache];
643
643
  for (let iMeridian = 0; iMeridian < 4; iMeridian++) {
644
644
  const phi = iMeridian / 4 * Math.PI * 2;
645
645
  setBasisDirection(radialDirection, basis.normalA, basis.normalB, phi);
@@ -671,7 +671,7 @@ function appendHemisphereFill(geometry, center, axis, radius, radialSegments, ca
671
671
  const vec3Cache = borrowVec3ScratchCache(vec3Caches_appendHemisphereFill);
672
672
  let pVec3Cache = 0;
673
673
  const point = vec3Cache[pVec3Cache++];
674
- const transformedPoint = vec3Cache[pVec3Cache++];
674
+ const transformedPoint = vec3Cache[pVec3Cache];
675
675
  const topology = getHemisphereTopology(radialSegments, capSegments);
676
676
  const baseVertex = geometry.vertices.length / vertexStrideF;
677
677
  for (let pPosition = 0; pPosition < topology.positions.length; pPosition += 3) {
@@ -704,7 +704,7 @@ function appendCylinderFill(geometry, from, to, radius, radialSegments, transfor
704
704
  const vec3Cache = borrowVec3ScratchCache(vec3Caches_appendCylinderFill);
705
705
  let pVec3Cache = 0;
706
706
  const point = vec3Cache[pVec3Cache++];
707
- const transformedPoint = vec3Cache[pVec3Cache++];
707
+ const transformedPoint = vec3Cache[pVec3Cache];
708
708
  const topology = getCircleTopology(radialSegments);
709
709
  const baseVertex = geometry.vertices.length / vertexStrideF;
710
710
  for (let iPoint = 0; iPoint < radialSegments; iPoint++) {
@@ -1149,7 +1149,7 @@ export function createOrUpdateRenderingSubMeshRecord(device, geometry, record) {
1149
1149
  }
1150
1150
  const vertexBufferData = Float32Array.from(geometry.vertices);
1151
1151
  const indexBufferData = createIndexBufferData(geometry.indices, vertexCount);
1152
- if (record && record.indexBytesPerElement === indexBufferData.BYTES_PER_ELEMENT) {
1152
+ if (record?.indexBytesPerElement === indexBufferData.BYTES_PER_ELEMENT) {
1153
1153
  updateRenderingSubMeshRecord(record, vertexBufferData, indexBufferData);
1154
1154
  return record;
1155
1155
  }
package/lib/w2.d.ts CHANGED
@@ -40,7 +40,6 @@ export declare class Canvas3DW2Impl implements Canvas3DW2 {
40
40
  fill(): this;
41
41
  getLineDash(): number[];
42
42
  setLineDash(value: readonly number[]): void;
43
- private _createStrokeStyle;
44
43
  private _lineWidth;
45
44
  private _lineJoin;
46
45
  private _lineCap;
@@ -54,5 +53,6 @@ export declare class Canvas3DW2Impl implements Canvas3DW2 {
54
53
  private readonly _enqueueGeometry;
55
54
  private _currentSubPath;
56
55
  private _hasCurrentPoint;
56
+ private _createStrokeStyle;
57
57
  }
58
58
  //# sourceMappingURL=w2.d.ts.map
package/lib/w2.js CHANGED
@@ -229,16 +229,6 @@ export class Canvas3DW2Impl {
229
229
  setLineDash(value) {
230
230
  this._lineDash = normalizeLineDash(value);
231
231
  }
232
- _createStrokeStyle() {
233
- return {
234
- lineWidth: this._lineWidth,
235
- lineJoin: this._lineJoin,
236
- lineCap: this._lineCap,
237
- miterLimit: this._miterLimit,
238
- lineDash: this.getLineDash(),
239
- lineDashOffset: this._lineDashOffset,
240
- };
241
- }
242
232
  _lineWidth = 1;
243
233
  _lineJoin = Canvas3DLineJoin.miter;
244
234
  _lineCap = Canvas3DLineCap.butt;
@@ -252,5 +242,15 @@ export class Canvas3DW2Impl {
252
242
  _enqueueGeometry;
253
243
  _currentSubPath = undefined;
254
244
  _hasCurrentPoint = false;
245
+ _createStrokeStyle() {
246
+ return {
247
+ lineWidth: this._lineWidth,
248
+ lineJoin: this._lineJoin,
249
+ lineCap: this._lineCap,
250
+ miterLimit: this._miterLimit,
251
+ lineDash: this.getLineDash(),
252
+ lineDashOffset: this._lineDashOffset,
253
+ };
254
+ }
255
255
  }
256
256
  //# sourceMappingURL=w2.js.map
package/lib/w3.d.ts CHANGED
@@ -10,8 +10,8 @@ export declare class Canvas3DW3Impl implements Canvas3DW3 {
10
10
  ring(options: Canvas3DRingOptions): this;
11
11
  sphere(options: Canvas3DSphereOptions): this;
12
12
  capsule(options: Canvas3DCapsuleOptions): this;
13
- private _drawDirect;
14
13
  private readonly _enqueueGeometry;
15
14
  private readonly _directScope;
15
+ private _drawDirect;
16
16
  }
17
17
  //# sourceMappingURL=w3.d.ts.map
package/lib/w3.js CHANGED
@@ -57,11 +57,11 @@ export class Canvas3DW3Impl {
57
57
  });
58
58
  return this;
59
59
  }
60
+ _enqueueGeometry;
61
+ _directScope;
60
62
  _drawDirect(draw) {
61
63
  draw(this._directScope);
62
64
  }
63
- _enqueueGeometry;
64
- _directScope;
65
65
  }
66
66
  class Canvas3DW3ScopeImpl {
67
67
  constructor(enqueueGeometry) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cyclonium/canvas-3d",
3
- "version": "0.0.105",
3
+ "version": "1.0.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/shrinktofit/cyclonium",
@@ -14,7 +14,7 @@
14
14
  ".": "./lib/index.js"
15
15
  },
16
16
  "peerDependencies": {
17
- "@cyclonium/core": "0.0.105"
17
+ "@cyclonium/core": "1.0.1"
18
18
  },
19
19
  "devDependencies": {
20
20
  "@types/node": "^25.9.2",