|
@@ -53956,9 +53956,14 @@
|
|
|
return rotation
|
|
|
}
|
|
|
|
|
|
- set rotation(rotation){//这个在数字很小(垂直向上看)的时候水平旋转精度可能损失,导致突变到另一个角度去了,用 set quaternion比较好
|
|
|
- //因为 rotation的y不一定是0 , 所以不能直接逆着写。
|
|
|
- this.direction = new Vector3(0,0,-1).applyEuler(rotation);
|
|
|
+ set rotation(rotation){
|
|
|
+ if(rotation.y != 0){//因为 rotation的y不一定是0 , 所以不能直接逆着get rotation写。
|
|
|
+ //console.error('set rotation y不为0!!!!?', rotation ) //过渡时因为quaternion lerp所以不为0。没办法了orz
|
|
|
+ this.direction = new Vector3(0,0,-1).applyEuler(rotation); //转回direction有损耗,在俯视时的(dir.x==dir.y==0), 丢失yaw信息从而 yaw无法获取(希望不要遇到这种情况,如果有的话,考虑先计算yaw,似乎好像可以算)
|
|
|
+ }else {//尽量不用direction
|
|
|
+ this.pitch = rotation.x - Math.PI / 2;
|
|
|
+ this.yaw = rotation.z;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
@@ -53966,8 +53971,8 @@
|
|
|
return new Quaternion().setFromEuler(this.rotation)
|
|
|
}
|
|
|
|
|
|
- set quaternion(q){
|
|
|
- this.direction = new Vector3(0,0,-1).applyQuaternion(q); //注意如果得到的dir.x==dir.y==0, yaw不会变为0, 导致算的quaternion和q不一致
|
|
|
+ set quaternion(q){
|
|
|
+ this.rotation = new Euler().setFromQuaternion(q);
|
|
|
}
|
|
|
|
|
|
copy(a){
|
|
@@ -54146,21 +54151,36 @@
|
|
|
|
|
|
this.restrictPos(endPosition);
|
|
|
|
|
|
-
|
|
|
+ if(info.endYaw == void 0){
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if(info.target ){
|
|
|
+ endTarget = new Vector3().copy(info.target);
|
|
|
+ endQuaternion = math.getQuaFromPosAim(endPosition,endTarget); //若为垂直,会自动偏向x负的方向
|
|
|
+
|
|
|
+
|
|
|
+ }else if(info.quaternion){
|
|
|
+ endQuaternion = info.quaternion.clone();
|
|
|
+ }
|
|
|
+
|
|
|
+ if(endQuaternion && math.closeTo(Math.abs(this.direction.z), 1, 1e-4)){ //在垂直的视角下的quaternion刚开始突变的厉害,这时候可能渐变yaw比较好(如俯视时点击测量线)
|
|
|
+ let a = this.clone();
|
|
|
+ a.quaternion = endQuaternion;
|
|
|
+ info.endYaw = a.yaw; info.endPitch = a.pitch;
|
|
|
+ console.log('turn to yaw');
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
if(info.endYaw != void 0) {
|
|
|
startPitch = this.pitch;
|
|
|
endPitch = info.endPitch;
|
|
|
let a = math.getStandardYaw(this.yaw, info.endYaw );
|
|
|
startYaw = a[0]; endYaw = a[1];
|
|
|
- }else if(info.target ){
|
|
|
- endTarget = new Vector3().copy(info.target);
|
|
|
- endQuaternion = math.getQuaFromPosAim(endPosition,endTarget); //若为垂直,会自动偏向x负的方向
|
|
|
- dir = new Vector3().subVectors(endTarget, endPosition).normalize();
|
|
|
- //console.log(dir, this.direction)
|
|
|
- }else if(info.quaternion){
|
|
|
- endQuaternion = info.quaternion.clone();
|
|
|
- }
|
|
|
-
|
|
|
+ console.log('startYaw', startYaw, 'endYaw', endYaw);
|
|
|
+ }
|
|
|
if(endQuaternion){
|
|
|
startQuaternion = this.quaternion;
|
|
|
}
|
|
@@ -57995,7 +58015,7 @@
|
|
|
this.uniforms.resolution.value.copy(viewport.resolution2);
|
|
|
this.uniforms.devicePixelRatio.value = window.devicePixelRatio;
|
|
|
this.lineWidth = this.lineWidth_; //update
|
|
|
- if(!this.useDepth /* || !e.viewport.camera.isPerspectiveCamera */|| !e.viewport)return
|
|
|
+ if(!this.realUseDepth || !e.viewport)return
|
|
|
let viewportOffset = viewport.offset || new THREE.Vector2();
|
|
|
this.uniforms.viewportOffset.value.copy(viewportOffset);
|
|
|
|
|
@@ -58034,7 +58054,7 @@
|
|
|
|
|
|
if(value){
|
|
|
viewer.addEventListener("render.begin", this.events.render);
|
|
|
- this.events.setSize( {viewport:viewer.mainViewport} );
|
|
|
+
|
|
|
this.updateDepthParams();
|
|
|
}else {
|
|
|
viewer.removeEventListener("render.begin", this.events.render);
|
|
@@ -58045,7 +58065,7 @@
|
|
|
}
|
|
|
|
|
|
|
|
|
- setRealDepth(useDepth){//确实使用到depthTex
|
|
|
+ setRealDepth(useDepth, viewport){//确实使用到depthTex
|
|
|
if(this.realUseDepth != useDepth){
|
|
|
if(useDepth ){
|
|
|
this.defines.useDepth = '';
|
|
@@ -58055,6 +58075,8 @@
|
|
|
this.realUseDepth = useDepth;
|
|
|
if(this.autoDepthTest)this.depthWrite = this.depthTest = !useDepth; //如果useDepth = false,使用原始的depthTest
|
|
|
this.needsUpdate = true;
|
|
|
+ if(!viewport)viewport = viewer.mainViewport; //暂时这么设置
|
|
|
+ useDepth && this.events.setSize({viewport});
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -58070,7 +58092,7 @@
|
|
|
let hasDepth = this.useDepth && Potree.settings.displayMode == 'showPointCloud' &&
|
|
|
(Potree.settings.pointEnableRT || viewer.useEDL);
|
|
|
|
|
|
- this.setRealDepth(hasDepth);
|
|
|
+ this.setRealDepth(hasDepth, viewport);
|
|
|
|
|
|
if(hasDepth){
|
|
|
this.uniforms.depthTexture.value = viewer.getPRenderer().getRtEDL(viewport).depthTexture; //其实只赋值一次就行
|
|
@@ -70901,7 +70923,7 @@ void main()
|
|
|
|
|
|
this.events = {
|
|
|
setSize:(e)=>{//如果出现横条状的异常,往往是viewportOffset出错 //地图不需要
|
|
|
- if(!this.useDepth /* || !e.viewport.camera.isPerspectiveCamera */|| !e.viewport)return
|
|
|
+ if(!this.realUseDepth || !e.viewport)return
|
|
|
let viewport = e.viewport;
|
|
|
let viewportOffset = viewport.offset || new Vector2();
|
|
|
|
|
@@ -70911,12 +70933,12 @@ void main()
|
|
|
render:(e)=>{//before render 如果有大于两个viewport的话,不同viewport用不同的depthTex
|
|
|
this.updateDepthParams(e);
|
|
|
},
|
|
|
- cameraChange:(e)=>{
|
|
|
+ /* cameraChange:(e)=>{
|
|
|
if(e.changeInfo.projectionChanged){//resize时也会触发。虽然保守起见的话加上resize比较好//所以当时为何不用resize
|
|
|
//console.log('projectionChanged')
|
|
|
- this.events.setSize(e);
|
|
|
- }
|
|
|
- }
|
|
|
+ this.events.setSize(e)
|
|
|
+ }
|
|
|
+ } */
|
|
|
|
|
|
};
|
|
|
if(o.mapColorReplace){
|
|
@@ -70954,19 +70976,19 @@ void main()
|
|
|
|
|
|
if(value){
|
|
|
viewer.addEventListener("render.begin", this.events.render);
|
|
|
- viewer.addEventListener('camera_changed', this.events.cameraChange);
|
|
|
- this.events.setSize( {viewport:viewer.mainViewport} );
|
|
|
+ //viewer.addEventListener('camera_changed', this.events.cameraChange)
|
|
|
+ viewer.addEventListener('resize', this.events.setSize);
|
|
|
this.updateDepthParams();
|
|
|
}else {
|
|
|
viewer.removeEventListener("render.begin", this.events.render);
|
|
|
- viewer.removeEventListener('camera_changed', this.events.cameraChange);
|
|
|
+ viewer.removeEventListener('resize', this.events.setSize);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
- setRealDepth(useDepth){//确实使用到depthTex
|
|
|
+ setRealDepth(useDepth, viewport){//确实使用到depthTex
|
|
|
if(this.realUseDepth != useDepth){
|
|
|
if(useDepth ){
|
|
|
this.defines.useDepth = '';
|
|
@@ -70976,6 +70998,8 @@ void main()
|
|
|
this.realUseDepth = useDepth;
|
|
|
if(this.autoDepthTest)this.depthWrite = this.depthTest = !useDepth; //如果useDepth = false,使用原始的depthTest
|
|
|
this.needsUpdate = true;
|
|
|
+ if(!viewport)viewport = viewer.mainViewport; //暂时这么设置
|
|
|
+ useDepth && this.events.setSize({viewport});
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -71037,7 +71061,7 @@ void main()
|
|
|
(Potree.settings.pointEnableRT || viewer.useEDL);
|
|
|
|
|
|
|
|
|
- this.setRealDepth(hasDepth);
|
|
|
+ this.setRealDepth(hasDepth, viewport);
|
|
|
|
|
|
if(hasDepth){
|
|
|
this.uniforms.depthTexture.value = viewer.getPRenderer().getRtEDL(viewport).depthTexture; //其实只赋值一次就行
|
|
@@ -71080,27 +71104,23 @@ void main()
|
|
|
this.visible_ = true;
|
|
|
|
|
|
|
|
|
- let update = (e)=>{
|
|
|
- //this.update(e)
|
|
|
- this.needsUpdate = true;
|
|
|
+ let clear = (e)=>{
|
|
|
+ this.matrixMap.clear();//清空后在所有viewport上都必须更新才能渲染 //this.needsUpdate = true
|
|
|
};
|
|
|
- viewer.mapViewer && viewer.mapViewer.addEventListener("camera_changed", update);
|
|
|
- viewer.addEventListener("camera_changed", update);
|
|
|
- /* if(viewer.viewports.length == 1){//直接更新。如果有多个不在这更新,在"render.begin"
|
|
|
- this.update(e)
|
|
|
- } */
|
|
|
+ viewer.mapViewer && viewer.mapViewer.addEventListener("camera_changed", clear);
|
|
|
+ viewer.addEventListener("camera_changed", clear);
|
|
|
|
|
|
|
|
|
let applyMatrix = (e)=>{
|
|
|
- if(this.needsUpdate) this.update(e);
|
|
|
- else this.applyMatrix(e);
|
|
|
+ /* if(this.needsUpdate) this.update(e)
|
|
|
+ else */this.applyMatrix(e);
|
|
|
};
|
|
|
viewer.addEventListener("raycaster", applyMatrix); //before render
|
|
|
viewer.addEventListener("render.begin", applyMatrix); //before render //magnifier时要禁止吗
|
|
|
|
|
|
this.addEventListener('dispose', ()=>{
|
|
|
- viewer.mapViewer && viewer.mapViewer.removeEventListener("camera_changed", update);
|
|
|
- viewer.removeEventListener("camera_changed", update);
|
|
|
+ viewer.mapViewer && viewer.mapViewer.removeEventListener("camera_changed", clear);
|
|
|
+ viewer.removeEventListener("camera_changed", clear);
|
|
|
viewer.removeEventListener("raycaster", applyMatrix); //before render
|
|
|
viewer.removeEventListener("render.begin", applyMatrix);
|
|
|
|
|
@@ -71110,9 +71130,10 @@ void main()
|
|
|
}
|
|
|
|
|
|
set visible(v){
|
|
|
+ let oldV = this.visible_;
|
|
|
this.visible_ = v;
|
|
|
- if(v){
|
|
|
- this.update();
|
|
|
+ if(v && !oldV){
|
|
|
+ this.matrixMap && this.matrixMap.clear(); //this.update() //update内有unableCompute会无限回调
|
|
|
}
|
|
|
}
|
|
|
get visible(){
|
|
@@ -71158,6 +71179,10 @@ void main()
|
|
|
|
|
|
|
|
|
|
|
|
+ waitUpdate(){
|
|
|
+ this.matrixMap.clear();//清空后在所有viewport上都必须更新才能渲染
|
|
|
+ //viewer.dispatchEvent('content_changed')
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
@@ -71206,7 +71231,7 @@ void main()
|
|
|
|
|
|
let p2State = '', len=1, p2StateHistory = [];
|
|
|
while(p2State != 'got' && p2StateHistory.length<10){
|
|
|
- point2 = center.clone().add(lineDir.multiplyScalar(len));
|
|
|
+ point2 = center.clone().add(lineDir.clone().multiplyScalar(len));
|
|
|
|
|
|
r2 = Potree.Utils.getPos2d(point2, camera, viewer.renderArea, e.viewport);
|
|
|
if(!r2.trueSide){ //很少遇到点2在背面的
|
|
@@ -71281,7 +71306,8 @@ void main()
|
|
|
|
|
|
if(index == 1){
|
|
|
orient2dAngle -= Math.PI;
|
|
|
- }
|
|
|
+ }
|
|
|
+ //console.log('orient2dAngle measure_point',index, orient2dAngle )
|
|
|
}
|
|
|
}else {
|
|
|
Potree.Utils.updateVisible(this, 'unableCompute', false);
|
|
@@ -71298,6 +71324,7 @@ void main()
|
|
|
this.root.quaternion.multiplyQuaternions(parentQua.invert(),camera.quaternion); //乘上parentQua.invert()是为了中和掉父结点的qua,使只剩下camera.quaternion
|
|
|
|
|
|
if(orient2dAngle){
|
|
|
+ //console.log('orient2dAngle ',this.root.name,orient2dAngle)
|
|
|
let qua = new Quaternion().setFromAxisAngle(new Vector3(0,0,1), orient2dAngle);
|
|
|
this.root.quaternion.multiply(qua);
|
|
|
}
|
|
@@ -71425,6 +71452,7 @@ void main()
|
|
|
this.text = text + '';
|
|
|
|
|
|
this.updateTexture();
|
|
|
+ this.sprite.waitUpdate(); //重新计算各个viewport的matrix
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -71447,10 +71475,10 @@ void main()
|
|
|
}
|
|
|
setPos(pos){
|
|
|
this.position.copy(pos);
|
|
|
- this.sprite.update();
|
|
|
+ this.sprite.waitUpdate();
|
|
|
}
|
|
|
update(){
|
|
|
- this.sprite.update();
|
|
|
+ this.sprite.waitUpdate();
|
|
|
}
|
|
|
setVisible(v){
|
|
|
Potree.Utils.updateVisible(this, 'setVisible', v);
|
|
@@ -71461,60 +71489,68 @@ void main()
|
|
|
updateTexture(){
|
|
|
let canvas = document.createElement('canvas');
|
|
|
let context = canvas.getContext('2d');
|
|
|
- context.font = this.fontWeight + ' ' + this.fontsize + 'px ' + this.fontface;
|
|
|
+ const r = window.devicePixelRatio;
|
|
|
+ context.font = this.fontWeight + ' ' + this.fontsize * r + 'px ' + this.fontface;
|
|
|
|
|
|
//context["font-weight"] = 100; //语法与 CSS font 属性相同。
|
|
|
- // get size data (height depends only on font size)
|
|
|
-
|
|
|
- //this.text = 'f 啊啊啊 jg'
|
|
|
+
|
|
|
+
|
|
|
+ //this.text = '啊啊啊啊啊啊fag'
|
|
|
|
|
|
let metrics = context.measureText(this.text );
|
|
|
let textWidth = metrics.width;
|
|
|
- let margin = this.margin || new Vector2(this.fontsize, Math.max( this.fontsize*0.4, 10) );
|
|
|
- let spriteWidth = 2 * margin.x + textWidth + 2 * this.rectBorderThick;
|
|
|
- let spriteHeight = 2 * margin.y + this.fontsize + 2 * this.rectBorderThick;
|
|
|
+ let margin = (this.margin ? new Vector2().copy(this.margin) : new Vector2(this.fontsize, Math.max( this.fontsize*0.4, 10) )).clone().multiplyScalar(r);
|
|
|
+ let spriteWidth = 2 * margin.x + textWidth + 2 * this.rectBorderThick * r ;
|
|
|
+ let spriteHeight = 2 * margin.y + this.fontsize * r + 2 * this.rectBorderThick * r;
|
|
|
context.canvas.width = spriteWidth;
|
|
|
context.canvas.height = spriteHeight;
|
|
|
- context.font = this.fontWeight + ' ' + this.fontsize + 'px ' + this.fontface;
|
|
|
-
|
|
|
+ context.font = this.fontWeight + ' ' + this.fontsize * r + 'px ' + this.fontface;
|
|
|
|
|
|
- let expand = Math.max(1, Math.pow(this.fontsize / 16, 1.3)); // 针对英文大部分在baseLine之上所以降低一点,或者可以识别当不包含jgqp时才加这个值
|
|
|
+ /* let diff = 2//针对英文大部分在baseLine之上所以降低一点(metrics.fontBoundingBoxAscent - metrics.fontBoundingBoxDescent) / 2
|
|
|
+
|
|
|
+ context.textBaseline = "middle"
|
|
|
+ */
|
|
|
+ let expand = Math.max(1, Math.pow(this.fontsize / 16, 1.3)) * r; // 针对英文大部分在baseLine之上所以降低一点,或者可以识别当不包含jgqp时才加这个值
|
|
|
|
|
|
//canvas原点在左上角
|
|
|
context.textBaseline = 'alphabetic'; // "middle" //设置文字基线。当起点y设置为0时,只有该线以下的部分被绘制出来。middle时文字显示一半(但是对该字体所有字的一半,有的字是不一定显示一半的,尤其汉字),alphabetic时是英文字母的那条基线。
|
|
|
|
|
|
- let actualHeight = metrics.actualBoundingBoxAscent + metrics.actualBoundingBoxDescent; // 当前文本字符串在这个字体下用的实际高度
|
|
|
+ //let actualHeight = metrics.actualBoundingBoxAscent + metrics.actualBoundingBoxDescent; // 当前文本字符串在这个字体下用的实际高度
|
|
|
|
|
|
//文字y向距离从textBaseline向上算
|
|
|
- let y = metrics.actualBoundingBoxAscent + margin.y + expand;
|
|
|
+ let actualBoundingBoxAscent = metrics.actualBoundingBoxAscent == void 0 ? this.fontsize * r * 0.8 : metrics.actualBoundingBoxAscent; //有的流览器没有。只能大概给一个
|
|
|
+ let y = actualBoundingBoxAscent + margin.y + expand;
|
|
|
//console.log(this.text, 'y' , y, 'actualBoundingBoxAscent', metrics.actualBoundingBoxAscent,'expand',expand )
|
|
|
-
|
|
|
+
|
|
|
|
|
|
// border color
|
|
|
context.strokeStyle = 'rgba(' + this.borderColor.r + ',' + this.borderColor.g + ',' +
|
|
|
this.borderColor.b + ',' + this.borderColor.a + ')';
|
|
|
-
|
|
|
- context.lineWidth = this.rectBorderThick;
|
|
|
+
|
|
|
+ let rectBorderThick = this.rectBorderThick * r;
|
|
|
+
|
|
|
+ context.lineWidth = rectBorderThick;
|
|
|
// background color
|
|
|
context.fillStyle = 'rgba(' + this.backgroundColor.r + ',' + this.backgroundColor.g + ',' +
|
|
|
this.backgroundColor.b + ',' + this.backgroundColor.a + ')';
|
|
|
- this.roundRect(context, this.rectBorderThick / 2, this.rectBorderThick / 2,
|
|
|
- spriteWidth - this.rectBorderThick, spriteHeight - this.rectBorderThick, this.borderRadius);
|
|
|
+ this.roundRect(context, rectBorderThick / 2 , rectBorderThick / 2,
|
|
|
+ spriteWidth - rectBorderThick, spriteHeight - rectBorderThick, this.borderRadius * r);
|
|
|
|
|
|
// text color
|
|
|
if(this.textBorderThick){
|
|
|
context.strokeStyle = 'rgba(' + this.textBorderColor.r + ',' + this.textBorderColor.g + ',' +
|
|
|
this.textBorderColor.b + ',' + this.textBorderColor.a + ')';
|
|
|
- context.lineWidth = this.textBorderThick;
|
|
|
- context.strokeText(this.text , this.rectBorderThick + margin.x, y /* spriteHeight/2 + expand */ );
|
|
|
+ context.lineWidth = this.textBorderThick * r;
|
|
|
+ context.strokeText(this.text , rectBorderThick + margin.x, y /* spriteHeight/2 + diff */ );
|
|
|
}
|
|
|
|
|
|
context.fillStyle = 'rgba(' + this.textColor.r + ',' + this.textColor.g + ',' +
|
|
|
this.textColor.b + ',' + this.textColor.a + ')';
|
|
|
- context.fillText(this.text , this.rectBorderThick + margin.x, y /* spriteHeight/2 + expand */);//x,y
|
|
|
+ context.fillText(this.text , rectBorderThick + margin.x, y/* spriteHeight/2 + diff */ );//x,y
|
|
|
+
|
|
|
|
|
|
let texture = new Texture(canvas);
|
|
|
- texture.minFilter = LinearFilter; //LinearMipMapLinearFilter会缩放到power of 2
|
|
|
+ texture.minFilter = LinearFilter;
|
|
|
texture.magFilter = LinearFilter;
|
|
|
texture.needsUpdate = true;
|
|
|
|
|
@@ -71522,10 +71558,9 @@ void main()
|
|
|
this.sprite.material.map.dispose();
|
|
|
}
|
|
|
this.sprite.material.map = texture;
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
|
|
|
- this.sprite.scale.set(spriteWidth * 0.01, spriteHeight * 0.01, 1.0);
|
|
|
+ this.sprite.scale.set(spriteWidth * 0.01 / r, spriteHeight * 0.01 / r, 1.0);
|
|
|
}
|
|
|
|
|
|
roundRect(ctx, x, y, w, h, r){
|
|
@@ -81679,7 +81714,8 @@ void main()
|
|
|
|
|
|
updateMarker(marker, pos){
|
|
|
marker.position.copy(pos);
|
|
|
- marker.update();
|
|
|
+ marker.waitUpdate();
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
@@ -81934,6 +81970,7 @@ void main()
|
|
|
maxClipFactor:0.1
|
|
|
};
|
|
|
|
|
|
+ const textSizeRatio = math.linearClamp(window.innerWidth * window.innerHeight , 360*720, 1920*1080, 0.75, 1); //pc字显示大一些
|
|
|
|
|
|
|
|
|
const markerSizeInfo = {
|
|
@@ -81946,7 +81983,7 @@ void main()
|
|
|
textColor: {r: textColor.r*255, g: textColor.g*255, b: textColor.b*255, a: 1.0},
|
|
|
textBorderColor: {r:255, g: 255, b:255, a: 1.0},
|
|
|
textBorderThick:3,
|
|
|
- fontsize: 14,
|
|
|
+ fontsize: 15 * textSizeRatio,
|
|
|
borderRadius : 12, margin:{x:20,y:4},
|
|
|
renderOrder : 5, pickOrder:5,
|
|
|
disToLine:-0.15,
|
|
@@ -81965,7 +82002,7 @@ void main()
|
|
|
const subLabelProp = {
|
|
|
backgroundColor: {r: 255, g: 255, b: 255, a:config$1.measure.default.opacity},
|
|
|
textColor: {r: 0.3, g: 0.3, b:0.3, a: 1.0},
|
|
|
- fontsize:12, borderRadius : 12, margin:{x:20,y:4},
|
|
|
+ fontsize:15 * textSizeRatio, borderRadius : 12, margin:{x:20,y:4},
|
|
|
renderOrder : 4, pickOrder:4,
|
|
|
};
|
|
|
|
|
@@ -82180,7 +82217,7 @@ void main()
|
|
|
/* this.closed || */edgeLabel.setVisible(edgeLabel.shouldVisi);
|
|
|
if(edgeLabel.shouldVisi){
|
|
|
this.lineDir = new Vector3().subVectors(point,nextPoint).normalize(); //[point,nextPoint]
|
|
|
-
|
|
|
+
|
|
|
setEdgeLabel(edgeLabel,point,nextPoint,distance);
|
|
|
|
|
|
}
|
|
@@ -82237,6 +82274,9 @@ void main()
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
setEdgeLabelPos(label,p1,p2){ //调整label的位置,使倾斜后看起来在线的中心,而不要挡住端点
|
|
|
let center = new Vector3().addVectors(p1,p2).multiplyScalar(0.5);
|
|
|
|
|
@@ -82514,13 +82554,13 @@ void main()
|
|
|
let color = new Color(Potree.config.measure.highlight.color);
|
|
|
//label.sprite.material.opacity = config.measure.highlight.opacity
|
|
|
|
|
|
- //label.backgroundColor = {r:255*color.r, g:255*color.g, b:255*color.b, a:config.measure.highlight.opacity},
|
|
|
- //label.backgroundColor.a = config.measure.highlight.opacity
|
|
|
+ //label.setBackgroundColor({r:255*color.r, g:255*color.g, b:255*color.b, a:config.measure.highlight.opacity})
|
|
|
+
|
|
|
label.sprite.material.useDepth = false;
|
|
|
//label.textColor = {r: this.color.r*255, g: this.color.g*255, b: this.color.b*255, a: 1}
|
|
|
}else {
|
|
|
- //label.backgroundColor = {r: this.color.r*255, g: this.color.g*255, b: this.color.b*255, a:config.measure.default.opacity}
|
|
|
- //label.backgroundColor.a = config.measure.default.opacity
|
|
|
+ //label.setBackgroundColor({r: this.color.r*255, g: this.color.g*255, b: this.color.b*255, a:config.measure.default.opacity})
|
|
|
+
|
|
|
label.sprite.material.useDepth = true;
|
|
|
//label.sprite.material.opacity = 0.98
|
|
|
//label.textColor = {r: 255, g: 255, b: 255, a: 1}
|
|
@@ -82555,6 +82595,11 @@ void main()
|
|
|
|
|
|
setPosition(index, position) {
|
|
|
super.setPosition(index, position);
|
|
|
+
|
|
|
+ //相连的点的箭头也要更新方向
|
|
|
+ this.markers[(index + this.points.length - 1) % this.points.length].waitUpdate();
|
|
|
+ this.markers[(index + this.points.length + 1) % this.points.length].waitUpdate();
|
|
|
+
|
|
|
let event = {
|
|
|
type: 'marker_moved',
|
|
|
measure: this,
|
|
@@ -82562,6 +82607,7 @@ void main()
|
|
|
position: position.clone()
|
|
|
};
|
|
|
this.dispatchEvent(event);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
dispose(){//add
|
|
@@ -82757,7 +82803,7 @@ void main()
|
|
|
|
|
|
|
|
|
const areaLabel = new TextSprite$2(
|
|
|
- $.extend(mainLabelProp,{sizeInfo: labelSizeInfo, name:'areaLabel_'} )
|
|
|
+ $.extend({}, mainLabelProp,{sizeInfo: labelSizeInfo, name:'areaLabel', fontsize:16*textSizeRatio} )
|
|
|
);
|
|
|
|
|
|
areaLabel.addEventListener('mouseover',()=>{
|
|
@@ -83773,7 +83819,7 @@ void main()
|
|
|
|
|
|
marker.isDragging = true;
|
|
|
|
|
|
- console.log('continueDrag' , marker.uuid);
|
|
|
+ //console.log('continueDrag' , marker.uuid)
|
|
|
measure.continueDrag(marker, e);
|
|
|
}
|
|
|
|
|
@@ -89074,7 +89120,7 @@ void main()
|
|
|
//}
|
|
|
viewport.needRender = true; //直接写这咯
|
|
|
if(changeInfo.resolutionChanged){
|
|
|
- this.dispatchEvent( {type:'resize', viewport});
|
|
|
+ this.ifEmitResize({viewport}); //for map
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -91906,8 +91952,8 @@ void main()
|
|
|
|
|
|
updateCamera(){
|
|
|
let view = this.listenViewport.view;
|
|
|
- this.view.quaternion = view.quaternion; //this.view.rotation = view.rotation
|
|
|
- this.view.yaw = view.yaw;
|
|
|
+ this.view.yaw = view.yaw;
|
|
|
+ this.view.pitch = view.pitch;
|
|
|
var dir = view.direction; //相机朝向
|
|
|
this.view.position.copy(dir.multiplyScalar(this.view.radius).negate()); //相机绕着指南针中心(000)转动
|
|
|
|
|
@@ -91916,7 +91962,7 @@ void main()
|
|
|
|
|
|
applyToMainView(){
|
|
|
let view = this.listenViewport.view;
|
|
|
- view.quaternion = this.view.quaternion;
|
|
|
+ view.rotation = this.view.rotation;
|
|
|
}
|
|
|
|
|
|
pushHomeBtn(){
|
|
@@ -96474,7 +96520,7 @@ ENDSEC
|
|
|
);
|
|
|
this.images360.node.add(this.label2);
|
|
|
this.floorPosition && this.label2.position.copy(this.floorPosition);
|
|
|
- let s = 0.4;
|
|
|
+ let s = 0.25;
|
|
|
this.label2.scale.set(s,s,s);
|
|
|
//Potree.Utils.updateVisible(this.label2, 'notDisplay', false)
|
|
|
Potree.Utils.updateVisible(this.label2, 'panoVisi', this.visible);
|
|
@@ -103770,7 +103816,7 @@ ENDSEC
|
|
|
|
|
|
const texLoader$7 = new TextureLoader();
|
|
|
const circleGeo = new CircleGeometry(1.45,100);
|
|
|
- const sphereGeo = new SphereBufferGeometry(0.018,10,10);
|
|
|
+ const sphereGeo = new SphereBufferGeometry(0.008,8,8);
|
|
|
|
|
|
|
|
|
const magDisMin = 1;//相机离目标位置的距离的分界线,当离得远时要缩小fov以使看到的视野固定(望远镜效果)
|
|
@@ -103778,7 +103824,7 @@ ENDSEC
|
|
|
/* const radius_ = 0.2; //当相机离目标位置的距离>magDistance_时,希望看到的视野的半径
|
|
|
const maxFov = THREE.Math.radToDeg(Math.atan(radius_ / magDisMin )) * 2//提前计算出当相机离目标位置的距离<magDisMin时的fov,均使用=magDisMin时的fov。只要保证该fov大于主相机的fov就会有放大效果
|
|
|
*/
|
|
|
- let w = 250/1.43;
|
|
|
+ let w = 230/1.43;
|
|
|
let maxPX = 1366*1024; //ipad pro. 大于这个分辨率的就直接用devicePixelRatio, 如macbook也是
|
|
|
const width2dPX = Math.round(window.devicePixelRatio >= 2 ? ( window.screen.width * window.screen.height >= maxPX ? window.devicePixelRatio/1.2 : window.devicePixelRatio/1.5)*w : w); //触屏或高分辨率的可能要放大些。但在手机上不能太大
|
|
|
//console.log('width2dPX', width2dPX)
|
|
@@ -103895,12 +103941,12 @@ ENDSEC
|
|
|
this.targetPoint.add(new Mesh(sphereGeo, new MeshBasicMaterial({
|
|
|
color:"#ff0000",
|
|
|
transparent:true,
|
|
|
- opacity:0.5,
|
|
|
+ opacity:0.7,
|
|
|
})));
|
|
|
this.targetPoint.add(new Mesh(sphereGeo, new MeshBasicMaterial({
|
|
|
color:"#ff0000",
|
|
|
transparent:true,
|
|
|
- opacity:0.2,
|
|
|
+ opacity:0.3,
|
|
|
depthTest:false //被遮挡层
|
|
|
})));
|
|
|
|
|
@@ -104157,7 +104203,7 @@ ENDSEC
|
|
|
}
|
|
|
|
|
|
let texLoader$8 = new TextureLoader();
|
|
|
- let defaultOpacity = 0.7;
|
|
|
+ let defaultOpacity = 0.5;
|
|
|
let Buttons$1 = Potree.defines.Buttons;
|
|
|
|
|
|
|
|
@@ -104250,7 +104296,7 @@ ENDSEC
|
|
|
|
|
|
|
|
|
move(e){
|
|
|
- if(e.type == "global_mousemove" && (e.isTouch || e.buttons != Buttons$1.NONE) && this.state != 'crosshair'){
|
|
|
+ if(e.type == "global_mousemove" && (e.isTouch || e.buttons != Buttons$1.NONE) && !this.state.cross){
|
|
|
return//按下时不更新,除非拖拽测量
|
|
|
}
|
|
|
|
|
@@ -104320,8 +104366,22 @@ ENDSEC
|
|
|
}else {
|
|
|
|
|
|
let n = camera.position.distanceTo(this.position);
|
|
|
- s = 1 + .1 * n;
|
|
|
- n < 1 && (s -= 1 - n);
|
|
|
+ if( n < 1 ){
|
|
|
+ if(this.state.cross ){ //测量时更精细些
|
|
|
+ s = 0.7 * n;
|
|
|
+ }else {
|
|
|
+ s = 1.1 * n;
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ if(this.state.cross ){
|
|
|
+ s = 0.4 + 0.3 * n; //n乘以的系数越高,其越不近大远小(大小越恒定)
|
|
|
+ }else {
|
|
|
+ s = 1 + 0.1 * n;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(this.state.cross ){ //测量时更精细些
|
|
|
+ s /= viewer.images360.zoomLevel;
|
|
|
+ }
|
|
|
}
|
|
|
this.scale.set(s, s, s);
|
|
|
|