@vibecook/ice 0.10.0 → 0.11.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/dist/devtools.js CHANGED
@@ -14,7 +14,7 @@ import {
14
14
  WheelPan,
15
15
  WheelZoom,
16
16
  Wire
17
- } from "./chunk-5FQS7V2C.js";
17
+ } from "./chunk-VGVDJZSP.js";
18
18
  import "./chunk-OR5FNVUE.js";
19
19
 
20
20
  // ../devtools/src/attach.ts
package/dist/dom.js CHANGED
@@ -19,8 +19,8 @@ import {
19
19
  startRafLoop,
20
20
  wheelCede,
21
21
  wireMeasurement
22
- } from "./chunk-JWRHAM7L.js";
23
- import "./chunk-5FQS7V2C.js";
22
+ } from "./chunk-2TNVB2ON.js";
23
+ import "./chunk-VGVDJZSP.js";
24
24
  import "./chunk-OR5FNVUE.js";
25
25
  export {
26
26
  CLAIM_OWNS_ESCAPE,
package/dist/ground.js CHANGED
@@ -29,7 +29,7 @@ import {
29
29
  defineQuery,
30
30
  portSlots,
31
31
  widgets
32
- } from "./chunk-5FQS7V2C.js";
32
+ } from "./chunk-VGVDJZSP.js";
33
33
  import {
34
34
  portAnchor,
35
35
  tessellateCubic,
@@ -141,93 +141,14 @@ function createLayer(host, world, renderer, passes) {
141
141
  };
142
142
  }
143
143
 
