|
@@ -60818,7 +60818,7 @@
|
|
|
},
|
|
|
//WEBGL2: {
|
|
|
// isSupported: function(){
|
|
|
- // return gl instanceof WebGL2RenderingContext;
|
|
|
+ // return typeof WebGL2RenderingContext != 'undefined' && gl instanceof WebGL2RenderingContext;
|
|
|
// }
|
|
|
//},
|
|
|
precision: precision
|
|
@@ -66951,7 +66951,7 @@ void main()
|
|
|
}
|
|
|
|
|
|
// uniform blocks
|
|
|
- if(gl instanceof WebGL2RenderingContext){
|
|
|
+ if(typeof WebGL2RenderingContext != 'undefined' && gl instanceof WebGL2RenderingContext){
|
|
|
let numBlocks = gl.getProgramParameter(program, gl.ACTIVE_UNIFORM_BLOCKS);
|
|
|
|
|
|
for (let i = 0; i < numBlocks; i++) {
|
|
@@ -70509,7 +70509,7 @@ void main()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- return gl instanceof WebGL2RenderingContext || gl.getExtension('EXT_frag_depth'); //shader中的GL_EXT_frag_depth需要判断一下detectIOS吗。。
|
|
|
+ return (typeof WebGL2RenderingContext != 'undefined' && gl instanceof WebGL2RenderingContext) || gl.getExtension('EXT_frag_depth'); //shader中的GL_EXT_frag_depth需要判断一下detectIOS吗。。
|
|
|
}
|
|
|
};
|
|
|
|
|
@@ -75356,7 +75356,7 @@ void main()
|
|
|
const geo = new PlaneBufferGeometry(1,1);
|
|
|
class Sprite$2 extends Mesh{
|
|
|
|
|
|
- constructor(options){
|
|
|
+ constructor(options={}){
|
|
|
super(geo, options.mat || new DepthBasicMaterial(options));/* ({map:options.map, useDepth:options.useDepth})) */
|
|
|
|
|
|
this.root = options.root || this;
|
|
@@ -75364,6 +75364,8 @@ void main()
|
|
|
this.pickOrder = options.pickOrder || 0;
|
|
|
this.sizeInfo = options.sizeInfo;
|
|
|
this.dontFixOrient = options.dontFixOrient;
|
|
|
+ this.options = options;
|
|
|
+ this.lineDir = options.lineDir;
|
|
|
|
|
|
this.root.matrixAutoUpdate = false;
|
|
|
this.matrixMap = new Map();
|
|
@@ -75455,9 +75457,34 @@ void main()
|
|
|
let camera = e.viewport.camera;
|
|
|
//rotation
|
|
|
|
|
|
- if(!this.dontFixOrient){ //orthoCamera一般要加dontFixOrient
|
|
|
+ if(!this.dontFixOrient){ //orthoCamera一般要加dontFixOrient
|
|
|
+ let orient2d;
|
|
|
+
|
|
|
+ if(this.lineDir){
|
|
|
+ /* let r1 = Potree.Utils.getPos2d(new THREE.Vector3, camera, viewer.renderArea, e.viewport);
|
|
|
+ let r2 = Potree.Utils.getPos2d(this.lineDir, camera, viewer.renderArea, e.viewport); */
|
|
|
+
|
|
|
+ let r1 = Potree.Utils.getPos2d(this.lineDir[0], camera, viewer.renderArea, e.viewport);
|
|
|
+ let r2 = Potree.Utils.getPos2d(this.lineDir[1], camera, viewer.renderArea, e.viewport);
|
|
|
+
|
|
|
+ if(!r1.trueSide || !r2.trueSide){
|
|
|
+ return console.log('!r1.trueSide || !r2.trueSide', )
|
|
|
+ }
|
|
|
+ let p1 = r1.pos, p2 = r2.pos;
|
|
|
+ let vec = new Vector2().subVectors(p1,p2);
|
|
|
+ let angle = vec.angle();
|
|
|
+ let axis = p1.x < p2.x ? 1 : -1;
|
|
|
+ orient2d = new Quaternion().setFromAxisAngle(new Vector3(0,0,1), axis*angle);
|
|
|
+ console.log(this.parent.text, MathUtils$1.radToDeg(angle), axis );
|
|
|
+ }
|
|
|
+
|
|
|
let parentQua = this.root.parent.getWorldQuaternion(new Quaternion);
|
|
|
this.root.quaternion.multiplyQuaternions(parentQua.invert(),camera.quaternion); //乘上parentQua.invert()是为了中和掉父结点的qua,使只剩下camera.quaternion
|
|
|
+
|
|
|
+ if(this.lineDir){
|
|
|
+ this.root.quaternion.multiply(orient2d);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
//scale
|
|
@@ -81048,6 +81075,7 @@ void main()
|
|
|
if(edgeLabel.visible){
|
|
|
setEdgeLabel(edgeLabel,point,nextPoint,distance);
|
|
|
}
|
|
|
+ edgeLabel.sprite.lineDir = [point,nextPoint];//new THREE.Vector3().subVectors(point,nextPoint)
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -141223,8 +141251,10 @@ ENDSEC
|
|
|
}else {
|
|
|
path = `${Potree.settings.urls.prefix1}/vision.json`;
|
|
|
}
|
|
|
-
|
|
|
- return loadFile(path, { }, callback)
|
|
|
+ Potree.getRealUrl(path, (path)=>{
|
|
|
+ loadFile(path, { }, callback);
|
|
|
+ });
|
|
|
+ //return loadFile(path, { }, callback)
|
|
|
|
|
|
}
|
|
|
|