|
@@ -53989,11 +53989,12 @@
|
|
|
}
|
|
|
|
|
|
const children = this.children;
|
|
|
+ if(children){
|
|
|
+ for ( let i = 0, l = children.length; i < l; i ++ ) {
|
|
|
|
|
|
- for ( let i = 0, l = children.length; i < l; i ++ ) {
|
|
|
-
|
|
|
- children[ i ].traverse( callback );
|
|
|
+ children[ i ].traverse( callback );
|
|
|
|
|
|
+ }
|
|
|
}
|
|
|
};
|
|
|
|
|
@@ -59133,7 +59134,7 @@
|
|
|
var reg = new RegExp(f, "g"); //创建正则RegExp对象
|
|
|
return str.replace(reg, e);
|
|
|
}
|
|
|
- ,
|
|
|
+ ,
|
|
|
downloadFile : function(data, filename, cb) {
|
|
|
var save_link = document.createElementNS('http://www.w3.org/1999/xhtml', 'a');
|
|
|
save_link.href = data;
|
|
@@ -59143,6 +59144,29 @@
|
|
|
save_link.dispatchEvent(event);
|
|
|
cb && cb();
|
|
|
},
|
|
|
+
|
|
|
+ dealURL(url){
|
|
|
+ return this.replaceAll(url, "\\+", "%2B");// 浏览器似乎不支持访问带+的地址
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ getNameFromURL(url){
|
|
|
+ let get = (e)=>{
|
|
|
+ return e.split('/').pop()
|
|
|
+ };
|
|
|
+ if(url instanceof Array){
|
|
|
+ return url.map(e=>get(e))
|
|
|
+ }
|
|
|
+ return get(url)
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ //---------------------------
|
|
|
+
|
|
|
|
|
|
intervalTool:{ //延时update,防止卡顿
|
|
|
list:[],
|
|
@@ -69828,8 +69852,9 @@ void main()
|
|
|
|
|
|
Utils.getIntersect = function (camera, meshes, pointer, raycaster) {
|
|
|
//获取鼠标和meshes交点
|
|
|
- camera.updateMatrixWorld();
|
|
|
+
|
|
|
if(!raycaster){//getMouseIntersect
|
|
|
+ camera.updateMatrixWorld();
|
|
|
raycaster = new Raycaster();
|
|
|
var origin = new Vector3(pointer.x, pointer.y, -1).unproject(camera),
|
|
|
end = new Vector3(pointer.x, pointer.y, 1).unproject(camera);
|
|
@@ -69838,7 +69863,7 @@ void main()
|
|
|
}
|
|
|
|
|
|
meshes.forEach(e=>{
|
|
|
- raycaster.layers.enable(math.getBaseLog(e.layers.mask,2));
|
|
|
+ raycaster.layers.enable(math.getBaseLog(2,e.layers.mask));
|
|
|
});
|
|
|
var n = raycaster.intersectObjects(meshes);
|
|
|
if (0 === n.length) return null
|
|
@@ -72537,7 +72562,7 @@ void main()
|
|
|
loadPointsWhenUnfocus:true, //页面unfocus时也仍在加载点云 */
|
|
|
|
|
|
//initialShowPano:true
|
|
|
- drawEntityData: false,
|
|
|
+ drawEntityData: false, //包括marker、线
|
|
|
|
|
|
zoomFromPointert:{//定点缩放(包括点云模式、全景模式、地图)
|
|
|
whenPanos:true,
|
|
@@ -91309,7 +91334,7 @@ void main()
|
|
|
}
|
|
|
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
return {
|
|
|
camera, viewport, pointer
|
|
@@ -98575,8 +98600,8 @@ void main()
|
|
|
vFov: viewer.scene.getActiveCamera().fov
|
|
|
}//原先是null,不要求方向 */
|
|
|
var fov = null; //若不为null的话,因为可能可见范围的tile下载过了从而无法触发下载,然后得不到下载成功的消息,怎么办
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
|
|
|
pano.loadTiledPano(/* 1024 */ basePanoSize , vectorForward, fov, isclear, l, null).done(function(e, t) {
|
|
|
callback1 && callback1(e, t);
|
|
@@ -98590,15 +98615,15 @@ void main()
|
|
|
.bind(this));
|
|
|
|
|
|
return !0;
|
|
|
- }
|
|
|
-
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
fitPanoTowardPoint(o){ //寻找最适合的点位
|
|
@@ -98622,9 +98647,9 @@ void main()
|
|
|
//if(o.floor)require.push(Panorama.filters.atFloor(o.floor))
|
|
|
let depthTiming = Potree.timeCollect.depthSampler.median;
|
|
|
let checkIntersect = o.checkIntersect;// && depthTiming < 0.3
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
if(o.boundSphere){//只接受boundSphere
|
|
|
let aspect = 1;//size.x / size.y
|
|
|
let dis;
|
|
@@ -98633,9 +98658,8 @@ void main()
|
|
|
}else {
|
|
|
let hfov = cameraLight.getHFOVForCamera(camera , true );
|
|
|
dis = /* size.x */ o.boundSphere.radius /* / 2 */ / (hfov / 2);
|
|
|
- }
|
|
|
-
|
|
|
- bestDistance = dis;//*0.8
|
|
|
+ }
|
|
|
+ bestDistance = dis;//*0.8
|
|
|
|
|
|
}
|
|
|
let disSquareMap = new Map();
|
|
@@ -98672,23 +98696,25 @@ void main()
|
|
|
if(result1){
|
|
|
g = Common$1.sortByScore(result1, [], [(e)=>{//避免遮挡
|
|
|
let pano = e.item;
|
|
|
- let disSquare = disSquareMap.get(pano), score = 0;
|
|
|
+ let disSquare = disSquareMap.get(pano), score = 0, log = 'score: '+pano.id;
|
|
|
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({pos3d:target, margin:0.1, cameraPos:pano})
|
|
|
if(intersect){
|
|
|
score = 0;
|
|
|
}else {
|
|
|
- score = 1000;
|
|
|
+ score = 600;
|
|
|
}
|
|
|
- //console.log('intersect score ', pano.id, score)
|
|
|
+ log += (',intersect: '+intersect );
|
|
|
}else {
|
|
|
- score = 900; //没加载好的话,不管了 , 几乎当做无遮挡,否则容易到不了最近点
|
|
|
+ score = 500; //没加载好的话,不管了 , 几乎当做无遮挡,否则容易到不了最近点
|
|
|
+ log += ',no checkIntersect,';
|
|
|
}
|
|
|
|
|
|
if(atFloor && atFloor.panos.includes(pano)){//如果不在任何一楼呢?
|
|
|
- score += 1000;
|
|
|
+ score += 600;
|
|
|
+ log += ', atFloor,';
|
|
|
}
|
|
|
-
|
|
|
+ console.log(log);
|
|
|
|
|
|
return score + e.score
|
|
|
}]);
|
|
@@ -111184,11 +111210,15 @@ ENDSEC
|
|
|
}
|
|
|
if(this.buildParent)this.dontDragFloorHeight = this.buildParent.dontDragFloorHeight;
|
|
|
|
|
|
+
|
|
|
+ if(this.buildType != 'hole'){
|
|
|
+ this.box = this.createBox(); //无论是否edit都绘制的原因:为了将在外的点移到在内,需要用mesh来获取intersect
|
|
|
+ this.add(this.box);
|
|
|
+ this.box.visible = !!this.ifDraw;
|
|
|
+ }
|
|
|
+
|
|
|
if(this.ifDraw){ //只存储空间模型信息,不绘制
|
|
|
- if(this.buildType != 'hole'){
|
|
|
- this.box = this.createBox();
|
|
|
- this.add(this.box);
|
|
|
- }
|
|
|
+
|
|
|
{
|
|
|
this.lineMesh = LineDraw.createLine([],{color: color$2});
|
|
|
this.lineMesh.name = 'buildingLines';
|
|
@@ -137472,6 +137502,7 @@ ENDSEC
|
|
|
|
|
|
function createBox(box, transform, result) {
|
|
|
const center = new Vector3$1(box[0], box[1], box[2]);
|
|
|
+ result && (result.oriCenter = center);//add
|
|
|
transform.transform(center, center);
|
|
|
let origin = [];
|
|
|
|
|
@@ -138787,6 +138818,10 @@ ENDSEC
|
|
|
const TILES_LOAD_FAILED = 'Failed Tile Loads';
|
|
|
const POINTS_COUNT = 'Points';
|
|
|
const TILES_GPU_MEMORY = 'Tile Memory Use';
|
|
|
+
|
|
|
+
|
|
|
+ let tilesetSid = 0;//add
|
|
|
+
|
|
|
class Tileset3D extends EventDispatcher{//xzw add EventDispatcher
|
|
|
constructor(json, options) {
|
|
|
super();
|
|
@@ -138973,7 +139008,9 @@ ENDSEC
|
|
|
|
|
|
getTileUrl(tilePath) {
|
|
|
const isDataUrl = tilePath.startsWith('data:');
|
|
|
-
|
|
|
+
|
|
|
+ tilePath = Potree.Common.dealURL(tilePath); //add 去除'+'
|
|
|
+
|
|
|
if (isDataUrl) {
|
|
|
return tilePath;
|
|
|
}
|
|
@@ -139191,7 +139228,8 @@ ENDSEC
|
|
|
}
|
|
|
|
|
|
_initializeTileHeaders(tilesetJson, parentTileHeader) {
|
|
|
- const rootTile = new TileHeader(this, tilesetJson.root, parentTileHeader);
|
|
|
+
|
|
|
+ const rootTile = new TileHeader(this, tilesetJson.root, parentTileHeader, parentTileHeader == void 0 && 'root_'+tilesetSid++);
|
|
|
|
|
|
if (parentTileHeader) {
|
|
|
parentTileHeader.children.push(rootTile);
|
|
@@ -145938,8 +145976,12 @@ ENDSEC
|
|
|
const { boundingVolume } = tile;
|
|
|
let redColor = 0;
|
|
|
if (tile.content) {
|
|
|
- redColor = Math.min(tile.content.byteLength / 500000, 1.0);
|
|
|
- }
|
|
|
+ //redColor = Math.min((tile.content.byteLength != void 0 ? tile.content.byteLength : 0) / 500000, 1.0);
|
|
|
+ redColor = Math.min( tile.depth / 10 , 1.0); //改
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
const boxColor = new Color(redColor, 1.0, 0.0);
|
|
|
const boxGeometry = new BoxGeometry(1, 1, 1);
|
|
|
const boxTransform = new Matrix4();
|
|
@@ -145949,10 +145991,34 @@ ENDSEC
|
|
|
else if (boundingVolume.radius) {
|
|
|
boxGeometry.scale(boundingVolume.radius * 2, boundingVolume.radius * 2, boundingVolume.radius * 2);
|
|
|
}
|
|
|
+
|
|
|
+ boxTransform.premultiply((new Matrix4()).setPosition(...boundingVolume.center)); //add
|
|
|
+
|
|
|
+
|
|
|
boxGeometry.applyMatrix4(boxTransform);
|
|
|
+
|
|
|
+
|
|
|
const edges = new EdgesGeometry(boxGeometry);
|
|
|
- const dispPlane = new LineSegments(edges, new LineBasicMaterial({ color: boxColor }));
|
|
|
- dispPlane.position.copy(new Vector3(...boundingVolume.center));
|
|
|
+ const dispPlane = new LineSegments(edges, new LineBasicMaterial({ color: boxColor, transparent:true }));
|
|
|
+ //dispPlane.position.copy(new Vector3$1(...boundingVolume.center));
|
|
|
+ dispPlane.matrixAutoUpdate = false; //add
|
|
|
+
|
|
|
+
|
|
|
+ /* if(tile.content.byteLength == void 0){
|
|
|
+ let oldUpdate = dispPlane.updateMatrixWorld.bind(dispPlane)
|
|
|
+ dispPlane.updateMatrixWorld = (a,b)=>{
|
|
|
+ oldUpdate(a,b)
|
|
|
+ }
|
|
|
+
|
|
|
+ let oldU = dispPlane.updateMatrix.bind(dispPlane)
|
|
|
+ dispPlane.updateMatrix = (a,b)=>{
|
|
|
+ oldU(a,b)
|
|
|
+ }
|
|
|
+
|
|
|
+ } */
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
return dispPlane;
|
|
|
}
|
|
|
function getMatrix4FromHalfAxes(halfAxes) {
|
|
@@ -146274,8 +146340,11 @@ ENDSEC
|
|
|
const unloadQueue = [];
|
|
|
const root = new Group();
|
|
|
const tileBoxes = new Group();
|
|
|
+ tileBoxes.matrixAutoUpdate = false;//add
|
|
|
if (!options.debug) {
|
|
|
tileBoxes.visible = false;
|
|
|
+ }else {
|
|
|
+ options.parent.add(tileBoxes); //add
|
|
|
}
|
|
|
const pointcloudUniforms = {
|
|
|
pointSize: { type: 'f', value: options.pointSize },
|
|
@@ -146345,7 +146414,7 @@ ENDSEC
|
|
|
if (options.debug) {
|
|
|
const box = loadersBoundingBoxToMesh(tile);
|
|
|
tileBoxes.add(box);
|
|
|
- boxMap[tile.id] = box;
|
|
|
+ boxMap[tile.id] = box;
|
|
|
}
|
|
|
//xzw :
|
|
|
tileset.dispatchEvent({type:'tileLoaded',tileContent}); //每一个tile加载完要更改透明度等
|
|
@@ -146510,6 +146579,7 @@ ENDSEC
|
|
|
if(visiVertexCount<maxVertexVisi){
|
|
|
renderMap[tile.id].visible = true;
|
|
|
visiVertexCount += renderMap[tile.id].vertexCount; //xzw add
|
|
|
+ options.debug && (boxMap[tile.id].material.opacity = 1);
|
|
|
}else {
|
|
|
console.log('超出', visiVertexCount);
|
|
|
}
|
|
@@ -146520,6 +146590,8 @@ ENDSEC
|
|
|
if (renderMap[tile.id]) {
|
|
|
if(renderMap[tile.id].visible){
|
|
|
renderMap[tile.id].visible = false;
|
|
|
+ options.debug && (boxMap[tile.id].material.opacity = 0.1);
|
|
|
+
|
|
|
visiVertexCount -= renderMap[tile.id].vertexCount; //xzw add
|
|
|
}
|
|
|
}
|
|
@@ -146644,8 +146716,17 @@ ENDSEC
|
|
|
pointcloudUniforms.rootNormal.value.copy(new Vector3(0, 0, 1).applyMatrix4(lastRootTransform).normalize());
|
|
|
rootTransformInverse.copy(lastRootTransform).invert();
|
|
|
if (options.debug) {
|
|
|
- boxMap[tileset.root.id].matrixWorld.copy(threeMat);
|
|
|
- boxMap[tileset.root.id].applyMatrix4(lastRootTransform);
|
|
|
+ /* console.log('move', tileset.root.id, boxMap[tileset.root.id].matrix.elements, boxMap[tileset.root.id].matrixWorld.elements)
|
|
|
+ boxMap[tileset.root.id].matrix.copy(root.matrixWorld);
|
|
|
+ boxMap[tileset.root.id].matrixWorld.copy(root.matrixWorld); */
|
|
|
+
|
|
|
+
|
|
|
+ //boxMap[tileset.root.id].applyMatrix4(threeMat);
|
|
|
+ tileBoxes.matrix.copy(root.matrixWorld);
|
|
|
+
|
|
|
+ //boxMap[tileset.root.id].matrixWorld.copy(threeMat);
|
|
|
+ //boxMap[tileset.root.id].applyMatrix4(lastRootTransform);//boxMap[tileset.root.id].applyMatrix4(lastRootTransform);
|
|
|
+ //boxMap[tileset.root.id].updateWorldMatrix()
|
|
|
}
|
|
|
}
|
|
|
if (this.lastCameraTransform == null) {
|
|
@@ -146694,13 +146775,14 @@ ENDSEC
|
|
|
}
|
|
|
}
|
|
|
function createGLTFNodes(gltfLoader, tile, unlitMaterial, options, rootTransformInverse) {
|
|
|
+
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
return new Promise((resolve, reject) => {
|
|
|
var _a;
|
|
|
const rotateX = new Matrix4().makeRotationAxis(new Vector3(1, 0, 0), Math.PI / 2);
|
|
|
const shouldRotate = ((_a = tile.tileset.asset) === null || _a === void 0 ? void 0 : _a.gltfUpAxis) !== "Z";
|
|
|
// The computed trasnform already contains the root's transform, so we have to invert it
|
|
|
- const contentTransform = new Matrix4().fromArray(tile.computedTransform).premultiply(rootTransformInverse);
|
|
|
+ const contentTransform = new Matrix4() .fromArray(tile.computedTransform).premultiply(rootTransformInverse); //xzw 删。原先的会造成移动后tiles错乱
|
|
|
if (shouldRotate) {
|
|
|
contentTransform.multiply(rotateX); // convert from GLTF Y-up to Z-up
|
|
|
}
|
|
@@ -149842,7 +149924,7 @@ ENDSEC
|
|
|
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 cameraPos = this.mainViewport.view.position.clone();
|
|
@@ -149877,7 +149959,7 @@ ENDSEC
|
|
|
while(old = shelterHistory[0], now - old.lastTime > 1000){//因为不知热点个数,所以需要加上时间限制,超过时间才能删。
|
|
|
if(old == history || shelterHistory.length == minCount)break;
|
|
|
shelterHistory.pop();
|
|
|
- console.log('delete');
|
|
|
+ //console.log('delete')
|
|
|
}
|
|
|
|
|
|
|
|
@@ -149899,20 +149981,20 @@ ENDSEC
|
|
|
ifShelter = !!viewer.inputHandler.ifBlockedByIntersect({pos3d, margin:0.3, useDepthTex:true, pano } );
|
|
|
history.panos[panoId] = ifShelter;
|
|
|
this.shelterCount.byTex ++ ;
|
|
|
- console.log('computeByTex direct');
|
|
|
+ //console.log('computeByTex direct', panoId, ifShelter)
|
|
|
}else {
|
|
|
- console.log('延迟tex' );
|
|
|
+ //console.log('延迟tex' )
|
|
|
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:0.3 } );
|
|
|
+ ifShelter = !!viewer.inputHandler.ifBlockedByIntersect({pos3d, margin:0.3, pickWindowSize:3} );
|
|
|
history.notAtPano = {cameraPos , ifShelter };
|
|
|
this.shelterCount.byCloud ++ ;
|
|
|
- console.log('computeByCloud direct', pos3d.toArray());
|
|
|
+ //console.log('computeByCloud direct', pos3d.toArray())
|
|
|
}else {
|
|
|
- console.log('延迟cloud' );
|
|
|
+ //console.log('延迟cloud' )
|
|
|
history.waitCompute = {cameraPos};
|
|
|
return useLastResult()
|
|
|
}
|
|
@@ -149970,7 +150052,7 @@ ENDSEC
|
|
|
history.panos[this.images360.currentPano.id] = ifShelter;
|
|
|
history.ifShelter = ifShelter;
|
|
|
delete history.waitCompute;
|
|
|
- console.log('补1', history.pos3d.toArray());
|
|
|
+ //console.log('补1', history.pos3d.toArray())
|
|
|
}else {
|
|
|
waitCloud.push(history);
|
|
|
}
|
|
@@ -149983,7 +150065,7 @@ ENDSEC
|
|
|
|
|
|
let maxCloudCount;
|
|
|
if(byTex < maxTexCount && waitCloud.length){
|
|
|
- maxCloudCount = this.lastFrameChanged ? Common$1.getBestCount('shelterMaxDepthSample', 0, 2, 4, 8 ,true ) : 5;
|
|
|
+ maxCloudCount = this.lastFrameChanged ? Common$1.getBestCount('shelterMaxCloud', 0, 2, 4, 8 /* ,true */ ) : 5;
|
|
|
let waitCloud2 = [];
|
|
|
if(maxCloudCount){
|
|
|
for(let i=0; i<waitCloud.length; i++){
|
|
@@ -150006,11 +150088,12 @@ ENDSEC
|
|
|
if(maxCloudCount){
|
|
|
let list = waitCloud2.map(e=>e.pos3d);
|
|
|
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);
|
|
|
+ //list.length>0 && console.log('list',list, maxCloudCount)
|
|
|
|
|
|
result.list.forEach(e=>{
|
|
|
- let history = waitCloud2.find(a=>a.pos3d == e);
|
|
|
- let ifShelter = !!viewer.inputHandler.ifBlockedByIntersect({pos3d:history.pos3d, margin:0.3 } );
|
|
|
+ let history = waitCloud2.find(a=>a.pos3d.equals(e));
|
|
|
+
|
|
|
+ let ifShelter = !!viewer.inputHandler.ifBlockedByIntersect({pos3d:history.pos3d, margin:0.3 , pickWindowSize:3} );
|
|
|
|
|
|
if(history.waitCompute.cameraPos){
|
|
|
history.notAtPano = {cameraPos: history.waitCompute.cameraPos , ifShelter };
|
|
@@ -150019,7 +150102,7 @@ ENDSEC
|
|
|
}
|
|
|
history.ifShelter = ifShelter;
|
|
|
byCloud++;
|
|
|
- console.log('补2', history.pos3d.toArray());
|
|
|
+ //console.log('补2', history.pos3d.toArray())
|
|
|
delete history.waitCompute;
|
|
|
});
|
|
|
|
|
@@ -150031,7 +150114,7 @@ ENDSEC
|
|
|
if(byTex || byCloud){
|
|
|
//console.log('shelterComputed',byTex,byCloud, maxTexCount, maxCloudCount)
|
|
|
Common$1.intervalTool.isWaiting('shelterComputed', ()=>{
|
|
|
- console.log('shelterComputed update');
|
|
|
+ //console.log('shelterComputed update')
|
|
|
this.dispatchEvent('shelterComputed');
|
|
|
},340);
|
|
|
}
|
|
@@ -152874,6 +152957,7 @@ ENDSEC
|
|
|
this.mapViewer.moveTo(target.clone(), null, duration);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
if(Potree.settings.displayMode == 'showPointCloud'){
|
|
|
if(o.dontChangePos){
|
|
|
position.copy(cameraPos);
|
|
@@ -152883,20 +152967,40 @@ ENDSEC
|
|
|
if(o.dontLookUp && dir.z<0) dir.z *= -1;
|
|
|
position.copy(target).add(dir.multiplyScalar(dis));
|
|
|
}
|
|
|
- /* if(o.checkIntersect){//识别被点云遮住的话
|
|
|
- let ifShelter
|
|
|
-
|
|
|
- while(1){
|
|
|
- ifShelter = this.inputHandler.ifBlockedByIntersect(target, o.checkMargin, position)
|
|
|
- if(ifShelter){
|
|
|
- if(dis > 0.5){
|
|
|
- dis --
|
|
|
- dir.dot(ifShelter.normal)>0 ? dir.copy(ifShelter.normal).negate() : dir.copy(ifShelter.normal);
|
|
|
- position.copy(target).add(dir.multiplyScalar(dis))
|
|
|
+
|
|
|
+ if(o.sameFloor){//需要在同一楼层
|
|
|
+ let atFloor = this.modules.SiteModel.pointInWhichEntity(target, 'floor');
|
|
|
+ if(atFloor){
|
|
|
+ let camFloor = this.modules.SiteModel.pointInWhichEntity(position, 'floor');
|
|
|
+ if(camFloor != atFloor){
|
|
|
+ let raycaster = new Raycaster();
|
|
|
+ let origin = target;
|
|
|
+ let dir = new Vector3().subVectors( position, target ).normalize();
|
|
|
+ raycaster.set(origin, dir);
|
|
|
+ let intersect = Potree.Utils.getIntersect(null, [atFloor.box], null, raycaster);
|
|
|
+ if(intersect){
|
|
|
+ let dis = MathUtils.clamp(intersect.distance - 0.2, camera.near, intersect.distance);
|
|
|
+ position.addVectors(origin, dir.multiplyScalar(dis));
|
|
|
+ console.log('移动到楼层');
|
|
|
+ }else {
|
|
|
+ console.error('?no intersect?');
|
|
|
}
|
|
|
- }
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
- } */
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if(o.checkIntersect){//识别被点云遮住的话
|
|
|
+ let intersect; //反向查找从target到相机的第一个intersect
|
|
|
+ intersect = this.inputHandler.ifBlockedByIntersect({pos3d:position, margin:0, cameraPos:target} /* {pos3d:target, margin: 0.2, cameraPos:position} */);
|
|
|
+
|
|
|
+ if(intersect){
|
|
|
+ position.copy(intersect.location);
|
|
|
+ console.log('移近');
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
}else if(Potree.settings.displayMode == 'showPanos'){
|
|
|
let pano = viewer.images360.fitPanoTowardPoint({
|
|
@@ -153567,7 +153671,7 @@ ENDSEC
|
|
|
return
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ fileInfo.url = Common$1.dealURL(fileInfo.url); //去除'+'
|
|
|
|
|
|
//let fileType = fileInfo.tilesUrl ? '3dTiles' : fileInfo.objurl ? 'obj' : 'glb'
|
|
|
|
|
@@ -153726,10 +153830,11 @@ ENDSEC
|
|
|
options: {
|
|
|
//dracoDecoderPath: '../utils/loaders/DRACOLoader/draco',
|
|
|
//basisTranscoderPath: '../utils/loaders/KTX2Loader/basis',
|
|
|
- maximumScreenSpaceError: 100,
|
|
|
- maxDepth: 20,
|
|
|
+ maximumScreenSpaceError: 50,
|
|
|
+ maxDepth: 100,
|
|
|
maximumMemoryUsage: 700, //缓存大小。 若太小,密集的tile反复加载很卡
|
|
|
-
|
|
|
+ //debug:true,
|
|
|
+ parent: this.scene.scene
|
|
|
},
|
|
|
});
|
|
|
console.log(result);
|