|
@@ -74350,9 +74350,10 @@ void main() {
|
|
|
|
|
|
this.targets = [];
|
|
|
this.createPath();
|
|
|
- this.duration = 5;
|
|
|
+ this.duration = 5;
|
|
|
this.percent = 0;
|
|
|
this.currentIndex = 0;
|
|
|
+ this.durations = [];
|
|
|
this.quaternions = [];
|
|
|
|
|
|
if(!Potree.settings.isTest){
|
|
@@ -74460,6 +74461,7 @@ void main() {
|
|
|
}else {
|
|
|
position.copy(posInfo.position);
|
|
|
target.copy(posInfo.target);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
this.posCurve.addPoint(position, index/* , true */);
|
|
@@ -74467,6 +74469,9 @@ void main() {
|
|
|
let targetSvg = new HandleSvg(target, colors.target);
|
|
|
targetSvg.visible = this.visible;
|
|
|
this.targets = [...this.targets.slice(0,index), targetSvg, ...this.targets.slice(index,length)];
|
|
|
+ if(this.useDurSlice){//不使用全局的duration,而是分段的
|
|
|
+ this.durations = [...this.durations.slice(0,index), posInfo.duration, ...this.durations.slice(index,length)];
|
|
|
+ }
|
|
|
|
|
|
|
|
|
this.dispatchEvent({
|
|
@@ -74523,7 +74528,9 @@ void main() {
|
|
|
index
|
|
|
});
|
|
|
this.targetLines.remove(this.targetLines.children[index]);
|
|
|
-
|
|
|
+ if(this.useDurSlice){
|
|
|
+ this.durations.splice(index, 1);
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|
|
@@ -74594,41 +74601,64 @@ void main() {
|
|
|
if(length<2){
|
|
|
return this.newPointsPercents = []
|
|
|
}
|
|
|
- const maxSpaceDur = this.duration / length; //每两点之间修改间隔时间后,最大时间
|
|
|
- const durPerRad = 0.8; //每弧度应该占用的时间
|
|
|
- const minSpaceDur = Math.min(0.8, maxSpaceDur);//每两点之间修改间隔时间后,最小时间
|
|
|
- const maxAngleSpaceDur = MathUtils.clamp(durPerRad * Math.PI, minSpaceDur, maxSpaceDur );// 最大可能差距是180度
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- var percents = this.posCurve.pointsPercent;
|
|
|
var newPercents = [0];
|
|
|
|
|
|
|
|
|
- for(let i=1;i<length;i++){
|
|
|
- let diff = (percents[i] - percents[i-1]) * this.duration; //间隔时间
|
|
|
- let percent;
|
|
|
- let curMin = minSpaceDur;
|
|
|
- if(diff < maxAngleSpaceDur){ //若小于最大旋转时间
|
|
|
- let rad = this.quaternions[i].angleTo(this.quaternions[i-1]);
|
|
|
- curMin = MathUtils.clamp(rad * durPerRad, minSpaceDur, maxSpaceDur);
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- diff = Math.max(diff, curMin);
|
|
|
- percent = newPercents[i-1] + (diff / this.duration); //得到新的percent
|
|
|
+
|
|
|
+ if(this.useDurSlice){ //已经设定好了每一段的duration的话
|
|
|
+ let sums = [0];
|
|
|
+ let sum = 0, last = this.durations[0];
|
|
|
+ for(let i=1;i<length;i++){
|
|
|
+ let duration = this.durations[i];
|
|
|
+ sum += duration;
|
|
|
+ last = duration;
|
|
|
+ sums.push(sum);
|
|
|
+ }
|
|
|
+ for(let i=1;i<length;i++){
|
|
|
+ newPercents.push(sum == 0 ? i/length : sums[i] / sum);
|
|
|
+ }
|
|
|
+
|
|
|
+ }else {
|
|
|
|
|
|
+ const maxSpaceDur = this.duration / length; //每两点之间修改间隔时间后,最大时间
|
|
|
+ const durPerRad = 0.8; //每弧度应该占用的时间
|
|
|
+ const minSpaceDur = Math.min(0.8, maxSpaceDur);//每两点之间修改间隔时间后,最小时间
|
|
|
+ const maxAngleSpaceDur = MathUtils.clamp(durPerRad * Math.PI, minSpaceDur, maxSpaceDur );// 最大可能差距是180度
|
|
|
|
|
|
- newPercents.push(percent);
|
|
|
- }
|
|
|
-
|
|
|
- let maxPercent = newPercents[length-1]; //最后一个,若扩充过时间,就会>1
|
|
|
+
|
|
|
+
|
|
|
+ var percents = this.posCurve.pointsPercent;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ for(let i=1;i<length;i++){
|
|
|
+ let diff = (percents[i] - percents[i-1]) * this.duration; //间隔时间
|
|
|
+ let percent;
|
|
|
+ let curMin = minSpaceDur;
|
|
|
+ if(diff < maxAngleSpaceDur){ //若小于最大旋转时间
|
|
|
+ let rad = this.quaternions[i].angleTo(this.quaternions[i-1]);
|
|
|
+ curMin = MathUtils.clamp(rad * durPerRad, minSpaceDur, maxSpaceDur);
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
+ diff = Math.max(diff, curMin);
|
|
|
+ percent = newPercents[i-1] + (diff / this.duration); //得到新的percent
|
|
|
+
|
|
|
+
|
|
|
+ newPercents.push(percent);
|
|
|
+ }
|
|
|
+
|
|
|
+ let maxPercent = newPercents[length-1]; //最后一个,若扩充过时间,就会>1
|
|
|
|
|
|
- if( !math.closeTo(maxPercent, 1)){
|
|
|
- let scale = 1 / maxPercent; //需要压缩的比例 <1 这一步会让实际得到的间隔更小
|
|
|
- newPercents = newPercents.map(e=> e*=scale );
|
|
|
+
|
|
|
+ if( !math.closeTo(maxPercent, 1)){
|
|
|
+ let scale = 1 / maxPercent; //需要压缩的比例 <1 这一步会让实际得到的间隔更小
|
|
|
+ newPercents = newPercents.map(e=> e*=scale );
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
this.newPointsPercents = newPercents;
|
|
|
//console.log(newPercents)
|
|
|
}
|
|
@@ -74890,7 +74920,7 @@ void main() {
|
|
|
this.posCurve.dispose();
|
|
|
//this.targetCurve.dispatchEvent({type:'dispose'})
|
|
|
this.targets.forEach(e=>e.dispose());
|
|
|
-
|
|
|
+ this.durations = [];
|
|
|
this.node.parent.remove(this.node);
|
|
|
}
|
|
|
}
|
|
@@ -115063,12 +115093,12 @@ ENDSEC
|
|
|
}else {
|
|
|
viewer.outlinePass.edgeStrength = 100;
|
|
|
}
|
|
|
- console.log('selectModel', model);
|
|
|
+ //console.log('selectModel', model)
|
|
|
|
|
|
}else {
|
|
|
viewer.outlinePass.selectedObjects = [];
|
|
|
this.selected = null;
|
|
|
- console.log('selectModel', null);
|
|
|
+ //console.log('selectModel', null)
|
|
|
}
|
|
|
|
|
|
|
|
@@ -118656,9 +118686,10 @@ ENDSEC
|
|
|
/* const position = Potree.Utils.datasetPosTransform({ fromDataset: true, position: cpdata.position, datasetId: Potree.settings.originDatasetId })
|
|
|
const target = Potree.Utils.datasetPosTransform({ fromDataset: true, position: cpdata.target, datasetId: Potree.settings.originDatasetId })
|
|
|
*/
|
|
|
- const position = new THREE.Vector3().copy(cpdata.position);
|
|
|
- const target = new THREE.Vector3().copy(cpdata.target);
|
|
|
- const cp = animation.createControlPoint(null,{position, target});
|
|
|
+ const position = new Vector3().copy(cpdata.position);
|
|
|
+ const target = new Vector3().copy(cpdata.target);
|
|
|
+ const duration = cpdata.duration;
|
|
|
+ const cp = animation.createControlPoint(null, {position, target, duration});
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -123097,6 +123128,7 @@ ENDSEC
|
|
|
this.modules.PanoEditor = PanoEditor$1;
|
|
|
}else if(Potree.settings.editType == "merge"){
|
|
|
this.modules.MergeEditor = MergeEditor;
|
|
|
+ this.modules.CamAniEditor = CamAniEditor;
|
|
|
}
|
|
|
|
|
|
}else {
|