|
@@ -61,27 +61,13 @@ class base{
|
|
|
l
|
|
|
}
|
|
|
|
|
|
- createWireframe(e, lineWidth) {
|
|
|
- /* for (var t = new THREE.LineGeometry, i = [], n = 0; n < e.length; n++) {
|
|
|
- var o = e[n];
|
|
|
- i.push(o.x, o.y, o.z)
|
|
|
- }
|
|
|
- t.setPositions(i);
|
|
|
- var s = new THREE.LineMaterial({
|
|
|
- color: this.wireframeDefaultColor,
|
|
|
- linewidth: 1
|
|
|
- });
|
|
|
- s.resolution.set(160, 160);
|
|
|
- var r = new THREE.Line2(t,s);
|
|
|
- return r.componentId = this.componentId,
|
|
|
- r */
|
|
|
-
|
|
|
+ createWireframe(e ) {
|
|
|
let line = LineDraw.createFatLine(e,{
|
|
|
color: Colors.gray ,
|
|
|
- lineWidth ,
|
|
|
+ lineWidth : 2,
|
|
|
viewer: navCubeViewer,
|
|
|
depthTest:true, depthWrite:true,
|
|
|
- //transparent:true
|
|
|
+ transparent:true
|
|
|
});
|
|
|
line.renderOrder = 3;
|
|
|
return line
|
|
@@ -114,7 +100,7 @@ class base{
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
+/*
|
|
|
|
|
|
class Edge extends base{
|
|
|
constructor(t, i, n) {
|
|
@@ -206,7 +192,7 @@ class Edge extends base{
|
|
|
}
|
|
|
|
|
|
}
|
|
|
-
|
|
|
+ */
|
|
|
|
|
|
|
|
|
|
|
@@ -248,12 +234,12 @@ class Corner extends base{
|
|
|
e.push(a),
|
|
|
this.cornerVertices = e
|
|
|
this.mesh = this.createMesh([n, s, a])
|
|
|
- this.wireframeMesh = this.createWireframe([n, s, a, n], 2),
|
|
|
+ /* this.wireframeMesh = this.createWireframe([n, s, a, n], 2),
|
|
|
this.buildCornerFace()
|
|
|
- this.buildCornerWireframe()
|
|
|
+ this.buildCornerWireframe() */
|
|
|
}
|
|
|
|
|
|
- highlight() {
|
|
|
+ /* highlight() {
|
|
|
this.wireframeMesh.material.color.setHex(this.wireframeHighlightColor),
|
|
|
this.wireframeMesh.renderOrder = 100,
|
|
|
this.mesh.material.color.setHex(this.faceHighlightColor),
|
|
@@ -270,13 +256,13 @@ class Corner extends base{
|
|
|
this.mesh.material.color.setHex(this.faceDefaultColor),
|
|
|
this.transparent(this.cornerFace),
|
|
|
this.cornerWireframe.visible = !1
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
buildCornerFace() {
|
|
|
if (!this.cornerFace) {
|
|
|
var e = this.cornerVertices;
|
|
|
- e.push(e[1]),
|
|
|
- this.cornerFace = this.createMesh(e),
|
|
|
+ e.push(e[1])
|
|
|
+ this.cornerFace = this.createMesh(e)
|
|
|
this.transparent(this.cornerFace)
|
|
|
}
|
|
|
}
|
|
@@ -300,7 +286,7 @@ class Corner extends base{
|
|
|
this.cornerWireframe.visible = !1
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ */
|
|
|
|
|
|
}
|
|
|
|
|
@@ -354,16 +340,16 @@ class Face extends base{
|
|
|
}
|
|
|
for (var u = h.getCenter(new THREE.Vector3).normalize(), g = [], p = 0; p < e.length; p++) {
|
|
|
var m = e[p];
|
|
|
- g.push(m.clone().add(u))
|
|
|
+ g.push(m.clone()/* .add(u) */)
|
|
|
}
|
|
|
- this.highlightMesh = this.createMesh(g)
|
|
|
+ /* this.highlightMesh = this.createMesh(g)
|
|
|
this.highlightMesh.visible = !1
|
|
|
- this.highlightMesh.isHighlightMesh = !0
|
|
|
+ this.highlightMesh.isHighlightMesh = !0 */
|
|
|
g.push(g[0])
|
|
|
- this.wireframeMesh = this.createWireframe(g, 1)
|
|
|
+ this.wireframeMesh = this.createWireframe(g, 1)
|
|
|
}
|
|
|
|
|
|
- highlight() {
|
|
|
+ /* highlight() {
|
|
|
this.highlightMesh.visible = !0
|
|
|
this.highlightMesh.material.color.setHex(this.faceHighlightColor)
|
|
|
this.highlightMesh.material.transparent = !0
|
|
@@ -374,7 +360,7 @@ class Face extends base{
|
|
|
cancelHighlight() {
|
|
|
this.highlightMesh.visible = !1
|
|
|
//this.wireframeMesh.material.color.setHex(this.wireframeDefaultColor)
|
|
|
- }
|
|
|
+ } */
|
|
|
|
|
|
createTexturedMesh(e) {
|
|
|
for (var t = e.length - 2, i = new Uint32Array(3 * t), n = 0, o = 1; o <= t; o++)
|
|
@@ -434,7 +420,7 @@ class Face extends base{
|
|
|
this.mesh.componentId = this.componentId
|
|
|
}
|
|
|
|
|
|
- getHighlightMesh() {
|
|
|
+ /* getHighlightMesh() {
|
|
|
return this.highlightMesh
|
|
|
}
|
|
|
|
|
@@ -453,7 +439,7 @@ class Face extends base{
|
|
|
t.push(c)
|
|
|
}
|
|
|
return t
|
|
|
- }
|
|
|
+ } */
|
|
|
|
|
|
}
|
|
|
|
|
@@ -485,7 +471,7 @@ class NavigationCube{
|
|
|
"5764": "Back",
|
|
|
"1375": "Right",
|
|
|
"4620": "Left",
|
|
|
- 3: "RoofSouthEast",
|
|
|
+ /* 3: "RoofSouthEast",
|
|
|
2: "RoofSouthWest",
|
|
|
7: "RoofNorthEast",
|
|
|
6: "RoofNorthWest",
|
|
@@ -504,7 +490,7 @@ class NavigationCube{
|
|
|
13: "SouthEast",
|
|
|
20: "SouthWest",
|
|
|
57: "NorthEast",
|
|
|
- 64: "NorthWest"
|
|
|
+ 64: "NorthWest" */
|
|
|
}
|
|
|
this.vertices = [],
|
|
|
this.vertexIds = [],
|
|
@@ -527,13 +513,13 @@ class NavigationCube{
|
|
|
for (var t = 0; t < 8; t++)
|
|
|
this.vertexIds.push(t + "");
|
|
|
//12条边
|
|
|
- this.edgeIndices.push([0, 1], [1, 3], [3, 2], [2, 0]),
|
|
|
+ /* this.edgeIndices.push([0, 1], [1, 3], [3, 2], [2, 0]),
|
|
|
this.edgeIndices.push([0, 4], [1, 5], [2, 6], [3, 7]),
|
|
|
this.edgeIndices.push([4, 5], [5, 7], [7, 6], [6, 4]);
|
|
|
for (t = 0; t < 12; t++) {
|
|
|
var i = this.edgeIndices[t];
|
|
|
this.edgeIds.push(i[0] + "" + i[1])
|
|
|
- }
|
|
|
+ } */
|
|
|
|
|
|
//6个面,每个面2个三角形
|
|
|
this.faceIndices.push([0, 2, 3, 1]),
|
|
@@ -572,11 +558,11 @@ class NavigationCube{
|
|
|
, r = new THREE.TextureLoader;
|
|
|
r.setCrossOrigin("anonymous");
|
|
|
r.load(url, (tex)=> {
|
|
|
- var face = new Face(e,t[n], this.faceIds[n], tex);
|
|
|
+ var face = new Face(e,t[n], this.faceIds[n], tex);
|
|
|
this.componentList.push(face)
|
|
|
- let faceMesh = face.getMesh()
|
|
|
+ let faceMesh = face.getMesh()
|
|
|
this.scene.add(faceMesh)
|
|
|
- this.scene.add(face.getWireframe())
|
|
|
+ this.scene.add(face.getWireframe()) //每个面是八边形
|
|
|
/* this.scene.add(face.getHighlightMesh()) */
|
|
|
//6 == ++texturesLoaded && a.callback && a.callback()
|
|
|
|
|
@@ -613,31 +599,34 @@ class NavigationCube{
|
|
|
create(s)
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ buildCorners() {
|
|
|
+ for (var e = this.vertices, t = this.vertexIds, i = 0; i < 8; i++) {
|
|
|
+ var n = new Corner(e[i],t[i]);
|
|
|
+ this.componentList.push(n)
|
|
|
+ this.scene.add(n.getMesh()) //8个三角形
|
|
|
+ //this.scene.add(n.getWireframe())
|
|
|
+ //this.scene.add(n.getCornerFace())
|
|
|
+ //this.scene.add(n.getCornerWireframe())
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- buildEdges() {
|
|
|
+ /* buildEdges() {
|
|
|
for (var e = this.vertices, t = this.edgeIndices, i = this.edgeIds, n = 0; n < 12; n++) {
|
|
|
var o = new Edge(e,t[n],i[n]);
|
|
|
- this.componentList.push(o),
|
|
|
- this.scene.add(o.getMesh()),
|
|
|
- this.scene.add(o.getWireframe()),
|
|
|
- this.scene.add(o.getHighlightWireframeMesh())
|
|
|
+ this.componentList.push(o)
|
|
|
+ //this.scene.add(o.getMesh())
|
|
|
+ //this.scene.add(o.getWireframe())
|
|
|
+ //this.scene.add(o.getHighlightWireframeMesh())
|
|
|
}
|
|
|
- }
|
|
|
+ } */
|
|
|
|
|
|
- buildCorners() {
|
|
|
- for (var e = this.vertices, t = this.vertexIds, i = 0; i < 8; i++) {
|
|
|
- var n = new Corner(e[i],t[i]);
|
|
|
- this.componentList.push(n)
|
|
|
- this.scene.add(n.getMesh())
|
|
|
- this.scene.add(n.getWireframe()),
|
|
|
- this.scene.add(n.getCornerFace())
|
|
|
- this.scene.add(n.getCornerWireframe())
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
getComponent(e) {
|
|
|
for (var t = 0; t < this.componentList.length; t++) {
|
|
@@ -649,27 +638,6 @@ class NavigationCube{
|
|
|
}
|
|
|
|
|
|
|
|
|
- /*
|
|
|
- getMeshes() {
|
|
|
- for (var e = [], t = this.scene.children, i = 0; i < t.length; i++) {
|
|
|
- var n = t[i];
|
|
|
- "Mesh" === n.type && !0 !== n.isHighlightMesh && e.push(n)
|
|
|
- }
|
|
|
- return e
|
|
|
- }
|
|
|
-
|
|
|
- destroy() {
|
|
|
- this.scene = null,
|
|
|
- this.vertices = null,
|
|
|
- this.vertexIds = null,
|
|
|
- this.edgeIds = null,
|
|
|
- this.edgeIndices = null,
|
|
|
- this.faceIds = null,
|
|
|
- this.faceIndices = null,
|
|
|
- this.componentList = null,
|
|
|
- this.enumViewMode = null
|
|
|
- }
|
|
|
- , */
|
|
|
|
|
|
|
|
|
}
|
|
@@ -740,6 +708,7 @@ class NavCubeViewer extends ViewerBase{
|
|
|
splitScreen.splitStart(viewportProps)
|
|
|
})
|
|
|
|
|
|
+ //this.addEventListener('resize',(e)=>{console.log('resize',e)})
|
|
|
|
|
|
}
|
|
|
|