|
@@ -496,7 +496,8 @@
|
|
|
,
|
|
|
panoEdit:{
|
|
|
maxLevelPercent: 1, //在远处时由于pointBudget限制而展示稀疏,凑近时就变为最高质量了
|
|
|
- pointBudget :1*1000*1000, //避免卡顿
|
|
|
+ pointBudget :4*1000*1000, //避免卡顿
|
|
|
+ percentByUser:true,
|
|
|
},
|
|
|
|
|
|
low:{//highPerformance
|
|
@@ -63618,7 +63619,8 @@ void main() {
|
|
|
Potree.settings.number = number;
|
|
|
|
|
|
Potree.settings.unableNavigate = true;
|
|
|
-
|
|
|
+ Potree.settings.sizeFitToLevel = true;//当type为衰减模式时自动根据level调节大小。每长一级,大小就除以2
|
|
|
+
|
|
|
|
|
|
let viewer = new Potree.Viewer(dom);
|
|
|
let Alignment = viewer.modules.Alignment;
|
|
@@ -63635,7 +63637,7 @@ void main() {
|
|
|
$("#alignment").show();
|
|
|
viewer.toggleSidebar();
|
|
|
});
|
|
|
- Potree.settings.sizeFitToLevel = true;
|
|
|
+ //Potree.settings.sizeFitToLevel = true
|
|
|
}
|
|
|
|
|
|
var pointcloudLoadDone = function( ){//所有点云cloud.js加载完毕后
|
|
@@ -84452,10 +84454,14 @@ void main() {
|
|
|
let distance = camera.position.distanceTo(this.intersectStart.location); //不按下ctrl的话
|
|
|
|
|
|
//按照orbitControl的方式旋转:
|
|
|
- let rotationSpeed = 2.5;
|
|
|
+ /* let rotationSpeed = 1//2.5;
|
|
|
|
|
|
- this.yawDelta -= e.drag.pointerDelta.x * rotationSpeed;
|
|
|
- this.pitchDelta += e.drag.pointerDelta.y * rotationSpeed;
|
|
|
+ this.yawDelta += e.drag.pointerDelta.x * rotationSpeed;
|
|
|
+ this.pitchDelta -= e.drag.pointerDelta.y * rotationSpeed; */
|
|
|
+
|
|
|
+ //旋转方向和偏移量尽量和在漫游点处旋转方式的一样
|
|
|
+ this.yawDelta += e.drag.pointerDelta.x / 700 * viewport.resolution.x;
|
|
|
+ this.pitchDelta -= e.drag.pointerDelta.y / 700 * viewport.resolution.y;
|
|
|
|
|
|
|
|
|
//先更新一下相机:
|
|
@@ -87781,7 +87787,7 @@ void main() {
|
|
|
this.quaternion = new Quaternion(); //{w: 0, x: 0, y: 0, z: 1}
|
|
|
//this.quaternion4dkk = math.convertVisionQuaternion(this.quaternion)//4dkk内使用的quaternion
|
|
|
this.visibles = o.visibles;
|
|
|
-
|
|
|
+ this.rtkState = o.has_rtk ? o.use_rtk : null;
|
|
|
|
|
|
const height = 1.4; //相机高度
|
|
|
this.originFloorPosition = this.originPosition.clone();
|
|
@@ -89558,14 +89564,20 @@ void main() {
|
|
|
Fail: 3
|
|
|
});
|
|
|
|
|
|
- this.visible = true; //add 借用viewer.updateVisible来判断是否start
|
|
|
|
|
|
viewer.addEventListener('pageVisible', (e)=>{//不可见时不refreshUpdateInterval
|
|
|
//console.log('visibilitychange:', state)
|
|
|
viewer.updateVisible(this, 'pageVisible', e.v);
|
|
|
this.judgeStart();
|
|
|
});
|
|
|
-
|
|
|
+
|
|
|
+ this.visible = true; //add 借用viewer.updateVisible来判断是否start
|
|
|
+ if(Potree.settings.useDepthTex){
|
|
|
+ this.judgeStart(); //开始下载depthTex
|
|
|
+ }else {
|
|
|
+ viewer.updateVisible(this,'showPanos', false ); //默认visible = false
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
setPanoData(e, t /* , i */) {
|
|
@@ -89577,7 +89589,7 @@ void main() {
|
|
|
start() {
|
|
|
this.downloadCubeTex = true;
|
|
|
if(!Potree.settings.useDepthTex){
|
|
|
- viewer.updateVisible(this,'pano', true );
|
|
|
+ viewer.updateVisible(this,'showPanos', true );
|
|
|
this.judgeStart();
|
|
|
}else {
|
|
|
this.refreshInterval || this.judgeStart();
|
|
@@ -89587,7 +89599,7 @@ void main() {
|
|
|
stop() {
|
|
|
this.downloadCubeTex = false;
|
|
|
if(!Potree.settings.useDepthTex){
|
|
|
- viewer.updateVisible(this,'pano', false );
|
|
|
+ viewer.updateVisible(this,'showPanos', false );
|
|
|
this.judgeStart();
|
|
|
}
|
|
|
}
|
|
@@ -92351,7 +92363,7 @@ void main() {
|
|
|
},1);
|
|
|
this.removeEventListener('loadedDepthImg', wait);
|
|
|
};
|
|
|
- if(!pano.depthTex && pano.pointcloud.hasDepthTex){ //需要用到depthTex计算neighbour
|
|
|
+ if(!pano.depthTex && pano.pointcloud.hasDepthTex){ //点云模式也要加载depthTex,因获取neighbour需要用到
|
|
|
this.addEventListener('loadedDepthImg', wait);
|
|
|
return pano.loadDepthImg()
|
|
|
}
|
|
@@ -93263,7 +93275,7 @@ void main() {
|
|
|
|
|
|
if(pano0.pointcloud != pano1.pointcloud){ //距离太远的数据集,过渡会畸变。所以扩大skybox
|
|
|
let dis = pano0.position.distanceTo(pano1.position);
|
|
|
- if(dis > 100){
|
|
|
+ if(dis > 50){
|
|
|
let bound = getPanoBound(pano0).union(getPanoBound(pano1));
|
|
|
let size = bound.getSize(new Vector3);
|
|
|
let max = Math.max(size.x, size.y, size.z);
|
|
@@ -93469,14 +93481,33 @@ void main() {
|
|
|
/* let sideDis_ = [(sideDis0[0] + sideDis1[1])/2, (sideDis0[1] + sideDis1[0])/2];
|
|
|
let sideDis = [Math.min(sideDis0[0] , sideDis1[1]), Math.min(sideDis0[1] , sideDis1[0])]//
|
|
|
*/
|
|
|
-
|
|
|
+ /* let maxH = 40, minH = 2, height = pano.ceilZ - pano.floorPosition.z, minR = 0.5, maxR = 2
|
|
|
+
|
|
|
+ let r = minR + ( maxR - minR) * THREE.Math.clamp((height - minH) / (maxH - minH),0,1) //THREE.Math.smoothstep(currentDis, op.nearBound, op.farBound);
|
|
|
+
|
|
|
+ let getZ = (deg)=>{
|
|
|
+ deg *= r
|
|
|
+ deg = THREE.Math.clamp(deg, 1, 80);
|
|
|
+ return Math.tan(THREE.Math.degToRad(deg))
|
|
|
+ }
|
|
|
+ */
|
|
|
|
|
|
if(pano0.pointcloud.hasDepthTex && pano0.pointcloud.hasDepthTex){
|
|
|
let panos = [pano0,pano1];
|
|
|
let vecs = [vec.clone().negate(), vec];
|
|
|
let axis = [[-1,1],[1,-1]];
|
|
|
let dis2d = new Vector2$1().subVectors(pano0.position, pano1.position).length();//水平上的距离
|
|
|
- let angles = [MathUtils.degToRad(40), MathUtils.degToRad(70)]; //正的在左边 尽量能够平分中间这段墙体
|
|
|
+
|
|
|
+ let maxDis = 50, minDis = 0.5, minR = 0.2, maxR = 1.2;
|
|
|
+ let r = maxR - ( maxR - minR) * MathUtils.clamp((dis2d - minDis) / (maxDis - minDis),0,1); //dis2d越大,角度要越小 //THREE.Math.smoothstep(currentDis, op.nearBound, op.farBound);
|
|
|
+ //console.log('dis2d',dis2d,'r',r)
|
|
|
+ let angles = [35,65].map(deg=>{ //正的在左边 尽量能够平分中间这段墙体。
|
|
|
+ let angle = MathUtils.clamp(deg * r, 5, 80);
|
|
|
+ //console.log('angle',angle)
|
|
|
+ return MathUtils.degToRad(angle)
|
|
|
+ });
|
|
|
+
|
|
|
+ //let angles = [THREE.Math.degToRad(40), THREE.Math.degToRad(70)]
|
|
|
axis.forEach((axis_, index0)=>{
|
|
|
let disToSides = [];
|
|
|
let accordingPano = index0 == 0 ? pano0 : pano1; //根据离该点在vec方向上的距离顺序来存顶点
|
|
@@ -115469,15 +115500,16 @@ ENDSEC
|
|
|
|
|
|
|
|
|
addEntity:function(entity, parent){
|
|
|
- this.meshGroup.add(entity);
|
|
|
- this.entities.push(entity);
|
|
|
- if(entity.buildType == 'building'){
|
|
|
- this.buildings.push(entity);
|
|
|
- }else {
|
|
|
- parent.buildChildren.push(entity);
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
+ if(entity.buildType != 'hole'){
|
|
|
+ this.meshGroup.add(entity);
|
|
|
+ this.entities.push(entity);
|
|
|
+ if(entity.buildType == 'building'){
|
|
|
+ this.buildings.push(entity);
|
|
|
+ }else {
|
|
|
+ parent.buildChildren.push(entity);
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
if(entity.buildType == 'room'){
|
|
|
entity.addEventListener('marker_dropped',()=>{
|
|
@@ -122368,7 +122400,7 @@ ENDSEC
|
|
|
|
|
|
};
|
|
|
|
|
|
- let clickPanoToLink = false;//是否在编辑漫游点连接时,通过点击漫游点能修改连接
|
|
|
+ let clickPanoToDisLink = false;//是否在编辑漫游点连接时,通过点击漫游点能断开连接
|
|
|
let images360, Alignment$1, SiteModel$1;
|
|
|
|
|
|
const texLoader$c = new TextureLoader();
|
|
@@ -122846,7 +122878,7 @@ ENDSEC
|
|
|
this.updateTranCtl();
|
|
|
this.setTranMode(this.tranMode); // update
|
|
|
this.setZoomInState(false); //取消放大模式
|
|
|
-
|
|
|
+ this.updatePointLevels();
|
|
|
}
|
|
|
|
|
|
|
|
@@ -122991,6 +123023,7 @@ ENDSEC
|
|
|
}
|
|
|
|
|
|
informBy2d || this.dispatchEvent({type:"switchPanoVisible", pano, v});
|
|
|
+ this.updatePointLevels();
|
|
|
}
|
|
|
|
|
|
|
|
@@ -123052,7 +123085,7 @@ ENDSEC
|
|
|
if(this.selectedLine){
|
|
|
this.selectedLine.dispatchEvent('click');//删除
|
|
|
}
|
|
|
- if(this.selectedPano && clickPanoToLink){
|
|
|
+ if(this.selectedPano && clickPanoToDisLink){
|
|
|
this.selectedPano.circle.dispatchEvent('click');//删除
|
|
|
}
|
|
|
}
|
|
@@ -123240,27 +123273,34 @@ ENDSEC
|
|
|
|
|
|
addPanoMesh(){
|
|
|
let map = texLoader$c.load(Potree.resourcePath+'/textures/correct_n.png' );
|
|
|
- circleMats.default = new MeshBasicMaterial({
|
|
|
+ circleMats.default_normal = new MeshBasicMaterial({
|
|
|
map,
|
|
|
color: 0xffffff,
|
|
|
transparent: true,
|
|
|
depthTest: false,
|
|
|
depthWrite: false,
|
|
|
});
|
|
|
- circleMats.hovered = new MeshBasicMaterial({
|
|
|
- map,
|
|
|
- color: 0xffff00,
|
|
|
- transparent: true,
|
|
|
- depthTest: false,
|
|
|
- depthWrite: false,
|
|
|
- });
|
|
|
- circleMats.selected = new MeshBasicMaterial({
|
|
|
- map: texLoader$c.load(Potree.resourcePath+'/textures/correct_s.png' ) ,
|
|
|
- color: 0xffffff,
|
|
|
- transparent: true,
|
|
|
- depthTest: false,
|
|
|
- depthWrite: false,
|
|
|
- });
|
|
|
+ circleMats.default_rtk_on = circleMats.default_normal.clone();
|
|
|
+ circleMats.default_rtk_on.map = texLoader$c.load(Potree.resourcePath+'/textures/rtk-y-n.png' );
|
|
|
+ circleMats.default_rtk_off = circleMats.default_normal.clone();
|
|
|
+ circleMats.default_rtk_off.map = texLoader$c.load(Potree.resourcePath+'/textures/rtk-f-n.png' );
|
|
|
+ circleMats.selected_normal = circleMats.default_normal.clone();
|
|
|
+ circleMats.selected_normal.map = texLoader$c.load(Potree.resourcePath+'/textures/correct_s.png' );
|
|
|
+ circleMats.selected_rtk_on = circleMats.default_normal.clone();
|
|
|
+ circleMats.selected_rtk_on.map = texLoader$c.load(Potree.resourcePath+'/textures/rtk-y-s.png' );
|
|
|
+ circleMats.selected_rtk_off = circleMats.default_normal.clone();
|
|
|
+ circleMats.selected_rtk_off.map = texLoader$c.load(Potree.resourcePath+'/textures/rtk-f-s.png' );
|
|
|
+
|
|
|
+ circleMats.hovered_normal = circleMats.default_normal.clone();
|
|
|
+ circleMats.hovered_normal.color.set(0x00ff00);
|
|
|
+ circleMats.hovered_rtk_on = circleMats.default_rtk_on.clone();
|
|
|
+ circleMats.hovered_rtk_on.color.set(0x00ff00);
|
|
|
+ circleMats.hovered_rtk_off = circleMats.default_rtk_off.clone();
|
|
|
+ circleMats.hovered_rtk_off.color.set(0x00ff00);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
let setPos = (circle)=>{
|
|
|
circle.position.copy(circle.pano.position);
|
|
@@ -123279,12 +123319,12 @@ ENDSEC
|
|
|
|
|
|
|
|
|
images360.panos.forEach(pano=>{
|
|
|
- var circle = new Sprite$1({mat: circleMats.default, sizeInfo:{
|
|
|
+ var circle = new Sprite$1({mat: circleMats['default' + '_'+ this.getPanoRtkState(pano) ] , sizeInfo:{
|
|
|
minSize : 50 , maxSize : 120, nearBound : 2, farBound : 10,
|
|
|
},
|
|
|
renderOrder : renderOrders$1.circle,
|
|
|
pickOrder: renderOrders$1.circle
|
|
|
- }); //new THREE.Sprite(circleMats.default)
|
|
|
+ });
|
|
|
|
|
|
circle.name = 'panoCircle';
|
|
|
circle.sid = pano.id;
|
|
@@ -123298,7 +123338,7 @@ ENDSEC
|
|
|
pano.addEventListener('rePos', setPos.bind(this,circle));
|
|
|
|
|
|
let drag = ()=>{
|
|
|
- if(this.activeViewName == 'mainView')return
|
|
|
+ if(this.tranMode != 'translate' || this.activeViewName == 'mainView' )return
|
|
|
this.selectPano(circle.pano); //为了方便拖拽点云,拖动circle就直接选中
|
|
|
|
|
|
viewer.inputHandler.drag.object = null; //取消拖拽状态,否则不触发点云拖动
|
|
@@ -123318,12 +123358,12 @@ ENDSEC
|
|
|
circle.addEventListener('click', ()=>{
|
|
|
//if(this.activeViewName == 'mainView')return
|
|
|
if(this.clickToZoomInEnabled)return
|
|
|
- if(clickPanoToLink && this.operation == 'removeLink'){
|
|
|
+ if(clickPanoToDisLink && this.operation == 'removeLink'){
|
|
|
this.linkChange(pano, null, 'remove'); //删除所有连接
|
|
|
}
|
|
|
|
|
|
if(this.selectedPano == circle.pano) return this.selectPano(null)
|
|
|
- if(clickPanoToLink && this.operation == 'addLink' && this.selectedPano){
|
|
|
+ if(this.operation == 'addLink' && this.selectedPano){
|
|
|
this.linkChange(this.selectedPano, circle.pano, 'add');
|
|
|
//this.setLinkOperateState('addLink',false)
|
|
|
return
|
|
@@ -123363,7 +123403,7 @@ ENDSEC
|
|
|
type : "CursorChange", action : "add", name:"hoverPano"
|
|
|
});
|
|
|
}
|
|
|
- if(this.selectedPano != pano) pano.circle.material = circleMats.hovered;
|
|
|
+ if(this.selectedPano != pano) pano.circle.material = circleMats['hovered' + '_'+ this.getPanoRtkState(pano) ];
|
|
|
|
|
|
}else if(pano && !state){//unhover
|
|
|
if(this.hoveredPano != pano)return
|
|
@@ -123371,7 +123411,7 @@ ENDSEC
|
|
|
viewer.dispatchEvent({
|
|
|
type : "CursorChange", action : "remove", name:"hoverPano"
|
|
|
});
|
|
|
- if(this.selectedPano != pano) pano.circle.material = circleMats.default;
|
|
|
+ if(this.selectedPano != pano) pano.circle.material = circleMats['default' + '_'+ this.getPanoRtkState(pano) ];
|
|
|
this.hoveredPano = null;
|
|
|
}else {//unhover any
|
|
|
if(this.hoveredPano){
|
|
@@ -123386,7 +123426,7 @@ ENDSEC
|
|
|
let lastSeletedPano = this.selectedPano;
|
|
|
if(this.selectedPano){
|
|
|
|
|
|
- this.selectedPano.circle.material = circleMats.default;
|
|
|
+ this.selectedPano.circle.material = circleMats['default' + '_'+ this.getPanoRtkState(this.selectedPano) ];
|
|
|
this.selectedPano.circle.renderOrder = renderOrders$1.circle;
|
|
|
|
|
|
if(this.activeViewName == 'mainView'){
|
|
@@ -123405,7 +123445,7 @@ ENDSEC
|
|
|
this.updateSelectGroup();
|
|
|
|
|
|
if(pano){
|
|
|
- this.selectedPano.circle.material = circleMats.selected;
|
|
|
+ this.selectedPano.circle.material = circleMats['selected' + '_'+ this.getPanoRtkState(this.selectedPano) ];
|
|
|
this.selectedPano.circle.renderOrder = this.selectedPano.circle.pickOrder = renderOrders$1.circleSelected; //侧视图能显示在最前
|
|
|
|
|
|
if(this.activeViewName == 'mainView'){
|
|
@@ -123458,7 +123498,33 @@ ENDSEC
|
|
|
}
|
|
|
|
|
|
|
|
|
+ updatePointLevels(){
|
|
|
+ let percent = 1;
|
|
|
+ if(this.activeViewName == 'mainView'){
|
|
|
+ //假设每个pointcloud所带的点个数大致相同,那么当可见点云个数越多,所能展示的level越低,否则因总个数超过budget的话密度会参差不齐。
|
|
|
+ let visiCount = viewer.scene.pointclouds.filter(e=>e.visible).length;
|
|
|
+ let maxCount = 70, minCount = 1, minPer = 0.3, maxPer = 1;
|
|
|
+ percent = maxPer - ( maxPer - minPer) * MathUtils.clamp((visiCount - minCount) / (maxCount - minCount),0,1); //dis2d越大,角度要越小
|
|
|
+ //pointcloud.changePointSize()
|
|
|
+ console.log('updatePointLevels', percent, visiCount);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ Potree.settings.UserDensityPercent = percent;
|
|
|
+ viewer.setPointLevels();
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
+ getPanoRtkState(pano){
|
|
|
+ //'normal' 'rtk_on' 'rtk_off'
|
|
|
+
|
|
|
+ return pano.panosData.has_rtk ? pano.rtkState ? 'rtk_on' : 'rtk_off' : 'normal'
|
|
|
+ }
|
|
|
+ changePanoRtkState(pano,state){
|
|
|
+ pano.rtkState = state;
|
|
|
+ pano.circle.material = circleMats[(this.selectedPano == pano ? 'selected' : 'default') + '_'+ this.getPanoRtkState(pano) ];
|
|
|
+ }
|
|
|
|
|
|
updateSelectGroup(){//更新选中的组
|
|
|
this.selectedGroup = this.panoGroup.find(e=>e.includes(this.selectedPano));
|
|
@@ -123534,7 +123600,7 @@ ENDSEC
|
|
|
},
|
|
|
|
|
|
visibles,
|
|
|
-
|
|
|
+ use_rtk : !!pano.rtkState
|
|
|
//subgroup: 0,group: 1, "id_view":..
|
|
|
})
|
|
|
});
|