@realsee/dnalogel
Version:
45 lines (44 loc) • 1.39 kB
JavaScript
var m = Object.defineProperty;
var c = (o, t, e) => t in o ? m(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
var s = (o, t, e) => (c(o, typeof t != "symbol" ? t + "" : t, e), e);
import * as r from "three";
import { IObject3D as h } from "../../shared-utils/three/IObject3D.js";
import d from "../utils/generatePolygonGeometry.js";
import "earcut";
const p = new r.BufferGeometry();
class B extends h {
constructor(e) {
super();
s(this, "isPolygonMesh", !0);
s(this, "geometry", new r.BufferGeometry());
s(this, "isBlank", !0);
s(this, "points", []);
const n = new r.MeshBasicMaterial({
color: 4090367,
transparent: !0,
side: r.DoubleSide,
depthTest: !0,
opacity: 0.5
}), l = new r.MeshBasicMaterial({
color: 16777215,
transparent: !0,
side: r.DoubleSide,
depthTest: !1,
depthWrite: !1,
opacity: 0.3
}), i = new r.Mesh(this.geometry, n), a = new r.Mesh(this.geometry, l);
i.renderOrder = 1, a.renderOrder = 0, e && this.updatePoints(e), this.add(i, a);
}
/**
* @description: 按照新的端点来更新多边形的geometry
*/
updatePoints(e) {
this.points = e;
const n = d(e);
n ? (this.geometry.copy(n), this.isBlank = !1) : (this.geometry.copy(p), this.isBlank = !0);
}
}
export {
p as blankGeometry,
B as default
};