144
- // ../ground/src/passes/grid.ts
145
- import { Group as Group2 } from "three/webgpu";
146
-
147
- // ../ground/src/passes/grid-classic.ts
148
- import {
149
- clamp,
150
- float,
151
- fract,
152
- length,
153
- max,
154
- min,
155
- mix,
156
- positionGeometry,
157
- screenCoordinate,
158
- smoothstep,
159
- uniform,
160
- vec4
161
- } from "three/tsl";
162
- import {
163
- BufferAttribute,
164
- BufferGeometry,
165
- Mesh,
166
- MeshBasicNodeMaterial,
167
- Vector2,
168
- Vector3
169
- } from "three/webgpu";
170
- var FULLSCREEN_TRIANGLE = new Float32Array([-1, -1, 0, 3, -1, 0, -1, 3, 0]);
171
- function createClassicGrid(cfg) {
172
- const uCamera = uniform(new Vector2(0, 0));
173
- const uZoom = uniform(1);
174
- const uDpr = uniform(1);
175
- const uSpacings = uniform(new Vector3(...cfg.spacings));
176
- const uDotColor = uniform(new Vector3(...cfg.dotColor));
177
- const uDotAlpha = uniform(cfg.dotAlpha);
178
- const uFadeIn = uniform(new Vector2(...cfg.fadeIn));
179
- const uFadeOut = uniform(new Vector2(...cfg.fadeOut));
180
- const uDotRadius = uniform(new Vector2(...cfg.dotRadius));
181
- const uLevelWeight = uniform(new Vector2(...cfg.levelWeight));
182
- const effZoom = uZoom.mul(uDpr);
183
- const worldPos = screenCoordinate.xy.div(effZoom).add(uCamera);
184
- let total = float(0);
185
- for (let i = 0; i < 3; i++) {
186
- const spacing = i === 0 ? uSpacings.x : i === 1 ? uSpacings.y : uSpacings.z;
187
- const cssSpacing = spacing.mul(uZoom);
188
- const rise = cssSpacing.sub(uFadeIn.x).div(uFadeIn.y.sub(uFadeIn.x));
189
- const fall = float(1).sub(cssSpacing.sub(uFadeOut.x).div(uFadeOut.y.sub(uFadeOut.x)));
190
- const opacity = clamp(min(rise, fall), 0, 1);
191
- const f = fract(worldPos.div(spacing).add(0.5)).sub(0.5);
192
- const dist = length(f).mul(spacing).mul(effZoom);
193
- const t = clamp(cssSpacing.sub(uFadeIn.x).div(40), 0, 1);
194
- const radius = mix(uDotRadius.x, uDotRadius.y, t).mul(uDpr);
195
- const dot = smoothstep(radius.sub(0.5), radius.add(0.5), dist).oneMinus();
196
- const weight = uLevelWeight.x.add(float(i).mul(uLevelWeight.y));
197
- total = max(total, dot.mul(opacity).mul(weight));
198
- }
199
- const material = new MeshBasicNodeMaterial();
200
- material.vertexNode = vec4(positionGeometry.xy, 0, 1);
201
- material.fragmentNode = vec4(uDotColor, clamp(total.mul(uDotAlpha), 0, 1));
202
- material.transparent = true;
203
- material.depthTest = false;
204
- material.depthWrite = false;
205
- const geometry = new BufferGeometry();
206
- geometry.setAttribute("position", new BufferAttribute(FULLSCREEN_TRIANGLE, 3));
207
- const mesh = new Mesh(geometry, material);
208
- mesh.frustumCulled = false;
209
- mesh.renderOrder = 0;
210
- return {
211
- mesh,
212
- setCamera(frame) {
213
- uCamera.value.set(frame.camera.x, frame.camera.y);
214
- uZoom.value = frame.camera.zoom;
215
- uDpr.value = frame.dpr;
216
- },
217
- configure(next) {
218
- uSpacings.value.set(...next.spacings);
219
- uDotColor.value.set(...next.dotColor);
220
- uDotAlpha.value = next.dotAlpha;
221
- uFadeIn.value.set(...next.fadeIn);
222
- uFadeOut.value.set(...next.fadeOut);
223
- uDotRadius.value.set(...next.dotRadius);
224
- uLevelWeight.value.set(...next.levelWeight);
225
- },
226
- dispose() {
227
- geometry.dispose();
228
- material.dispose();
229
- }
230
- };
144
+ // ../ground/src/passes/grid-contract.ts
145
+ function mergeGridConfig(base, next) {
146
+ const merged = { ...base, ...next };
147
+ if (next.magnet !== void 0) merged.magnet = { ...base.magnet, ...next.magnet };
148
+ return merged;
149
+ }
150
+ function resolveInitialGridConfig(initial) {
151
+ return mergeGridConfig(DEFAULT_GRID_CONFIG, initial);
231
152
  }
232
153
 
233
154
  // ../ground/src/passes/grid-magnet.ts
@@ -236,37 +157,37 @@ import {
236
157
  If,
237
158
  Loop,
238
159
  abs,
239
- clamp as clamp2,
240
- float as float2,
160
+ clamp,
161
+ float,
241
162
  instanceIndex,
242
163
  int,
243
- length as length2,
244
- max as max2,
245
- min as min2,
246
- mix as mix2,
164
+ length,
165
+ max,
166
+ min,
167
+ mix,
247
168
  mod,
248
- positionGeometry as positionGeometry2,
169
+ positionGeometry,
249
170
  select,
250
171
  sign,
251
- smoothstep as smoothstep2,
172
+ smoothstep,
252
173
  sqrt,
253
174
  storage,
254
- uniform as uniform2,
175
+ uniform,
255
176
  varying,
256
177
  vec2,
257
- vec4 as vec42,
178
+ vec4,
258
179
  Continue,
259
180
  Discard
260
181
  } from "three/tsl";
261
182
  import {
262
- BufferAttribute as BufferAttribute2,
183
+ BufferAttribute,
263
184
  Group,
264
185
  InstancedBufferGeometry,
265
- Mesh as Mesh2,
266
- MeshBasicNodeMaterial as MeshBasicNodeMaterial2,
186
+ Mesh,
187
+ MeshBasicNodeMaterial,
267
188
  StorageBufferAttribute,
268
- Vector2 as Vector22,
269
- Vector3 as Vector32
189
+ Vector2,
190
+ Vector3
270
191
  } from "three/webgpu";
271
192
 
272
193
  // ../ground/src/passes/soup-collect.ts
@@ -618,33 +539,33 @@ function createMagnetGrid() {
618
539
  const sourceArray = new Float32Array(MAX_MAGNET_SOURCES * MAGNET_SOURCE_FLOATS);
619
540
  const sourceAttr = new StorageBufferAttribute(sourceArray, 4);
620
541
  const sourceBuf = storage(sourceAttr, "vec4", MAX_MAGNET_SOURCES * 2).setPBO(true).toReadOnly();
621
- const uCam = uniform2(new Vector22(0, 0));
622
- const uZoom = uniform2(1);
623
- const uView = uniform2(new Vector22(1, 1));
624
- const uDotMode = uniform2(0);
625
- const uHalfLen = uniform2(5);
626
- const uHalfWidth = uniform2(0.55);
627
- const uRestRadius = uniform2(0.75);
628
- const uK = uniform2(0);
629
- const uPad = uniform2(0);
630
- const uPolarity = uniform2(1);
631
- const uAlwaysAlign = uniform2(0);
632
- const uCount = uniform2(0, "int");
633
- const uColor = uniform2(new Vector32(0.75, 0.77, 0.8));
634
- const EPS = float2(25);
542
+ const uCam = uniform(new Vector2(0, 0));
543
+ const uZoom = uniform(1);
544
+ const uView = uniform(new Vector2(1, 1));
545
+ const uDotMode = uniform(0);
546
+ const uHalfLen = uniform(5);
547
+ const uHalfWidth = uniform(0.55);
548
+ const uRestRadius = uniform(0.75);
549
+ const uK = uniform(0);
550
+ const uPad = uniform(0);
551
+ const uPolarity = uniform(1);
552
+ const uAlwaysAlign = uniform(0);
553
+ const uCount = uniform(0, "int");
554
+ const uColor = uniform(new Vector3(0.75, 0.77, 0.8));
555
+ const EPS = float(25);
635
556
  const REST = vec2(0, 1);
636
557
  const sdRoundBox = Fn(([p, b, r]) => {
637
558
  const q = abs(p).sub(b).add(vec2(r, r));
638
- return length2(max2(q, vec2(0, 0))).add(min2(max2(q.x, q.y), 0)).sub(r);
559
+ return length(max(q, vec2(0, 0))).add(min(max(q.x, q.y), 0)).sub(r);
639
560
  });
640
561
  const roundBoxNormal = Fn(([p, b, r]) => {
641
562
  const s = sign(p);
642
563
  const q = abs(p);
643
- const inner = max2(b.sub(vec2(r, r)), vec2(0, 0));
564
+ const inner = max(b.sub(vec2(r, r)), vec2(0, 0));
644
565
  const d = q.sub(inner);
645
566
  const n = vec2(0, 0).toVar();
646
567
  If(d.x.greaterThan(0).and(d.y.greaterThan(0)), () => {
647
- const len = length2(d);
568
+ const len = length(d);
648
569
  If(len.greaterThan(1e-4), () => {
649
570
  n.assign(s.mul(d.div(len)));
650
571
  }).Else(() => {
@@ -658,33 +579,33 @@ function createMagnetGrid() {
658
579
  return n;
659
580
  });
660
581
  const safeNormalize = Fn(([v, fallback]) => {
661
- const n = length2(v);
662
- return select(n.greaterThan(1e-4), v.div(max2(n, 1e-4)), fallback);
582
+ const n = length(v);
583
+ return select(n.greaterThan(1e-4), v.div(max(n, 1e-4)), fallback);
663
584
  });
664
585
  const group = new Group();
665
586
  const geometries = [];
666
587
  const materials = [];
667
588
  const meshes = [];
668
589
  const levelUniforms = Array.from({ length: LEVELS }, () => ({
669
- origin: uniform2(new Vector22(0, 0)),
670
- dims: uniform2(new Vector22(1, 1)),
671
- spacing: uniform2(20),
672
- alpha: uniform2(0),
673
- skipMod: uniform2(0)
590
+ origin: uniform(new Vector2(0, 0)),
591
+ dims: uniform(new Vector2(1, 1)),
592
+ spacing: uniform(20),
593
+ alpha: uniform(0),
594
+ skipMod: uniform(0)
674
595
  }));
675
596
  for (let level = 0; level < LEVELS; level++) {
676
597
  const lu = levelUniforms[level];
677
598
  const vUv = varying(vec2(0, 0), `vMagnetUv${level}`);
678
- const vAlpha = varying(float2(0), `vMagnetAlpha${level}`);
599
+ const vAlpha = varying(float(0), `vMagnetAlpha${level}`);
679
600
  const vertexNode = Fn(() => {
680
- const iid = float2(instanceIndex);
601
+ const iid = float(instanceIndex);
681
602
  const cols = lu.dims.x;
682
- const col = mod(iid, cols).floor();
683
- const row = iid.div(cols).floor();
603
+ const col = mod(iid, cols).floor().toVar();
604
+ const row = iid.div(cols).floor().toVar();
684
605
  const world = lu.origin.add(vec2(col, row)).mul(lu.spacing);
685
- const screen = world.sub(uCam).mul(uZoom);
606
+ const screen = world.sub(uCam).mul(uZoom).toVar();
686
607
  const field = vec2(0, 0).toVar();
687
- const minD = float2(1e9).toVar();
608
+ const minD = float(1e9).toVar();
688
609
  Loop({ start: int(0), end: uCount, type: "int", condition: "<" }, ({ i }) => {
689
610
  const a = sourceBuf.element(i.mul(2));
690
611
  const b = sourceBuf.element(i.mul(2).add(1));
@@ -693,7 +614,7 @@ function createMagnetGrid() {
693
614
  const rad = b.x;
694
615
  const strength = b.y;
695
616
  const rel = screen.sub(center);
696
- const reach = uPad.mul(sqrt(max2(strength, 1e-4)));
617
+ const reach = uPad.mul(sqrt(max(strength, 1e-4)));
697
618
  If(
698
619
  abs(rel.x).greaterThan(half.x.add(reach)).or(abs(rel.y).greaterThan(half.y.add(reach))),
699
620
  () => {
@@ -701,32 +622,32 @@ function createMagnetGrid() {
701
622
  }
702
623
  );
703
624
  const d = sdRoundBox(rel, half, rad);
704
- minD.assign(min2(minD, d));
705
- const dist = max2(d, 0);
625
+ minD.assign(min(minD, d));
626
+ const dist = max(d, 0);
706
627
  const r2 = dist.mul(dist).add(EPS);
707
628
  const outward = roundBoxNormal(rel, half, rad);
708
629
  field.subAssign(outward.mul(uK.mul(strength).mul(uPolarity).div(r2)));
709
630
  });
710
631
  const fieldDir = safeNormalize(field, REST);
711
- const mag = length2(field);
712
- const influence = select(uDotMode.greaterThan(0.5), mag.div(mag.add(1)), clamp2(mag, 0, 1));
713
- const corner = positionGeometry2.xy;
714
- const dotRadius = mix2(uRestRadius, uHalfLen.mul(1.05), influence);
715
- const dotLocal = corner.mul(dotRadius);
632
+ const mag = length(field);
633
+ const influence = select(uDotMode.greaterThan(0.5), mag.div(mag.add(1)), clamp(mag, 0, 1));
634
+ const corner = positionGeometry.xy;
635
+ const dotRadius = mix(uRestRadius, uHalfLen.mul(1.05), influence);
636
+ const dotLocal = vec2(corner.x, corner.y.negate()).mul(dotRadius);
716
637
  const dir = select(
717
638
  uAlwaysAlign.greaterThan(0.5),
718
639
  fieldDir,
719
- safeNormalize(mix2(REST, fieldDir, influence), REST)
640
+ safeNormalize(mix(REST, fieldDir, influence), REST)
720
641
  );
721
642
  const nrm = vec2(dir.y.negate(), dir.x);
722
- const nLen = mix2(uHalfLen.mul(0.55), uHalfLen.mul(1.35), influence);
723
- const nWid = mix2(uHalfWidth.mul(0.85), uHalfWidth.mul(1.15), influence);
643
+ const nLen = mix(uHalfLen.mul(0.55), uHalfLen.mul(1.35), influence);
644
+ const nWid = mix(uHalfWidth.mul(0.85), uHalfWidth.mul(1.15), influence);
724
645
  const needleLocal = nrm.mul(corner.x).mul(nWid).add(dir.mul(corner.y).mul(nLen));
725
646
  const local = select(uDotMode.greaterThan(0.5), dotLocal, needleLocal);
726
647
  const pos = screen.add(local);
727
- const restAlpha = select(uDotMode.greaterThan(0.5), float2(0.72), float2(0.35));
728
- const fieldAlpha = mix2(restAlpha, float2(1), influence);
729
- const alpha = clamp2(lu.alpha.mul(fieldAlpha), 0, 1).toVar();
648
+ const restAlpha = select(uDotMode.greaterThan(0.5), float(0.72), float(0.35));
649
+ const fieldAlpha = mix(restAlpha, float(1), influence);
650
+ const alpha = clamp(lu.alpha.mul(fieldAlpha), 0, 1).toVar();
730
651
  If(minD.lessThan(-0.5), () => {
731
652
  alpha.assign(0);
732
653
  });
@@ -742,29 +663,29 @@ function createMagnetGrid() {
742
663
  vAlpha.assign(alpha);
743
664
  const ndc = vec2(
744
665
  pos.x.div(uView.x).mul(2).sub(1),
745
- float2(1).sub(pos.y.div(uView.y).mul(2))
666
+ float(1).sub(pos.y.div(uView.y).mul(2))
746
667
  );
747
- return vec42(ndc, 0, 1);
668
+ return vec4(ndc, 0, 1);
748
669
  })();
749
670
  const fragmentNode = Fn(() => {
750
- const dotEdge = float2(1).sub(smoothstep2(0.62, 1, length2(vUv)));
751
- const ax = float2(1).sub(smoothstep2(0.55, 1, abs(vUv.x)));
752
- const ay = float2(1).sub(smoothstep2(0.82, 1, abs(vUv.y)));
671
+ const dotEdge = float(1).sub(smoothstep(0.62, 1, length(vUv)));
672
+ const ax = float(1).sub(smoothstep(0.55, 1, abs(vUv.x)));
673
+ const ay = float(1).sub(smoothstep(0.82, 1, abs(vUv.y)));
753
674
  const edge = select(uDotMode.greaterThan(0.5), dotEdge, ax.mul(ay));
754
675
  const a = vAlpha.mul(edge);
755
676
  Discard(a.lessThan(0.01));
756
- return vec42(uColor, a);
677
+ return vec4(uColor, a);
757
678
  })();
758
- const material = new MeshBasicNodeMaterial2();
679
+ const material = new MeshBasicNodeMaterial();
759
680
  material.vertexNode = vertexNode;
760
681
  material.fragmentNode = fragmentNode;
761
682
  material.transparent = true;
762
683
  material.depthTest = false;
763
684
  material.depthWrite = false;
764
685
  const geometry = new InstancedBufferGeometry();
765
- geometry.setAttribute("position", new BufferAttribute2(CORNERS, 3));
686
+ geometry.setAttribute("position", new BufferAttribute(CORNERS, 3));
766
687
  geometry.instanceCount = 0;
767
- const mesh = new Mesh2(geometry, material);
688
+ const mesh = new Mesh(geometry, material);
768
689
  mesh.frustumCulled = false;
769
690
  mesh.renderOrder = 0;
770
691
  mesh.visible = false;
@@ -820,51 +741,28 @@ function createMagnetGrid() {
820
741
  };
821
742
  }
822
743
 
823
- // ../ground/src/passes/grid.ts
824
- function mergeGridConfig(base, next) {
825
- const merged = { ...base, ...next };
826
- if (next.magnet !== void 0) merged.magnet = { ...base.magnet, ...next.magnet };
827
- return merged;
828
- }
829
- function createGridPass(initial = {}, deps = {}) {
830
- let cfg = mergeGridConfig(DEFAULT_GRID_CONFIG, initial);
831
- const group = new Group2();
832
- const classic = createClassicGrid(cfg);
833
- group.add(classic.mesh);
834
- let magnet = null;
744
+ // ../ground/src/passes/grid-magnet-pass.ts
745
+ var createGridPass = (initial = {}, deps = {}) => {
746
+ let cfg = resolveInitialGridConfig(initial);
747
+ const renderer = createMagnetGrid();
835
748
  const poles = deps.poles ?? [];
836
749
  const sourceScratch = new Float32Array(MAX_MAGNET_SOURCES * MAGNET_SOURCE_FLOATS);
837
750
  const poleScratch = [];
838
751
  return {
839
752
  name: "grid",
840
- object: group,
753
+ object: renderer.group,
841
754
  arm(world, wake) {
842
755
  const wakeIfWidgets = () => {
843
- const m = resolveMagnet(cfg);
844
- if (m.enabled && m.widgets && deps.readSpatial !== void 0) wake();
845
- };
846
- const wakeIfEnabled = () => {
847
- if (resolveMagnet(cfg).enabled) wake();
756
+ const magnet = resolveMagnet(cfg);
757
+ if (magnet.widgets && deps.readSpatial !== void 0) wake();
848
758
  };
849
759
  const unsubs = [world.reactive.observeResource(SpatialVersion, wakeIfWidgets)];
850
- for (const source of poles) unsubs.push(source.subscribe(world, wakeIfEnabled));
760
+ for (const source of poles) unsubs.push(source.subscribe(world, wake));
851
761
  return unsubs;
852
762
  },
853
763
  collect(world, frame) {
854
- const m = resolveMagnet(cfg);
855
- if (!m.enabled) {
856
- classic.mesh.visible = true;
857
- if (magnet !== null) magnet.group.visible = false;
858
- classic.setCamera(frame);
859
- return;
860
- }
861
- if (magnet === null) {
862
- magnet = createMagnetGrid();
863
- group.add(magnet.group);
864
- }
865
- classic.mesh.visible = false;
866
- magnet.group.visible = true;
867
- const fieldScale = magnetFieldScale(frame.camera.zoom, m.fadeZoom);
764
+ const magnet = resolveMagnet(cfg);
765
+ const fieldScale = magnetFieldScale(frame.camera.zoom, magnet.fadeZoom);
868
766
  poleScratch.length = 0;
869
767
  if (fieldScale > 0) {
870
768
  for (const source of poles) poleScratch.push(...source.read(world));
@@ -872,26 +770,23 @@ function createGridPass(initial = {}, deps = {}) {
872
770
  const sourceCount = collectMagnetSources(
873
771
  world,
874
772
  frame,
875
- m,
773
+ magnet,
876
774
  fieldScale,
877
775
  poleScratch,
878
776
  deps.readSpatial,
879
777
  sourceScratch
880
778
  );
881
779
  const levels = collectMagnetLevels(frame, cfg);
882
- magnet.update(frame, cfg, m, levels, sourceScratch, sourceCount);
780
+ renderer.update(frame, cfg, magnet, levels, sourceScratch, sourceCount);
883
781
  },
884
782
  configure(next) {
885
783
  cfg = mergeGridConfig(cfg, next);
886
- classic.configure(cfg);
887
784
  },
888
785
  dispose() {
889
- classic.dispose();
890
- magnet?.dispose();
891
- magnet = null;
786
+ renderer.dispose();
892
787
  }
893
788
  };
894
- }
789
+ };
895
790
 
896
791
  // ../ground/src/passes/guides-collect.ts
897
792
  var guideQ = defineQuery([GuideLine]);
@@ -947,17 +842,17 @@ function collectGuides(world, frame, config = DEFAULT_SNAP_GUIDES_CONFIG) {
947
842
 
948
843
  // ../ground/src/passes/soup-mesh.ts
949
844
  import { attribute } from "three/tsl";
950
- import { BufferAttribute as BufferAttribute3, BufferGeometry as BufferGeometry2, DoubleSide, Mesh as Mesh3, MeshBasicNodeMaterial as MeshBasicNodeMaterial3 } from "three/webgpu";
845
+ import { BufferAttribute as BufferAttribute2, BufferGeometry, DoubleSide, Mesh as Mesh2, MeshBasicNodeMaterial as MeshBasicNodeMaterial2 } from "three/webgpu";
951
846
  function createSoupMesh(renderOrder) {
952
- const material = new MeshBasicNodeMaterial3();
847
+ const material = new MeshBasicNodeMaterial2();
953
848
  material.fragmentNode = attribute("color", "vec4");
954
849
  material.transparent = true;
955
850
  material.depthTest = false;
956
851
  material.depthWrite = false;
957
852
  material.side = DoubleSide;
958
- let geometry = new BufferGeometry2();
853
+ let geometry = new BufferGeometry();
959
854
  let capacity = 0;
960
- const mesh = new Mesh3(geometry, material);
855
+ const mesh = new Mesh2(geometry, material);
961
856
  mesh.frustumCulled = false;
962
857
  mesh.renderOrder = renderOrder;
963
858
  mesh.visible = false;
@@ -972,13 +867,13 @@ function createSoupMesh(renderOrder) {
972
867
  if (soup.vertexCount > capacity) {
973
868
  capacity = Math.max(soup.vertexCount, capacity * 2, 256);
974
869
  const old = geometry;
975
- geometry = new BufferGeometry2();
870
+ geometry = new BufferGeometry();
976
871
  const pos = new Float32Array(capacity * 3);
977
872
  const col = new Float32Array(capacity * 4);
978
873
  pos.set(soup.positions);
979
874
  col.set(soup.colors);
980
- geometry.setAttribute("position", new BufferAttribute3(pos, 3));
981
- geometry.setAttribute("color", new BufferAttribute3(col, 4));
875
+ geometry.setAttribute("position", new BufferAttribute2(pos, 3));
876
+ geometry.setAttribute("color", new BufferAttribute2(col, 4));
982
877
  mesh.geometry = geometry;
983
878
  old.dispose();
984
879
  } else {