|
@@ -63651,8 +63651,10 @@ void main() {
|
|
|
var transformPointcloud = (pointcloud )=>{ //初始化位置
|
|
|
viewer.sidebar && viewer.sidebar.addAlignmentButton(pointcloud);
|
|
|
|
|
|
- let orientation = pointcloud.panos[0].dataRotation.z;
|
|
|
- let location = pointcloud.panos[0].dataPosition.clone().negate();
|
|
|
+ let orientation = pointcloud.panos[0].dataRotation.z + Math.PI;
|
|
|
+
|
|
|
+ let location = pointcloud.panos[0].dataPosition.clone();//.negate()
|
|
|
+
|
|
|
Alignment.rotate(pointcloud, null, orientation );
|
|
|
Alignment.translate(pointcloud, location );
|
|
|
|
|
@@ -63692,7 +63694,7 @@ void main() {
|
|
|
material.minSize = config.minSize;
|
|
|
material.maxSize = config.maxSize;
|
|
|
material.pointSizeType = /* 'ADAPTIVE'// */config.pointSizeType; //Potree.PointSizeType[config.pointSizeType]//Potree.PointSizeType.ADAPTIVE;//FIXED
|
|
|
- pointcloud.changePointSize( 0.2 /* config.realPointSize */ ); //material.size = config.pointSize;
|
|
|
+ pointcloud.changePointSize( 0.1 /* config.realPointSize */ ); //material.size = config.pointSize;
|
|
|
pointcloud.changePointOpacity(1);
|
|
|
material.shape = Potree.PointShape.SQUARE;
|
|
|
pointcloud.color = config.pointColor;
|
|
@@ -69893,17 +69895,17 @@ void main() {
|
|
|
|
|
|
// 设置点透明度
|
|
|
changePointOpacity(num, canMoreThanOne) {
|
|
|
- if(Potree.settings.editType == 'merge'){ //not AdditiveBlending
|
|
|
- return this.material.opacity = num
|
|
|
- }
|
|
|
-
|
|
|
//num:0-1 navvis用的是亮度
|
|
|
if (num == void 0) {
|
|
|
num = this.temp.pointOpacity;
|
|
|
} else {
|
|
|
this.temp.pointOpacity = num;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ if(Potree.settings.editType == 'merge'){ //not AdditiveBlending
|
|
|
+ return this.material.opacity = num
|
|
|
+ }
|
|
|
+
|
|
|
if (num == 1) {
|
|
|
this.material.opacity = 1;
|
|
|
} else {
|
|
@@ -80089,17 +80091,19 @@ void main() {
|
|
|
|
|
|
class Compass extends EventDispatcher{
|
|
|
|
|
|
- constructor(dom){
|
|
|
+ constructor(dom, viewport){
|
|
|
super();
|
|
|
this.angle = 0;
|
|
|
+ this.show = false;
|
|
|
if(dom){
|
|
|
this.dom = $(dom);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ this.viewport = viewport;
|
|
|
this.init();
|
|
|
- this.show = false;
|
|
|
-
|
|
|
+
|
|
|
|
|
|
+
|
|
|
|
|
|
}
|
|
|
init(){
|
|
@@ -80108,7 +80112,7 @@ void main() {
|
|
|
this.dom = $('<div id="compass"></div>');
|
|
|
$("#potree_render_area").append(this.dom);
|
|
|
}
|
|
|
- this.dom.css({/* display:"none", */ position:"absolute",right:"2%",top: "4%",width:width+"px",height:height+"px", "z-index":100,"pointer-events":"none" });
|
|
|
+ this.dom.css({ display:"none", position:"absolute",right:"2%",top: "4%",width:width+"px",height:height+"px", "z-index":100,"pointer-events":"none" });
|
|
|
|
|
|
let child = $("<div class='dirText north'><span>"+/* (config.lang=='zh'? */'北'/* :'N') */+"</span></div><div class='center'></div>");
|
|
|
this.dom.append(child);
|
|
@@ -80184,11 +80188,13 @@ void main() {
|
|
|
this.createCompass();
|
|
|
|
|
|
viewer.addEventListener('camera_changed', e => {
|
|
|
- if (e.viewport.name == 'MainView' && (e.changeInfo.positionChanged || e.changeInfo.quaternionChanged)) {
|
|
|
+ if (e.viewport == this.viewport && (e.changeInfo.positionChanged || e.changeInfo.quaternionChanged)) {
|
|
|
this.update();
|
|
|
}
|
|
|
});
|
|
|
|
|
|
+ this.setDomPos();
|
|
|
+ if(this.viewport)this.setDisplay(true);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -80272,8 +80278,8 @@ void main() {
|
|
|
}
|
|
|
|
|
|
update(quaternion){
|
|
|
- //if(!this.show)return;
|
|
|
- if(!quaternion) quaternion = viewer.mainViewport.camera.quaternion.clone();
|
|
|
+ if(!this.show)return;
|
|
|
+ if(!quaternion) quaternion = this.viewport.camera.quaternion.clone();
|
|
|
this.updateCamera(quaternion);
|
|
|
this.updateLabel(quaternion);
|
|
|
this.render();
|
|
@@ -80281,39 +80287,39 @@ void main() {
|
|
|
}
|
|
|
|
|
|
|
|
|
- updateLabel(quaternion){//更新北标签
|
|
|
+ /*updateLabel(quaternion){//更新北标签
|
|
|
|
|
|
var dir = viewer.mainViewport.view.direction;
|
|
|
- var oriDir = initDir.clone(); //指南针最初始时的北方向
|
|
|
- var extraQua;
|
|
|
- /* if(objects.player.mode == "transitioning"){//当transitioning时,相机的quaternion不是用control的lookAt算出来,而是直接由一个quaternion过渡到另一个,这样相机将会是歪的,投影面也就不会是原先的水平面。
|
|
|
+ var oriDir = initDir.clone() //指南针最初始时的北方向
|
|
|
+ var extraQua
|
|
|
+ if(objects.player.mode == "transitioning"){//当transitioning时,相机的quaternion不是用control的lookAt算出来,而是直接由一个quaternion过渡到另一个,这样相机将会是歪的,投影面也就不会是原先的水平面。
|
|
|
var tempCamera = new THREE.Camera(); //借用camera的lookAt算出如果正视同样的target, quaternion会是什么值。 将它乘以当前相机quaternion,得到的就是相机歪的旋转值。
|
|
|
tempCamera.position.copy(this.camera.position);
|
|
|
tempCamera.lookAt(tempCamera.position.clone().add(dir))
|
|
|
var q = tempCamera.quaternion.inverse()
|
|
|
extraQua = q.premultiply(quaternion) //歪掉的额外旋转值
|
|
|
|
|
|
- } */
|
|
|
+ }
|
|
|
|
|
|
//北标签的方向为指南针轮盘方向,也就是要将camera的方向投影到水平面上。 但是如果相机歪了,看到的世界都会歪一定角度,投影面也要歪一定角度。
|
|
|
- var up = new Vector3(0,0,1); //投影水平面的法线,也是相机的摆正的up方向
|
|
|
- extraQua && up.applyQuaternion(extraQua);
|
|
|
- dir.projectOnPlane(up); //将方向投影到水平面上; 如果相机不是正视(extraQua不为0001),就要将水平面也转动
|
|
|
- oriDir.projectOnPlane(up);//为什么initDir投影了和没有投影angle结果一样
|
|
|
- var angle = dir.angleTo(oriDir);
|
|
|
- if(dir.cross(oriDir).y > 0)angle = -angle;
|
|
|
+ var up = new THREE.Vector3(0,0,1) //投影水平面的法线,也是相机的摆正的up方向
|
|
|
+ extraQua && up.applyQuaternion(extraQua)
|
|
|
+ dir.projectOnPlane(up) //将方向投影到水平面上; 如果相机不是正视(extraQua不为0001),就要将水平面也转动
|
|
|
+ oriDir.projectOnPlane(up)//为什么initDir投影了和没有投影angle结果一样
|
|
|
+ var angle = dir.angleTo(oriDir)
|
|
|
+ if(dir.cross(oriDir).y > 0)angle = -angle
|
|
|
|
|
|
- var deg = this.angle - 90 + MathUtils.radToDeg(angle); //因为css写的样式初始是指向右方,和initDir差了90°,所以减去。
|
|
|
+ var deg = this.angle - 90 + THREE.Math.radToDeg(angle) //因为css写的样式初始是指向右方,和initDir差了90°,所以减去。
|
|
|
|
|
|
|
|
|
- this.dom.find(".dirText").css( "transform","rotate("+deg+"deg)" );
|
|
|
- this.dom.find(".dirText span").css("transform","rotate("+(-deg)+"deg)");
|
|
|
- }
|
|
|
+ this.dom.find(".dirText").css( "transform","rotate("+deg+"deg)" )
|
|
|
+ this.dom.find(".dirText span").css("transform","rotate("+(-deg)+"deg)")
|
|
|
+ } */
|
|
|
|
|
|
|
|
|
|
|
|
updateLabel(quaternion){//更新北标签
|
|
|
- let deg = MathUtils.radToDeg(viewer.mainViewport.view.yaw) - 90;
|
|
|
+ let deg = MathUtils.radToDeg(this.viewport.view.yaw) - 90;
|
|
|
this.dom.find(".dirText").css( "transform","rotate("+deg+"deg)" );
|
|
|
this.dom.find(".dirText span").css("transform","rotate("+(-deg)+"deg)");
|
|
|
}
|
|
@@ -80323,12 +80329,14 @@ void main() {
|
|
|
const radius = 5; //相机距离
|
|
|
|
|
|
this.camera.quaternion.copy(quaternion);
|
|
|
- var dir = viewer.mainViewport.view.direction; //相机朝向
|
|
|
+ var dir = this.viewport.view.direction; //相机朝向
|
|
|
this.camera.position.copy(dir.multiplyScalar(radius).negate()); //相机绕着指南针中心(000)转动
|
|
|
}
|
|
|
+
|
|
|
render(){
|
|
|
this.renderer.render(this.scene, this.camera);
|
|
|
}
|
|
|
+
|
|
|
setDisplay(state){
|
|
|
this.show = !!state;
|
|
|
if(this.show){
|
|
@@ -80345,8 +80353,12 @@ void main() {
|
|
|
|
|
|
}
|
|
|
|
|
|
- setDomLeft(){
|
|
|
- this.dom.css({'right':'none','left':config.isMobile? "1%" : "2%"});
|
|
|
+ setDomPos(){
|
|
|
+ if(!this.viewport)return
|
|
|
+ let right = (1-this.viewport.left + this.viewport.width);
|
|
|
+ this.dom.css({'right':(right*100 + 2) + '%'});
|
|
|
+
|
|
|
+ //this.dom.css({'right':'none','left':config.isMobile? "1%" : "2%"})
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -117922,6 +117934,13 @@ ENDSEC
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ {
|
|
|
+
|
|
|
+ this.secondCompass = new Compass(null);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
viewer.setControls(viewer.orbitControls);
|
|
|
//viewer.mainViewport.view.fixZWhenPan = true
|
|
|
viewer.orbitControls.constantlyForward = true;
|
|
@@ -118121,7 +118140,9 @@ ENDSEC
|
|
|
this.transformControls2._gizmo.hideAxis = {translate:['x','y'], rotate:['x','y','z'] };
|
|
|
|
|
|
|
|
|
-
|
|
|
+ this.secondCompass.viewport = viewer.viewports[1];
|
|
|
+ this.secondCompass.setDomPos();
|
|
|
+ this.secondCompass.setDisplay(true);
|
|
|
},
|
|
|
|
|
|
leaveSplit(){
|
|
@@ -118140,6 +118161,8 @@ ENDSEC
|
|
|
viewer.setObjectLayers(this.transformControls, 'sceneObjects' ); //恢复
|
|
|
|
|
|
|
|
|
+ this.secondCompass.setDisplay(false);
|
|
|
+
|
|
|
|
|
|
},
|
|
|
|
|
@@ -122997,7 +123020,7 @@ ENDSEC
|
|
|
|
|
|
exportSavingData(){//输出漫游点新的坐标和朝向、以及连接信息
|
|
|
let sweepLocations = {};
|
|
|
-
|
|
|
+ let rotQua = new Quaternion().setFromAxisAngle(new Vector3(0,0,1), Math.PI);
|
|
|
for(let datasetId in Potree.settings.datasetsPanos ) {
|
|
|
let {panos} = Potree.settings.datasetsPanos[datasetId];
|
|
|
let data = panos.map(pano=>{
|
|
@@ -123011,8 +123034,8 @@ ENDSEC
|
|
|
return Object.assign({}, pano.panosData, {
|
|
|
uuid: pano.uuid,
|
|
|
pose:{
|
|
|
- translation: dealData(pano.position.clone().negate()),
|
|
|
- rotation: dealData(new Quaternion().setFromRotationMatrix(pano.panoMatrix) ),
|
|
|
+ translation: dealData(pano.position.clone()/* .negate() */),
|
|
|
+ rotation: dealData(new Quaternion().setFromRotationMatrix(pano.panoMatrix).premultiply(rotQua) ),
|
|
|
},
|
|
|
visibles,
|
|
|
|
|
@@ -126695,7 +126718,7 @@ ENDSEC
|
|
|
});
|
|
|
this.viewports = [this.mainViewport];
|
|
|
|
|
|
- Potree.settings.showCompass && (this.compass = new Compass(Potree.settings.compassDom));
|
|
|
+ Potree.settings.showCompass && (this.compass = new Compass(Potree.settings.compassDom, this.mainViewport));
|
|
|
this.magnifier = new Magnifier(this);
|
|
|
this.reticule = new Reticule(this);
|
|
|
this.scene.scene.add(this.magnifier);
|