|
@@ -63072,7 +63072,7 @@ void main() {
|
|
var boundingBox = new Box3();
|
|
var boundingBox = new Box3();
|
|
pointclouds.forEach(pointcloud=>{
|
|
pointclouds.forEach(pointcloud=>{
|
|
pointcloud.updateBound();
|
|
pointcloud.updateBound();
|
|
- boundingBox.union(pointcloud.bound);
|
|
|
|
|
|
+ boundingBox.union(pointcloud.bound2);
|
|
});
|
|
});
|
|
var boundSize = boundingBox.getSize(new Vector3);
|
|
var boundSize = boundingBox.getSize(new Vector3);
|
|
var center = boundingBox.getCenter(new Vector3);
|
|
var center = boundingBox.getCenter(new Vector3);
|
|
@@ -63341,7 +63341,17 @@ void main() {
|
|
var pointcloudLoaded = 0;
|
|
var pointcloudLoaded = 0;
|
|
var panosLoaded = 0;
|
|
var panosLoaded = 0;
|
|
var pointcloudLoadDone = function(){//点云cloud.js加载完毕后
|
|
var pointcloudLoadDone = function(){//点云cloud.js加载完毕后
|
|
- viewer.updateModelBound();
|
|
|
|
|
|
+
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ var panosLoadDone = function(){
|
|
|
|
+
|
|
|
|
+ viewer.images360.loadDone();
|
|
|
|
+ viewer.scene.add360Images(viewer.images360);
|
|
|
|
+ viewer.mapViewer.addListener(viewer.images360);
|
|
|
|
+
|
|
|
|
+ viewer.updateModelBound(); //需等pano加载完
|
|
let {boundSize, center} = viewer.bound;
|
|
let {boundSize, center} = viewer.bound;
|
|
|
|
|
|
Potree.Log(`中心点: ${math.toPrecision(center.toArray(),2)}, boundSize: ${math.toPrecision(boundSize.toArray(),2)} ` , null, 12);
|
|
Potree.Log(`中心点: ${math.toPrecision(center.toArray(),2)}, boundSize: ${math.toPrecision(boundSize.toArray(),2)} ` , null, 12);
|
|
@@ -63366,16 +63376,6 @@ void main() {
|
|
Potree.Log('loadPointCloudDone 点云加载完毕', null, 10);
|
|
Potree.Log('loadPointCloudDone 点云加载完毕', null, 10);
|
|
}
|
|
}
|
|
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- var panosLoadDone = function(){
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- viewer.images360.loadDone();
|
|
|
|
- viewer.scene.add360Images(viewer.images360);
|
|
|
|
- viewer.mapViewer.addListener(viewer.images360);
|
|
|
|
-
|
|
|
|
|
|
|
|
{//初始位置
|
|
{//初始位置
|
|
var urlFirstView = false;
|
|
var urlFirstView = false;
|
|
@@ -70019,11 +70019,26 @@ void main() {
|
|
updateBound(){
|
|
updateBound(){
|
|
var boundingBox_ = this.pcoGeometry.tightBoundingBox.clone().applyMatrix4(this.matrixWorld);
|
|
var boundingBox_ = this.pcoGeometry.tightBoundingBox.clone().applyMatrix4(this.matrixWorld);
|
|
this.bound = boundingBox_;
|
|
this.bound = boundingBox_;
|
|
|
|
+ this.bound2 = this.getBoundWithPanos();
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ getBoundWithPanos(){//确保pano在内的bound
|
|
|
|
+ let bound = this.bound.clone();
|
|
|
|
+ this.panos.forEach(pano=>{
|
|
|
|
+ let panoBound = new Box3;
|
|
|
|
+ panoBound.expandByPoint(pano.position);
|
|
|
|
+ panoBound.expandByVector(new Vector3(.1,.1,.1));//give pano a margin
|
|
|
|
+ bound.union(panoBound);
|
|
|
|
+ });
|
|
|
|
+ return bound
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
getPanosBound(){
|
|
getPanosBound(){
|
|
if(this.panos.length > 0){
|
|
if(this.panos.length > 0){
|
|
let minSize = new Vector3(1,1,1);
|
|
let minSize = new Vector3(1,1,1);
|
|
- this.panosBound = math.getBoundByPoints(this.panos.map(e=>e.position), minSize);
|
|
|
|
|
|
+ this.panosBound = math.getBoundByPoints(this.panos.map (e=>e.position), minSize);
|
|
}else {
|
|
}else {
|
|
this.panosBound = null;
|
|
this.panosBound = null;
|
|
}
|
|
}
|
|
@@ -81647,7 +81662,7 @@ void main() {
|
|
let startQuaternion, endQuaternion, endTarget = null ;
|
|
let startQuaternion, endQuaternion, endTarget = null ;
|
|
|
|
|
|
|
|
|
|
- if(info.target ){
|
|
|
|
|
|
+ if(info.target && !info.target.equals(endPosition)){ //注:若target和position相同,没有意义,算出来的quaternion和最后lookAt(target)的效果不同,所以不使用
|
|
endTarget = new Vector3().copy(info.target);
|
|
endTarget = new Vector3().copy(info.target);
|
|
endQuaternion = math.getQuaFromPosAim(endPosition,endTarget);
|
|
endQuaternion = math.getQuaFromPosAim(endPosition,endTarget);
|
|
}else if(info.quaternion){
|
|
}else if(info.quaternion){
|
|
@@ -87165,9 +87180,12 @@ void main() {
|
|
float distance = (depth.g + depth.r / 256.) * 255.; //为什么要乘以255
|
|
float distance = (depth.g + depth.r / 256.) * 255.; //为什么要乘以255
|
|
|
|
|
|
if(distance == 0.0){//漫游点底部识别不到的区域,给一个地板高度
|
|
if(distance == 0.0){//漫游点底部识别不到的区域,给一个地板高度
|
|
- if(uv2.y > 0.75)distance = height / dir.y;
|
|
|
|
|
|
+ if(uv2.y > 0.75) distance = height / dir.y;
|
|
else distance = 100000.0;//给个超级远的值
|
|
else distance = 100000.0;//给个超级远的值
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ if(distance == 0.0)distance = 100000.0;//给个超级远的值
|
|
|
|
+
|
|
depthValue.x = distance;
|
|
depthValue.x = distance;
|
|
|
|
|
|
// return r[1] + r[0] / 256
|
|
// return r[1] + r[0] / 256
|
|
@@ -87187,7 +87205,8 @@ void main() {
|
|
|
|
|
|
void main()
|
|
void main()
|
|
{
|
|
{
|
|
-
|
|
|
|
|
|
+ vec3 vWorldPosition0N = normalize(vWorldPosition0);
|
|
|
|
+ vec3 vWorldPosition1N = normalize(vWorldPosition0);
|
|
/* vec2 samplerCoord0 = getSamplerCoord(vWorldPosition0.xyz);
|
|
/* vec2 samplerCoord0 = getSamplerCoord(vWorldPosition0.xyz);
|
|
vec2 samplerCoord1 = getSamplerCoord(vWorldPosition1.xyz);
|
|
vec2 samplerCoord1 = getSamplerCoord(vWorldPosition1.xyz);
|
|
vec4 colorFromPano0=texture2D(pano0Map,samplerCoord0);
|
|
vec4 colorFromPano0=texture2D(pano0Map,samplerCoord0);
|
|
@@ -87195,9 +87214,9 @@ void main() {
|
|
|
|
|
|
vec4 colorFromPano0 = vec4(0.0,0.0,0.0,0.0);
|
|
vec4 colorFromPano0 = vec4(0.0,0.0,0.0,0.0);
|
|
if(progress < 1.0){//通常是1
|
|
if(progress < 1.0){//通常是1
|
|
- colorFromPano0=textureCube(pano0Map,vWorldPosition0.xyz);
|
|
|
|
|
|
+ colorFromPano0=textureCube(pano0Map,vWorldPosition0N.xyz);
|
|
}
|
|
}
|
|
- vec4 colorFromPano1=textureCube(pano1Map,vWorldPosition1.xyz);
|
|
|
|
|
|
+ vec4 colorFromPano1=textureCube(pano1Map,vWorldPosition1N.xyz);
|
|
|
|
|
|
gl_FragColor=mix(colorFromPano0,colorFromPano1,progress);
|
|
gl_FragColor=mix(colorFromPano0,colorFromPano1,progress);
|
|
|
|
|
|
@@ -87217,9 +87236,9 @@ void main() {
|
|
vec4 eyePos = inverseProjectionMatrix * clipPos;
|
|
vec4 eyePos = inverseProjectionMatrix * clipPos;
|
|
vec2 depth0 = vec2(0.0,0.0);
|
|
vec2 depth0 = vec2(0.0,0.0);
|
|
if(progress < 1.0){
|
|
if(progress < 1.0){
|
|
- depth0 = getDepth(vWorldPosition0, depthMap0, cameraHeight0, eyePos);
|
|
|
|
|
|
+ depth0 = getDepth(vWorldPosition0N, depthMap0, cameraHeight0, eyePos);
|
|
}
|
|
}
|
|
- vec2 depth1 = getDepth(vWorldPosition1, depthMap1, cameraHeight1, eyePos);
|
|
|
|
|
|
+ vec2 depth1 = getDepth(vWorldPosition1N, depthMap1, cameraHeight1, eyePos);
|
|
|
|
|
|
/* if(progress < 1.0 && depth1.x == 0.0 && depth0.x > 0.0){
|
|
/* if(progress < 1.0 && depth1.x == 0.0 && depth0.x > 0.0){
|
|
gl_FragDepthEXT = depth0.y;
|
|
gl_FragDepthEXT = depth0.y;
|
|
@@ -87279,7 +87298,7 @@ void main() {
|
|
|
|
|
|
viewer.addEventListener('camera_changed', (e)=>{
|
|
viewer.addEventListener('camera_changed', (e)=>{
|
|
//this.uniforms.projectionMatrix.value.copy(e.camera.projectionMatrix)
|
|
//this.uniforms.projectionMatrix.value.copy(e.camera.projectionMatrix)
|
|
- this.uniforms.inverseProjectionMatrix.value.copy(e.camera.projectionMatrixInverse);
|
|
|
|
|
|
+ e.camera && this.uniforms.inverseProjectionMatrix.value.copy(e.camera.projectionMatrixInverse);
|
|
});
|
|
});
|
|
|
|
|
|
}
|
|
}
|
|
@@ -90301,7 +90320,7 @@ void main() {
|
|
r && this.deactiveDescripor(r.renderTarget);
|
|
r && this.deactiveDescripor(r.renderTarget);
|
|
r = this.activeDescripor(l);
|
|
r = this.activeDescripor(l);
|
|
if (!r) {
|
|
if (!r) {
|
|
- var ren = this.initTiledPano(l, !1);
|
|
|
|
|
|
+ var ren = this.initTiledPano(l, true);
|
|
r = this.initDescriptor(ren.width);
|
|
r = this.initDescriptor(ren.width);
|
|
r.renderTarget = ren;
|
|
r.renderTarget = ren;
|
|
}
|
|
}
|
|
@@ -90406,7 +90425,7 @@ void main() {
|
|
* @param {number} size 当前的panoSize,每个面的分辨率
|
|
* @param {number} size 当前的panoSize,每个面的分辨率
|
|
*/
|
|
*/
|
|
|
|
|
|
- initTiledPano(size, t) {//创建 RenderTargetCube
|
|
|
|
|
|
+ initTiledPano(size, ifNormalFilter) {//创建 RenderTargetCube
|
|
var renderer = this.viewer.renderer;
|
|
var renderer = this.viewer.renderer;
|
|
var renderTarget, texture;
|
|
var renderTarget, texture;
|
|
renderTarget = new WebGLCubeRenderTarget(size,{ //THREE.WebGLRenderTargetCube(size, size, {
|
|
renderTarget = new WebGLCubeRenderTarget(size,{ //THREE.WebGLRenderTargetCube(size, size, {
|
|
@@ -90417,14 +90436,18 @@ void main() {
|
|
texture.flipY = !0,
|
|
texture.flipY = !0,
|
|
texture.format = RGBAFormat;
|
|
texture.format = RGBAFormat;
|
|
|
|
|
|
- t ? (texture.generateMipmaps = !0,
|
|
|
|
|
|
+ ifNormalFilter ? (texture.generateMipmaps = !0,
|
|
texture.magFilter = LinearFilter,
|
|
texture.magFilter = LinearFilter,
|
|
texture.minFilter = LinearMipMapLinearFilter)
|
|
texture.minFilter = LinearMipMapLinearFilter)
|
|
: (texture.generateMipmaps = !1,
|
|
: (texture.generateMipmaps = !1,
|
|
- texture.magFilter = LinearFilter,
|
|
|
|
- texture.minFilter = LinearFilter);
|
|
|
|
|
|
+ texture.magFilter = LinearFilter, //LinearFilter更清晰,但锯齿噪点严重,相当于锐化,其实失真了。对于条纹状的画面移动镜头时锯齿明显 眩晕
|
|
|
|
+ texture.minFilter = LinearFilter);
|
|
|
|
+
|
|
|
|
+ //平时还是直接用LinearMipMapLinearFilter,其实并非不清晰,只是没有加锐化,像加了层柔光和抗锯齿,观感更好。放大后使用LinearFilter
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
+ renderTarget.texture = texture; //居然漏了一句,2022.10.9补
|
|
renderer.setRenderTarget(renderTarget);
|
|
renderer.setRenderTarget(renderTarget);
|
|
renderer.setRenderTarget(null);
|
|
renderer.setRenderTarget(null);
|
|
var o = renderer.properties.get(texture);
|
|
var o = renderer.properties.get(texture);
|
|
@@ -90904,7 +90927,7 @@ void main() {
|
|
if(targets[size]){
|
|
if(targets[size]){
|
|
this.zoomRenderTarget = targets[size];
|
|
this.zoomRenderTarget = targets[size];
|
|
}else {
|
|
}else {
|
|
- this.zoomRenderTarget = this.initTiledPano(size, !1);
|
|
|
|
|
|
+ this.zoomRenderTarget = this.initTiledPano(size, false );
|
|
targets[size] = this.zoomRenderTarget;
|
|
targets[size] = this.zoomRenderTarget;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -92569,9 +92592,8 @@ void main() {
|
|
|
|
|
|
updateCube(pano0, pano1){
|
|
updateCube(pano0, pano1){
|
|
|
|
|
|
- if(!viewer.scene.pointclouds.some(e=>!e.hasDepthTex)) return this.updateCube2(pano0, pano1) //都hasDepthTex的话
|
|
|
|
-
|
|
|
|
if(Potree.settings.displayMode != 'showPanos')return
|
|
if(Potree.settings.displayMode != 'showPanos')return
|
|
|
|
+ if(!viewer.scene.pointclouds.some(e=>!e.hasDepthTex)) return this.updateCube2(pano0, pano1) //都hasDepthTex的话
|
|
|
|
|
|
|
|
|
|
let f = (bound, size)=>{
|
|
let f = (bound, size)=>{
|
|
@@ -93201,8 +93223,7 @@ void main() {
|
|
|
|
|
|
//console.log('updateCube',pano0.id, pano1&&pano1.id)
|
|
//console.log('updateCube',pano0.id, pano1&&pano1.id)
|
|
|
|
|
|
- let useBound = (bound, size)=>{
|
|
|
|
-
|
|
|
|
|
|
+ let useBound = (bound, size)=>{
|
|
size = size || bound.getSize(new Vector3);
|
|
size = size || bound.getSize(new Vector3);
|
|
let center = bound.getCenter(new Vector3);
|
|
let center = bound.getCenter(new Vector3);
|
|
size.max(new Vector3(HighMapCubeWidth,HighMapCubeWidth,HighMapCubeWidth));
|
|
size.max(new Vector3(HighMapCubeWidth,HighMapCubeWidth,HighMapCubeWidth));
|
|
@@ -93212,14 +93233,21 @@ void main() {
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
+ let getPanoBound = (pano)=>{//因漫游点可能在点云外部,如室外平地,所以需要union进漫游点
|
|
|
|
+ let panoBound = new Box3;
|
|
|
|
+ panoBound.expandByPoint(pano.position);
|
|
|
|
+ panoBound.expandByVector(new Vector3(10,10,10));//give pano a margin
|
|
|
|
+ return pano.pointcloud.bound.clone().union(panoBound)
|
|
|
|
+ };
|
|
|
|
+
|
|
this.cube.geometry.dispose();
|
|
this.cube.geometry.dispose();
|
|
|
|
|
|
if(pano1){//过渡
|
|
if(pano1){//过渡
|
|
|
|
|
|
if(pano0.pointcloud != pano1.pointcloud){ //距离太远的数据集,过渡会畸变。所以扩大skybox
|
|
if(pano0.pointcloud != pano1.pointcloud){ //距离太远的数据集,过渡会畸变。所以扩大skybox
|
|
let dis = pano0.position.distanceTo(pano1.position);
|
|
let dis = pano0.position.distanceTo(pano1.position);
|
|
- if(dis > 100){
|
|
|
|
- let bound = pano0.pointcloud.bound.clone().union(pano1.pointcloud.bound);
|
|
|
|
|
|
+ if(dis > 100){
|
|
|
|
+ let bound = getPanoBound(pano0).union(getPanoBound(pano1));
|
|
let size = bound.getSize(new Vector3);
|
|
let size = bound.getSize(new Vector3);
|
|
let max = Math.max(size.x, size.y, size.z);
|
|
let max = Math.max(size.x, size.y, size.z);
|
|
size.set(max,max,max);
|
|
size.set(max,max,max);
|
|
@@ -93585,7 +93613,7 @@ void main() {
|
|
//this.cube.position.copy(pano1.position).multiplyScalar(-100)
|
|
//this.cube.position.copy(pano1.position).multiplyScalar(-100)
|
|
}else {
|
|
}else {
|
|
|
|
|
|
- useBound(pano0.pointcloud.bound);
|
|
|
|
|
|
+ useBound(getPanoBound(pano0));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -93783,7 +93811,7 @@ void main() {
|
|
n.pano = null),
|
|
n.pano = null),
|
|
e || (e = 0);
|
|
e || (e = 0);
|
|
var r = Common.sortByScore(this.panos, t, i);
|
|
var r = Common.sortByScore(this.panos, t, i);
|
|
- console.log('findRankedByScore', r && r.map(u=>u.item.id + '| ' + math.toPrecision(u.score,4) + " | " + math.toPrecision(u.scores,4)));
|
|
|
|
|
|
+ //console.log('findRankedByScore', r && r.map(u=>u.item.id + '| ' + math.toPrecision(u.score,4) + " | " + math.toPrecision(u.scores,4)))
|
|
|
|
|
|
|
|
|
|
return !r || 0 === r.length || e >= r.length ? null : (n && (n.candidates = r,
|
|
return !r || 0 === r.length || e >= r.length ? null : (n && (n.candidates = r,
|
|
@@ -119138,12 +119166,13 @@ ENDSEC
|
|
class Reticule extends Mesh{
|
|
class Reticule extends Mesh{
|
|
constructor(viewer){
|
|
constructor(viewer){
|
|
var defaultTex = texLoader$a.load(Potree.resourcePath+'/textures/whiteCircle.png'/* reticule-256x256.png' */);
|
|
var defaultTex = texLoader$a.load(Potree.resourcePath+'/textures/whiteCircle.png'/* reticule-256x256.png' */);
|
|
|
|
+
|
|
super(new PlaneBufferGeometry(0.11,0.11,1,1),new MeshBasicMaterial({
|
|
super(new PlaneBufferGeometry(0.11,0.11,1,1),new MeshBasicMaterial({
|
|
side: DoubleSide ,
|
|
side: DoubleSide ,
|
|
map: defaultTex,
|
|
map: defaultTex,
|
|
transparent:true,
|
|
transparent:true,
|
|
depthTest: !1,
|
|
depthTest: !1,
|
|
- opacity: defaultOpacity,
|
|
|
|
|
|
+ opacity: defaultOpacity,
|
|
//depthWrite: !1,
|
|
//depthWrite: !1,
|
|
}));
|
|
}));
|
|
this.name = 'reticule';
|
|
this.name = 'reticule';
|
|
@@ -119151,6 +119180,9 @@ ENDSEC
|
|
this.crosshairTex = texLoader$a.load(Potree.resourcePath+'/textures/reticule_cross_hair.png');
|
|
this.crosshairTex = texLoader$a.load(Potree.resourcePath+'/textures/reticule_cross_hair.png');
|
|
this.forbitTex = texLoader$a.load(Potree.resourcePath+'/textures/pic-forbid.png');
|
|
this.forbitTex = texLoader$a.load(Potree.resourcePath+'/textures/pic-forbid.png');
|
|
|
|
|
|
|
|
+ this.defaultTex.anisotropy = 4;
|
|
|
|
+ this.crosshairTex.anisotropy = 4;
|
|
|
|
+ this.forbitTex.anisotropy = 4;
|
|
//this.layers.set(0/* RenderLayers.RETICULE */);
|
|
//this.layers.set(0/* RenderLayers.RETICULE */);
|
|
this.renderOrder = 100;
|
|
this.renderOrder = 100;
|
|
this.layers.set(Potree.config.renderLayers.marker);
|
|
this.layers.set(Potree.config.renderLayers.marker);
|