|
@@ -22035,6 +22035,7 @@
|
|
|
//pointcloud.getPanosBound()
|
|
|
viewer.updateModelBound();
|
|
|
};
|
|
|
+ var moveModelWhenLoad = false;
|
|
|
var moveModel = e => {
|
|
|
//根据鼠标移动的位置改变位置
|
|
|
|
|
@@ -22172,8 +22173,10 @@
|
|
|
done(model); // 先发送成功,因为2d界面会随机执行changePosition等初始化,然后这边再将模型移到中心地面上
|
|
|
|
|
|
if (prop.isFirstLoad) {
|
|
|
- if (model.hasLonLat) {
|
|
|
- MergeEditor.focusOn(model);
|
|
|
+ if (model.hasLonLat || !moveModelWhenLoad) {
|
|
|
+ setTimeout(() => {
|
|
|
+ MergeEditor.focusOn(model);
|
|
|
+ }, 1);
|
|
|
} else {
|
|
|
MergeEditor.moveBoundCenterTo(model, new Vector3(0, 0, 0));
|
|
|
}
|
|
@@ -22188,7 +22191,7 @@
|
|
|
confirmPos()
|
|
|
},1)
|
|
|
}else{ */
|
|
|
- if (!model.hasLonLat) {
|
|
|
+ if (!model.hasLonLat && moveModelWhenLoad) {
|
|
|
viewer.addEventListener('global_mousemove', moveModel);
|
|
|
viewer.addEventListener('global_click', confirmPos, {
|
|
|
importance: 3
|
|
@@ -43116,6 +43119,7 @@
|
|
|
var AB = new Vector3().subVectors(B, A);
|
|
|
var searchIndex;
|
|
|
while (j <= _nextIndex) {
|
|
|
+ //根据APlen长度算区间
|
|
|
var len = AB.clone().normalize().dot(new Vector3().subVectors(this.points[j + 1], A)); //在AB的投影长度
|
|
|
if (len > APlen) {
|
|
|
searchIndex = j;
|
|
@@ -43224,17 +43228,19 @@
|
|
|
this.edge.geometry.dispose();
|
|
|
if (count <= 1) {
|
|
|
geo = voidGeometry;
|
|
|
+ this.geoPoints = [];
|
|
|
} else {
|
|
|
if (Potree.settings.pathSmooth) {
|
|
|
//使用曲线
|
|
|
- var line = new CatmullRomCurve3(points, false);
|
|
|
- line.UtoTMapArr = [];
|
|
|
- //window.arcLengthDivisions && (line.arcLengthDivisions = arcLengthDivisions) //默认200,但改为1也没变化呀
|
|
|
- count = Math.max(2, Math.round(this.getTotalDistance() * 400)), points = line.getSpacedPoints(count - 1); //拆分为更密集的点
|
|
|
- this.UtoTMapArr = [];
|
|
|
- //减少点数(拐弯的部分紧凑些,直线部分宽松些)
|
|
|
+ var curve = new CatmullRomCurve3(points, false);
|
|
|
+ curve.UtoTMapArr = []; //用于存储 getSpacedPoints得到的点对应points的百分比对应
|
|
|
+ //window.arcLengthDivisions && (curve.arcLengthDivisions = arcLengthDivisions) //默认200,但改为1也没变化呀
|
|
|
+ count = Math.max(2, Math.round(this.getTotalDistance() * 400)), points = curve.getSpacedPoints(count - 1); //拆分为更密集的点
|
|
|
+ this.curve = curve;
|
|
|
+ //减少点数(拐弯的部分紧凑些,直线部分宽松些):
|
|
|
var lastVec;
|
|
|
var newPoints = [];
|
|
|
+ this.UtoTMapArr = [];
|
|
|
for (var i = 0; i < count; i++) {
|
|
|
var point = points[i];
|
|
|
var last = points[i - 1];
|
|
@@ -43251,7 +43257,7 @@
|
|
|
if (curVec.angleTo(lastVec) > 0.05) {
|
|
|
//最小角度
|
|
|
newPoints.push(point);
|
|
|
- this.UtoTMapArr.push(line.UtoTMapArr[i]);
|
|
|
+ this.UtoTMapArr.push(curve.UtoTMapArr[i]);
|
|
|
lastVec = curVec;
|
|
|
}
|
|
|
}
|
|
@@ -43259,6 +43265,7 @@
|
|
|
}
|
|
|
points = newPoints;
|
|
|
count = points.length;
|
|
|
+ //delete curve.UtoTMapArr
|
|
|
}
|
|
|
var lastSideVec;
|
|
|
var posArr = [],
|
|
@@ -57738,6 +57745,8 @@
|
|
|
updateMatrixWorld(force) {
|
|
|
//重写,只为了将root当做parent
|
|
|
|
|
|
+ this.scale.set(1 / this.root.scale.x, 1 / this.root.scale.y, 1 / this.root.scale.z); //中和模型缩放。无论模型缩放如何都不能改tag大小
|
|
|
+
|
|
|
this.updateMatrix();
|
|
|
this.matrixWorld.multiplyMatrices(this.root.matrixWorld, this.matrix);
|
|
|
var children = this.children;
|
|
@@ -59569,7 +59578,7 @@
|
|
|
percent = easing.easeOutSine(originPercent-(1-easePercent), 1-easePercent, easePercent, easePercent)
|
|
|
} */
|
|
|
|
|
|
- var quaternion;
|
|
|
+ var quaternion, position;
|
|
|
if (percent < 1) {
|
|
|
//修改第二层:使用每个点的重定位的 newPointsPercents
|
|
|
|
|
@@ -59587,11 +59596,17 @@
|
|
|
var startQuaternion = this.quaternions[this.currentIndex];
|
|
|
quaternion = new Quaternion().copy(startQuaternion);
|
|
|
lerp.quaternion(quaternion, endQuaternion)(progress);
|
|
|
+ var endPos = this.posCurve.points[this.currentIndex + 1];
|
|
|
+ var startPos = this.posCurve.points[this.currentIndex];
|
|
|
+ position = new Vector3().copy(startPos);
|
|
|
+ lerp.vector(position, endPos)(progress);
|
|
|
} else {
|
|
|
this.currentIndex = this.posCurve.points.length - 1;
|
|
|
- quaternion = math.getQuaFromPosAim(this.posCurve.points[this.currentIndex], this.targets[this.currentIndex].position);
|
|
|
+ quaternion = this.quaternions[this.currentIndex];
|
|
|
+ position = this.posCurve.points[this.currentIndex];
|
|
|
}
|
|
|
- var position = this.posCurve.getPointAt(percent); // 需要this.posCurve.points.length>1 否则报错
|
|
|
+
|
|
|
+ //position = this.posCurve.getPointAt(percent); // 需要this.posCurve.points.length>1 否则报错
|
|
|
|
|
|
//console.log(this.currentIndex, originPercent)
|
|
|
//缓动:
|
|
@@ -59663,7 +59678,7 @@
|
|
|
Potree.settings.tourTestCameraMove || this.setVisible(false);
|
|
|
var tStart,
|
|
|
startTransitionRatio = 0.2;
|
|
|
- var startDelay = 1 / startTransitionRatio / 20; //因为缓动所以延迟开始,前面前都是at(0),使过渡到开始点位(但是依旧不能准确停在起始点,因为缓动是乘百分比有残留。所以直接平滑衔接到开始后的位置)
|
|
|
+ var startDelay = 1 / startTransitionRatio / 20; //s 因为缓动所以延迟开始,前面前都是at(0),使过渡到开始点位(但是依旧不能准确停在起始点,因为缓动是乘百分比有残留。所以直接平滑衔接到开始后的位置)
|
|
|
var hasPlayedTime = 0;
|
|
|
var finishDelay = Potree.settings.cameraAniSmoothRatio / 60 * 3; //结束后还需要多久时间才能大致达到缓动的最终目标
|
|
|
var hasStoppedTime = 0;
|
|
@@ -59682,11 +59697,11 @@
|
|
|
var elapsed = (tNow - tStart) / 1000;
|
|
|
percent = elapsed / duration + startPercent;
|
|
|
} else {
|
|
|
- //从当前位置过渡到开始位置
|
|
|
- percent = 0;
|
|
|
+ //从当前位置过渡到开始位置
|
|
|
+ percent = 0; //因为at函数里有缓动措施,所以只需要设置位置在初始点即可。
|
|
|
hasPlayedTime += e.delta;
|
|
|
transitionRatio = startTransitionRatio;
|
|
|
- //console.log('延迟开始')
|
|
|
+ // console.log('延迟开始')
|
|
|
if (hasPlayedTime > startDelay) {
|
|
|
tStart = performance.now();
|
|
|
}
|
|
@@ -74189,6 +74204,42 @@
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+ class CameraAnimationCurve extends EventDispatcher {
|
|
|
+ //沿着curve轨迹的相机动画,不指定target,因视线沿着路线
|
|
|
+
|
|
|
+ constructor(curve, points, UtoTMapArr, duration) {
|
|
|
+ //简单写
|
|
|
+ super();
|
|
|
+ this.viewer = viewer;
|
|
|
+ this.curve = curve;
|
|
|
+ this.duration = duration;
|
|
|
+ this.newPointsPercents = UtoTMapArr.slice();
|
|
|
+ this.posCurve = {
|
|
|
+ points,
|
|
|
+ pointsPercent: this.newPointsPercents,
|
|
|
+ getPointAt(t) {
|
|
|
+ return curve.getPointAt(t);
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ //每个点直接朝向前面那个点
|
|
|
+ this.quaternions = [];
|
|
|
+ var quaternion,
|
|
|
+ length = points.length;
|
|
|
+ for (var i = 0; i < length - 1; i++) {
|
|
|
+ quaternion = math.getQuaFromPosAim(points[i], points[i + 1]);
|
|
|
+ this.quaternions.push(quaternion);
|
|
|
+ }
|
|
|
+ this.quaternions.push(quaternion); //最后一个点的朝向和前一个相同即可
|
|
|
+ }
|
|
|
+ setVisible() {}
|
|
|
+ updateFrustum() {}
|
|
|
+ }
|
|
|
+ CameraAnimationCurve.prototype.play = CameraAnimation$1.prototype.play;
|
|
|
+ CameraAnimationCurve.prototype.at = CameraAnimation$1.prototype.at;
|
|
|
+ CameraAnimationCurve.prototype.set = CameraAnimation$1.prototype.set;
|
|
|
+ CameraAnimationCurve.prototype.pause = CameraAnimation$1.prototype.pause;
|
|
|
+
|
|
|
var CamAniEditor = {
|
|
|
createAnimation(data) {
|
|
|
var animation = new CameraAnimation$1(viewer, data.tension);
|
|
@@ -74393,6 +74444,10 @@
|
|
|
//再把中间的缓动去除
|
|
|
};
|
|
|
return result;
|
|
|
+ },
|
|
|
+ createCurveAni(curve, points, UtoTMapArr, duration) {
|
|
|
+ var ani = new CameraAnimationCurve(curve, points, UtoTMapArr, duration);
|
|
|
+ return ani;
|
|
|
}
|
|
|
};
|
|
|
|