|
@@ -90029,11 +90029,11 @@ void main()
|
|
|
}
|
|
|
|
|
|
|
|
|
- ifBlockedByIntersect({pos3d, margin=0, cameraPos, pickWindowSize, pano, useDepthTex}={}){//某点是否被遮挡(不允许camera修改位置, 因为depthTex不好置换)
|
|
|
+ ifBlockedByIntersect({point, margin=0, cameraPos, pickWindowSize, pano, useDepthTex}={}){//某点是否被遮挡(不允许camera修改位置, 因为depthTex不好置换)
|
|
|
|
|
|
- let intersect = this.getIntersect(this.hoverViewport, true, pickWindowSize, null, null, useDepthTex, {pos3d, cameraPos, pano});
|
|
|
+ let intersect = this.getIntersect(this.hoverViewport, true, pickWindowSize, null, null, useDepthTex, {point, cameraPos, pano});
|
|
|
let cameraPos_ = (!cameraPos && pano) ? pano.position : (cameraPos||this.hoverViewport.view.position);
|
|
|
- if(intersect && intersect.distance+margin <= pos3d.distanceTo(cameraPos_)){
|
|
|
+ if(intersect && intersect.distance+margin <= point.distanceTo(cameraPos_)){
|
|
|
return intersect //被遮挡
|
|
|
}
|
|
|
//点云模式,对没加载出的点云不准确。 尤其是需要修改相机位置时,因临时修改并不能使点云加载。
|
|
@@ -90050,14 +90050,14 @@ void main()
|
|
|
|
|
|
let getByDepthTex = ()=>{
|
|
|
let intersect;
|
|
|
- if(prop.pos3d){
|
|
|
+ if(prop.point){
|
|
|
let cameraPos = prop.pano ? prop.pano.position : camera.position;
|
|
|
- let dir = new Vector3().subVectors(prop.pos3d, cameraPos).normalize();
|
|
|
+ let dir = new Vector3().subVectors(prop.point, cameraPos).normalize();
|
|
|
intersect = {dir};
|
|
|
}else {
|
|
|
intersect = Utils.getIntersect(camera, [viewer.images360.cube], this.pointer, raycaster);
|
|
|
}
|
|
|
- intersectPoint = viewer.images360.depthSampler.sample(intersect, prop.pano, !!prop.pos3d); //可能不准确, 因pano可能未加载depthTex
|
|
|
+ intersectPoint = viewer.images360.depthSampler.sample(intersect, prop.pano, !!prop.point); //可能不准确, 因pano可能未加载depthTex
|
|
|
if(intersectPoint && Potree.settings.depTexLocBindDataset){
|
|
|
intersectPoint.pointcloud = (prop.pano || viewer.images360.currentPano).pointcloud;
|
|
|
//在全景模式下,虽然深度图上的点可能对应别的pointcloud,但因为是在当前全景图处得到的,所以即使将原本对应的点云移走,该点也不移动是有道理的。它可以永远跟着该全景图。
|
|
@@ -90065,9 +90065,9 @@ void main()
|
|
|
};
|
|
|
|
|
|
let getByCloud = ()=>{
|
|
|
- if(prop.pos3d){//指定了目标点,而非只是用pointer所在位置
|
|
|
+ if(prop.point){//指定了目标点,而非只是用pointer所在位置
|
|
|
prop.cameraPos && camera.position.copy(prop.cameraPos);
|
|
|
- camera.lookAt(prop.pos3d);
|
|
|
+ camera.lookAt(prop.point);
|
|
|
camera.updateMatrixWorld();
|
|
|
prop.pointer = this.pointer.clone();
|
|
|
prop.mouse = this.mouse.clone();
|
|
@@ -90082,13 +90082,13 @@ void main()
|
|
|
camera,
|
|
|
this.viewer,
|
|
|
this.viewer.scene.pointclouds,
|
|
|
- {pickClipped: true, isMeasuring: this.isMeasuring, pickWindowSize, cameraChanged: !!prop.pos3d }
|
|
|
+ {pickClipped: true, isMeasuring: this.isMeasuring, pickWindowSize, cameraChanged: !!prop.point }
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
//恢复
|
|
|
- if(prop.pos3d){
|
|
|
+ if(prop.point){
|
|
|
viewport.view.applyToCamera(camera);
|
|
|
this.pointer.copy(prop.pointer);
|
|
|
this.mouse.copy(prop.mouse);
|
|
@@ -97762,10 +97762,10 @@ ENDSEC
|
|
|
};
|
|
|
if(computeDirFirst){//先计算方向,防止重复计算ifBlockedByIntersect
|
|
|
if(inDirection()){
|
|
|
- ifNeighbour = !viewer.inputHandler.ifBlockedByIntersect({pos3d:pano1.position, margin, cameraPos:pano0.position});
|
|
|
+ ifNeighbour = !viewer.inputHandler.ifBlockedByIntersect({point:pano1.position, margin, cameraPos:pano0.position});
|
|
|
}
|
|
|
}else {
|
|
|
- ifNeighbour = !viewer.inputHandler.ifBlockedByIntersect({pos3d:pano1.position, margin, cameraPos:pano0.position});
|
|
|
+ ifNeighbour = !viewer.inputHandler.ifBlockedByIntersect({point:pano1.position, margin, cameraPos:pano0.position});
|
|
|
if(ifNeighbour && !inDirection()){
|
|
|
ifNeighbour = undefined; //不确定
|
|
|
}
|
|
@@ -98136,7 +98136,7 @@ ENDSEC
|
|
|
(pano)=>{
|
|
|
let score = 0;
|
|
|
if(pano.depthTex && checkIntersect){
|
|
|
- let intersect = !!viewer.ifPointBlockedByIntersect(target, pano.id, true); //viewer.inputHandler.ifBlockedByIntersect({pos3d:target, margin:0.1, cameraPos:pano})
|
|
|
+ let intersect = !!viewer.ifPointBlockedByIntersect(target, pano.id, true); //viewer.inputHandler.ifBlockedByIntersect({point:target, margin:0.1, cameraPos:pano})
|
|
|
if(intersect){
|
|
|
score = 0;
|
|
|
}else {
|
|
@@ -134850,13 +134850,13 @@ ENDSEC
|
|
|
|
|
|
|
|
|
|
|
|
- ifPointBlockedByIntersect(pos3d , panoId, soon ){//点是否被遮挡
|
|
|
+ ifPointBlockedByIntersect(point , panoId, soon ){//点是否被遮挡
|
|
|
let ifShelter;
|
|
|
let now = Date.now();
|
|
|
let extraPanoId = panoId != void 0;
|
|
|
if(!this.shelterCount)return
|
|
|
|
|
|
- let history = shelterHistory.find(e=>e.pos3d.equals(pos3d));
|
|
|
+ let history = shelterHistory.find(e=>e.point.equals(point));
|
|
|
let cameraPos = this.mainViewport.view.position.clone();
|
|
|
if(panoId == void 0){
|
|
|
if(this.images360.isAtPano(0.05)){
|
|
@@ -134879,7 +134879,7 @@ ENDSEC
|
|
|
shelterHistory.splice(index, 1);
|
|
|
|
|
|
}else {//新增
|
|
|
- history = {pos3d, panos:{}, notAtPano:{}};
|
|
|
+ history = {point, panos:{}, notAtPano:{}};
|
|
|
|
|
|
const minCount = 100;
|
|
|
if(shelterHistory.length > minCount){//去除最早的
|
|
@@ -134903,21 +134903,21 @@ ENDSEC
|
|
|
if(panoId != void 0){
|
|
|
let pano = this.images360.getPano(panoId);
|
|
|
if((soon || this.shelterCount.byTex<this.shelterCount.maxByTex) && pano.depthTex){
|
|
|
- ifShelter = !!viewer.inputHandler.ifBlockedByIntersect({pos3d, margin:Potree.config.shelterMargin, useDepthTex:true, pano } );
|
|
|
+ ifShelter = !!viewer.inputHandler.ifBlockedByIntersect({point, margin:Potree.config.shelterMargin, useDepthTex:true, pano } );
|
|
|
history.panos[panoId] = ifShelter;
|
|
|
this.shelterCount.byTex ++ ;
|
|
|
- //console.log('computeByTex direct', panoId, pos3d, ifShelter)
|
|
|
+ //console.log('computeByTex direct', panoId, point, ifShelter)
|
|
|
}else {
|
|
|
- //console.log('延迟tex',panoId, pos3d )
|
|
|
+ //console.log('延迟tex',panoId, point )
|
|
|
history.waitCompute = {panoId, forceGet:extraPanoId };
|
|
|
return useLastResult()
|
|
|
}
|
|
|
}else {
|
|
|
if(/* history.ifShelter == void 0 || */ this.shelterCount.byCloud<this.shelterCount.maxByCloud){//弊端:第一个总是直接计算,后面的都是延后。但无法改进,因是一个个传进来的,无法预测。
|
|
|
- ifShelter = !!viewer.inputHandler.ifBlockedByIntersect({pos3d, margin:Potree.config.shelterMargin, pickWindowSize:3} );
|
|
|
+ ifShelter = !!viewer.inputHandler.ifBlockedByIntersect({point, margin:Potree.config.shelterMargin, pickWindowSize:3} );
|
|
|
history.notAtPano = {cameraPos , ifShelter };
|
|
|
this.shelterCount.byCloud ++ ;
|
|
|
- //console.log('computeByCloud direct', pos3d.toArray())
|
|
|
+ //console.log('computeByCloud direct', point.toArray())
|
|
|
}else {
|
|
|
//console.log('延迟cloud' )
|
|
|
history.waitCompute = {cameraPos};
|
|
@@ -134972,11 +134972,11 @@ ENDSEC
|
|
|
if(byTex >= maxTexCount)break
|
|
|
|
|
|
byTex ++;
|
|
|
- let ifShelter = !!viewer.inputHandler.ifBlockedByIntersect({pos3d:history.pos3d, margin:Potree.config.shelterMargin, useDepthTex:true } );
|
|
|
+ let ifShelter = !!viewer.inputHandler.ifBlockedByIntersect({point:history.point, margin:Potree.config.shelterMargin, useDepthTex:true } );
|
|
|
history.panos[this.images360.currentPano.id] = ifShelter;
|
|
|
history.ifShelter = ifShelter;
|
|
|
delete history.waitCompute;
|
|
|
- //console.log('补1', history.pos3d.toArray())
|
|
|
+ //console.log('补1', history.point.toArray())
|
|
|
}else {
|
|
|
if(this.images360.currentPano.pointcloud.hasDepthTex){
|
|
|
//先等待加载完深度图
|
|
@@ -135015,14 +135015,14 @@ ENDSEC
|
|
|
|
|
|
|
|
|
|
|
|
- let list = waitCloud2.map(e=>e.pos3d);
|
|
|
+ let list = waitCloud2.map(e=>e.point);
|
|
|
let result = Common$1.batchHandling.getSlice('shelterByCloud', list, {maxUseCount:maxCloudCount,useEquals:true, stopWhenAllUsed:true} ); //iphonex稳定后大概在7-10。
|
|
|
//list.length>0 && console.log('list',list, maxCloudCount)
|
|
|
|
|
|
result.list.forEach(e=>{
|
|
|
- let history = waitCloud2.find(a=>a.pos3d.equals(e));
|
|
|
+ let history = waitCloud2.find(a=>a.point.equals(e));
|
|
|
|
|
|
- let ifShelter = !!viewer.inputHandler.ifBlockedByIntersect({pos3d:history.pos3d, margin: Potree.config.shelterMargin , pickWindowSize:3} );
|
|
|
+ let ifShelter = !!viewer.inputHandler.ifBlockedByIntersect({point:history.point, margin: Potree.config.shelterMargin , pickWindowSize:3} );
|
|
|
|
|
|
if(history.waitCompute.cameraPos){
|
|
|
history.notAtPano = {cameraPos: history.waitCompute.cameraPos , ifShelter };
|
|
@@ -135031,7 +135031,7 @@ ENDSEC
|
|
|
}
|
|
|
history.ifShelter = ifShelter;
|
|
|
byCloud++;
|
|
|
- //console.log('补2', history.pos3d.toArray())
|
|
|
+ //console.log('补2', history.point.toArray())
|
|
|
delete history.waitCompute;
|
|
|
});
|
|
|
|
|
@@ -137310,10 +137310,7 @@ ENDSEC
|
|
|
render(params={}){//add params
|
|
|
viewer.addTimeMark('render','start');
|
|
|
const vrActive = this.renderer.xr.isPresenting;
|
|
|
-
|
|
|
-
|
|
|
- //Potree.settings.useRTPoint = !(SiteModel.editing && SiteModel.selected && SiteModel.selected.buildType == 'room' )//空间模型的房间选中材质是需要depth的,这时候需要绘制两次点云
|
|
|
-
|
|
|
+
|
|
|
Potree.settings.pointEnableRT = this.scene.measurements.length > 0 || !Potree.settings.useRTPoint;
|
|
|
|
|
|
|
|
@@ -137905,12 +137902,12 @@ ENDSEC
|
|
|
|
|
|
if(o.checkIntersect){
|
|
|
let checkIntersect = ( )=>{
|
|
|
- let intersect = this.inputHandler.ifBlockedByIntersect({pos3d:position, cameraPos: target});// 不一定准确
|
|
|
+ let intersect = this.inputHandler.ifBlockedByIntersect({point:position, cameraPos: target});// 不一定准确
|
|
|
if(intersect){
|
|
|
let blockCount = 0, unblockCount = 0, visi;
|
|
|
for(let i=0;i<object.points.length;i++){ //如果顶点超过一半不可见,就要更改位置
|
|
|
let p = object.points[i];
|
|
|
- let blocked = this.inputHandler.ifBlockedByIntersect({pos3d:p, margin:0.3 , cameraPos:position, pickWindowSize:4});
|
|
|
+ let blocked = this.inputHandler.ifBlockedByIntersect({point:p, margin:0.3 , cameraPos:position, pickWindowSize:4});
|
|
|
if(blocked){
|
|
|
blockCount ++;
|
|
|
if(blockCount / object.points.length >= 0.5){
|
|
@@ -137941,7 +137938,7 @@ ENDSEC
|
|
|
let position1 = position.clone();
|
|
|
let dir = new Vector3().subVectors(position, target);
|
|
|
position.copy(target).sub(dir);
|
|
|
- let intersect2 = this.inputHandler.ifBlockedByIntersect({pos3d: position, cameraPos:target});// 不一定准确
|
|
|
+ let intersect2 = this.inputHandler.ifBlockedByIntersect({point: position, cameraPos:target});// 不一定准确
|
|
|
if(intersect2){
|
|
|
if(intersect2.distance < intersect.distance ){
|
|
|
position.copy(position1);//恢复
|
|
@@ -138040,7 +138037,7 @@ ENDSEC
|
|
|
|
|
|
if(o.checkIntersect){//识别被点云遮住的话
|
|
|
let intersect; //反向查找从target到相机的第一个intersect
|
|
|
- intersect = this.inputHandler.ifBlockedByIntersect({pos3d:position, margin:0, cameraPos:target} /* {pos3d:target, margin: 0.2, cameraPos:position} */);
|
|
|
+ intersect = this.inputHandler.ifBlockedByIntersect({point:position, margin:0, cameraPos:target} /* {point:target, margin: 0.2, cameraPos:position} */);
|
|
|
|
|
|
if(intersect){
|
|
|
position.copy(intersect.location);
|