Initial project import
This commit is contained in:
14
node_modules/three-stdlib/lines/Line2.cjs
generated
vendored
Normal file
14
node_modules/three-stdlib/lines/Line2.cjs
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
||||
const LineSegments2 = require("./LineSegments2.cjs");
|
||||
const LineGeometry = require("./LineGeometry.cjs");
|
||||
const LineMaterial = require("./LineMaterial.cjs");
|
||||
class Line2 extends LineSegments2.LineSegments2 {
|
||||
constructor(geometry = new LineGeometry.LineGeometry(), material = new LineMaterial.LineMaterial({ color: Math.random() * 16777215 })) {
|
||||
super(geometry, material);
|
||||
this.isLine2 = true;
|
||||
this.type = "Line2";
|
||||
}
|
||||
}
|
||||
exports.Line2 = Line2;
|
||||
//# sourceMappingURL=Line2.cjs.map
|
||||
1
node_modules/three-stdlib/lines/Line2.cjs.map
generated
vendored
Normal file
1
node_modules/three-stdlib/lines/Line2.cjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Line2.cjs","sources":["../../src/lines/Line2.js"],"sourcesContent":["import { LineSegments2 } from '../lines/LineSegments2'\nimport { LineGeometry } from '../lines/LineGeometry'\nimport { LineMaterial } from '../lines/LineMaterial'\n\nclass Line2 extends LineSegments2 {\n constructor(geometry = new LineGeometry(), material = new LineMaterial({ color: Math.random() * 0xffffff })) {\n super(geometry, material)\n\n this.isLine2 = true\n\n this.type = 'Line2'\n }\n}\n\nexport { Line2 }\n"],"names":["LineSegments2","LineGeometry","LineMaterial"],"mappings":";;;;;AAIA,MAAM,cAAcA,cAAAA,cAAc;AAAA,EAChC,YAAY,WAAW,IAAIC,0BAAc,GAAE,WAAW,IAAIC,aAAAA,aAAa,EAAE,OAAO,KAAK,WAAW,SAAU,CAAA,GAAG;AAC3G,UAAM,UAAU,QAAQ;AAExB,SAAK,UAAU;AAEf,SAAK,OAAO;AAAA,EACb;AACH;;"}
|
||||
11
node_modules/three-stdlib/lines/Line2.d.ts
generated
vendored
Normal file
11
node_modules/three-stdlib/lines/Line2.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import { LineGeometry } from './LineGeometry'
|
||||
import { LineSegments2 } from './LineSegments2'
|
||||
import { LineMaterial } from './LineMaterial'
|
||||
|
||||
export class Line2 extends LineSegments2 {
|
||||
geometry: LineGeometry
|
||||
material: LineMaterial
|
||||
|
||||
constructor(geometry?: LineGeometry, material?: LineMaterial)
|
||||
readonly isLine2: true
|
||||
}
|
||||
14
node_modules/three-stdlib/lines/Line2.js
generated
vendored
Normal file
14
node_modules/three-stdlib/lines/Line2.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import { LineSegments2 } from "./LineSegments2.js";
|
||||
import { LineGeometry } from "./LineGeometry.js";
|
||||
import { LineMaterial } from "./LineMaterial.js";
|
||||
class Line2 extends LineSegments2 {
|
||||
constructor(geometry = new LineGeometry(), material = new LineMaterial({ color: Math.random() * 16777215 })) {
|
||||
super(geometry, material);
|
||||
this.isLine2 = true;
|
||||
this.type = "Line2";
|
||||
}
|
||||
}
|
||||
export {
|
||||
Line2
|
||||
};
|
||||
//# sourceMappingURL=Line2.js.map
|
||||
1
node_modules/three-stdlib/lines/Line2.js.map
generated
vendored
Normal file
1
node_modules/three-stdlib/lines/Line2.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Line2.js","sources":["../../src/lines/Line2.js"],"sourcesContent":["import { LineSegments2 } from '../lines/LineSegments2'\nimport { LineGeometry } from '../lines/LineGeometry'\nimport { LineMaterial } from '../lines/LineMaterial'\n\nclass Line2 extends LineSegments2 {\n constructor(geometry = new LineGeometry(), material = new LineMaterial({ color: Math.random() * 0xffffff })) {\n super(geometry, material)\n\n this.isLine2 = true\n\n this.type = 'Line2'\n }\n}\n\nexport { Line2 }\n"],"names":[],"mappings":";;;AAIA,MAAM,cAAc,cAAc;AAAA,EAChC,YAAY,WAAW,IAAI,aAAc,GAAE,WAAW,IAAI,aAAa,EAAE,OAAO,KAAK,WAAW,SAAU,CAAA,GAAG;AAC3G,UAAM,UAAU,QAAQ;AAExB,SAAK,UAAU;AAEf,SAAK,OAAO;AAAA,EACb;AACH;"}
|
||||
58
node_modules/three-stdlib/lines/LineGeometry.cjs
generated
vendored
Normal file
58
node_modules/three-stdlib/lines/LineGeometry.cjs
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
||||
const LineSegmentsGeometry = require("./LineSegmentsGeometry.cjs");
|
||||
class LineGeometry extends LineSegmentsGeometry.LineSegmentsGeometry {
|
||||
constructor() {
|
||||
super();
|
||||
this.isLineGeometry = true;
|
||||
this.type = "LineGeometry";
|
||||
}
|
||||
setPositions(array) {
|
||||
const length = array.length - 3;
|
||||
const points = new Float32Array(2 * length);
|
||||
for (let i = 0; i < length; i += 3) {
|
||||
points[2 * i] = array[i];
|
||||
points[2 * i + 1] = array[i + 1];
|
||||
points[2 * i + 2] = array[i + 2];
|
||||
points[2 * i + 3] = array[i + 3];
|
||||
points[2 * i + 4] = array[i + 4];
|
||||
points[2 * i + 5] = array[i + 5];
|
||||
}
|
||||
super.setPositions(points);
|
||||
return this;
|
||||
}
|
||||
setColors(array, itemSize = 3) {
|
||||
const length = array.length - itemSize;
|
||||
const colors = new Float32Array(2 * length);
|
||||
if (itemSize === 3) {
|
||||
for (let i = 0; i < length; i += itemSize) {
|
||||
colors[2 * i] = array[i];
|
||||
colors[2 * i + 1] = array[i + 1];
|
||||
colors[2 * i + 2] = array[i + 2];
|
||||
colors[2 * i + 3] = array[i + 3];
|
||||
colors[2 * i + 4] = array[i + 4];
|
||||
colors[2 * i + 5] = array[i + 5];
|
||||
}
|
||||
} else {
|
||||
for (let i = 0; i < length; i += itemSize) {
|
||||
colors[2 * i] = array[i];
|
||||
colors[2 * i + 1] = array[i + 1];
|
||||
colors[2 * i + 2] = array[i + 2];
|
||||
colors[2 * i + 3] = array[i + 3];
|
||||
colors[2 * i + 4] = array[i + 4];
|
||||
colors[2 * i + 5] = array[i + 5];
|
||||
colors[2 * i + 6] = array[i + 6];
|
||||
colors[2 * i + 7] = array[i + 7];
|
||||
}
|
||||
}
|
||||
super.setColors(colors, itemSize);
|
||||
return this;
|
||||
}
|
||||
fromLine(line) {
|
||||
const geometry = line.geometry;
|
||||
this.setPositions(geometry.attributes.position.array);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
exports.LineGeometry = LineGeometry;
|
||||
//# sourceMappingURL=LineGeometry.cjs.map
|
||||
1
node_modules/three-stdlib/lines/LineGeometry.cjs.map
generated
vendored
Normal file
1
node_modules/three-stdlib/lines/LineGeometry.cjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"LineGeometry.cjs","sources":["../../src/lines/LineGeometry.js"],"sourcesContent":["import { LineSegmentsGeometry } from '../lines/LineSegmentsGeometry'\n\nclass LineGeometry extends LineSegmentsGeometry {\n constructor() {\n super()\n\n this.isLineGeometry = true\n\n this.type = 'LineGeometry'\n }\n\n setPositions(array) {\n // converts [ x1, y1, z1, x2, y2, z2, ... ] to pairs format\n\n const length = array.length - 3\n const points = new Float32Array(2 * length)\n\n for (let i = 0; i < length; i += 3) {\n points[2 * i] = array[i]\n points[2 * i + 1] = array[i + 1]\n points[2 * i + 2] = array[i + 2]\n\n points[2 * i + 3] = array[i + 3]\n points[2 * i + 4] = array[i + 4]\n points[2 * i + 5] = array[i + 5]\n }\n\n super.setPositions(points)\n\n return this\n }\n\n setColors(array, itemSize = 3) {\n // converts [ r1, g1, b1, (a1), r2, g2, b2, (a2), ... ] to pairs format\n\n const length = array.length - itemSize\n const colors = new Float32Array(2 * length)\n\n if (itemSize === 3) {\n for (let i = 0; i < length; i += itemSize) {\n colors[2 * i] = array[i]\n colors[2 * i + 1] = array[i + 1]\n colors[2 * i + 2] = array[i + 2]\n\n colors[2 * i + 3] = array[i + 3]\n colors[2 * i + 4] = array[i + 4]\n colors[2 * i + 5] = array[i + 5]\n }\n } else {\n for (let i = 0; i < length; i += itemSize) {\n colors[2 * i] = array[i]\n colors[2 * i + 1] = array[i + 1]\n colors[2 * i + 2] = array[i + 2]\n colors[2 * i + 3] = array[i + 3]\n\n colors[2 * i + 4] = array[i + 4]\n colors[2 * i + 5] = array[i + 5]\n colors[2 * i + 6] = array[i + 6]\n colors[2 * i + 7] = array[i + 7]\n }\n }\n\n super.setColors(colors, itemSize)\n\n return this\n }\n\n fromLine(line) {\n const geometry = line.geometry\n\n this.setPositions(geometry.attributes.position.array) // assumes non-indexed\n\n // set colors, maybe\n\n return this\n }\n}\n\nexport { LineGeometry }\n"],"names":["LineSegmentsGeometry"],"mappings":";;;AAEA,MAAM,qBAAqBA,qBAAAA,qBAAqB;AAAA,EAC9C,cAAc;AACZ,UAAO;AAEP,SAAK,iBAAiB;AAEtB,SAAK,OAAO;AAAA,EACb;AAAA,EAED,aAAa,OAAO;AAGlB,UAAM,SAAS,MAAM,SAAS;AAC9B,UAAM,SAAS,IAAI,aAAa,IAAI,MAAM;AAE1C,aAAS,IAAI,GAAG,IAAI,QAAQ,KAAK,GAAG;AAClC,aAAO,IAAI,CAAC,IAAI,MAAM,CAAC;AACvB,aAAO,IAAI,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC;AAC/B,aAAO,IAAI,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC;AAE/B,aAAO,IAAI,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC;AAC/B,aAAO,IAAI,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC;AAC/B,aAAO,IAAI,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC;AAAA,IAChC;AAED,UAAM,aAAa,MAAM;AAEzB,WAAO;AAAA,EACR;AAAA,EAED,UAAU,OAAO,WAAW,GAAG;AAG7B,UAAM,SAAS,MAAM,SAAS;AAC9B,UAAM,SAAS,IAAI,aAAa,IAAI,MAAM;AAE1C,QAAI,aAAa,GAAG;AAClB,eAAS,IAAI,GAAG,IAAI,QAAQ,KAAK,UAAU;AACzC,eAAO,IAAI,CAAC,IAAI,MAAM,CAAC;AACvB,eAAO,IAAI,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC;AAC/B,eAAO,IAAI,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC;AAE/B,eAAO,IAAI,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC;AAC/B,eAAO,IAAI,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC;AAC/B,eAAO,IAAI,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC;AAAA,MAChC;AAAA,IACP,OAAW;AACL,eAAS,IAAI,GAAG,IAAI,QAAQ,KAAK,UAAU;AACzC,eAAO,IAAI,CAAC,IAAI,MAAM,CAAC;AACvB,eAAO,IAAI,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC;AAC/B,eAAO,IAAI,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC;AAC/B,eAAO,IAAI,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC;AAE/B,eAAO,IAAI,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC;AAC/B,eAAO,IAAI,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC;AAC/B,eAAO,IAAI,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC;AAC/B,eAAO,IAAI,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC;AAAA,MAChC;AAAA,IACF;AAED,UAAM,UAAU,QAAQ,QAAQ;AAEhC,WAAO;AAAA,EACR;AAAA,EAED,SAAS,MAAM;AACb,UAAM,WAAW,KAAK;AAEtB,SAAK,aAAa,SAAS,WAAW,SAAS,KAAK;AAIpD,WAAO;AAAA,EACR;AACH;;"}
|
||||
10
node_modules/three-stdlib/lines/LineGeometry.d.ts
generated
vendored
Normal file
10
node_modules/three-stdlib/lines/LineGeometry.d.ts
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import { Line } from 'three'
|
||||
|
||||
import { LineSegmentsGeometry } from './LineSegmentsGeometry'
|
||||
|
||||
export class LineGeometry extends LineSegmentsGeometry {
|
||||
constructor()
|
||||
readonly isLineGeometry: true
|
||||
|
||||
fromLine(line: Line): this
|
||||
}
|
||||
58
node_modules/three-stdlib/lines/LineGeometry.js
generated
vendored
Normal file
58
node_modules/three-stdlib/lines/LineGeometry.js
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
import { LineSegmentsGeometry } from "./LineSegmentsGeometry.js";
|
||||
class LineGeometry extends LineSegmentsGeometry {
|
||||
constructor() {
|
||||
super();
|
||||
this.isLineGeometry = true;
|
||||
this.type = "LineGeometry";
|
||||
}
|
||||
setPositions(array) {
|
||||
const length = array.length - 3;
|
||||
const points = new Float32Array(2 * length);
|
||||
for (let i = 0; i < length; i += 3) {
|
||||
points[2 * i] = array[i];
|
||||
points[2 * i + 1] = array[i + 1];
|
||||
points[2 * i + 2] = array[i + 2];
|
||||
points[2 * i + 3] = array[i + 3];
|
||||
points[2 * i + 4] = array[i + 4];
|
||||
points[2 * i + 5] = array[i + 5];
|
||||
}
|
||||
super.setPositions(points);
|
||||
return this;
|
||||
}
|
||||
setColors(array, itemSize = 3) {
|
||||
const length = array.length - itemSize;
|
||||
const colors = new Float32Array(2 * length);
|
||||
if (itemSize === 3) {
|
||||
for (let i = 0; i < length; i += itemSize) {
|
||||
colors[2 * i] = array[i];
|
||||
colors[2 * i + 1] = array[i + 1];
|
||||
colors[2 * i + 2] = array[i + 2];
|
||||
colors[2 * i + 3] = array[i + 3];
|
||||
colors[2 * i + 4] = array[i + 4];
|
||||
colors[2 * i + 5] = array[i + 5];
|
||||
}
|
||||
} else {
|
||||
for (let i = 0; i < length; i += itemSize) {
|
||||
colors[2 * i] = array[i];
|
||||
colors[2 * i + 1] = array[i + 1];
|
||||
colors[2 * i + 2] = array[i + 2];
|
||||
colors[2 * i + 3] = array[i + 3];
|
||||
colors[2 * i + 4] = array[i + 4];
|
||||
colors[2 * i + 5] = array[i + 5];
|
||||
colors[2 * i + 6] = array[i + 6];
|
||||
colors[2 * i + 7] = array[i + 7];
|
||||
}
|
||||
}
|
||||
super.setColors(colors, itemSize);
|
||||
return this;
|
||||
}
|
||||
fromLine(line) {
|
||||
const geometry = line.geometry;
|
||||
this.setPositions(geometry.attributes.position.array);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
export {
|
||||
LineGeometry
|
||||
};
|
||||
//# sourceMappingURL=LineGeometry.js.map
|
||||
1
node_modules/three-stdlib/lines/LineGeometry.js.map
generated
vendored
Normal file
1
node_modules/three-stdlib/lines/LineGeometry.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"LineGeometry.js","sources":["../../src/lines/LineGeometry.js"],"sourcesContent":["import { LineSegmentsGeometry } from '../lines/LineSegmentsGeometry'\n\nclass LineGeometry extends LineSegmentsGeometry {\n constructor() {\n super()\n\n this.isLineGeometry = true\n\n this.type = 'LineGeometry'\n }\n\n setPositions(array) {\n // converts [ x1, y1, z1, x2, y2, z2, ... ] to pairs format\n\n const length = array.length - 3\n const points = new Float32Array(2 * length)\n\n for (let i = 0; i < length; i += 3) {\n points[2 * i] = array[i]\n points[2 * i + 1] = array[i + 1]\n points[2 * i + 2] = array[i + 2]\n\n points[2 * i + 3] = array[i + 3]\n points[2 * i + 4] = array[i + 4]\n points[2 * i + 5] = array[i + 5]\n }\n\n super.setPositions(points)\n\n return this\n }\n\n setColors(array, itemSize = 3) {\n // converts [ r1, g1, b1, (a1), r2, g2, b2, (a2), ... ] to pairs format\n\n const length = array.length - itemSize\n const colors = new Float32Array(2 * length)\n\n if (itemSize === 3) {\n for (let i = 0; i < length; i += itemSize) {\n colors[2 * i] = array[i]\n colors[2 * i + 1] = array[i + 1]\n colors[2 * i + 2] = array[i + 2]\n\n colors[2 * i + 3] = array[i + 3]\n colors[2 * i + 4] = array[i + 4]\n colors[2 * i + 5] = array[i + 5]\n }\n } else {\n for (let i = 0; i < length; i += itemSize) {\n colors[2 * i] = array[i]\n colors[2 * i + 1] = array[i + 1]\n colors[2 * i + 2] = array[i + 2]\n colors[2 * i + 3] = array[i + 3]\n\n colors[2 * i + 4] = array[i + 4]\n colors[2 * i + 5] = array[i + 5]\n colors[2 * i + 6] = array[i + 6]\n colors[2 * i + 7] = array[i + 7]\n }\n }\n\n super.setColors(colors, itemSize)\n\n return this\n }\n\n fromLine(line) {\n const geometry = line.geometry\n\n this.setPositions(geometry.attributes.position.array) // assumes non-indexed\n\n // set colors, maybe\n\n return this\n }\n}\n\nexport { LineGeometry }\n"],"names":[],"mappings":";AAEA,MAAM,qBAAqB,qBAAqB;AAAA,EAC9C,cAAc;AACZ,UAAO;AAEP,SAAK,iBAAiB;AAEtB,SAAK,OAAO;AAAA,EACb;AAAA,EAED,aAAa,OAAO;AAGlB,UAAM,SAAS,MAAM,SAAS;AAC9B,UAAM,SAAS,IAAI,aAAa,IAAI,MAAM;AAE1C,aAAS,IAAI,GAAG,IAAI,QAAQ,KAAK,GAAG;AAClC,aAAO,IAAI,CAAC,IAAI,MAAM,CAAC;AACvB,aAAO,IAAI,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC;AAC/B,aAAO,IAAI,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC;AAE/B,aAAO,IAAI,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC;AAC/B,aAAO,IAAI,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC;AAC/B,aAAO,IAAI,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC;AAAA,IAChC;AAED,UAAM,aAAa,MAAM;AAEzB,WAAO;AAAA,EACR;AAAA,EAED,UAAU,OAAO,WAAW,GAAG;AAG7B,UAAM,SAAS,MAAM,SAAS;AAC9B,UAAM,SAAS,IAAI,aAAa,IAAI,MAAM;AAE1C,QAAI,aAAa,GAAG;AAClB,eAAS,IAAI,GAAG,IAAI,QAAQ,KAAK,UAAU;AACzC,eAAO,IAAI,CAAC,IAAI,MAAM,CAAC;AACvB,eAAO,IAAI,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC;AAC/B,eAAO,IAAI,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC;AAE/B,eAAO,IAAI,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC;AAC/B,eAAO,IAAI,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC;AAC/B,eAAO,IAAI,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC;AAAA,MAChC;AAAA,IACP,OAAW;AACL,eAAS,IAAI,GAAG,IAAI,QAAQ,KAAK,UAAU;AACzC,eAAO,IAAI,CAAC,IAAI,MAAM,CAAC;AACvB,eAAO,IAAI,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC;AAC/B,eAAO,IAAI,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC;AAC/B,eAAO,IAAI,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC;AAE/B,eAAO,IAAI,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC;AAC/B,eAAO,IAAI,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC;AAC/B,eAAO,IAAI,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC;AAC/B,eAAO,IAAI,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC;AAAA,MAChC;AAAA,IACF;AAED,UAAM,UAAU,QAAQ,QAAQ;AAEhC,WAAO;AAAA,EACR;AAAA,EAED,SAAS,MAAM;AACb,UAAM,WAAW,KAAK;AAEtB,SAAK,aAAa,SAAS,WAAW,SAAS,KAAK;AAIpD,WAAO;AAAA,EACR;AACH;"}
|
||||
577
node_modules/three-stdlib/lines/LineMaterial.cjs
generated
vendored
Normal file
577
node_modules/three-stdlib/lines/LineMaterial.cjs
generated
vendored
Normal file
@@ -0,0 +1,577 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
||||
const THREE = require("three");
|
||||
const constants = require("../_polyfill/constants.cjs");
|
||||
class LineMaterial extends THREE.ShaderMaterial {
|
||||
constructor(parameters) {
|
||||
super({
|
||||
type: "LineMaterial",
|
||||
uniforms: THREE.UniformsUtils.clone(
|
||||
THREE.UniformsUtils.merge([
|
||||
THREE.UniformsLib.common,
|
||||
THREE.UniformsLib.fog,
|
||||
{
|
||||
worldUnits: { value: 1 },
|
||||
linewidth: { value: 1 },
|
||||
resolution: { value: new THREE.Vector2(1, 1) },
|
||||
dashOffset: { value: 0 },
|
||||
dashScale: { value: 1 },
|
||||
dashSize: { value: 1 },
|
||||
gapSize: { value: 1 }
|
||||
// todo FIX - maybe change to totalSize
|
||||
}
|
||||
])
|
||||
),
|
||||
vertexShader: (
|
||||
/* glsl */
|
||||
`
|
||||
#include <common>
|
||||
#include <fog_pars_vertex>
|
||||
#include <logdepthbuf_pars_vertex>
|
||||
#include <clipping_planes_pars_vertex>
|
||||
|
||||
uniform float linewidth;
|
||||
uniform vec2 resolution;
|
||||
|
||||
attribute vec3 instanceStart;
|
||||
attribute vec3 instanceEnd;
|
||||
|
||||
#ifdef USE_COLOR
|
||||
#ifdef USE_LINE_COLOR_ALPHA
|
||||
varying vec4 vLineColor;
|
||||
attribute vec4 instanceColorStart;
|
||||
attribute vec4 instanceColorEnd;
|
||||
#else
|
||||
varying vec3 vLineColor;
|
||||
attribute vec3 instanceColorStart;
|
||||
attribute vec3 instanceColorEnd;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef WORLD_UNITS
|
||||
|
||||
varying vec4 worldPos;
|
||||
varying vec3 worldStart;
|
||||
varying vec3 worldEnd;
|
||||
|
||||
#ifdef USE_DASH
|
||||
|
||||
varying vec2 vUv;
|
||||
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
varying vec2 vUv;
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef USE_DASH
|
||||
|
||||
uniform float dashScale;
|
||||
attribute float instanceDistanceStart;
|
||||
attribute float instanceDistanceEnd;
|
||||
varying float vLineDistance;
|
||||
|
||||
#endif
|
||||
|
||||
void trimSegment( const in vec4 start, inout vec4 end ) {
|
||||
|
||||
// trim end segment so it terminates between the camera plane and the near plane
|
||||
|
||||
// conservative estimate of the near plane
|
||||
float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column
|
||||
float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column
|
||||
float nearEstimate = - 0.5 * b / a;
|
||||
|
||||
float alpha = ( nearEstimate - start.z ) / ( end.z - start.z );
|
||||
|
||||
end.xyz = mix( start.xyz, end.xyz, alpha );
|
||||
|
||||
}
|
||||
|
||||
void main() {
|
||||
|
||||
#ifdef USE_COLOR
|
||||
|
||||
vLineColor = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef USE_DASH
|
||||
|
||||
vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;
|
||||
vUv = uv;
|
||||
|
||||
#endif
|
||||
|
||||
float aspect = resolution.x / resolution.y;
|
||||
|
||||
// camera space
|
||||
vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );
|
||||
vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );
|
||||
|
||||
#ifdef WORLD_UNITS
|
||||
|
||||
worldStart = start.xyz;
|
||||
worldEnd = end.xyz;
|
||||
|
||||
#else
|
||||
|
||||
vUv = uv;
|
||||
|
||||
#endif
|
||||
|
||||
// special case for perspective projection, and segments that terminate either in, or behind, the camera plane
|
||||
// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space
|
||||
// but we need to perform ndc-space calculations in the shader, so we must address this issue directly
|
||||
// perhaps there is a more elegant solution -- WestLangley
|
||||
|
||||
bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column
|
||||
|
||||
if ( perspective ) {
|
||||
|
||||
if ( start.z < 0.0 && end.z >= 0.0 ) {
|
||||
|
||||
trimSegment( start, end );
|
||||
|
||||
} else if ( end.z < 0.0 && start.z >= 0.0 ) {
|
||||
|
||||
trimSegment( end, start );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// clip space
|
||||
vec4 clipStart = projectionMatrix * start;
|
||||
vec4 clipEnd = projectionMatrix * end;
|
||||
|
||||
// ndc space
|
||||
vec3 ndcStart = clipStart.xyz / clipStart.w;
|
||||
vec3 ndcEnd = clipEnd.xyz / clipEnd.w;
|
||||
|
||||
// direction
|
||||
vec2 dir = ndcEnd.xy - ndcStart.xy;
|
||||
|
||||
// account for clip-space aspect ratio
|
||||
dir.x *= aspect;
|
||||
dir = normalize( dir );
|
||||
|
||||
#ifdef WORLD_UNITS
|
||||
|
||||
// get the offset direction as perpendicular to the view vector
|
||||
vec3 worldDir = normalize( end.xyz - start.xyz );
|
||||
vec3 offset;
|
||||
if ( position.y < 0.5 ) {
|
||||
|
||||
offset = normalize( cross( start.xyz, worldDir ) );
|
||||
|
||||
} else {
|
||||
|
||||
offset = normalize( cross( end.xyz, worldDir ) );
|
||||
|
||||
}
|
||||
|
||||
// sign flip
|
||||
if ( position.x < 0.0 ) offset *= - 1.0;
|
||||
|
||||
float forwardOffset = dot( worldDir, vec3( 0.0, 0.0, 1.0 ) );
|
||||
|
||||
// don't extend the line if we're rendering dashes because we
|
||||
// won't be rendering the endcaps
|
||||
#ifndef USE_DASH
|
||||
|
||||
// extend the line bounds to encompass endcaps
|
||||
start.xyz += - worldDir * linewidth * 0.5;
|
||||
end.xyz += worldDir * linewidth * 0.5;
|
||||
|
||||
// shift the position of the quad so it hugs the forward edge of the line
|
||||
offset.xy -= dir * forwardOffset;
|
||||
offset.z += 0.5;
|
||||
|
||||
#endif
|
||||
|
||||
// endcaps
|
||||
if ( position.y > 1.0 || position.y < 0.0 ) {
|
||||
|
||||
offset.xy += dir * 2.0 * forwardOffset;
|
||||
|
||||
}
|
||||
|
||||
// adjust for linewidth
|
||||
offset *= linewidth * 0.5;
|
||||
|
||||
// set the world position
|
||||
worldPos = ( position.y < 0.5 ) ? start : end;
|
||||
worldPos.xyz += offset;
|
||||
|
||||
// project the worldpos
|
||||
vec4 clip = projectionMatrix * worldPos;
|
||||
|
||||
// shift the depth of the projected points so the line
|
||||
// segments overlap neatly
|
||||
vec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;
|
||||
clip.z = clipPose.z * clip.w;
|
||||
|
||||
#else
|
||||
|
||||
vec2 offset = vec2( dir.y, - dir.x );
|
||||
// undo aspect ratio adjustment
|
||||
dir.x /= aspect;
|
||||
offset.x /= aspect;
|
||||
|
||||
// sign flip
|
||||
if ( position.x < 0.0 ) offset *= - 1.0;
|
||||
|
||||
// endcaps
|
||||
if ( position.y < 0.0 ) {
|
||||
|
||||
offset += - dir;
|
||||
|
||||
} else if ( position.y > 1.0 ) {
|
||||
|
||||
offset += dir;
|
||||
|
||||
}
|
||||
|
||||
// adjust for linewidth
|
||||
offset *= linewidth;
|
||||
|
||||
// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...
|
||||
offset /= resolution.y;
|
||||
|
||||
// select end
|
||||
vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;
|
||||
|
||||
// back to clip space
|
||||
offset *= clip.w;
|
||||
|
||||
clip.xy += offset;
|
||||
|
||||
#endif
|
||||
|
||||
gl_Position = clip;
|
||||
|
||||
vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation
|
||||
|
||||
#include <logdepthbuf_vertex>
|
||||
#include <clipping_planes_vertex>
|
||||
#include <fog_vertex>
|
||||
|
||||
}
|
||||
`
|
||||
),
|
||||
fragmentShader: (
|
||||
/* glsl */
|
||||
`
|
||||
uniform vec3 diffuse;
|
||||
uniform float opacity;
|
||||
uniform float linewidth;
|
||||
|
||||
#ifdef USE_DASH
|
||||
|
||||
uniform float dashOffset;
|
||||
uniform float dashSize;
|
||||
uniform float gapSize;
|
||||
|
||||
#endif
|
||||
|
||||
varying float vLineDistance;
|
||||
|
||||
#ifdef WORLD_UNITS
|
||||
|
||||
varying vec4 worldPos;
|
||||
varying vec3 worldStart;
|
||||
varying vec3 worldEnd;
|
||||
|
||||
#ifdef USE_DASH
|
||||
|
||||
varying vec2 vUv;
|
||||
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
varying vec2 vUv;
|
||||
|
||||
#endif
|
||||
|
||||
#include <common>
|
||||
#include <fog_pars_fragment>
|
||||
#include <logdepthbuf_pars_fragment>
|
||||
#include <clipping_planes_pars_fragment>
|
||||
|
||||
#ifdef USE_COLOR
|
||||
#ifdef USE_LINE_COLOR_ALPHA
|
||||
varying vec4 vLineColor;
|
||||
#else
|
||||
varying vec3 vLineColor;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
vec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {
|
||||
|
||||
float mua;
|
||||
float mub;
|
||||
|
||||
vec3 p13 = p1 - p3;
|
||||
vec3 p43 = p4 - p3;
|
||||
|
||||
vec3 p21 = p2 - p1;
|
||||
|
||||
float d1343 = dot( p13, p43 );
|
||||
float d4321 = dot( p43, p21 );
|
||||
float d1321 = dot( p13, p21 );
|
||||
float d4343 = dot( p43, p43 );
|
||||
float d2121 = dot( p21, p21 );
|
||||
|
||||
float denom = d2121 * d4343 - d4321 * d4321;
|
||||
|
||||
float numer = d1343 * d4321 - d1321 * d4343;
|
||||
|
||||
mua = numer / denom;
|
||||
mua = clamp( mua, 0.0, 1.0 );
|
||||
mub = ( d1343 + d4321 * ( mua ) ) / d4343;
|
||||
mub = clamp( mub, 0.0, 1.0 );
|
||||
|
||||
return vec2( mua, mub );
|
||||
|
||||
}
|
||||
|
||||
void main() {
|
||||
|
||||
#include <clipping_planes_fragment>
|
||||
|
||||
#ifdef USE_DASH
|
||||
|
||||
if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps
|
||||
|
||||
if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX
|
||||
|
||||
#endif
|
||||
|
||||
float alpha = opacity;
|
||||
|
||||
#ifdef WORLD_UNITS
|
||||
|
||||
// Find the closest points on the view ray and the line segment
|
||||
vec3 rayEnd = normalize( worldPos.xyz ) * 1e5;
|
||||
vec3 lineDir = worldEnd - worldStart;
|
||||
vec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );
|
||||
|
||||
vec3 p1 = worldStart + lineDir * params.x;
|
||||
vec3 p2 = rayEnd * params.y;
|
||||
vec3 delta = p1 - p2;
|
||||
float len = length( delta );
|
||||
float norm = len / linewidth;
|
||||
|
||||
#ifndef USE_DASH
|
||||
|
||||
#ifdef USE_ALPHA_TO_COVERAGE
|
||||
|
||||
float dnorm = fwidth( norm );
|
||||
alpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );
|
||||
|
||||
#else
|
||||
|
||||
if ( norm > 0.5 ) {
|
||||
|
||||
discard;
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#ifdef USE_ALPHA_TO_COVERAGE
|
||||
|
||||
// artifacts appear on some hardware if a derivative is taken within a conditional
|
||||
float a = vUv.x;
|
||||
float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
|
||||
float len2 = a * a + b * b;
|
||||
float dlen = fwidth( len2 );
|
||||
|
||||
if ( abs( vUv.y ) > 1.0 ) {
|
||||
|
||||
alpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );
|
||||
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
if ( abs( vUv.y ) > 1.0 ) {
|
||||
|
||||
float a = vUv.x;
|
||||
float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
|
||||
float len2 = a * a + b * b;
|
||||
|
||||
if ( len2 > 1.0 ) discard;
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
vec4 diffuseColor = vec4( diffuse, alpha );
|
||||
#ifdef USE_COLOR
|
||||
#ifdef USE_LINE_COLOR_ALPHA
|
||||
diffuseColor *= vLineColor;
|
||||
#else
|
||||
diffuseColor.rgb *= vLineColor;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <logdepthbuf_fragment>
|
||||
|
||||
gl_FragColor = diffuseColor;
|
||||
|
||||
#include <tonemapping_fragment>
|
||||
#include <${constants.version >= 154 ? "colorspace_fragment" : "encodings_fragment"}>
|
||||
#include <fog_fragment>
|
||||
#include <premultiplied_alpha_fragment>
|
||||
|
||||
}
|
||||
`
|
||||
),
|
||||
clipping: true
|
||||
// required for clipping support
|
||||
});
|
||||
this.isLineMaterial = true;
|
||||
this.onBeforeCompile = function() {
|
||||
if (this.transparent) {
|
||||
this.defines.USE_LINE_COLOR_ALPHA = "1";
|
||||
} else {
|
||||
delete this.defines.USE_LINE_COLOR_ALPHA;
|
||||
}
|
||||
};
|
||||
Object.defineProperties(this, {
|
||||
color: {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return this.uniforms.diffuse.value;
|
||||
},
|
||||
set: function(value) {
|
||||
this.uniforms.diffuse.value = value;
|
||||
}
|
||||
},
|
||||
worldUnits: {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return "WORLD_UNITS" in this.defines;
|
||||
},
|
||||
set: function(value) {
|
||||
if (value === true) {
|
||||
this.defines.WORLD_UNITS = "";
|
||||
} else {
|
||||
delete this.defines.WORLD_UNITS;
|
||||
}
|
||||
}
|
||||
},
|
||||
linewidth: {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return this.uniforms.linewidth.value;
|
||||
},
|
||||
set: function(value) {
|
||||
this.uniforms.linewidth.value = value;
|
||||
}
|
||||
},
|
||||
dashed: {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return Boolean("USE_DASH" in this.defines);
|
||||
},
|
||||
set(value) {
|
||||
if (Boolean(value) !== Boolean("USE_DASH" in this.defines)) {
|
||||
this.needsUpdate = true;
|
||||
}
|
||||
if (value === true) {
|
||||
this.defines.USE_DASH = "";
|
||||
} else {
|
||||
delete this.defines.USE_DASH;
|
||||
}
|
||||
}
|
||||
},
|
||||
dashScale: {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return this.uniforms.dashScale.value;
|
||||
},
|
||||
set: function(value) {
|
||||
this.uniforms.dashScale.value = value;
|
||||
}
|
||||
},
|
||||
dashSize: {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return this.uniforms.dashSize.value;
|
||||
},
|
||||
set: function(value) {
|
||||
this.uniforms.dashSize.value = value;
|
||||
}
|
||||
},
|
||||
dashOffset: {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return this.uniforms.dashOffset.value;
|
||||
},
|
||||
set: function(value) {
|
||||
this.uniforms.dashOffset.value = value;
|
||||
}
|
||||
},
|
||||
gapSize: {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return this.uniforms.gapSize.value;
|
||||
},
|
||||
set: function(value) {
|
||||
this.uniforms.gapSize.value = value;
|
||||
}
|
||||
},
|
||||
opacity: {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return this.uniforms.opacity.value;
|
||||
},
|
||||
set: function(value) {
|
||||
this.uniforms.opacity.value = value;
|
||||
}
|
||||
},
|
||||
resolution: {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return this.uniforms.resolution.value;
|
||||
},
|
||||
set: function(value) {
|
||||
this.uniforms.resolution.value.copy(value);
|
||||
}
|
||||
},
|
||||
alphaToCoverage: {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return Boolean("USE_ALPHA_TO_COVERAGE" in this.defines);
|
||||
},
|
||||
set: function(value) {
|
||||
if (Boolean(value) !== Boolean("USE_ALPHA_TO_COVERAGE" in this.defines)) {
|
||||
this.needsUpdate = true;
|
||||
}
|
||||
if (value === true) {
|
||||
this.defines.USE_ALPHA_TO_COVERAGE = "";
|
||||
this.extensions.derivatives = true;
|
||||
} else {
|
||||
delete this.defines.USE_ALPHA_TO_COVERAGE;
|
||||
this.extensions.derivatives = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
this.setValues(parameters);
|
||||
}
|
||||
}
|
||||
exports.LineMaterial = LineMaterial;
|
||||
//# sourceMappingURL=LineMaterial.cjs.map
|
||||
1
node_modules/three-stdlib/lines/LineMaterial.cjs.map
generated
vendored
Normal file
1
node_modules/three-stdlib/lines/LineMaterial.cjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
31
node_modules/three-stdlib/lines/LineMaterial.d.ts
generated
vendored
Normal file
31
node_modules/three-stdlib/lines/LineMaterial.d.ts
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
import { Color, MaterialParameters, ShaderMaterial, Vector2 } from 'three'
|
||||
|
||||
export interface LineMaterialParameters extends MaterialParameters {
|
||||
alphaToCoverage?: boolean | undefined
|
||||
color?: number | undefined
|
||||
dashed?: boolean | undefined
|
||||
dashScale?: number | undefined
|
||||
dashSize?: number | undefined
|
||||
dashOffset?: number | undefined
|
||||
gapSize?: number | undefined
|
||||
linewidth?: number | undefined
|
||||
resolution?: Vector2 | undefined
|
||||
wireframe?: boolean | undefined
|
||||
worldUnits?: boolean | undefined
|
||||
}
|
||||
|
||||
export class LineMaterial extends ShaderMaterial {
|
||||
constructor(parameters?: LineMaterialParameters)
|
||||
color: Color
|
||||
dashed: boolean
|
||||
dashScale: number
|
||||
dashSize: number
|
||||
dashOffset: number
|
||||
gapSize: number
|
||||
opacity: number
|
||||
readonly isLineMaterial: true
|
||||
linewidth: number
|
||||
resolution: Vector2
|
||||
alphaToCoverage: boolean
|
||||
worldUnits: boolean
|
||||
}
|
||||
577
node_modules/three-stdlib/lines/LineMaterial.js
generated
vendored
Normal file
577
node_modules/three-stdlib/lines/LineMaterial.js
generated
vendored
Normal file
@@ -0,0 +1,577 @@
|
||||
import { ShaderMaterial, UniformsUtils, UniformsLib, Vector2 } from "three";
|
||||
import { version } from "../_polyfill/constants.js";
|
||||
class LineMaterial extends ShaderMaterial {
|
||||
constructor(parameters) {
|
||||
super({
|
||||
type: "LineMaterial",
|
||||
uniforms: UniformsUtils.clone(
|
||||
UniformsUtils.merge([
|
||||
UniformsLib.common,
|
||||
UniformsLib.fog,
|
||||
{
|
||||
worldUnits: { value: 1 },
|
||||
linewidth: { value: 1 },
|
||||
resolution: { value: new Vector2(1, 1) },
|
||||
dashOffset: { value: 0 },
|
||||
dashScale: { value: 1 },
|
||||
dashSize: { value: 1 },
|
||||
gapSize: { value: 1 }
|
||||
// todo FIX - maybe change to totalSize
|
||||
}
|
||||
])
|
||||
),
|
||||
vertexShader: (
|
||||
/* glsl */
|
||||
`
|
||||
#include <common>
|
||||
#include <fog_pars_vertex>
|
||||
#include <logdepthbuf_pars_vertex>
|
||||
#include <clipping_planes_pars_vertex>
|
||||
|
||||
uniform float linewidth;
|
||||
uniform vec2 resolution;
|
||||
|
||||
attribute vec3 instanceStart;
|
||||
attribute vec3 instanceEnd;
|
||||
|
||||
#ifdef USE_COLOR
|
||||
#ifdef USE_LINE_COLOR_ALPHA
|
||||
varying vec4 vLineColor;
|
||||
attribute vec4 instanceColorStart;
|
||||
attribute vec4 instanceColorEnd;
|
||||
#else
|
||||
varying vec3 vLineColor;
|
||||
attribute vec3 instanceColorStart;
|
||||
attribute vec3 instanceColorEnd;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef WORLD_UNITS
|
||||
|
||||
varying vec4 worldPos;
|
||||
varying vec3 worldStart;
|
||||
varying vec3 worldEnd;
|
||||
|
||||
#ifdef USE_DASH
|
||||
|
||||
varying vec2 vUv;
|
||||
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
varying vec2 vUv;
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef USE_DASH
|
||||
|
||||
uniform float dashScale;
|
||||
attribute float instanceDistanceStart;
|
||||
attribute float instanceDistanceEnd;
|
||||
varying float vLineDistance;
|
||||
|
||||
#endif
|
||||
|
||||
void trimSegment( const in vec4 start, inout vec4 end ) {
|
||||
|
||||
// trim end segment so it terminates between the camera plane and the near plane
|
||||
|
||||
// conservative estimate of the near plane
|
||||
float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column
|
||||
float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column
|
||||
float nearEstimate = - 0.5 * b / a;
|
||||
|
||||
float alpha = ( nearEstimate - start.z ) / ( end.z - start.z );
|
||||
|
||||
end.xyz = mix( start.xyz, end.xyz, alpha );
|
||||
|
||||
}
|
||||
|
||||
void main() {
|
||||
|
||||
#ifdef USE_COLOR
|
||||
|
||||
vLineColor = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef USE_DASH
|
||||
|
||||
vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;
|
||||
vUv = uv;
|
||||
|
||||
#endif
|
||||
|
||||
float aspect = resolution.x / resolution.y;
|
||||
|
||||
// camera space
|
||||
vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );
|
||||
vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );
|
||||
|
||||
#ifdef WORLD_UNITS
|
||||
|
||||
worldStart = start.xyz;
|
||||
worldEnd = end.xyz;
|
||||
|
||||
#else
|
||||
|
||||
vUv = uv;
|
||||
|
||||
#endif
|
||||
|
||||
// special case for perspective projection, and segments that terminate either in, or behind, the camera plane
|
||||
// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space
|
||||
// but we need to perform ndc-space calculations in the shader, so we must address this issue directly
|
||||
// perhaps there is a more elegant solution -- WestLangley
|
||||
|
||||
bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column
|
||||
|
||||
if ( perspective ) {
|
||||
|
||||
if ( start.z < 0.0 && end.z >= 0.0 ) {
|
||||
|
||||
trimSegment( start, end );
|
||||
|
||||
} else if ( end.z < 0.0 && start.z >= 0.0 ) {
|
||||
|
||||
trimSegment( end, start );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// clip space
|
||||
vec4 clipStart = projectionMatrix * start;
|
||||
vec4 clipEnd = projectionMatrix * end;
|
||||
|
||||
// ndc space
|
||||
vec3 ndcStart = clipStart.xyz / clipStart.w;
|
||||
vec3 ndcEnd = clipEnd.xyz / clipEnd.w;
|
||||
|
||||
// direction
|
||||
vec2 dir = ndcEnd.xy - ndcStart.xy;
|
||||
|
||||
// account for clip-space aspect ratio
|
||||
dir.x *= aspect;
|
||||
dir = normalize( dir );
|
||||
|
||||
#ifdef WORLD_UNITS
|
||||
|
||||
// get the offset direction as perpendicular to the view vector
|
||||
vec3 worldDir = normalize( end.xyz - start.xyz );
|
||||
vec3 offset;
|
||||
if ( position.y < 0.5 ) {
|
||||
|
||||
offset = normalize( cross( start.xyz, worldDir ) );
|
||||
|
||||
} else {
|
||||
|
||||
offset = normalize( cross( end.xyz, worldDir ) );
|
||||
|
||||
}
|
||||
|
||||
// sign flip
|
||||
if ( position.x < 0.0 ) offset *= - 1.0;
|
||||
|
||||
float forwardOffset = dot( worldDir, vec3( 0.0, 0.0, 1.0 ) );
|
||||
|
||||
// don't extend the line if we're rendering dashes because we
|
||||
// won't be rendering the endcaps
|
||||
#ifndef USE_DASH
|
||||
|
||||
// extend the line bounds to encompass endcaps
|
||||
start.xyz += - worldDir * linewidth * 0.5;
|
||||
end.xyz += worldDir * linewidth * 0.5;
|
||||
|
||||
// shift the position of the quad so it hugs the forward edge of the line
|
||||
offset.xy -= dir * forwardOffset;
|
||||
offset.z += 0.5;
|
||||
|
||||
#endif
|
||||
|
||||
// endcaps
|
||||
if ( position.y > 1.0 || position.y < 0.0 ) {
|
||||
|
||||
offset.xy += dir * 2.0 * forwardOffset;
|
||||
|
||||
}
|
||||
|
||||
// adjust for linewidth
|
||||
offset *= linewidth * 0.5;
|
||||
|
||||
// set the world position
|
||||
worldPos = ( position.y < 0.5 ) ? start : end;
|
||||
worldPos.xyz += offset;
|
||||
|
||||
// project the worldpos
|
||||
vec4 clip = projectionMatrix * worldPos;
|
||||
|
||||
// shift the depth of the projected points so the line
|
||||
// segments overlap neatly
|
||||
vec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;
|
||||
clip.z = clipPose.z * clip.w;
|
||||
|
||||
#else
|
||||
|
||||
vec2 offset = vec2( dir.y, - dir.x );
|
||||
// undo aspect ratio adjustment
|
||||
dir.x /= aspect;
|
||||
offset.x /= aspect;
|
||||
|
||||
// sign flip
|
||||
if ( position.x < 0.0 ) offset *= - 1.0;
|
||||
|
||||
// endcaps
|
||||
if ( position.y < 0.0 ) {
|
||||
|
||||
offset += - dir;
|
||||
|
||||
} else if ( position.y > 1.0 ) {
|
||||
|
||||
offset += dir;
|
||||
|
||||
}
|
||||
|
||||
// adjust for linewidth
|
||||
offset *= linewidth;
|
||||
|
||||
// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...
|
||||
offset /= resolution.y;
|
||||
|
||||
// select end
|
||||
vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;
|
||||
|
||||
// back to clip space
|
||||
offset *= clip.w;
|
||||
|
||||
clip.xy += offset;
|
||||
|
||||
#endif
|
||||
|
||||
gl_Position = clip;
|
||||
|
||||
vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation
|
||||
|
||||
#include <logdepthbuf_vertex>
|
||||
#include <clipping_planes_vertex>
|
||||
#include <fog_vertex>
|
||||
|
||||
}
|
||||
`
|
||||
),
|
||||
fragmentShader: (
|
||||
/* glsl */
|
||||
`
|
||||
uniform vec3 diffuse;
|
||||
uniform float opacity;
|
||||
uniform float linewidth;
|
||||
|
||||
#ifdef USE_DASH
|
||||
|
||||
uniform float dashOffset;
|
||||
uniform float dashSize;
|
||||
uniform float gapSize;
|
||||
|
||||
#endif
|
||||
|
||||
varying float vLineDistance;
|
||||
|
||||
#ifdef WORLD_UNITS
|
||||
|
||||
varying vec4 worldPos;
|
||||
varying vec3 worldStart;
|
||||
varying vec3 worldEnd;
|
||||
|
||||
#ifdef USE_DASH
|
||||
|
||||
varying vec2 vUv;
|
||||
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
varying vec2 vUv;
|
||||
|
||||
#endif
|
||||
|
||||
#include <common>
|
||||
#include <fog_pars_fragment>
|
||||
#include <logdepthbuf_pars_fragment>
|
||||
#include <clipping_planes_pars_fragment>
|
||||
|
||||
#ifdef USE_COLOR
|
||||
#ifdef USE_LINE_COLOR_ALPHA
|
||||
varying vec4 vLineColor;
|
||||
#else
|
||||
varying vec3 vLineColor;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
vec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {
|
||||
|
||||
float mua;
|
||||
float mub;
|
||||
|
||||
vec3 p13 = p1 - p3;
|
||||
vec3 p43 = p4 - p3;
|
||||
|
||||
vec3 p21 = p2 - p1;
|
||||
|
||||
float d1343 = dot( p13, p43 );
|
||||
float d4321 = dot( p43, p21 );
|
||||
float d1321 = dot( p13, p21 );
|
||||
float d4343 = dot( p43, p43 );
|
||||
float d2121 = dot( p21, p21 );
|
||||
|
||||
float denom = d2121 * d4343 - d4321 * d4321;
|
||||
|
||||
float numer = d1343 * d4321 - d1321 * d4343;
|
||||
|
||||
mua = numer / denom;
|
||||
mua = clamp( mua, 0.0, 1.0 );
|
||||
mub = ( d1343 + d4321 * ( mua ) ) / d4343;
|
||||
mub = clamp( mub, 0.0, 1.0 );
|
||||
|
||||
return vec2( mua, mub );
|
||||
|
||||
}
|
||||
|
||||
void main() {
|
||||
|
||||
#include <clipping_planes_fragment>
|
||||
|
||||
#ifdef USE_DASH
|
||||
|
||||
if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps
|
||||
|
||||
if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX
|
||||
|
||||
#endif
|
||||
|
||||
float alpha = opacity;
|
||||
|
||||
#ifdef WORLD_UNITS
|
||||
|
||||
// Find the closest points on the view ray and the line segment
|
||||
vec3 rayEnd = normalize( worldPos.xyz ) * 1e5;
|
||||
vec3 lineDir = worldEnd - worldStart;
|
||||
vec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );
|
||||
|
||||
vec3 p1 = worldStart + lineDir * params.x;
|
||||
vec3 p2 = rayEnd * params.y;
|
||||
vec3 delta = p1 - p2;
|
||||
float len = length( delta );
|
||||
float norm = len / linewidth;
|
||||
|
||||
#ifndef USE_DASH
|
||||
|
||||
#ifdef USE_ALPHA_TO_COVERAGE
|
||||
|
||||
float dnorm = fwidth( norm );
|
||||
alpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );
|
||||
|
||||
#else
|
||||
|
||||
if ( norm > 0.5 ) {
|
||||
|
||||
discard;
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#ifdef USE_ALPHA_TO_COVERAGE
|
||||
|
||||
// artifacts appear on some hardware if a derivative is taken within a conditional
|
||||
float a = vUv.x;
|
||||
float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
|
||||
float len2 = a * a + b * b;
|
||||
float dlen = fwidth( len2 );
|
||||
|
||||
if ( abs( vUv.y ) > 1.0 ) {
|
||||
|
||||
alpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );
|
||||
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
if ( abs( vUv.y ) > 1.0 ) {
|
||||
|
||||
float a = vUv.x;
|
||||
float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
|
||||
float len2 = a * a + b * b;
|
||||
|
||||
if ( len2 > 1.0 ) discard;
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
vec4 diffuseColor = vec4( diffuse, alpha );
|
||||
#ifdef USE_COLOR
|
||||
#ifdef USE_LINE_COLOR_ALPHA
|
||||
diffuseColor *= vLineColor;
|
||||
#else
|
||||
diffuseColor.rgb *= vLineColor;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <logdepthbuf_fragment>
|
||||
|
||||
gl_FragColor = diffuseColor;
|
||||
|
||||
#include <tonemapping_fragment>
|
||||
#include <${version >= 154 ? "colorspace_fragment" : "encodings_fragment"}>
|
||||
#include <fog_fragment>
|
||||
#include <premultiplied_alpha_fragment>
|
||||
|
||||
}
|
||||
`
|
||||
),
|
||||
clipping: true
|
||||
// required for clipping support
|
||||
});
|
||||
this.isLineMaterial = true;
|
||||
this.onBeforeCompile = function() {
|
||||
if (this.transparent) {
|
||||
this.defines.USE_LINE_COLOR_ALPHA = "1";
|
||||
} else {
|
||||
delete this.defines.USE_LINE_COLOR_ALPHA;
|
||||
}
|
||||
};
|
||||
Object.defineProperties(this, {
|
||||
color: {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return this.uniforms.diffuse.value;
|
||||
},
|
||||
set: function(value) {
|
||||
this.uniforms.diffuse.value = value;
|
||||
}
|
||||
},
|
||||
worldUnits: {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return "WORLD_UNITS" in this.defines;
|
||||
},
|
||||
set: function(value) {
|
||||
if (value === true) {
|
||||
this.defines.WORLD_UNITS = "";
|
||||
} else {
|
||||
delete this.defines.WORLD_UNITS;
|
||||
}
|
||||
}
|
||||
},
|
||||
linewidth: {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return this.uniforms.linewidth.value;
|
||||
},
|
||||
set: function(value) {
|
||||
this.uniforms.linewidth.value = value;
|
||||
}
|
||||
},
|
||||
dashed: {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return Boolean("USE_DASH" in this.defines);
|
||||
},
|
||||
set(value) {
|
||||
if (Boolean(value) !== Boolean("USE_DASH" in this.defines)) {
|
||||
this.needsUpdate = true;
|
||||
}
|
||||
if (value === true) {
|
||||
this.defines.USE_DASH = "";
|
||||
} else {
|
||||
delete this.defines.USE_DASH;
|
||||
}
|
||||
}
|
||||
},
|
||||
dashScale: {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return this.uniforms.dashScale.value;
|
||||
},
|
||||
set: function(value) {
|
||||
this.uniforms.dashScale.value = value;
|
||||
}
|
||||
},
|
||||
dashSize: {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return this.uniforms.dashSize.value;
|
||||
},
|
||||
set: function(value) {
|
||||
this.uniforms.dashSize.value = value;
|
||||
}
|
||||
},
|
||||
dashOffset: {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return this.uniforms.dashOffset.value;
|
||||
},
|
||||
set: function(value) {
|
||||
this.uniforms.dashOffset.value = value;
|
||||
}
|
||||
},
|
||||
gapSize: {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return this.uniforms.gapSize.value;
|
||||
},
|
||||
set: function(value) {
|
||||
this.uniforms.gapSize.value = value;
|
||||
}
|
||||
},
|
||||
opacity: {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return this.uniforms.opacity.value;
|
||||
},
|
||||
set: function(value) {
|
||||
this.uniforms.opacity.value = value;
|
||||
}
|
||||
},
|
||||
resolution: {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return this.uniforms.resolution.value;
|
||||
},
|
||||
set: function(value) {
|
||||
this.uniforms.resolution.value.copy(value);
|
||||
}
|
||||
},
|
||||
alphaToCoverage: {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return Boolean("USE_ALPHA_TO_COVERAGE" in this.defines);
|
||||
},
|
||||
set: function(value) {
|
||||
if (Boolean(value) !== Boolean("USE_ALPHA_TO_COVERAGE" in this.defines)) {
|
||||
this.needsUpdate = true;
|
||||
}
|
||||
if (value === true) {
|
||||
this.defines.USE_ALPHA_TO_COVERAGE = "";
|
||||
this.extensions.derivatives = true;
|
||||
} else {
|
||||
delete this.defines.USE_ALPHA_TO_COVERAGE;
|
||||
this.extensions.derivatives = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
this.setValues(parameters);
|
||||
}
|
||||
}
|
||||
export {
|
||||
LineMaterial
|
||||
};
|
||||
//# sourceMappingURL=LineMaterial.js.map
|
||||
1
node_modules/three-stdlib/lines/LineMaterial.js.map
generated
vendored
Normal file
1
node_modules/three-stdlib/lines/LineMaterial.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
218
node_modules/three-stdlib/lines/LineSegments2.cjs
generated
vendored
Normal file
218
node_modules/three-stdlib/lines/LineSegments2.cjs
generated
vendored
Normal file
@@ -0,0 +1,218 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
||||
const THREE = require("three");
|
||||
const LineSegmentsGeometry = require("./LineSegmentsGeometry.cjs");
|
||||
const LineMaterial = require("./LineMaterial.cjs");
|
||||
const uv1 = require("../_polyfill/uv1.cjs");
|
||||
const _viewport = /* @__PURE__ */ new THREE.Vector4();
|
||||
const _start = /* @__PURE__ */ new THREE.Vector3();
|
||||
const _end = /* @__PURE__ */ new THREE.Vector3();
|
||||
const _start4 = /* @__PURE__ */ new THREE.Vector4();
|
||||
const _end4 = /* @__PURE__ */ new THREE.Vector4();
|
||||
const _ssOrigin = /* @__PURE__ */ new THREE.Vector4();
|
||||
const _ssOrigin3 = /* @__PURE__ */ new THREE.Vector3();
|
||||
const _mvMatrix = /* @__PURE__ */ new THREE.Matrix4();
|
||||
const _line = /* @__PURE__ */ new THREE.Line3();
|
||||
const _closestPoint = /* @__PURE__ */ new THREE.Vector3();
|
||||
const _box = /* @__PURE__ */ new THREE.Box3();
|
||||
const _sphere = /* @__PURE__ */ new THREE.Sphere();
|
||||
const _clipToWorldVector = /* @__PURE__ */ new THREE.Vector4();
|
||||
let _ray, _lineWidth;
|
||||
function getWorldSpaceHalfWidth(camera, distance, resolution) {
|
||||
_clipToWorldVector.set(0, 0, -distance, 1).applyMatrix4(camera.projectionMatrix);
|
||||
_clipToWorldVector.multiplyScalar(1 / _clipToWorldVector.w);
|
||||
_clipToWorldVector.x = _lineWidth / resolution.width;
|
||||
_clipToWorldVector.y = _lineWidth / resolution.height;
|
||||
_clipToWorldVector.applyMatrix4(camera.projectionMatrixInverse);
|
||||
_clipToWorldVector.multiplyScalar(1 / _clipToWorldVector.w);
|
||||
return Math.abs(Math.max(_clipToWorldVector.x, _clipToWorldVector.y));
|
||||
}
|
||||
function raycastWorldUnits(lineSegments, intersects) {
|
||||
const matrixWorld = lineSegments.matrixWorld;
|
||||
const geometry = lineSegments.geometry;
|
||||
const instanceStart = geometry.attributes.instanceStart;
|
||||
const instanceEnd = geometry.attributes.instanceEnd;
|
||||
const segmentCount = Math.min(geometry.instanceCount, instanceStart.count);
|
||||
for (let i = 0, l = segmentCount; i < l; i++) {
|
||||
_line.start.fromBufferAttribute(instanceStart, i);
|
||||
_line.end.fromBufferAttribute(instanceEnd, i);
|
||||
_line.applyMatrix4(matrixWorld);
|
||||
const pointOnLine = new THREE.Vector3();
|
||||
const point = new THREE.Vector3();
|
||||
_ray.distanceSqToSegment(_line.start, _line.end, point, pointOnLine);
|
||||
const isInside = point.distanceTo(pointOnLine) < _lineWidth * 0.5;
|
||||
if (isInside) {
|
||||
intersects.push({
|
||||
point,
|
||||
pointOnLine,
|
||||
distance: _ray.origin.distanceTo(point),
|
||||
object: lineSegments,
|
||||
face: null,
|
||||
faceIndex: i,
|
||||
uv: null,
|
||||
[uv1.UV1]: null
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
function raycastScreenSpace(lineSegments, camera, intersects) {
|
||||
const projectionMatrix = camera.projectionMatrix;
|
||||
const material = lineSegments.material;
|
||||
const resolution = material.resolution;
|
||||
const matrixWorld = lineSegments.matrixWorld;
|
||||
const geometry = lineSegments.geometry;
|
||||
const instanceStart = geometry.attributes.instanceStart;
|
||||
const instanceEnd = geometry.attributes.instanceEnd;
|
||||
const segmentCount = Math.min(geometry.instanceCount, instanceStart.count);
|
||||
const near = -camera.near;
|
||||
_ray.at(1, _ssOrigin);
|
||||
_ssOrigin.w = 1;
|
||||
_ssOrigin.applyMatrix4(camera.matrixWorldInverse);
|
||||
_ssOrigin.applyMatrix4(projectionMatrix);
|
||||
_ssOrigin.multiplyScalar(1 / _ssOrigin.w);
|
||||
_ssOrigin.x *= resolution.x / 2;
|
||||
_ssOrigin.y *= resolution.y / 2;
|
||||
_ssOrigin.z = 0;
|
||||
_ssOrigin3.copy(_ssOrigin);
|
||||
_mvMatrix.multiplyMatrices(camera.matrixWorldInverse, matrixWorld);
|
||||
for (let i = 0, l = segmentCount; i < l; i++) {
|
||||
_start4.fromBufferAttribute(instanceStart, i);
|
||||
_end4.fromBufferAttribute(instanceEnd, i);
|
||||
_start4.w = 1;
|
||||
_end4.w = 1;
|
||||
_start4.applyMatrix4(_mvMatrix);
|
||||
_end4.applyMatrix4(_mvMatrix);
|
||||
const isBehindCameraNear = _start4.z > near && _end4.z > near;
|
||||
if (isBehindCameraNear) {
|
||||
continue;
|
||||
}
|
||||
if (_start4.z > near) {
|
||||
const deltaDist = _start4.z - _end4.z;
|
||||
const t = (_start4.z - near) / deltaDist;
|
||||
_start4.lerp(_end4, t);
|
||||
} else if (_end4.z > near) {
|
||||
const deltaDist = _end4.z - _start4.z;
|
||||
const t = (_end4.z - near) / deltaDist;
|
||||
_end4.lerp(_start4, t);
|
||||
}
|
||||
_start4.applyMatrix4(projectionMatrix);
|
||||
_end4.applyMatrix4(projectionMatrix);
|
||||
_start4.multiplyScalar(1 / _start4.w);
|
||||
_end4.multiplyScalar(1 / _end4.w);
|
||||
_start4.x *= resolution.x / 2;
|
||||
_start4.y *= resolution.y / 2;
|
||||
_end4.x *= resolution.x / 2;
|
||||
_end4.y *= resolution.y / 2;
|
||||
_line.start.copy(_start4);
|
||||
_line.start.z = 0;
|
||||
_line.end.copy(_end4);
|
||||
_line.end.z = 0;
|
||||
const param = _line.closestPointToPointParameter(_ssOrigin3, true);
|
||||
_line.at(param, _closestPoint);
|
||||
const zPos = THREE.MathUtils.lerp(_start4.z, _end4.z, param);
|
||||
const isInClipSpace = zPos >= -1 && zPos <= 1;
|
||||
const isInside = _ssOrigin3.distanceTo(_closestPoint) < _lineWidth * 0.5;
|
||||
if (isInClipSpace && isInside) {
|
||||
_line.start.fromBufferAttribute(instanceStart, i);
|
||||
_line.end.fromBufferAttribute(instanceEnd, i);
|
||||
_line.start.applyMatrix4(matrixWorld);
|
||||
_line.end.applyMatrix4(matrixWorld);
|
||||
const pointOnLine = new THREE.Vector3();
|
||||
const point = new THREE.Vector3();
|
||||
_ray.distanceSqToSegment(_line.start, _line.end, point, pointOnLine);
|
||||
intersects.push({
|
||||
point,
|
||||
pointOnLine,
|
||||
distance: _ray.origin.distanceTo(point),
|
||||
object: lineSegments,
|
||||
face: null,
|
||||
faceIndex: i,
|
||||
uv: null,
|
||||
[uv1.UV1]: null
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
class LineSegments2 extends THREE.Mesh {
|
||||
constructor(geometry = new LineSegmentsGeometry.LineSegmentsGeometry(), material = new LineMaterial.LineMaterial({ color: Math.random() * 16777215 })) {
|
||||
super(geometry, material);
|
||||
this.isLineSegments2 = true;
|
||||
this.type = "LineSegments2";
|
||||
}
|
||||
// for backwards-compatibility, but could be a method of LineSegmentsGeometry...
|
||||
computeLineDistances() {
|
||||
const geometry = this.geometry;
|
||||
const instanceStart = geometry.attributes.instanceStart;
|
||||
const instanceEnd = geometry.attributes.instanceEnd;
|
||||
const lineDistances = new Float32Array(2 * instanceStart.count);
|
||||
for (let i = 0, j = 0, l = instanceStart.count; i < l; i++, j += 2) {
|
||||
_start.fromBufferAttribute(instanceStart, i);
|
||||
_end.fromBufferAttribute(instanceEnd, i);
|
||||
lineDistances[j] = j === 0 ? 0 : lineDistances[j - 1];
|
||||
lineDistances[j + 1] = lineDistances[j] + _start.distanceTo(_end);
|
||||
}
|
||||
const instanceDistanceBuffer = new THREE.InstancedInterleavedBuffer(lineDistances, 2, 1);
|
||||
geometry.setAttribute("instanceDistanceStart", new THREE.InterleavedBufferAttribute(instanceDistanceBuffer, 1, 0));
|
||||
geometry.setAttribute("instanceDistanceEnd", new THREE.InterleavedBufferAttribute(instanceDistanceBuffer, 1, 1));
|
||||
return this;
|
||||
}
|
||||
raycast(raycaster, intersects) {
|
||||
const worldUnits = this.material.worldUnits;
|
||||
const camera = raycaster.camera;
|
||||
if (camera === null && !worldUnits) {
|
||||
console.error(
|
||||
'LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.'
|
||||
);
|
||||
}
|
||||
const threshold = raycaster.params.Line2 !== void 0 ? raycaster.params.Line2.threshold || 0 : 0;
|
||||
_ray = raycaster.ray;
|
||||
const matrixWorld = this.matrixWorld;
|
||||
const geometry = this.geometry;
|
||||
const material = this.material;
|
||||
_lineWidth = material.linewidth + threshold;
|
||||
if (geometry.boundingSphere === null) {
|
||||
geometry.computeBoundingSphere();
|
||||
}
|
||||
_sphere.copy(geometry.boundingSphere).applyMatrix4(matrixWorld);
|
||||
let sphereMargin;
|
||||
if (worldUnits) {
|
||||
sphereMargin = _lineWidth * 0.5;
|
||||
} else {
|
||||
const distanceToSphere = Math.max(camera.near, _sphere.distanceToPoint(_ray.origin));
|
||||
sphereMargin = getWorldSpaceHalfWidth(camera, distanceToSphere, material.resolution);
|
||||
}
|
||||
_sphere.radius += sphereMargin;
|
||||
if (_ray.intersectsSphere(_sphere) === false) {
|
||||
return;
|
||||
}
|
||||
if (geometry.boundingBox === null) {
|
||||
geometry.computeBoundingBox();
|
||||
}
|
||||
_box.copy(geometry.boundingBox).applyMatrix4(matrixWorld);
|
||||
let boxMargin;
|
||||
if (worldUnits) {
|
||||
boxMargin = _lineWidth * 0.5;
|
||||
} else {
|
||||
const distanceToBox = Math.max(camera.near, _box.distanceToPoint(_ray.origin));
|
||||
boxMargin = getWorldSpaceHalfWidth(camera, distanceToBox, material.resolution);
|
||||
}
|
||||
_box.expandByScalar(boxMargin);
|
||||
if (_ray.intersectsBox(_box) === false) {
|
||||
return;
|
||||
}
|
||||
if (worldUnits) {
|
||||
raycastWorldUnits(this, intersects);
|
||||
} else {
|
||||
raycastScreenSpace(this, camera, intersects);
|
||||
}
|
||||
}
|
||||
onBeforeRender(renderer) {
|
||||
const uniforms = this.material.uniforms;
|
||||
if (uniforms && uniforms.resolution) {
|
||||
renderer.getViewport(_viewport);
|
||||
this.material.uniforms.resolution.value.set(_viewport.z, _viewport.w);
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.LineSegments2 = LineSegments2;
|
||||
//# sourceMappingURL=LineSegments2.cjs.map
|
||||
1
node_modules/three-stdlib/lines/LineSegments2.cjs.map
generated
vendored
Normal file
1
node_modules/three-stdlib/lines/LineSegments2.cjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
14
node_modules/three-stdlib/lines/LineSegments2.d.ts
generated
vendored
Normal file
14
node_modules/three-stdlib/lines/LineSegments2.d.ts
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import { Mesh } from 'three'
|
||||
|
||||
import { LineMaterial } from './LineMaterial'
|
||||
import { LineSegmentsGeometry } from './LineSegmentsGeometry'
|
||||
|
||||
export class LineSegments2 extends Mesh {
|
||||
geometry: LineSegmentsGeometry
|
||||
material: LineMaterial
|
||||
|
||||
constructor(geometry?: LineSegmentsGeometry, material?: LineMaterial)
|
||||
readonly isLineSegments2: true
|
||||
|
||||
computeLineDistances(): this
|
||||
}
|
||||
218
node_modules/three-stdlib/lines/LineSegments2.js
generated
vendored
Normal file
218
node_modules/three-stdlib/lines/LineSegments2.js
generated
vendored
Normal file
@@ -0,0 +1,218 @@
|
||||
import { Mesh, InstancedInterleavedBuffer, InterleavedBufferAttribute, Vector4, Vector3, Box3, Sphere, MathUtils, Matrix4, Line3 } from "three";
|
||||
import { LineSegmentsGeometry } from "./LineSegmentsGeometry.js";
|
||||
import { LineMaterial } from "./LineMaterial.js";
|
||||
import { UV1 } from "../_polyfill/uv1.js";
|
||||
const _viewport = /* @__PURE__ */ new Vector4();
|
||||
const _start = /* @__PURE__ */ new Vector3();
|
||||
const _end = /* @__PURE__ */ new Vector3();
|
||||
const _start4 = /* @__PURE__ */ new Vector4();
|
||||
const _end4 = /* @__PURE__ */ new Vector4();
|
||||
const _ssOrigin = /* @__PURE__ */ new Vector4();
|
||||
const _ssOrigin3 = /* @__PURE__ */ new Vector3();
|
||||
const _mvMatrix = /* @__PURE__ */ new Matrix4();
|
||||
const _line = /* @__PURE__ */ new Line3();
|
||||
const _closestPoint = /* @__PURE__ */ new Vector3();
|
||||
const _box = /* @__PURE__ */ new Box3();
|
||||
const _sphere = /* @__PURE__ */ new Sphere();
|
||||
const _clipToWorldVector = /* @__PURE__ */ new Vector4();
|
||||
let _ray, _lineWidth;
|
||||
function getWorldSpaceHalfWidth(camera, distance, resolution) {
|
||||
_clipToWorldVector.set(0, 0, -distance, 1).applyMatrix4(camera.projectionMatrix);
|
||||
_clipToWorldVector.multiplyScalar(1 / _clipToWorldVector.w);
|
||||
_clipToWorldVector.x = _lineWidth / resolution.width;
|
||||
_clipToWorldVector.y = _lineWidth / resolution.height;
|
||||
_clipToWorldVector.applyMatrix4(camera.projectionMatrixInverse);
|
||||
_clipToWorldVector.multiplyScalar(1 / _clipToWorldVector.w);
|
||||
return Math.abs(Math.max(_clipToWorldVector.x, _clipToWorldVector.y));
|
||||
}
|
||||
function raycastWorldUnits(lineSegments, intersects) {
|
||||
const matrixWorld = lineSegments.matrixWorld;
|
||||
const geometry = lineSegments.geometry;
|
||||
const instanceStart = geometry.attributes.instanceStart;
|
||||
const instanceEnd = geometry.attributes.instanceEnd;
|
||||
const segmentCount = Math.min(geometry.instanceCount, instanceStart.count);
|
||||
for (let i = 0, l = segmentCount; i < l; i++) {
|
||||
_line.start.fromBufferAttribute(instanceStart, i);
|
||||
_line.end.fromBufferAttribute(instanceEnd, i);
|
||||
_line.applyMatrix4(matrixWorld);
|
||||
const pointOnLine = new Vector3();
|
||||
const point = new Vector3();
|
||||
_ray.distanceSqToSegment(_line.start, _line.end, point, pointOnLine);
|
||||
const isInside = point.distanceTo(pointOnLine) < _lineWidth * 0.5;
|
||||
if (isInside) {
|
||||
intersects.push({
|
||||
point,
|
||||
pointOnLine,
|
||||
distance: _ray.origin.distanceTo(point),
|
||||
object: lineSegments,
|
||||
face: null,
|
||||
faceIndex: i,
|
||||
uv: null,
|
||||
[UV1]: null
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
function raycastScreenSpace(lineSegments, camera, intersects) {
|
||||
const projectionMatrix = camera.projectionMatrix;
|
||||
const material = lineSegments.material;
|
||||
const resolution = material.resolution;
|
||||
const matrixWorld = lineSegments.matrixWorld;
|
||||
const geometry = lineSegments.geometry;
|
||||
const instanceStart = geometry.attributes.instanceStart;
|
||||
const instanceEnd = geometry.attributes.instanceEnd;
|
||||
const segmentCount = Math.min(geometry.instanceCount, instanceStart.count);
|
||||
const near = -camera.near;
|
||||
_ray.at(1, _ssOrigin);
|
||||
_ssOrigin.w = 1;
|
||||
_ssOrigin.applyMatrix4(camera.matrixWorldInverse);
|
||||
_ssOrigin.applyMatrix4(projectionMatrix);
|
||||
_ssOrigin.multiplyScalar(1 / _ssOrigin.w);
|
||||
_ssOrigin.x *= resolution.x / 2;
|
||||
_ssOrigin.y *= resolution.y / 2;
|
||||
_ssOrigin.z = 0;
|
||||
_ssOrigin3.copy(_ssOrigin);
|
||||
_mvMatrix.multiplyMatrices(camera.matrixWorldInverse, matrixWorld);
|
||||
for (let i = 0, l = segmentCount; i < l; i++) {
|
||||
_start4.fromBufferAttribute(instanceStart, i);
|
||||
_end4.fromBufferAttribute(instanceEnd, i);
|
||||
_start4.w = 1;
|
||||
_end4.w = 1;
|
||||
_start4.applyMatrix4(_mvMatrix);
|
||||
_end4.applyMatrix4(_mvMatrix);
|
||||
const isBehindCameraNear = _start4.z > near && _end4.z > near;
|
||||
if (isBehindCameraNear) {
|
||||
continue;
|
||||
}
|
||||
if (_start4.z > near) {
|
||||
const deltaDist = _start4.z - _end4.z;
|
||||
const t = (_start4.z - near) / deltaDist;
|
||||
_start4.lerp(_end4, t);
|
||||
} else if (_end4.z > near) {
|
||||
const deltaDist = _end4.z - _start4.z;
|
||||
const t = (_end4.z - near) / deltaDist;
|
||||
_end4.lerp(_start4, t);
|
||||
}
|
||||
_start4.applyMatrix4(projectionMatrix);
|
||||
_end4.applyMatrix4(projectionMatrix);
|
||||
_start4.multiplyScalar(1 / _start4.w);
|
||||
_end4.multiplyScalar(1 / _end4.w);
|
||||
_start4.x *= resolution.x / 2;
|
||||
_start4.y *= resolution.y / 2;
|
||||
_end4.x *= resolution.x / 2;
|
||||
_end4.y *= resolution.y / 2;
|
||||
_line.start.copy(_start4);
|
||||
_line.start.z = 0;
|
||||
_line.end.copy(_end4);
|
||||
_line.end.z = 0;
|
||||
const param = _line.closestPointToPointParameter(_ssOrigin3, true);
|
||||
_line.at(param, _closestPoint);
|
||||
const zPos = MathUtils.lerp(_start4.z, _end4.z, param);
|
||||
const isInClipSpace = zPos >= -1 && zPos <= 1;
|
||||
const isInside = _ssOrigin3.distanceTo(_closestPoint) < _lineWidth * 0.5;
|
||||
if (isInClipSpace && isInside) {
|
||||
_line.start.fromBufferAttribute(instanceStart, i);
|
||||
_line.end.fromBufferAttribute(instanceEnd, i);
|
||||
_line.start.applyMatrix4(matrixWorld);
|
||||
_line.end.applyMatrix4(matrixWorld);
|
||||
const pointOnLine = new Vector3();
|
||||
const point = new Vector3();
|
||||
_ray.distanceSqToSegment(_line.start, _line.end, point, pointOnLine);
|
||||
intersects.push({
|
||||
point,
|
||||
pointOnLine,
|
||||
distance: _ray.origin.distanceTo(point),
|
||||
object: lineSegments,
|
||||
face: null,
|
||||
faceIndex: i,
|
||||
uv: null,
|
||||
[UV1]: null
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
class LineSegments2 extends Mesh {
|
||||
constructor(geometry = new LineSegmentsGeometry(), material = new LineMaterial({ color: Math.random() * 16777215 })) {
|
||||
super(geometry, material);
|
||||
this.isLineSegments2 = true;
|
||||
this.type = "LineSegments2";
|
||||
}
|
||||
// for backwards-compatibility, but could be a method of LineSegmentsGeometry...
|
||||
computeLineDistances() {
|
||||
const geometry = this.geometry;
|
||||
const instanceStart = geometry.attributes.instanceStart;
|
||||
const instanceEnd = geometry.attributes.instanceEnd;
|
||||
const lineDistances = new Float32Array(2 * instanceStart.count);
|
||||
for (let i = 0, j = 0, l = instanceStart.count; i < l; i++, j += 2) {
|
||||
_start.fromBufferAttribute(instanceStart, i);
|
||||
_end.fromBufferAttribute(instanceEnd, i);
|
||||
lineDistances[j] = j === 0 ? 0 : lineDistances[j - 1];
|
||||
lineDistances[j + 1] = lineDistances[j] + _start.distanceTo(_end);
|
||||
}
|
||||
const instanceDistanceBuffer = new InstancedInterleavedBuffer(lineDistances, 2, 1);
|
||||
geometry.setAttribute("instanceDistanceStart", new InterleavedBufferAttribute(instanceDistanceBuffer, 1, 0));
|
||||
geometry.setAttribute("instanceDistanceEnd", new InterleavedBufferAttribute(instanceDistanceBuffer, 1, 1));
|
||||
return this;
|
||||
}
|
||||
raycast(raycaster, intersects) {
|
||||
const worldUnits = this.material.worldUnits;
|
||||
const camera = raycaster.camera;
|
||||
if (camera === null && !worldUnits) {
|
||||
console.error(
|
||||
'LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.'
|
||||
);
|
||||
}
|
||||
const threshold = raycaster.params.Line2 !== void 0 ? raycaster.params.Line2.threshold || 0 : 0;
|
||||
_ray = raycaster.ray;
|
||||
const matrixWorld = this.matrixWorld;
|
||||
const geometry = this.geometry;
|
||||
const material = this.material;
|
||||
_lineWidth = material.linewidth + threshold;
|
||||
if (geometry.boundingSphere === null) {
|
||||
geometry.computeBoundingSphere();
|
||||
}
|
||||
_sphere.copy(geometry.boundingSphere).applyMatrix4(matrixWorld);
|
||||
let sphereMargin;
|
||||
if (worldUnits) {
|
||||
sphereMargin = _lineWidth * 0.5;
|
||||
} else {
|
||||
const distanceToSphere = Math.max(camera.near, _sphere.distanceToPoint(_ray.origin));
|
||||
sphereMargin = getWorldSpaceHalfWidth(camera, distanceToSphere, material.resolution);
|
||||
}
|
||||
_sphere.radius += sphereMargin;
|
||||
if (_ray.intersectsSphere(_sphere) === false) {
|
||||
return;
|
||||
}
|
||||
if (geometry.boundingBox === null) {
|
||||
geometry.computeBoundingBox();
|
||||
}
|
||||
_box.copy(geometry.boundingBox).applyMatrix4(matrixWorld);
|
||||
let boxMargin;
|
||||
if (worldUnits) {
|
||||
boxMargin = _lineWidth * 0.5;
|
||||
} else {
|
||||
const distanceToBox = Math.max(camera.near, _box.distanceToPoint(_ray.origin));
|
||||
boxMargin = getWorldSpaceHalfWidth(camera, distanceToBox, material.resolution);
|
||||
}
|
||||
_box.expandByScalar(boxMargin);
|
||||
if (_ray.intersectsBox(_box) === false) {
|
||||
return;
|
||||
}
|
||||
if (worldUnits) {
|
||||
raycastWorldUnits(this, intersects);
|
||||
} else {
|
||||
raycastScreenSpace(this, camera, intersects);
|
||||
}
|
||||
}
|
||||
onBeforeRender(renderer) {
|
||||
const uniforms = this.material.uniforms;
|
||||
if (uniforms && uniforms.resolution) {
|
||||
renderer.getViewport(_viewport);
|
||||
this.material.uniforms.resolution.value.set(_viewport.z, _viewport.w);
|
||||
}
|
||||
}
|
||||
}
|
||||
export {
|
||||
LineSegments2
|
||||
};
|
||||
//# sourceMappingURL=LineSegments2.js.map
|
||||
1
node_modules/three-stdlib/lines/LineSegments2.js.map
generated
vendored
Normal file
1
node_modules/three-stdlib/lines/LineSegments2.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
125
node_modules/three-stdlib/lines/LineSegmentsGeometry.cjs
generated
vendored
Normal file
125
node_modules/three-stdlib/lines/LineSegmentsGeometry.cjs
generated
vendored
Normal file
@@ -0,0 +1,125 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
||||
const THREE = require("three");
|
||||
const _box = /* @__PURE__ */ new THREE.Box3();
|
||||
const _vector = /* @__PURE__ */ new THREE.Vector3();
|
||||
class LineSegmentsGeometry extends THREE.InstancedBufferGeometry {
|
||||
constructor() {
|
||||
super();
|
||||
this.isLineSegmentsGeometry = true;
|
||||
this.type = "LineSegmentsGeometry";
|
||||
const positions = [-1, 2, 0, 1, 2, 0, -1, 1, 0, 1, 1, 0, -1, 0, 0, 1, 0, 0, -1, -1, 0, 1, -1, 0];
|
||||
const uvs = [-1, 2, 1, 2, -1, 1, 1, 1, -1, -1, 1, -1, -1, -2, 1, -2];
|
||||
const index = [0, 2, 1, 2, 3, 1, 2, 4, 3, 4, 5, 3, 4, 6, 5, 6, 7, 5];
|
||||
this.setIndex(index);
|
||||
this.setAttribute("position", new THREE.Float32BufferAttribute(positions, 3));
|
||||
this.setAttribute("uv", new THREE.Float32BufferAttribute(uvs, 2));
|
||||
}
|
||||
applyMatrix4(matrix) {
|
||||
const start = this.attributes.instanceStart;
|
||||
const end = this.attributes.instanceEnd;
|
||||
if (start !== void 0) {
|
||||
start.applyMatrix4(matrix);
|
||||
end.applyMatrix4(matrix);
|
||||
start.needsUpdate = true;
|
||||
}
|
||||
if (this.boundingBox !== null) {
|
||||
this.computeBoundingBox();
|
||||
}
|
||||
if (this.boundingSphere !== null) {
|
||||
this.computeBoundingSphere();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
setPositions(array) {
|
||||
let lineSegments;
|
||||
if (array instanceof Float32Array) {
|
||||
lineSegments = array;
|
||||
} else if (Array.isArray(array)) {
|
||||
lineSegments = new Float32Array(array);
|
||||
}
|
||||
const instanceBuffer = new THREE.InstancedInterleavedBuffer(lineSegments, 6, 1);
|
||||
this.setAttribute("instanceStart", new THREE.InterleavedBufferAttribute(instanceBuffer, 3, 0));
|
||||
this.setAttribute("instanceEnd", new THREE.InterleavedBufferAttribute(instanceBuffer, 3, 3));
|
||||
this.computeBoundingBox();
|
||||
this.computeBoundingSphere();
|
||||
return this;
|
||||
}
|
||||
setColors(array, itemSize = 3) {
|
||||
let colors;
|
||||
if (array instanceof Float32Array) {
|
||||
colors = array;
|
||||
} else if (Array.isArray(array)) {
|
||||
colors = new Float32Array(array);
|
||||
}
|
||||
const instanceColorBuffer = new THREE.InstancedInterleavedBuffer(colors, itemSize * 2, 1);
|
||||
this.setAttribute("instanceColorStart", new THREE.InterleavedBufferAttribute(instanceColorBuffer, itemSize, 0));
|
||||
this.setAttribute("instanceColorEnd", new THREE.InterleavedBufferAttribute(instanceColorBuffer, itemSize, itemSize));
|
||||
return this;
|
||||
}
|
||||
fromWireframeGeometry(geometry) {
|
||||
this.setPositions(geometry.attributes.position.array);
|
||||
return this;
|
||||
}
|
||||
fromEdgesGeometry(geometry) {
|
||||
this.setPositions(geometry.attributes.position.array);
|
||||
return this;
|
||||
}
|
||||
fromMesh(mesh) {
|
||||
this.fromWireframeGeometry(new THREE.WireframeGeometry(mesh.geometry));
|
||||
return this;
|
||||
}
|
||||
fromLineSegments(lineSegments) {
|
||||
const geometry = lineSegments.geometry;
|
||||
this.setPositions(geometry.attributes.position.array);
|
||||
return this;
|
||||
}
|
||||
computeBoundingBox() {
|
||||
if (this.boundingBox === null) {
|
||||
this.boundingBox = new THREE.Box3();
|
||||
}
|
||||
const start = this.attributes.instanceStart;
|
||||
const end = this.attributes.instanceEnd;
|
||||
if (start !== void 0 && end !== void 0) {
|
||||
this.boundingBox.setFromBufferAttribute(start);
|
||||
_box.setFromBufferAttribute(end);
|
||||
this.boundingBox.union(_box);
|
||||
}
|
||||
}
|
||||
computeBoundingSphere() {
|
||||
if (this.boundingSphere === null) {
|
||||
this.boundingSphere = new THREE.Sphere();
|
||||
}
|
||||
if (this.boundingBox === null) {
|
||||
this.computeBoundingBox();
|
||||
}
|
||||
const start = this.attributes.instanceStart;
|
||||
const end = this.attributes.instanceEnd;
|
||||
if (start !== void 0 && end !== void 0) {
|
||||
const center = this.boundingSphere.center;
|
||||
this.boundingBox.getCenter(center);
|
||||
let maxRadiusSq = 0;
|
||||
for (let i = 0, il = start.count; i < il; i++) {
|
||||
_vector.fromBufferAttribute(start, i);
|
||||
maxRadiusSq = Math.max(maxRadiusSq, center.distanceToSquared(_vector));
|
||||
_vector.fromBufferAttribute(end, i);
|
||||
maxRadiusSq = Math.max(maxRadiusSq, center.distanceToSquared(_vector));
|
||||
}
|
||||
this.boundingSphere.radius = Math.sqrt(maxRadiusSq);
|
||||
if (isNaN(this.boundingSphere.radius)) {
|
||||
console.error(
|
||||
"THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",
|
||||
this
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
toJSON() {
|
||||
}
|
||||
applyMatrix(matrix) {
|
||||
console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4().");
|
||||
return this.applyMatrix4(matrix);
|
||||
}
|
||||
}
|
||||
exports.LineSegmentsGeometry = LineSegmentsGeometry;
|
||||
//# sourceMappingURL=LineSegmentsGeometry.cjs.map
|
||||
1
node_modules/three-stdlib/lines/LineSegmentsGeometry.cjs.map
generated
vendored
Normal file
1
node_modules/three-stdlib/lines/LineSegmentsGeometry.cjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
16
node_modules/three-stdlib/lines/LineSegmentsGeometry.d.ts
generated
vendored
Normal file
16
node_modules/three-stdlib/lines/LineSegmentsGeometry.d.ts
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
import { EdgesGeometry, InstancedBufferGeometry, LineSegments, Matrix4, Mesh, WireframeGeometry } from 'three'
|
||||
|
||||
export class LineSegmentsGeometry extends InstancedBufferGeometry {
|
||||
constructor()
|
||||
readonly isLineSegmentsGeometry: true
|
||||
|
||||
applyMatrix4(matrix: Matrix4): this
|
||||
computeBoundingBox(): void
|
||||
computeBoundingSphere(): void
|
||||
fromEdgesGeometry(geometry: EdgesGeometry): this
|
||||
fromLineSegments(lineSegments: LineSegments): this
|
||||
fromMesh(mesh: Mesh): this
|
||||
fromWireframeGeometry(geometry: WireframeGeometry): this
|
||||
setColors(array: number[] | Float32Array, itemSize?: 3 | 4): this
|
||||
setPositions(array: number[] | Float32Array): this
|
||||
}
|
||||
125
node_modules/three-stdlib/lines/LineSegmentsGeometry.js
generated
vendored
Normal file
125
node_modules/three-stdlib/lines/LineSegmentsGeometry.js
generated
vendored
Normal file
@@ -0,0 +1,125 @@
|
||||
import { InstancedBufferGeometry, Float32BufferAttribute, InstancedInterleavedBuffer, InterleavedBufferAttribute, WireframeGeometry, Box3, Sphere, Vector3 } from "three";
|
||||
const _box = /* @__PURE__ */ new Box3();
|
||||
const _vector = /* @__PURE__ */ new Vector3();
|
||||
class LineSegmentsGeometry extends InstancedBufferGeometry {
|
||||
constructor() {
|
||||
super();
|
||||
this.isLineSegmentsGeometry = true;
|
||||
this.type = "LineSegmentsGeometry";
|
||||
const positions = [-1, 2, 0, 1, 2, 0, -1, 1, 0, 1, 1, 0, -1, 0, 0, 1, 0, 0, -1, -1, 0, 1, -1, 0];
|
||||
const uvs = [-1, 2, 1, 2, -1, 1, 1, 1, -1, -1, 1, -1, -1, -2, 1, -2];
|
||||
const index = [0, 2, 1, 2, 3, 1, 2, 4, 3, 4, 5, 3, 4, 6, 5, 6, 7, 5];
|
||||
this.setIndex(index);
|
||||
this.setAttribute("position", new Float32BufferAttribute(positions, 3));
|
||||
this.setAttribute("uv", new Float32BufferAttribute(uvs, 2));
|
||||
}
|
||||
applyMatrix4(matrix) {
|
||||
const start = this.attributes.instanceStart;
|
||||
const end = this.attributes.instanceEnd;
|
||||
if (start !== void 0) {
|
||||
start.applyMatrix4(matrix);
|
||||
end.applyMatrix4(matrix);
|
||||
start.needsUpdate = true;
|
||||
}
|
||||
if (this.boundingBox !== null) {
|
||||
this.computeBoundingBox();
|
||||
}
|
||||
if (this.boundingSphere !== null) {
|
||||
this.computeBoundingSphere();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
setPositions(array) {
|
||||
let lineSegments;
|
||||
if (array instanceof Float32Array) {
|
||||
lineSegments = array;
|
||||
} else if (Array.isArray(array)) {
|
||||
lineSegments = new Float32Array(array);
|
||||
}
|
||||
const instanceBuffer = new InstancedInterleavedBuffer(lineSegments, 6, 1);
|
||||
this.setAttribute("instanceStart", new InterleavedBufferAttribute(instanceBuffer, 3, 0));
|
||||
this.setAttribute("instanceEnd", new InterleavedBufferAttribute(instanceBuffer, 3, 3));
|
||||
this.computeBoundingBox();
|
||||
this.computeBoundingSphere();
|
||||
return this;
|
||||
}
|
||||
setColors(array, itemSize = 3) {
|
||||
let colors;
|
||||
if (array instanceof Float32Array) {
|
||||
colors = array;
|
||||
} else if (Array.isArray(array)) {
|
||||
colors = new Float32Array(array);
|
||||
}
|
||||
const instanceColorBuffer = new InstancedInterleavedBuffer(colors, itemSize * 2, 1);
|
||||
this.setAttribute("instanceColorStart", new InterleavedBufferAttribute(instanceColorBuffer, itemSize, 0));
|
||||
this.setAttribute("instanceColorEnd", new InterleavedBufferAttribute(instanceColorBuffer, itemSize, itemSize));
|
||||
return this;
|
||||
}
|
||||
fromWireframeGeometry(geometry) {
|
||||
this.setPositions(geometry.attributes.position.array);
|
||||
return this;
|
||||
}
|
||||
fromEdgesGeometry(geometry) {
|
||||
this.setPositions(geometry.attributes.position.array);
|
||||
return this;
|
||||
}
|
||||
fromMesh(mesh) {
|
||||
this.fromWireframeGeometry(new WireframeGeometry(mesh.geometry));
|
||||
return this;
|
||||
}
|
||||
fromLineSegments(lineSegments) {
|
||||
const geometry = lineSegments.geometry;
|
||||
this.setPositions(geometry.attributes.position.array);
|
||||
return this;
|
||||
}
|
||||
computeBoundingBox() {
|
||||
if (this.boundingBox === null) {
|
||||
this.boundingBox = new Box3();
|
||||
}
|
||||
const start = this.attributes.instanceStart;
|
||||
const end = this.attributes.instanceEnd;
|
||||
if (start !== void 0 && end !== void 0) {
|
||||
this.boundingBox.setFromBufferAttribute(start);
|
||||
_box.setFromBufferAttribute(end);
|
||||
this.boundingBox.union(_box);
|
||||
}
|
||||
}
|
||||
computeBoundingSphere() {
|
||||
if (this.boundingSphere === null) {
|
||||
this.boundingSphere = new Sphere();
|
||||
}
|
||||
if (this.boundingBox === null) {
|
||||
this.computeBoundingBox();
|
||||
}
|
||||
const start = this.attributes.instanceStart;
|
||||
const end = this.attributes.instanceEnd;
|
||||
if (start !== void 0 && end !== void 0) {
|
||||
const center = this.boundingSphere.center;
|
||||
this.boundingBox.getCenter(center);
|
||||
let maxRadiusSq = 0;
|
||||
for (let i = 0, il = start.count; i < il; i++) {
|
||||
_vector.fromBufferAttribute(start, i);
|
||||
maxRadiusSq = Math.max(maxRadiusSq, center.distanceToSquared(_vector));
|
||||
_vector.fromBufferAttribute(end, i);
|
||||
maxRadiusSq = Math.max(maxRadiusSq, center.distanceToSquared(_vector));
|
||||
}
|
||||
this.boundingSphere.radius = Math.sqrt(maxRadiusSq);
|
||||
if (isNaN(this.boundingSphere.radius)) {
|
||||
console.error(
|
||||
"THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",
|
||||
this
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
toJSON() {
|
||||
}
|
||||
applyMatrix(matrix) {
|
||||
console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4().");
|
||||
return this.applyMatrix4(matrix);
|
||||
}
|
||||
}
|
||||
export {
|
||||
LineSegmentsGeometry
|
||||
};
|
||||
//# sourceMappingURL=LineSegmentsGeometry.js.map
|
||||
1
node_modules/three-stdlib/lines/LineSegmentsGeometry.js.map
generated
vendored
Normal file
1
node_modules/three-stdlib/lines/LineSegmentsGeometry.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
41
node_modules/three-stdlib/lines/Wireframe.cjs
generated
vendored
Normal file
41
node_modules/three-stdlib/lines/Wireframe.cjs
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
||||
const THREE = require("three");
|
||||
const LineSegmentsGeometry = require("./LineSegmentsGeometry.cjs");
|
||||
const LineMaterial = require("./LineMaterial.cjs");
|
||||
const _start = /* @__PURE__ */ new THREE.Vector3();
|
||||
const _end = /* @__PURE__ */ new THREE.Vector3();
|
||||
const _viewport = /* @__PURE__ */ new THREE.Vector4();
|
||||
class Wireframe extends THREE.Mesh {
|
||||
constructor(geometry = new LineSegmentsGeometry.LineSegmentsGeometry(), material = new LineMaterial.LineMaterial({ color: Math.random() * 16777215 })) {
|
||||
super(geometry, material);
|
||||
this.isWireframe = true;
|
||||
this.type = "Wireframe";
|
||||
}
|
||||
// for backwards-compatibility, but could be a method of LineSegmentsGeometry...
|
||||
computeLineDistances() {
|
||||
const geometry = this.geometry;
|
||||
const instanceStart = geometry.attributes.instanceStart;
|
||||
const instanceEnd = geometry.attributes.instanceEnd;
|
||||
const lineDistances = new Float32Array(2 * instanceStart.count);
|
||||
for (let i = 0, j = 0, l = instanceStart.count; i < l; i++, j += 2) {
|
||||
_start.fromBufferAttribute(instanceStart, i);
|
||||
_end.fromBufferAttribute(instanceEnd, i);
|
||||
lineDistances[j] = j === 0 ? 0 : lineDistances[j - 1];
|
||||
lineDistances[j + 1] = lineDistances[j] + _start.distanceTo(_end);
|
||||
}
|
||||
const instanceDistanceBuffer = new THREE.InstancedInterleavedBuffer(lineDistances, 2, 1);
|
||||
geometry.setAttribute("instanceDistanceStart", new THREE.InterleavedBufferAttribute(instanceDistanceBuffer, 1, 0));
|
||||
geometry.setAttribute("instanceDistanceEnd", new THREE.InterleavedBufferAttribute(instanceDistanceBuffer, 1, 1));
|
||||
return this;
|
||||
}
|
||||
onBeforeRender(renderer) {
|
||||
const uniforms = this.material.uniforms;
|
||||
if (uniforms && uniforms.resolution) {
|
||||
renderer.getViewport(_viewport);
|
||||
this.material.uniforms.resolution.value.set(_viewport.z, _viewport.w);
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.Wireframe = Wireframe;
|
||||
//# sourceMappingURL=Wireframe.cjs.map
|
||||
1
node_modules/three-stdlib/lines/Wireframe.cjs.map
generated
vendored
Normal file
1
node_modules/three-stdlib/lines/Wireframe.cjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Wireframe.cjs","sources":["../../src/lines/Wireframe.js"],"sourcesContent":["import { InstancedInterleavedBuffer, InterleavedBufferAttribute, Mesh, Vector3, Vector4 } from 'three'\nimport { LineSegmentsGeometry } from '../lines/LineSegmentsGeometry'\nimport { LineMaterial } from '../lines/LineMaterial'\n\nconst _start = /* @__PURE__ */ new Vector3()\nconst _end = /* @__PURE__ */ new Vector3()\nconst _viewport = /* @__PURE__ */ new Vector4()\n\nclass Wireframe extends Mesh {\n constructor(geometry = new LineSegmentsGeometry(), material = new LineMaterial({ color: Math.random() * 0xffffff })) {\n super(geometry, material)\n\n this.isWireframe = true\n\n this.type = 'Wireframe'\n }\n\n // for backwards-compatibility, but could be a method of LineSegmentsGeometry...\n\n computeLineDistances() {\n const geometry = this.geometry\n\n const instanceStart = geometry.attributes.instanceStart\n const instanceEnd = geometry.attributes.instanceEnd\n const lineDistances = new Float32Array(2 * instanceStart.count)\n\n for (let i = 0, j = 0, l = instanceStart.count; i < l; i++, j += 2) {\n _start.fromBufferAttribute(instanceStart, i)\n _end.fromBufferAttribute(instanceEnd, i)\n\n lineDistances[j] = j === 0 ? 0 : lineDistances[j - 1]\n lineDistances[j + 1] = lineDistances[j] + _start.distanceTo(_end)\n }\n\n const instanceDistanceBuffer = new InstancedInterleavedBuffer(lineDistances, 2, 1) // d0, d1\n\n geometry.setAttribute('instanceDistanceStart', new InterleavedBufferAttribute(instanceDistanceBuffer, 1, 0)) // d0\n geometry.setAttribute('instanceDistanceEnd', new InterleavedBufferAttribute(instanceDistanceBuffer, 1, 1)) // d1\n\n return this\n }\n\n onBeforeRender(renderer) {\n const uniforms = this.material.uniforms\n\n if (uniforms && uniforms.resolution) {\n renderer.getViewport(_viewport)\n this.material.uniforms.resolution.value.set(_viewport.z, _viewport.w)\n }\n }\n}\n\nexport { Wireframe }\n"],"names":["Vector3","Vector4","Mesh","LineSegmentsGeometry","LineMaterial","InstancedInterleavedBuffer","InterleavedBufferAttribute"],"mappings":";;;;;AAIA,MAAM,SAAyB,oBAAIA,MAAAA,QAAS;AAC5C,MAAM,OAAuB,oBAAIA,MAAAA,QAAS;AAC1C,MAAM,YAA4B,oBAAIC,MAAAA,QAAS;AAE/C,MAAM,kBAAkBC,MAAAA,KAAK;AAAA,EAC3B,YAAY,WAAW,IAAIC,0CAAsB,GAAE,WAAW,IAAIC,aAAAA,aAAa,EAAE,OAAO,KAAK,WAAW,SAAU,CAAA,GAAG;AACnH,UAAM,UAAU,QAAQ;AAExB,SAAK,cAAc;AAEnB,SAAK,OAAO;AAAA,EACb;AAAA;AAAA,EAID,uBAAuB;AACrB,UAAM,WAAW,KAAK;AAEtB,UAAM,gBAAgB,SAAS,WAAW;AAC1C,UAAM,cAAc,SAAS,WAAW;AACxC,UAAM,gBAAgB,IAAI,aAAa,IAAI,cAAc,KAAK;AAE9D,aAAS,IAAI,GAAG,IAAI,GAAG,IAAI,cAAc,OAAO,IAAI,GAAG,KAAK,KAAK,GAAG;AAClE,aAAO,oBAAoB,eAAe,CAAC;AAC3C,WAAK,oBAAoB,aAAa,CAAC;AAEvC,oBAAc,CAAC,IAAI,MAAM,IAAI,IAAI,cAAc,IAAI,CAAC;AACpD,oBAAc,IAAI,CAAC,IAAI,cAAc,CAAC,IAAI,OAAO,WAAW,IAAI;AAAA,IACjE;AAED,UAAM,yBAAyB,IAAIC,MAAAA,2BAA2B,eAAe,GAAG,CAAC;AAEjF,aAAS,aAAa,yBAAyB,IAAIC,MAA0B,2BAAC,wBAAwB,GAAG,CAAC,CAAC;AAC3G,aAAS,aAAa,uBAAuB,IAAIA,MAA0B,2BAAC,wBAAwB,GAAG,CAAC,CAAC;AAEzG,WAAO;AAAA,EACR;AAAA,EAED,eAAe,UAAU;AACvB,UAAM,WAAW,KAAK,SAAS;AAE/B,QAAI,YAAY,SAAS,YAAY;AACnC,eAAS,YAAY,SAAS;AAC9B,WAAK,SAAS,SAAS,WAAW,MAAM,IAAI,UAAU,GAAG,UAAU,CAAC;AAAA,IACrE;AAAA,EACF;AACH;;"}
|
||||
11
node_modules/three-stdlib/lines/Wireframe.d.ts
generated
vendored
Normal file
11
node_modules/three-stdlib/lines/Wireframe.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import { Mesh } from 'three'
|
||||
|
||||
import { LineMaterial } from './LineMaterial'
|
||||
import { LineSegmentsGeometry } from './LineSegmentsGeometry'
|
||||
|
||||
export class Wireframe extends Mesh {
|
||||
constructor(geometry?: LineSegmentsGeometry, material?: LineMaterial)
|
||||
readonly isWireframe: true
|
||||
|
||||
computeLineDistances(): this
|
||||
}
|
||||
41
node_modules/three-stdlib/lines/Wireframe.js
generated
vendored
Normal file
41
node_modules/three-stdlib/lines/Wireframe.js
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
import { Mesh, InstancedInterleavedBuffer, InterleavedBufferAttribute, Vector3, Vector4 } from "three";
|
||||
import { LineSegmentsGeometry } from "./LineSegmentsGeometry.js";
|
||||
import { LineMaterial } from "./LineMaterial.js";
|
||||
const _start = /* @__PURE__ */ new Vector3();
|
||||
const _end = /* @__PURE__ */ new Vector3();
|
||||
const _viewport = /* @__PURE__ */ new Vector4();
|
||||
class Wireframe extends Mesh {
|
||||
constructor(geometry = new LineSegmentsGeometry(), material = new LineMaterial({ color: Math.random() * 16777215 })) {
|
||||
super(geometry, material);
|
||||
this.isWireframe = true;
|
||||
this.type = "Wireframe";
|
||||
}
|
||||
// for backwards-compatibility, but could be a method of LineSegmentsGeometry...
|
||||
computeLineDistances() {
|
||||
const geometry = this.geometry;
|
||||
const instanceStart = geometry.attributes.instanceStart;
|
||||
const instanceEnd = geometry.attributes.instanceEnd;
|
||||
const lineDistances = new Float32Array(2 * instanceStart.count);
|
||||
for (let i = 0, j = 0, l = instanceStart.count; i < l; i++, j += 2) {
|
||||
_start.fromBufferAttribute(instanceStart, i);
|
||||
_end.fromBufferAttribute(instanceEnd, i);
|
||||
lineDistances[j] = j === 0 ? 0 : lineDistances[j - 1];
|
||||
lineDistances[j + 1] = lineDistances[j] + _start.distanceTo(_end);
|
||||
}
|
||||
const instanceDistanceBuffer = new InstancedInterleavedBuffer(lineDistances, 2, 1);
|
||||
geometry.setAttribute("instanceDistanceStart", new InterleavedBufferAttribute(instanceDistanceBuffer, 1, 0));
|
||||
geometry.setAttribute("instanceDistanceEnd", new InterleavedBufferAttribute(instanceDistanceBuffer, 1, 1));
|
||||
return this;
|
||||
}
|
||||
onBeforeRender(renderer) {
|
||||
const uniforms = this.material.uniforms;
|
||||
if (uniforms && uniforms.resolution) {
|
||||
renderer.getViewport(_viewport);
|
||||
this.material.uniforms.resolution.value.set(_viewport.z, _viewport.w);
|
||||
}
|
||||
}
|
||||
}
|
||||
export {
|
||||
Wireframe
|
||||
};
|
||||
//# sourceMappingURL=Wireframe.js.map
|
||||
1
node_modules/three-stdlib/lines/Wireframe.js.map
generated
vendored
Normal file
1
node_modules/three-stdlib/lines/Wireframe.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Wireframe.js","sources":["../../src/lines/Wireframe.js"],"sourcesContent":["import { InstancedInterleavedBuffer, InterleavedBufferAttribute, Mesh, Vector3, Vector4 } from 'three'\nimport { LineSegmentsGeometry } from '../lines/LineSegmentsGeometry'\nimport { LineMaterial } from '../lines/LineMaterial'\n\nconst _start = /* @__PURE__ */ new Vector3()\nconst _end = /* @__PURE__ */ new Vector3()\nconst _viewport = /* @__PURE__ */ new Vector4()\n\nclass Wireframe extends Mesh {\n constructor(geometry = new LineSegmentsGeometry(), material = new LineMaterial({ color: Math.random() * 0xffffff })) {\n super(geometry, material)\n\n this.isWireframe = true\n\n this.type = 'Wireframe'\n }\n\n // for backwards-compatibility, but could be a method of LineSegmentsGeometry...\n\n computeLineDistances() {\n const geometry = this.geometry\n\n const instanceStart = geometry.attributes.instanceStart\n const instanceEnd = geometry.attributes.instanceEnd\n const lineDistances = new Float32Array(2 * instanceStart.count)\n\n for (let i = 0, j = 0, l = instanceStart.count; i < l; i++, j += 2) {\n _start.fromBufferAttribute(instanceStart, i)\n _end.fromBufferAttribute(instanceEnd, i)\n\n lineDistances[j] = j === 0 ? 0 : lineDistances[j - 1]\n lineDistances[j + 1] = lineDistances[j] + _start.distanceTo(_end)\n }\n\n const instanceDistanceBuffer = new InstancedInterleavedBuffer(lineDistances, 2, 1) // d0, d1\n\n geometry.setAttribute('instanceDistanceStart', new InterleavedBufferAttribute(instanceDistanceBuffer, 1, 0)) // d0\n geometry.setAttribute('instanceDistanceEnd', new InterleavedBufferAttribute(instanceDistanceBuffer, 1, 1)) // d1\n\n return this\n }\n\n onBeforeRender(renderer) {\n const uniforms = this.material.uniforms\n\n if (uniforms && uniforms.resolution) {\n renderer.getViewport(_viewport)\n this.material.uniforms.resolution.value.set(_viewport.z, _viewport.w)\n }\n }\n}\n\nexport { Wireframe }\n"],"names":[],"mappings":";;;AAIA,MAAM,SAAyB,oBAAI,QAAS;AAC5C,MAAM,OAAuB,oBAAI,QAAS;AAC1C,MAAM,YAA4B,oBAAI,QAAS;AAE/C,MAAM,kBAAkB,KAAK;AAAA,EAC3B,YAAY,WAAW,IAAI,qBAAsB,GAAE,WAAW,IAAI,aAAa,EAAE,OAAO,KAAK,WAAW,SAAU,CAAA,GAAG;AACnH,UAAM,UAAU,QAAQ;AAExB,SAAK,cAAc;AAEnB,SAAK,OAAO;AAAA,EACb;AAAA;AAAA,EAID,uBAAuB;AACrB,UAAM,WAAW,KAAK;AAEtB,UAAM,gBAAgB,SAAS,WAAW;AAC1C,UAAM,cAAc,SAAS,WAAW;AACxC,UAAM,gBAAgB,IAAI,aAAa,IAAI,cAAc,KAAK;AAE9D,aAAS,IAAI,GAAG,IAAI,GAAG,IAAI,cAAc,OAAO,IAAI,GAAG,KAAK,KAAK,GAAG;AAClE,aAAO,oBAAoB,eAAe,CAAC;AAC3C,WAAK,oBAAoB,aAAa,CAAC;AAEvC,oBAAc,CAAC,IAAI,MAAM,IAAI,IAAI,cAAc,IAAI,CAAC;AACpD,oBAAc,IAAI,CAAC,IAAI,cAAc,CAAC,IAAI,OAAO,WAAW,IAAI;AAAA,IACjE;AAED,UAAM,yBAAyB,IAAI,2BAA2B,eAAe,GAAG,CAAC;AAEjF,aAAS,aAAa,yBAAyB,IAAI,2BAA2B,wBAAwB,GAAG,CAAC,CAAC;AAC3G,aAAS,aAAa,uBAAuB,IAAI,2BAA2B,wBAAwB,GAAG,CAAC,CAAC;AAEzG,WAAO;AAAA,EACR;AAAA,EAED,eAAe,UAAU;AACvB,UAAM,WAAW,KAAK,SAAS;AAE/B,QAAI,YAAY,SAAS,YAAY;AACnC,eAAS,YAAY,SAAS;AAC9B,WAAK,SAAS,SAAS,WAAW,MAAM,IAAI,UAAU,GAAG,UAAU,CAAC;AAAA,IACrE;AAAA,EACF;AACH;"}
|
||||
14
node_modules/three-stdlib/lines/WireframeGeometry2.cjs
generated
vendored
Normal file
14
node_modules/three-stdlib/lines/WireframeGeometry2.cjs
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
||||
const THREE = require("three");
|
||||
const LineSegmentsGeometry = require("./LineSegmentsGeometry.cjs");
|
||||
class WireframeGeometry2 extends LineSegmentsGeometry.LineSegmentsGeometry {
|
||||
constructor(geometry) {
|
||||
super();
|
||||
this.isWireframeGeometry2 = true;
|
||||
this.type = "WireframeGeometry2";
|
||||
this.fromWireframeGeometry(new THREE.WireframeGeometry(geometry));
|
||||
}
|
||||
}
|
||||
exports.WireframeGeometry2 = WireframeGeometry2;
|
||||
//# sourceMappingURL=WireframeGeometry2.cjs.map
|
||||
1
node_modules/three-stdlib/lines/WireframeGeometry2.cjs.map
generated
vendored
Normal file
1
node_modules/three-stdlib/lines/WireframeGeometry2.cjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"WireframeGeometry2.cjs","sources":["../../src/lines/WireframeGeometry2.js"],"sourcesContent":["import { WireframeGeometry } from 'three'\nimport { LineSegmentsGeometry } from '../lines/LineSegmentsGeometry'\n\nclass WireframeGeometry2 extends LineSegmentsGeometry {\n constructor(geometry) {\n super()\n\n this.isWireframeGeometry2 = true\n\n this.type = 'WireframeGeometry2'\n\n this.fromWireframeGeometry(new WireframeGeometry(geometry))\n\n // set colors, maybe\n }\n}\n\nexport { WireframeGeometry2 }\n"],"names":["LineSegmentsGeometry","WireframeGeometry"],"mappings":";;;;AAGA,MAAM,2BAA2BA,qBAAAA,qBAAqB;AAAA,EACpD,YAAY,UAAU;AACpB,UAAO;AAEP,SAAK,uBAAuB;AAE5B,SAAK,OAAO;AAEZ,SAAK,sBAAsB,IAAIC,MAAiB,kBAAC,QAAQ,CAAC;AAAA,EAG3D;AACH;;"}
|
||||
8
node_modules/three-stdlib/lines/WireframeGeometry2.d.ts
generated
vendored
Normal file
8
node_modules/three-stdlib/lines/WireframeGeometry2.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import { BufferGeometry } from 'three'
|
||||
|
||||
import { LineSegmentsGeometry } from './LineSegmentsGeometry'
|
||||
|
||||
export class WireframeGeometry2 extends LineSegmentsGeometry {
|
||||
constructor(geometry: BufferGeometry)
|
||||
readonly sWireframeGeometry2: boolean
|
||||
}
|
||||
14
node_modules/three-stdlib/lines/WireframeGeometry2.js
generated
vendored
Normal file
14
node_modules/three-stdlib/lines/WireframeGeometry2.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import { WireframeGeometry } from "three";
|
||||
import { LineSegmentsGeometry } from "./LineSegmentsGeometry.js";
|
||||
class WireframeGeometry2 extends LineSegmentsGeometry {
|
||||
constructor(geometry) {
|
||||
super();
|
||||
this.isWireframeGeometry2 = true;
|
||||
this.type = "WireframeGeometry2";
|
||||
this.fromWireframeGeometry(new WireframeGeometry(geometry));
|
||||
}
|
||||
}
|
||||
export {
|
||||
WireframeGeometry2
|
||||
};
|
||||
//# sourceMappingURL=WireframeGeometry2.js.map
|
||||
1
node_modules/three-stdlib/lines/WireframeGeometry2.js.map
generated
vendored
Normal file
1
node_modules/three-stdlib/lines/WireframeGeometry2.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"WireframeGeometry2.js","sources":["../../src/lines/WireframeGeometry2.js"],"sourcesContent":["import { WireframeGeometry } from 'three'\nimport { LineSegmentsGeometry } from '../lines/LineSegmentsGeometry'\n\nclass WireframeGeometry2 extends LineSegmentsGeometry {\n constructor(geometry) {\n super()\n\n this.isWireframeGeometry2 = true\n\n this.type = 'WireframeGeometry2'\n\n this.fromWireframeGeometry(new WireframeGeometry(geometry))\n\n // set colors, maybe\n }\n}\n\nexport { WireframeGeometry2 }\n"],"names":[],"mappings":";;AAGA,MAAM,2BAA2B,qBAAqB;AAAA,EACpD,YAAY,UAAU;AACpB,UAAO;AAEP,SAAK,uBAAuB;AAE5B,SAAK,OAAO;AAEZ,SAAK,sBAAsB,IAAI,kBAAkB,QAAQ,CAAC;AAAA,EAG3D;AACH;"}
|
||||
Reference in New Issue
Block a user