three-stdlib 2.14.1 → 2.14.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/index.cjs.js +1 -1
- package/lines/Line2.cjs.js +1 -1
- package/lines/Line2.d.ts +7 -5
- package/lines/Line2.js +2 -5
- package/lines/LineGeometry.cjs.js +1 -1
- package/lines/LineGeometry.d.ts +6 -8
- package/lines/LineGeometry.js +28 -39
- package/lines/LineMaterial.cjs.js +1 -1
- package/lines/LineMaterial.d.ts +23 -19
- package/lines/LineMaterial.js +263 -107
- package/lines/LineSegments2.cjs.js +1 -1
- package/lines/LineSegments2.d.ts +12 -20
- package/lines/LineSegments2.js +272 -125
- package/lines/LineSegmentsGeometry.cjs.js +1 -1
- package/lines/LineSegmentsGeometry.d.ts +18 -16
- package/lines/LineSegmentsGeometry.js +30 -40
- package/lines/Wireframe.cjs.js +1 -1
- package/lines/Wireframe.js +39 -39
- package/lines/WireframeGeometry2.cjs.js +1 -1
- package/lines/WireframeGeometry2.js +8 -9
- package/package.json +1 -1
package/lines/Wireframe.js
CHANGED
@@ -1,45 +1,45 @@
|
|
1
|
-
import {
|
1
|
+
import { Vector3, Mesh, InstancedInterleavedBuffer, InterleavedBufferAttribute } from 'three';
|
2
2
|
import { LineSegmentsGeometry } from './LineSegmentsGeometry.js';
|
3
3
|
import { LineMaterial } from './LineMaterial.js';
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
5
|
+
const _start = new Vector3();
|
6
|
+
|
7
|
+
const _end = new Vector3();
|
8
|
+
|
9
|
+
class Wireframe extends Mesh {
|
10
|
+
constructor(geometry = new LineSegmentsGeometry(), material = new LineMaterial({
|
10
11
|
color: Math.random() * 0xffffff
|
11
|
-
})
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
});
|
12
|
+
})) {
|
13
|
+
super(geometry, material);
|
14
|
+
this.isWireframe = true;
|
15
|
+
this.type = 'Wireframe';
|
16
|
+
} // for backwards-compatibility, but could be a method of LineSegmentsGeometry...
|
17
|
+
|
18
|
+
|
19
|
+
computeLineDistances() {
|
20
|
+
const geometry = this.geometry;
|
21
|
+
const instanceStart = geometry.attributes.instanceStart;
|
22
|
+
const instanceEnd = geometry.attributes.instanceEnd;
|
23
|
+
const lineDistances = new Float32Array(2 * instanceStart.count);
|
24
|
+
|
25
|
+
for (let i = 0, j = 0, l = instanceStart.count; i < l; i++, j += 2) {
|
26
|
+
_start.fromBufferAttribute(instanceStart, i);
|
27
|
+
|
28
|
+
_end.fromBufferAttribute(instanceEnd, i);
|
29
|
+
|
30
|
+
lineDistances[j] = j === 0 ? 0 : lineDistances[j - 1];
|
31
|
+
lineDistances[j + 1] = lineDistances[j] + _start.distanceTo(_end);
|
32
|
+
}
|
33
|
+
|
34
|
+
const instanceDistanceBuffer = new InstancedInterleavedBuffer(lineDistances, 2, 1); // d0, d1
|
35
|
+
|
36
|
+
geometry.setAttribute('instanceDistanceStart', new InterleavedBufferAttribute(instanceDistanceBuffer, 1, 0)); // d0
|
37
|
+
|
38
|
+
geometry.setAttribute('instanceDistanceEnd', new InterleavedBufferAttribute(instanceDistanceBuffer, 1, 1)); // d1
|
39
|
+
|
40
|
+
return this;
|
41
|
+
}
|
42
|
+
|
43
|
+
}
|
44
44
|
|
45
45
|
export { Wireframe };
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("three"),r=require("./LineSegmentsGeometry.cjs.js");
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("three"),r=require("./LineSegmentsGeometry.cjs.js");class t extends r.LineSegmentsGeometry{constructor(r){super(),this.isWireframeGeometry2=!0,this.type="WireframeGeometry2",this.fromWireframeGeometry(new e.WireframeGeometry(r))}}exports.WireframeGeometry2=t;
|
@@ -1,15 +1,14 @@
|
|
1
1
|
import { WireframeGeometry } from 'three';
|
2
2
|
import { LineSegmentsGeometry } from './LineSegmentsGeometry.js';
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
class WireframeGeometry2 extends LineSegmentsGeometry {
|
5
|
+
constructor(geometry) {
|
6
|
+
super();
|
7
|
+
this.isWireframeGeometry2 = true;
|
8
|
+
this.type = 'WireframeGeometry2';
|
9
|
+
this.fromWireframeGeometry(new WireframeGeometry(geometry)); // set colors, maybe
|
10
|
+
}
|
9
11
|
|
10
|
-
|
11
|
-
constructor: WireframeGeometry2,
|
12
|
-
isWireframeGeometry2: true
|
13
|
-
});
|
12
|
+
}
|
14
13
|
|
15
14
|
export { WireframeGeometry2 };
|