|
@@ -580,7 +580,7 @@
|
|
|
skybox: 1,
|
|
|
pointcloud: 11,
|
|
|
sceneObjects:0,//default
|
|
|
-
|
|
|
+ model : 2,
|
|
|
|
|
|
measure:4,
|
|
|
magnifier:5,
|
|
@@ -60006,7 +60006,7 @@ void main() {
|
|
|
this.dragChange(I.clone(), i, atMap);
|
|
|
|
|
|
/* if(this.points_datasets){
|
|
|
- if(e.intersectPoint.pointcloud) this.points_datasets[i] = e.intersectPoint.pointcloud.dataset_id
|
|
|
+ if(e.intersect.pointcloud) this.points_datasets[i] = e.intersect.pointcloud.dataset_id
|
|
|
else this.points_datasets[i] = null
|
|
|
} */
|
|
|
if(this.points_datasets){
|
|
@@ -60946,7 +60946,7 @@ void main() {
|
|
|
|
|
|
setEdgesDisplay(state, ignoreGuideLine){
|
|
|
this.closed && this.edgeLabels.forEach(e=>e.setVisible(!!(state && e.shouldVisi)) );
|
|
|
-
|
|
|
+
|
|
|
if(!ignoreGuideLine && this.measureType == 'Distance'){
|
|
|
this.horEdgeLabel.visible = this.verEdgeLabel.visible = this.horGuideEdge.visible = this.verGuideEdge.visible = !!(state && this.shouldShowHorVerGuide);
|
|
|
}
|
|
@@ -78289,6 +78289,8 @@ void main() {
|
|
|
|
|
|
|
|
|
render(o={}){
|
|
|
+ if(this.scene.children.length == 0)return
|
|
|
+
|
|
|
viewer.setCameraLayers(o.camera, ['measure']);
|
|
|
|
|
|
if(o.screenshot){ //抗锯齿
|
|
@@ -78966,6 +78968,11 @@ void main() {
|
|
|
this.scene.add(this.frame);
|
|
|
viewer.setObjectLayers(this.scene, 'transformationTool' );
|
|
|
|
|
|
+ this.scene.traverse(e=>{
|
|
|
+ e.pickDontCheckDis = true; //pick时不需要识别是否在点云之上
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
@@ -79860,7 +79867,7 @@ void main() {
|
|
|
let camera = this.viewer.scene.getActiveCamera();
|
|
|
|
|
|
|
|
|
- var I = e.intersectPoint;
|
|
|
+ var I = e.intersect;
|
|
|
if (I) {
|
|
|
volume.position.copy(I.location);
|
|
|
|
|
@@ -80350,11 +80357,7 @@ void main() {
|
|
|
|
|
|
//viewer.dispatchEvent({type: "render.pass.begin",viewer: viewer});
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
let lights = [];
|
|
|
/* viewer.scene.scene.traverse(node => {
|
|
|
if(node.type === "SpotLight"){
|
|
@@ -80404,27 +80407,24 @@ void main() {
|
|
|
if(useDepthTex)return
|
|
|
}
|
|
|
|
|
|
- if(viewer.scene.pointclouds.length == 0)return
|
|
|
|
|
|
+ const visiblePointClouds2 = viewer.scene.pointclouds.filter(pc => viewer.getObjVisiByReason(pc,'datasetSelection') ); //需要绘制到rtEDL的
|
|
|
+ const showPointClouds = params.magnifier ? visiblePointClouds2.length>0 : viewer.scene.pointclouds.some(e=>e.visible); //是否有需要绘制到屏幕的
|
|
|
|
|
|
- //const visiblePointClouds = viewer.scene.pointclouds.filter(pc => pc.visible );
|
|
|
- const visiblePointClouds2 = viewer.scene.pointclouds.filter(pc => viewer.getObjVisiByReason(pc,'datasetSelection') );
|
|
|
- const showPointClouds = viewer.scene.pointclouds.some(e=>e.visible);
|
|
|
-
|
|
|
- viewer.scene.pointclouds.forEach(e=>{//为了绘制到depthTexture,先显示(展示全景图时隐藏了点云,所以需要显示下。且放大镜需要绘制点云)
|
|
|
+ visiblePointClouds2.forEach(e=>{//为了绘制到depthTexture,先显示(展示全景图时隐藏了点云,所以需要显示下。且放大镜需要绘制点云)
|
|
|
e.oldVisi = e.visible;
|
|
|
- if(viewer.getObjVisiByReason(e, 'datasetSelection') ) e.visible = true;
|
|
|
+ e.visible = true;
|
|
|
});
|
|
|
|
|
|
|
|
|
- //pointcloud
|
|
|
+
|
|
|
viewer.setCameraLayers(camera, ['pointcloud']);
|
|
|
camera.layers.set(Potree.config.renderLayers.pointcloud);
|
|
|
|
|
|
//TODO adapt to multiple lights
|
|
|
//this.renderShadowMap(visiblePointClouds2, camera, lights); //???????
|
|
|
|
|
|
- { //scenePointCloud COLOR & DEPTH PASS
|
|
|
+ {
|
|
|
for (let pointcloud of visiblePointClouds2) {
|
|
|
|
|
|
let material = pointcloud.material;
|
|
@@ -80454,39 +80454,23 @@ void main() {
|
|
|
}
|
|
|
|
|
|
|
|
|
- if(Features.EXT_DEPTH.isSupported() && !params.dontRenderRtEDL){
|
|
|
- //借用rtEDL存储深度信息
|
|
|
+ if(Features.EXT_DEPTH.isSupported() && !params.dontRenderRtEDL){
|
|
|
+ //借用rtEDL存储深度信息
|
|
|
viewer.renderer.setRenderTarget(params.rtEDL || this.getRtEDL(params.viewport)/* this.rtEDL */);
|
|
|
-
|
|
|
- //pointDensity已经使用的是panorama模式,在画面边缘点云会稀疏,遮挡效果差
|
|
|
-
|
|
|
- /* if(Potree.settings.displayMode == "showPanos"){ //还原成点云模式的材质,且可能要更大些,因点云变稀疏
|
|
|
- var matBefore = {
|
|
|
- pointSizeType : new Map(),
|
|
|
- size : new Map(),
|
|
|
- usePanoMap : new Map(),
|
|
|
- }
|
|
|
- for (let pointcloud of visiblePointClouds2) {
|
|
|
- matBefore.usePanoMap.set(pointcloud, pointcloud.material.usePanoMap)
|
|
|
- //matBefore.pointSizeType.set(pointcloud, pointcloud.material.pointSizeType)
|
|
|
- matBefore.size.set(pointcloud, pointcloud.temp.pointSize)
|
|
|
-
|
|
|
- //pointcloud.material.pointSizeType = Potree.config.material.pointSizeType //不能修改这项,因为是define,会卡。
|
|
|
- //pointcloud.changePointSize(pointcloud.temp.pointSize * (1+Potree.config.material.sizeAddAtPanoRtEDL))
|
|
|
-
|
|
|
- //pointcloud.changePointSize(Potree.config.material.sizeAtPanoRtEDL, true)
|
|
|
- pointcloud.material.usePanoMap = false //禁止使用absolutePanoramaSize大小
|
|
|
-
|
|
|
- }
|
|
|
- } */
|
|
|
- //渲染scenePointCloud到rtEDL
|
|
|
- viewer.pRenderer.render(viewer.scene.scenePointCloud, camera, params.rtEDL || this.getRtEDL(params.viewport), {
|
|
|
- shadowMaps: lights.length > 0 ? [this.shadowMap] : null,
|
|
|
- clipSpheres: viewer.scene.volumes.filter(v => (v instanceof SphereVolume)),
|
|
|
- transparent: false,
|
|
|
- });
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+ if(visiblePointClouds2.length>0){
|
|
|
+ //渲染scenePointCloud到rtEDL
|
|
|
+ viewer.pRenderer.render(viewer.scene.scenePointCloud, camera, params.rtEDL || this.getRtEDL(params.viewport), {
|
|
|
+ shadowMaps: lights.length > 0 ? [this.shadowMap] : null,
|
|
|
+ clipSpheres: viewer.scene.volumes.filter(v => (v instanceof SphereVolume)),
|
|
|
+ transparent: false,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if(Potree.settings.intersectOnObjs){// model也要渲染到rtEDL
|
|
|
+ camera.layers.set(Potree.config.renderLayers.model);
|
|
|
+ viewer.renderer.render(viewer.scene.scene, camera);
|
|
|
+ }
|
|
|
//test
|
|
|
/* {
|
|
|
viewer.objs.traverse((obj)=>{
|
|
@@ -80501,17 +80485,7 @@ void main() {
|
|
|
obj.material = obj.standardMat
|
|
|
}
|
|
|
})
|
|
|
- } */
|
|
|
-
|
|
|
-
|
|
|
- /* if(Potree.settings.displayMode == "showPanos"){
|
|
|
- for (let pointcloud of visiblePointClouds2) {
|
|
|
-
|
|
|
- //pointcloud.material.pointSizeType = matBefore.pointSizeType.get(pointcloud)
|
|
|
- pointcloud.material.usePanoMap = matBefore.usePanoMap.get(pointcloud)
|
|
|
- //pointcloud.changePointSize(matBefore.size.get(pointcloud))
|
|
|
- }
|
|
|
- } */
|
|
|
+ } */
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -80522,52 +80496,52 @@ void main() {
|
|
|
viewer.dispatchEvent({type: "render.pass.scene", viewer: viewer/* , renderTarget: this.rtRegular */});
|
|
|
viewer.renderer.setRenderTarget(params.target || null);
|
|
|
|
|
|
- if(!params.magnifier)viewer.scene.pointclouds.forEach(e=>{//放大镜显示点云
|
|
|
+ if(!params.magnifier)visiblePointClouds2.forEach(e=>{//放大镜显示点云
|
|
|
e.visible = e.oldVisi;
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
- //设置edlMaterial
|
|
|
- if(viewer.useEDL && showPointClouds /* || params.magnifier */) {
|
|
|
- //Features.EXT_DEPTH不支持的话不会到这一块
|
|
|
+ if(showPointClouds){ //绘制点云到画布
|
|
|
+ if(viewer.useEDL) { //设置edlMaterial
|
|
|
+ //Features.EXT_DEPTH不支持的话不会到这一块
|
|
|
+
|
|
|
+ const uniforms = this.edlMaterial.uniforms;
|
|
|
+ //if(viewer.useEDL){
|
|
|
+ /* uniforms.screenWidth.value = width;
|
|
|
+ uniforms.screenHeight.value = height; */
|
|
|
+ uniforms.resolution.value.copy(resolution);
|
|
|
+
|
|
|
+ uniforms.edlStrength.value = viewer.edlStrength;
|
|
|
+ uniforms.radius.value = viewer.edlRadius;
|
|
|
+ uniforms.useEDL.value = 1;//add
|
|
|
+ /* }else{
|
|
|
+ uniforms.useEDL.value = 0;//add
|
|
|
+ } */
|
|
|
+
|
|
|
+ let proj = camera.projectionMatrix;
|
|
|
+ let projArray = new Float32Array(16);
|
|
|
+ projArray.set(proj.elements);
|
|
|
+ uniforms.uProj.value = projArray;
|
|
|
|
|
|
- const uniforms = this.edlMaterial.uniforms;
|
|
|
- //if(viewer.useEDL){
|
|
|
- /* uniforms.screenWidth.value = width;
|
|
|
- uniforms.screenHeight.value = height; */
|
|
|
- uniforms.resolution.value.copy(resolution);
|
|
|
+ uniforms.uEDLColor.value = (params.rtEDL || this.getRtEDL(params.viewport)).texture;
|
|
|
+ //uniforms.uEDLDepth.value = (params.rtEDL || this.getRtEDL(params.viewport)).depthTexture; //其实没用到
|
|
|
+
|
|
|
+ uniforms.opacity.value = viewer.edlOpacity; // HACK
|
|
|
+
|
|
|
|
|
|
- uniforms.edlStrength.value = viewer.edlStrength;
|
|
|
- uniforms.radius.value = viewer.edlRadius;
|
|
|
- uniforms.useEDL.value = 1;//add
|
|
|
- /* }else{
|
|
|
- uniforms.useEDL.value = 0;//add
|
|
|
- } */
|
|
|
-
|
|
|
- let proj = camera.projectionMatrix;
|
|
|
- let projArray = new Float32Array(16);
|
|
|
- projArray.set(proj.elements);
|
|
|
- uniforms.uProj.value = projArray;
|
|
|
-
|
|
|
- uniforms.uEDLColor.value = (params.rtEDL || this.getRtEDL(params.viewport)).texture;
|
|
|
- //uniforms.uEDLDepth.value = (params.rtEDL || this.getRtEDL(params.viewport)).depthTexture; //其实没用到
|
|
|
-
|
|
|
- uniforms.opacity.value = viewer.edlOpacity; // HACK
|
|
|
-
|
|
|
-
|
|
|
- Utils.screenPass.render(viewer.renderer, this.edlMaterial, params.target);
|
|
|
- }else {
|
|
|
- //渲染点云 (直接用rtEDL上的会失去抗锯齿)
|
|
|
- viewer.pRenderer.render(viewer.scene.scenePointCloud, camera, null , {
|
|
|
- shadowMaps: lights.length > 0 ? [this.shadowMap] : null,
|
|
|
- clipSpheres: viewer.scene.volumes.filter(v => (v instanceof SphereVolume))
|
|
|
- });
|
|
|
- }
|
|
|
+ Utils.screenPass.render(viewer.renderer, this.edlMaterial, params.target);
|
|
|
+ }else {
|
|
|
+ //渲染点云 (直接用rtEDL上的会失去抗锯齿)
|
|
|
+ viewer.pRenderer.render(viewer.scene.scenePointCloud, camera, null , {
|
|
|
+ shadowMaps: lights.length > 0 ? [this.shadowMap] : null,
|
|
|
+ clipSpheres: viewer.scene.volumes.filter(v => (v instanceof SphereVolume))
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
//viewer.dispatchEvent({type: "render.pass.end",viewer: viewer});
|
|
|
- viewer.scene.pointclouds.forEach(e=>{
|
|
|
+ visiblePointClouds2.forEach(e=>{
|
|
|
e.visible = e.oldVisi;
|
|
|
});
|
|
|
|
|
@@ -84069,7 +84043,7 @@ void main() {
|
|
|
if(pointclouds){
|
|
|
this.dispatchEvent({
|
|
|
type : "transformPointcloud",
|
|
|
- intersectPoint: e.intersectPoint.orthoIntersect,
|
|
|
+ intersect: e.intersect.orthoIntersect,
|
|
|
intersectStart: e.drag.intersectStart.orthoIntersect,
|
|
|
moveVec,
|
|
|
pointclouds,
|
|
@@ -84280,9 +84254,9 @@ void main() {
|
|
|
};
|
|
|
let prepareRotate = (e)=>{
|
|
|
this.pointerDragStart = e.pointer.clone();
|
|
|
- this.intersectStart = e.intersectPoint && e.intersectPoint.location && {
|
|
|
- location : e.intersectPoint.location,
|
|
|
- pointer : e.intersectPoint.location.clone().project(e.dragViewport.camera) //intersect点在屏幕中的位置
|
|
|
+ this.intersectStart = e.intersect && e.intersect.location && {
|
|
|
+ location : e.intersect.location,
|
|
|
+ pointer : e.intersect.location.clone().project(e.dragViewport.camera) //intersect点在屏幕中的位置
|
|
|
};
|
|
|
//console.log('prepareRotate' )
|
|
|
};
|
|
@@ -84405,7 +84379,7 @@ void main() {
|
|
|
camera,
|
|
|
this.viewer,
|
|
|
this.scene.pointclouds); */
|
|
|
- var I = this.viewer.inputHandler.intersectPoint;
|
|
|
+ var I = this.viewer.inputHandler.intersect;
|
|
|
if (!I) {
|
|
|
return;
|
|
|
}
|
|
@@ -85165,7 +85139,7 @@ void main() {
|
|
|
}
|
|
|
|
|
|
|
|
|
- this.drag.intersectStart = this.intersectPoint;
|
|
|
+ this.drag.intersectStart = this.intersect;
|
|
|
this.mouseDownMouse = this.mouse.clone();
|
|
|
|
|
|
this.pointerDownTime = Date.now();
|
|
@@ -85331,7 +85305,7 @@ void main() {
|
|
|
}
|
|
|
|
|
|
let desc = this.getEventDesc(e,isTouch);
|
|
|
- //if(!clickElement){
|
|
|
+ if(!clickElement){
|
|
|
this.viewer.dispatchEvent($.extend(
|
|
|
desc,
|
|
|
{
|
|
@@ -85339,7 +85313,7 @@ void main() {
|
|
|
pressDistance
|
|
|
}
|
|
|
));
|
|
|
- //}
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
@@ -85473,15 +85447,15 @@ void main() {
|
|
|
usePointcloud = true; //只有使用点云才允许换位置
|
|
|
}
|
|
|
|
|
|
- let intersectPoint = this.getIntersect(this.hoverViewport, true, pickWindowSize, null, usePointcloud, {point, cameraPos, pano});
|
|
|
+ let intersect = this.getIntersect(this.hoverViewport, true, pickWindowSize, null, usePointcloud, {point, cameraPos, pano});
|
|
|
let cameraPos_ = (!usePointcloud && pano) ? pano.position : (cameraPos||this.hoverViewport.view.position);
|
|
|
- if(intersectPoint && intersectPoint.distance+margin <= point.distanceTo(cameraPos_)){
|
|
|
- return intersectPoint //被遮挡
|
|
|
+ if(intersect && intersect.distance+margin <= point.distanceTo(cameraPos_)){
|
|
|
+ return intersect //被遮挡
|
|
|
}
|
|
|
//点云模式,对没加载出的点云不准确。 尤其是需要修改相机位置时,因临时修改并不能使点云加载。
|
|
|
}
|
|
|
|
|
|
- getIntersect(viewport, onlyGetIntersect, pickWindowSize, dontIntersectPointcloud, usePointcloud, prop={}){
|
|
|
+ getIntersect(viewport, onlyGetIntersect, pickWindowSize, dontIntersect, usePointcloud, prop={}){
|
|
|
let intersectPoint;
|
|
|
let camera = viewport.camera;
|
|
|
|
|
@@ -85513,7 +85487,7 @@ void main() {
|
|
|
this.mouse.set(Math.round(viewport.resolution.x/2), Math.round(viewport.resolution.y/2));
|
|
|
}
|
|
|
|
|
|
- intersectPoint = (viewport.noPointcloud || dontIntersectPointcloud)? null : Utils.getMousePointCloudIntersection(
|
|
|
+ intersectPoint = (viewport.noPointcloud || dontIntersect)? null : Utils.getMousePointCloudIntersection(
|
|
|
viewport,
|
|
|
this.mouse,
|
|
|
this.pointer,
|
|
@@ -85535,7 +85509,7 @@ void main() {
|
|
|
let intersect;
|
|
|
let intersectOnModel;
|
|
|
|
|
|
- if(Potree.settings.intersectOnObjs){
|
|
|
+ if(Potree.settings.intersectOnObjs && !dontIntersect){
|
|
|
let intesects = this.getHoveredElements(viewer.objs.children, true);
|
|
|
|
|
|
|
|
@@ -85617,15 +85591,15 @@ void main() {
|
|
|
this.hoverViewport = viewport;
|
|
|
if(!viewport)return//刚变化viewport时会找不到
|
|
|
|
|
|
- let isFlying = this.viewer.viewports.some(e=>e.view.isFlying());
|
|
|
+ let isFlying = this.viewer.viewports.some(e=>e.view.isFlying()) || viewer.scene.cameraAnimations.some(c=>c.onUpdate);
|
|
|
let intersect;
|
|
|
|
|
|
|
|
|
if(e.onlyGetIntersect || !this.drag || this.drag.object || viewport.alignment ){ //没有拖拽物体,但按下鼠标了的话,不intersect
|
|
|
|
|
|
- let dontIntersectPointcloud = this.drag && viewport.alignment && Potree.settings.editType == 'pano' || isFlying;/* viewer.images360.flying */ // flying 时可能卡顿
|
|
|
+ let dontIntersect = this.drag && viewport.alignment && Potree.settings.editType == 'pano' || isFlying;/* viewer.images360.flying */ // flying 时可能卡顿
|
|
|
//console.log('dontIntersectPointcloud',dontIntersectPointcloud)
|
|
|
- intersect = this.getIntersect(viewport, e.onlyGetIntersect, e.pickWindowSize, dontIntersectPointcloud, e.whichPointcloud); //数据集多的时候卡顿
|
|
|
+ intersect = this.getIntersect(viewport, e.onlyGetIntersect, e.pickWindowSize, dontIntersect, e.whichPointcloud); //数据集多的时候卡顿
|
|
|
//console.log('intersectPoint', intersectPoint)
|
|
|
}
|
|
|
|
|
@@ -85990,20 +85964,23 @@ void main() {
|
|
|
|
|
|
//raycaster.layers.enableAll()//add
|
|
|
viewer.setCameraLayers(raycaster, //设置能识别到的layers(如空间模型里只有mapViewer能识别到marker)
|
|
|
- ['sceneObjects','mapObjects','measure', 'transformationTool'],
|
|
|
+ ['sceneObjects','mapObjects','measure', 'transformationTool', 'model'],
|
|
|
this.hoverViewport && this.hoverViewport.extraEnableLayers
|
|
|
);
|
|
|
|
|
|
|
|
|
viewer.dispatchEvent( {type:'raycaster', viewport: this.hoverViewport});//add
|
|
|
let intersections = raycaster.intersectObjects(interactables.filter(o => o.visible), true); //原本是false 检测不到children
|
|
|
- //if(this.intersectPoint && this.intersectPoint.distance != void 0){//add
|
|
|
-
|
|
|
+
|
|
|
+ let intersectionsCopy = intersections.slice();
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
if(this.intersect && this.intersect.distance != void 0 && !dontCheckDis){//add
|
|
|
intersections = intersections.filter(e=>{
|
|
|
let material = e.object.material;
|
|
|
|
|
|
- return (material.depthTest == false || material.depthWrite == false) && !material.useDepth //!material.depthTestWhenPick
|
|
|
+ return (e.object.pickDontCheckDis || material.depthTest == false || material.depthWrite == false) && !material.useDepth //!material.depthTestWhenPick
|
|
|
|| ( material.useDepth ? e.distance < this.intersect.distance + material.uniforms.occlusionDistance.value : e.distance < this.intersect.distance )
|
|
|
});
|
|
|
}
|
|
@@ -86024,17 +86001,7 @@ void main() {
|
|
|
});
|
|
|
|
|
|
|
|
|
- let intersectionsCopy = intersections.slice();
|
|
|
- /*
|
|
|
- let intersectOnModel =
|
|
|
-
|
|
|
- for(let i=0;i<intersections.length;i++){
|
|
|
- if(!intersections.oriObject.isModel)continue
|
|
|
- if(this.intersectPoint && intersections.distance < this.intersectPoint.distance ){
|
|
|
-
|
|
|
- }
|
|
|
- } */
|
|
|
-
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -92990,8 +92957,6 @@ void main() {
|
|
|
|
|
|
bump(direction) {//撞墙弹回效果
|
|
|
if (!this.bumping && !this.latestToPano) {
|
|
|
-
|
|
|
- console.log('bump');
|
|
|
let distance = Potree.settings.displayMode == 'showPanos' ? 0.3 : 0.2;//感觉点云模式比全景模式更明显,所以降低
|
|
|
let currentPos = this.position.clone();
|
|
|
let endPosition = new Vector3().addVectors(this.position, direction.clone().multiplyScalar(distance));
|
|
@@ -94123,7 +94088,7 @@ void main() {
|
|
|
|
|
|
this.addEventListener('global_click',(e)=>{
|
|
|
if(!e.isTouch && e.button != MOUSE.LEFT)return
|
|
|
- this.updateClosestPano(e.intersectPoint);
|
|
|
+ this.updateClosestPano(e.intersect);
|
|
|
});
|
|
|
|
|
|
|
|
@@ -111414,15 +111379,15 @@ ENDSEC
|
|
|
|
|
|
let lastPos;
|
|
|
let drag = (e)=>{
|
|
|
- let intersectPoint = e.intersectPoint.orthoIntersect;
|
|
|
+ let intersect = e.intersect.orthoIntersect;
|
|
|
if(lastPos){
|
|
|
- let moveVec = new Vector3().subVectors(intersectPoint, lastPos).setZ(0);
|
|
|
+ let moveVec = new Vector3().subVectors(intersect, lastPos).setZ(0);
|
|
|
this.center.add(moveVec);
|
|
|
this.updatePoints();
|
|
|
this.dispatchEvent({type:'repos'});
|
|
|
|
|
|
}
|
|
|
- lastPos = intersectPoint.clone();
|
|
|
+ lastPos = intersect.clone();
|
|
|
};
|
|
|
let drop = (e)=>{
|
|
|
lastPos = null;
|
|
@@ -111491,7 +111456,7 @@ ENDSEC
|
|
|
var I, atMap;
|
|
|
|
|
|
atMap = e.dragViewport.name == 'mapViewport';
|
|
|
- I = e.intersectPoint.orthoIntersect;
|
|
|
+ I = e.intersect.orthoIntersect;
|
|
|
|
|
|
if (I && dragInfo.lastPos) {
|
|
|
let i = this.edgeMarkers.indexOf(e.drag.object);
|
|
@@ -111618,17 +111583,17 @@ ENDSEC
|
|
|
|
|
|
let lastPos;
|
|
|
bar.addEventListener('drag',(e)=>{
|
|
|
- var intersectPoint = e.intersectPoint.orthoIntersect;
|
|
|
+ var intersect = e.intersect.orthoIntersect;
|
|
|
if(lastPos){
|
|
|
let vec1 = new Vector3().subVectors(lastPos, this.center).setZ(0);
|
|
|
- let vec2 = new Vector3().subVectors(intersectPoint, this.center).setZ(0);
|
|
|
+ let vec2 = new Vector3().subVectors(intersect, this.center).setZ(0);
|
|
|
let angle = math.getAngle(vec1,vec2,'z');
|
|
|
this.angle += angle;
|
|
|
this.rotateBar.rotation.z = this.angle;
|
|
|
this.updatePoints();
|
|
|
this.dispatchEvent({type:'rotate', angle: this.angle});
|
|
|
}
|
|
|
- lastPos = intersectPoint.clone();
|
|
|
+ lastPos = intersect.clone();
|
|
|
});
|
|
|
bar.addEventListener('drop',()=>{
|
|
|
lastPos = null;
|
|
@@ -112063,9 +112028,13 @@ ENDSEC
|
|
|
if(!viewport){
|
|
|
let view = new View();
|
|
|
if(prop.limitBound)view.limitBound = prop.limitBound;
|
|
|
+ prop.direction && (view.direction = prop.direction);
|
|
|
+
|
|
|
viewport = new Viewport(view , this.getOrthoCamera(), prop );
|
|
|
+ if(prop.viewContainsPoints)viewport.viewContainsPoints = prop.viewContainsPoints;
|
|
|
+
|
|
|
//viewport.unableDepth = true //depthBasicMaterial等在此viewport中不开启depth
|
|
|
- prop.direction && (view.direction = prop.direction);
|
|
|
+
|
|
|
}
|
|
|
if(viewport.camera.type == 'OrthographicCamera' ){
|
|
|
viewport.targetPlane = new Plane();
|
|
@@ -112096,11 +112065,14 @@ ENDSEC
|
|
|
viewportFitBound(viewport, bound, center, duration=0, margin){
|
|
|
let view = viewport.view;
|
|
|
let info = {bound};
|
|
|
-
|
|
|
- viewport.targetPlane.setFromNormalAndCoplanarPoint( view.direction.clone(), viewer.bound.center );
|
|
|
+ let {modelSize, modelCenter} = this.getModelBound(viewport);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ viewport.targetPlane.setFromNormalAndCoplanarPoint( view.direction.clone(), modelCenter );
|
|
|
viewport.targetPlane.projectPoint(center, viewport.shiftTarget); //target转换到过模型中心的平面,以保证镜头一定在模型外 this.shiftTarget是得到的
|
|
|
|
|
|
- info.endPosition = this.getPosOutOfModel(viewport);
|
|
|
+ info.endPosition = this.getPosOutOfModel(viewport, modelSize);
|
|
|
|
|
|
//if(viewport.name == 'mapViewport')info.endPosition.z = Math.max(Potree.config.map.cameraHeight, info.endPosition.z)
|
|
|
|
|
@@ -112108,8 +112080,23 @@ ENDSEC
|
|
|
view.moveOrthoCamera(viewport, info , duration );
|
|
|
}
|
|
|
|
|
|
- getPosOutOfModel(viewport){
|
|
|
+
|
|
|
+ getModelBound(viewport){
|
|
|
let {boundSize, center} = viewer.bound;
|
|
|
+ if(viewport.viewContainsPoints){//视野范围内必须要包含的点,直接算入模型区域
|
|
|
+ let boundingBox = viewer.bound.boundingBox.clone();
|
|
|
+ viewport.viewContainsPoints.forEach(point=>{
|
|
|
+ boundingBox.expandByPoint(point);
|
|
|
+ });
|
|
|
+ boundSize = boundingBox.getSize(new Vector3);
|
|
|
+ center = boundingBox.getCenter(new Vector3);
|
|
|
+ }
|
|
|
+ return {modelSize:boundSize, modelCenter:center}
|
|
|
+ }
|
|
|
+
|
|
|
+ getPosOutOfModel(viewport, boundSize){
|
|
|
+ //let {boundSize, center} = viewer.bound
|
|
|
+
|
|
|
let expand = 10;
|
|
|
let radius = boundSize.length() / 2;
|
|
|
let position = viewport.shiftTarget.clone().sub(viewport.view.direction.clone().multiplyScalar(radius + expand));
|
|
@@ -112120,10 +112107,11 @@ ENDSEC
|
|
|
updateCameraOutOfModel(){//因为移动模型导致模型超出相机外,所以更新位置
|
|
|
viewer.viewports.forEach((viewport, i )=>{
|
|
|
if(viewport != viewer.mainViewport){
|
|
|
- viewport.targetPlane.setFromNormalAndCoplanarPoint( viewport.view.direction.clone(), viewer.bound.center );
|
|
|
+ let {modelSize, modelCenter} = this.getModelBound(viewport);
|
|
|
+ viewport.targetPlane.setFromNormalAndCoplanarPoint( viewport.view.direction.clone(), modelCenter);
|
|
|
viewport.targetPlane.projectPoint(viewport.view.position, viewport.shiftTarget); //target转换到过模型中心的平面,以保证镜头一定在模型外 this.shiftTarget是得到的
|
|
|
|
|
|
- let endPosition = this.getPosOutOfModel(viewport.shiftTarget, viewport.view );
|
|
|
+ let endPosition = this.getPosOutOfModel(viewport, modelSize);
|
|
|
//if(viewport.name == 'mapViewport')endPosition.z = Math.max(Potree.config.map.cameraHeight, endPosition.z)
|
|
|
viewport.view.position.copy(endPosition);
|
|
|
}
|
|
@@ -112132,12 +112120,12 @@ ENDSEC
|
|
|
|
|
|
rotateSideCamera(viewport, angle){//侧视图绕模型中心水平旋转
|
|
|
|
|
|
- let {boundSize, center} = viewer.bound;
|
|
|
-
|
|
|
+ //let {boundSize, center} = viewer.bound
|
|
|
+ let {modelSize, modelCenter} = this.getModelBound(viewport);
|
|
|
//找到平移向量
|
|
|
- viewport.targetPlane.setFromNormalAndCoplanarPoint(viewport.view.direction , center );
|
|
|
+ viewport.targetPlane.setFromNormalAndCoplanarPoint(viewport.view.direction , modelCenter );
|
|
|
viewport.targetPlane.projectPoint(viewport.view.position, viewport.shiftTarget ); //target转换到过模型中心的平面,以保证镜头一定在模型外
|
|
|
- let vec = new Vector3().subVectors(center, viewport.shiftTarget);//相对于中心的偏移值,旋转后偏移值也旋转
|
|
|
+ let vec = new Vector3().subVectors(modelCenter, viewport.shiftTarget);//相对于中心的偏移值,旋转后偏移值也旋转
|
|
|
|
|
|
//旋转
|
|
|
var rotMatrix = new Matrix4().makeRotationAxis(new Vector3(0,0,1), angle);
|
|
@@ -112146,10 +112134,10 @@ ENDSEC
|
|
|
|
|
|
|
|
|
vec.applyMatrix4(rotMatrix);
|
|
|
- viewport.shiftTarget.subVectors(center,vec); //新的
|
|
|
+ viewport.shiftTarget.subVectors(modelCenter,vec); //新的
|
|
|
|
|
|
|
|
|
- viewport.view.position = this.getPosOutOfModel(viewport);
|
|
|
+ viewport.view.position = this.getPosOutOfModel(viewport, modelSize);
|
|
|
|
|
|
}
|
|
|
|
|
@@ -112586,7 +112574,7 @@ ENDSEC
|
|
|
if(Potree.settings.editType == 'pano'){
|
|
|
|
|
|
let center = e.intersectStart; //旋转中心是mousedown的位置
|
|
|
- if(e.intersectPoint.equals(center))return
|
|
|
+ if(e.intersect.equals(center))return
|
|
|
if(!rotateInfo){
|
|
|
rotateInfo = {
|
|
|
orientationUser : e.pointclouds[0].orientationUser,
|
|
@@ -112596,14 +112584,14 @@ ENDSEC
|
|
|
this.bus.dispatchEvent({type:'rotateStart', startPoint:center});
|
|
|
return
|
|
|
}else if(!rotateInfo.vecStart){
|
|
|
- let vec = new Vector3().subVectors(e.intersectPoint, center).setZ(0);
|
|
|
+ let vec = new Vector3().subVectors(e.intersect, center).setZ(0);
|
|
|
if(vec.length() * e.camera.zoom > 30){ //在屏幕上距离初始点有一定距离后开始算
|
|
|
//console.log('moveVec',vec)
|
|
|
rotateInfo.vecStart = vec;
|
|
|
}
|
|
|
}else {
|
|
|
|
|
|
- let vec = new Vector3().subVectors(e.intersectPoint, center).setZ(0);
|
|
|
+ let vec = new Vector3().subVectors(e.intersect, center).setZ(0);
|
|
|
let angle = math.getAngle(rotateInfo.vecStart,vec,'z');
|
|
|
let diffAngle = rotateInfo.orientationUser + angle - rotateInfo.pointclouds[0].orientationUser;
|
|
|
|
|
@@ -112625,11 +112613,11 @@ ENDSEC
|
|
|
|
|
|
|
|
|
}
|
|
|
- this.bus.dispatchEvent({type:'rotate', endPoint: e.intersectPoint});
|
|
|
+ this.bus.dispatchEvent({type:'rotate', endPoint: e.intersect});
|
|
|
|
|
|
}else {
|
|
|
let center = e.pointclouds[0].translateUser; //移动到的位置就是中心
|
|
|
- if(e.intersectPoint.equals(center))return
|
|
|
+ if(e.intersect.equals(center))return
|
|
|
if(!rotateInfo){
|
|
|
rotateInfo = {
|
|
|
orientationUser : e.pointclouds[0].orientationUser,
|
|
@@ -112638,7 +112626,7 @@ ENDSEC
|
|
|
pointcloud: e.pointclouds[0]
|
|
|
};
|
|
|
}else {
|
|
|
- let vec = new Vector3().subVectors(e.intersectPoint, center).setZ(0);
|
|
|
+ let vec = new Vector3().subVectors(e.intersect, center).setZ(0);
|
|
|
let angle = math.getAngle(rotateInfo.vecStart,vec,'z');
|
|
|
let diffAngle = rotateInfo.orientationUser + angle - rotateInfo.pointcloud.orientationUser;
|
|
|
Alignment.rotate(rotateInfo.pointcloud, null, diffAngle);
|
|
@@ -112669,7 +112657,7 @@ ENDSEC
|
|
|
|
|
|
if(e.hoverViewport.alignment && handleState && e.hoverViewport.alignment[handleState]){
|
|
|
if(handleState == 'translate'){
|
|
|
- if( e.intersectPoint && e.intersectPoint.location ){
|
|
|
+ if( e.intersect && e.intersect.location ){
|
|
|
viewer.dispatchEvent({
|
|
|
type : "CursorChange", action : "add", name:"movePointcloud"
|
|
|
});
|
|
@@ -112679,7 +112667,7 @@ ENDSEC
|
|
|
});
|
|
|
}
|
|
|
}else if(handleState == 'rotate'){
|
|
|
- if( e.intersectPoint && e.intersectPoint.location ){
|
|
|
+ if( e.intersect && e.intersect.location ){
|
|
|
viewer.dispatchEvent({
|
|
|
type : "CursorChange", action : "add", name:"rotatePointcloud"
|
|
|
});
|
|
@@ -114611,11 +114599,11 @@ ENDSEC
|
|
|
|
|
|
let firstZ, firstIntersect;
|
|
|
let drag = (e)=>{
|
|
|
- var intersectPoint = e.intersectPoint.orthoIntersect; //不要点云的intersect,只要orthocamera算出的平面intersect
|
|
|
+ var intersect = e.intersect.orthoIntersect; //不要点云的intersect,只要orthocamera算出的平面intersect
|
|
|
|
|
|
if(firstIntersect != void 0){
|
|
|
|
|
|
- let moveZ = intersectPoint.z - firstIntersect;
|
|
|
+ let moveZ = intersect.z - firstIntersect;
|
|
|
if(this.selected.buildType == 'floor'){//楼层
|
|
|
//限制高度不能超过上下
|
|
|
if(e.target == height_pull_box_up){
|
|
@@ -114635,7 +114623,7 @@ ENDSEC
|
|
|
}
|
|
|
}
|
|
|
}else {
|
|
|
- firstIntersect = intersectPoint.z;
|
|
|
+ firstIntersect = intersect.z;
|
|
|
}
|
|
|
};
|
|
|
|
|
@@ -115132,6 +115120,7 @@ ENDSEC
|
|
|
direction : new Vector3(1,0,0),
|
|
|
active: true,
|
|
|
//相机位置在x轴负向 右下角屏
|
|
|
+ viewContainsPoints:[new Vector3(0,0,0)]
|
|
|
} ];
|
|
|
|
|
|
|
|
@@ -115149,10 +115138,18 @@ ENDSEC
|
|
|
viewer.scene.scene.add(ground);
|
|
|
//再加两条线否则在正侧边看不到
|
|
|
let line1 = LineDraw.createLine([new Vector3(-10000, 0, 0),new Vector3(10000, 0, 0) ], {color:'#666', dontAlwaysSeen:true});
|
|
|
- let line2 = LineDraw.createLine([new Vector3(0, -10000, 0),new Vector3(0, 10000, 0) ], {color:'#666', dontAlwaysSeen:true});
|
|
|
+ let line2 = LineDraw.createLine([new Vector3(0, -10000, 0),new Vector3(0, 10000, 0) ], {mat:line1.material});
|
|
|
ground.renderOrder = line1.renderOrder + 1; //要比模型低,否则模型透明时效果不对
|
|
|
ground.add(line1);
|
|
|
ground.add(line2);
|
|
|
+
|
|
|
+ ground.material.polygonOffset = true; //多边形偏移(视觉上没有移动模型位置),防止闪烁
|
|
|
+ ground.material.polygonOffsetFactor = 10; //多边形偏移因子
|
|
|
+ ground.material.polygonOffsetUnits = 10; //多边形偏移单位
|
|
|
+ //ground.material.depthTest = false
|
|
|
+ line1.material.polygonOffset = true;
|
|
|
+ line1.material.polygonOffsetFactor = 20;
|
|
|
+ line1.material.polygonOffsetUnits = 10;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -115162,7 +115159,7 @@ ENDSEC
|
|
|
|
|
|
|
|
|
viewer.addEventListener('global_single_click',(e)=>{
|
|
|
- if( viewer.scene.cameraAnimations.length //正在播放
|
|
|
+ if( viewer.scene.cameraAnimations.some(c=>c.onUpdate) //正在播放
|
|
|
|| e.drag && e.drag.notPressMouse //在加测量线
|
|
|
|| viewer.mainViewport.view.isFlying() //有其他校准
|
|
|
//e.clickElement && e.clickElement != e.intersect.object
|
|
@@ -115516,7 +115513,7 @@ ENDSEC
|
|
|
var updateVisi = (e)=>{
|
|
|
if(e.hoverViewport == viewer.mainViewport){
|
|
|
viewer.updateVisible(this,"atViewport", true);
|
|
|
- this.update(e.intersectPoint && e.intersectPoint.location);
|
|
|
+ this.update(e.intersect && e.intersect.location);
|
|
|
}else {
|
|
|
viewer.updateVisible(this,"atViewport", false); //小地图不显示
|
|
|
}
|
|
@@ -115728,7 +115725,7 @@ ENDSEC
|
|
|
|
|
|
|
|
|
this.direction = new Vector3;
|
|
|
- this.hidden = !0;
|
|
|
+
|
|
|
this.mouseLastMoveTime = Date.now();
|
|
|
this.hoverViewport;
|
|
|
this.matrixMap = new Map;
|
|
@@ -118758,7 +118755,7 @@ ENDSEC
|
|
|
}
|
|
|
|
|
|
|
|
|
- var I = e.intersectPoint && (e.intersectPoint.orthoIntersect || e.intersectPoint.location);
|
|
|
+ var I = e.intersect && (e.intersect.orthoIntersect || e.intersect.location);
|
|
|
if(!I)return
|
|
|
|
|
|
curve.addPoint(I, null, true);
|
|
@@ -119036,7 +119033,7 @@ ENDSEC
|
|
|
this.setLinkOperateState('removeLink',false);
|
|
|
}else if(this.clickToZoomInEnabled){
|
|
|
|
|
|
- this.zoomIn(e.intersectPoint.orthoIntersect, e.pointer);
|
|
|
+ this.zoomIn(e.intersect.orthoIntersect, e.pointer);
|
|
|
|
|
|
this.setZoomInState(false);
|
|
|
}
|
|
@@ -119075,7 +119072,7 @@ ENDSEC
|
|
|
if(this.operation != 'addLink' || this.activeViewName != 'top' || !this.selectedPano){
|
|
|
return this.linkGuideLine.visible = false
|
|
|
}
|
|
|
- LineDraw.updateLine(this.linkGuideLine, [this.selectedPano.position, e.intersectPoint.orthoIntersect.clone().setZ(this.selectedPano.position.z)] );
|
|
|
+ LineDraw.updateLine(this.linkGuideLine, [this.selectedPano.position, e.intersect.orthoIntersect.clone().setZ(this.selectedPano.position.z)] );
|
|
|
this.linkGuideLine.visible = true;
|
|
|
};
|
|
|
|
|
@@ -119300,10 +119297,10 @@ ENDSEC
|
|
|
|
|
|
} */
|
|
|
|
|
|
- zoomIn(intersectPoint, pointer){
|
|
|
+ zoomIn(intersect, pointer){
|
|
|
let camera = viewer.mainViewport.camera;
|
|
|
let endZoom = 700;
|
|
|
- //this.moveFit(intersectPoint, {endZoom:viewer.mainViewport.camera.zoom < aimZoom ? aimZoom : null} , 300)
|
|
|
+ //this.moveFit(intersect, {endZoom:viewer.mainViewport.camera.zoom < aimZoom ? aimZoom : null} , 300)
|
|
|
let startZoom = camera.zoom;
|
|
|
if(startZoom >= endZoom){return}
|
|
|
|
|
@@ -119628,7 +119625,7 @@ ENDSEC
|
|
|
if(this.panoLink[pano0.id][pano1.id].line) return
|
|
|
let line = LineDraw.createFatLine([pano0.position, pano1.position], {material:lineMats$3.default});
|
|
|
line.name = `${pano0.id}-${pano1.id}`;
|
|
|
- line.renderOrder = renderOrders.line;
|
|
|
+ line.renderOrder = line.pickOrder = renderOrders.line;
|
|
|
this.lineMeshes.add(line);
|
|
|
this.panoLink[pano0.id][pano1.id].line = this.panoLink[pano1.id][pano0.id].line = line;
|
|
|
|
|
@@ -119726,7 +119723,8 @@ ENDSEC
|
|
|
var circle = new Sprite$1({mat: circleMats.default, sizeInfo:{
|
|
|
minSize : 50 , maxSize : 120, nearBound : 2, farBound : 10,
|
|
|
},
|
|
|
- renderOrder : renderOrders.circle
|
|
|
+ renderOrder : renderOrders.circle,
|
|
|
+ pickOrder: renderOrders.circle
|
|
|
}); //new THREE.Sprite(circleMats.default)
|
|
|
|
|
|
circle.name = 'panoCircle';
|
|
@@ -119850,14 +119848,15 @@ ENDSEC
|
|
|
|
|
|
if(pano){
|
|
|
this.selectedPano.circle.material = circleMats.selected;
|
|
|
- this.selectedPano.circle.renderOrder = renderOrders.circleSelected; //侧视图能显示在最前
|
|
|
+ this.selectedPano.circle.renderOrder = this.selectedPano.circle.pickOrder = renderOrders.circleSelected; //侧视图能显示在最前
|
|
|
//this.selectedPano.pointcloud.material.color = '#ff0000'
|
|
|
//this.selectedPano.pointcloud.changePointOpacity(opacitys.selected,true)
|
|
|
- this.selectedClouds.forEach(e=>{
|
|
|
- e.changePointOpacity(opacitys.selected,true);
|
|
|
- e.material.color = pointColor.selected;
|
|
|
- });
|
|
|
-
|
|
|
+ if(this.activeViewName != 'mainView'){
|
|
|
+ this.selectedClouds.forEach(e=>{
|
|
|
+ e.changePointOpacity(opacitys.selected,true);
|
|
|
+ e.material.color = pointColor.selected;
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
@@ -122793,18 +122792,24 @@ ENDSEC
|
|
|
|
|
|
}
|
|
|
|
|
|
- if ( ! bFound ) {
|
|
|
+ if ( ! bFound ) {
|
|
|
+
|
|
|
+ var visibility = object.visible;
|
|
|
+ viewer.updateVisible(object, 'overlinePass', bVisible); //add
|
|
|
+
|
|
|
+ /* if ( ! bVisible || object.bVisible ) object.visible = bVisible; */
|
|
|
|
|
|
- /* var visibility = object.visible;
|
|
|
- if(object == viewer.reticule){
|
|
|
- console.log(visibility)
|
|
|
+ if(!bVisible){
|
|
|
+ object.visible = false;
|
|
|
+ }else {
|
|
|
+ object.visible = object.bVisible;
|
|
|
}
|
|
|
- if ( ! bVisible || object.bVisible ) object.visible = bVisible;
|
|
|
|
|
|
- object.bVisible = visibility; */
|
|
|
+
|
|
|
+ object.bVisible = visibility;
|
|
|
+
|
|
|
|
|
|
- viewer.updateVisible(object, 'overlinePass', bVisible);
|
|
|
- //要确保其他所有mesh也都是通过updateVisible来设置visible=false的,否则会在这变为true
|
|
|
+ //这两种updateVisible 和 visible 设置都不能去掉, 第一块是为了防止有的visible不是通过updateVisible设置的; 第二块是为了防止渲染时updateVisible又修改了visible为true, 另外渲染时
|
|
|
|
|
|
}
|
|
|
|
|
@@ -122831,9 +122836,9 @@ ENDSEC
|
|
|
if(!(scenes instanceof Array))scenes = [scenes];
|
|
|
if ( this.selectedObjects.length > 0 ) {
|
|
|
|
|
|
- let render2 = (target)=>{
|
|
|
+ let render2 = (target, dontRenderRtEDL=true)=>{
|
|
|
if(renderFun){
|
|
|
- renderFun({target , dontRenderRtEDL:true});
|
|
|
+ renderFun({target , dontRenderRtEDL});
|
|
|
}else {
|
|
|
renderer.setRenderTarget(target);
|
|
|
renderer.clear();
|
|
@@ -122932,7 +122937,7 @@ ENDSEC
|
|
|
this.quad.material.transparent = true;
|
|
|
buffer = null;
|
|
|
renderer.setClearColor( this.oldClearColor, this.oldClearAlpha );
|
|
|
- render2();
|
|
|
+ render2(null,false);
|
|
|
|
|
|
//绘制到全屏
|
|
|
let renderSize = renderer.getSize(new Vector2$1()); //是client大小
|
|
@@ -126189,7 +126194,7 @@ ENDSEC
|
|
|
if(params.cameraLayers) cameraLayers = params.cameraLayers;
|
|
|
else {
|
|
|
if(params.isMap)cameraLayers = ['bothMapAndScene'];
|
|
|
- else cameraLayers = ['sceneObjects', 'bothMapAndScene' ];
|
|
|
+ else cameraLayers = ['sceneObjects', 'model', 'bothMapAndScene' ];
|
|
|
}
|
|
|
|
|
|
|
|
@@ -126425,9 +126430,9 @@ ENDSEC
|
|
|
/* 大规模WebGL应用引发浏览器崩溃的几种情况及解决办法
|
|
|
https://blog.csdn.net/weixin_30378311/article/details/94846947 */
|
|
|
|
|
|
- render(params){//add params
|
|
|
+ render(params={}){//add params
|
|
|
if(Potree.measureTimings) performance.mark("render-start");
|
|
|
- if(this.outlinePass.selectedObjects.length){
|
|
|
+ if(this.outlinePass.selectedObjects.length && !params.screenshot){
|
|
|
this.composer.render(this.inputHandler.interactiveScenes.concat(this.scene.scene).concat(viewer.scene.scenePointCloud), null, this.viewports, this.renderDefault.bind(this));
|
|
|
}else {
|
|
|
this.renderDefault(params);
|
|
@@ -126668,7 +126673,7 @@ ENDSEC
|
|
|
focusOnObject(object, type, duration, o={} ) {
|
|
|
//飞向热点、测量线等 。
|
|
|
|
|
|
- console.log('focusOnObject: '+object.name, type);
|
|
|
+ console.log('focusOnObject: ', object, type);
|
|
|
|
|
|
let deferred = o.deferred || $.Deferred();
|
|
|
let target = new Vector3, //相机focus的位置
|
|
@@ -126822,7 +126827,7 @@ ENDSEC
|
|
|
if(Potree.settings.displayMode == 'showPointCloud'){ //点云
|
|
|
let minDis = 0.3;
|
|
|
|
|
|
- if(o.checkIntersect){
|
|
|
+ //if(o.checkIntersect){
|
|
|
let checkIntersect = ( )=>{
|
|
|
let intersect = this.inputHandler.ifBlockedByIntersect(position, null , true, target);// 不一定准确
|
|
|
if(intersect){
|
|
@@ -126875,7 +126880,7 @@ ENDSEC
|
|
|
};
|
|
|
|
|
|
checkIntersect();
|
|
|
- }
|
|
|
+ //}
|
|
|
}else if(Potree.settings.displayMode == 'showPanos'){//全景 (比较难校准)
|
|
|
let pano = viewer.images360.fitPanoTowardPoint({
|
|
|
/*point : target, //不使用目标点来判断是因为缺少measure角度的信息。比如虽然可以靠近线的中心,但是线朝向屏幕,那几乎就是一个点了。
|
|
@@ -127502,6 +127507,8 @@ ENDSEC
|
|
|
|
|
|
console.log( fileInfo.name , fileInfo.id + '加载完毕, 模型数据量:' + weight + 'M');
|
|
|
|
|
|
+ this.setObjectLayers(object,'model');
|
|
|
+
|
|
|
object.traverse( ( child )=>{
|
|
|
if ( child instanceof Mesh ) {
|
|
|
child.renderOrder = 10;
|