|
@@ -62297,7 +62297,7 @@
|
|
|
this.cylinderNear = data.data.near || 0.03;
|
|
|
this.cylinderFar = data.data.far || 3;
|
|
|
model.add(this);
|
|
|
- this.video = videoPlayer.getVideo(data.video, this);
|
|
|
+ this.video = videoPlayer.getVideo(this.getVideoSrc(), this);
|
|
|
if (data.video) {
|
|
|
//console.error('createVideo', this.videoSrc, this.sid)
|
|
|
/* this.video.onloadedmetadata = () => {
|
|
@@ -62424,9 +62424,9 @@
|
|
|
this.position.copy(Potree.Utils.tran4dkkVecInModel(this.position, model));
|
|
|
|
|
|
// target的优先级大于rotation
|
|
|
- if (data.target) {
|
|
|
+ if (data.data.target) {
|
|
|
this.target = Potree.Utils.tran4dkkVecInModel(data.data.target, model);
|
|
|
- this.lookAt(data.target);
|
|
|
+ this.lookAt(data.data.target);
|
|
|
} else {
|
|
|
data.data.rotation && this.quaternion.setFromEuler(data.data.rotation);
|
|
|
this.target = new Vector3(0, 0, -1).applyQuaternion(this.quaternion).add(this.position);
|
|
@@ -62458,6 +62458,15 @@
|
|
|
Potree.Utils.setObjectLayers(this.cylinder.bottom, 'monitor');
|
|
|
this.cameraModel && Potree.Utils.setObjectLayers(this.cameraModel, 'sceneObjects');
|
|
|
}
|
|
|
+ getVideoSrc() {
|
|
|
+ if (this.data.urlType === 2) {
|
|
|
+ var a = this.parent.props.raw.surveillancePath.split('/');
|
|
|
+ a.pop();
|
|
|
+ return a.join('/') + '/' + data.fileName;
|
|
|
+ } else {
|
|
|
+ return data.playUrl;
|
|
|
+ }
|
|
|
+ }
|
|
|
modelLoaded() {
|
|
|
this.cameraModel = cameraModel.clone();
|
|
|
this.cameraModel.material = cameraModel.material.clone();
|
|
@@ -62490,6 +62499,7 @@
|
|
|
this.video.pause(); //先显示出画面
|
|
|
setTimeout(() => {
|
|
|
viewer.mainViewport.cameraLayers = ['monitor']; //hide others
|
|
|
+ viewer.scene.monitors.forEach(e => Potree.Utils.updateVisible(e, 'watch', e == this));
|
|
|
}, 800);
|
|
|
viewer.mainViewport.view.setRotMode('free');
|
|
|
viewer.mainViewport.view.setView({
|
|
@@ -62517,11 +62527,13 @@
|
|
|
this.cameraModel.material.color.copy(normalColor);
|
|
|
viewer.mainViewport.view.cancelFlying();
|
|
|
viewer.mainViewport.cameraLayers = null;
|
|
|
+ viewer.scene.monitors.forEach(e => Potree.Utils.updateVisible(e, 'watch', true));
|
|
|
this.video.pause();
|
|
|
viewer.mainViewport.view.setView({
|
|
|
position: this.oldState.position,
|
|
|
quaternion: this.oldState.quaternion,
|
|
|
onUpdate: percent => {
|
|
|
+ console.log(viewer.mainViewport.view.quaternion.toArray());
|
|
|
camera.fov = this.fov * (1 - percent) + this.oldState.fov * percent;
|
|
|
camera.updateProjectionMatrix();
|
|
|
},
|
|
@@ -62688,7 +62700,7 @@
|
|
|
// 横滚角
|
|
|
setRoll(angle) {
|
|
|
this.roll = angle % 360;
|
|
|
- this.obj3d.quaternion.setFromAxisAngle(vec1.set(0, 0, -1), MathUtils.degToRad(angle));
|
|
|
+ this.obj3d.quaternion.setFromAxisAngle(vec1.set /* (0,1,0) */(0, 0, -1), MathUtils.degToRad(angle));
|
|
|
}
|
|
|
get yaw() {
|
|
|
// 左右转角
|
|
@@ -76394,7 +76406,7 @@
|
|
|
maxClipFactor: 1,
|
|
|
text: model.name,
|
|
|
sizeInfo: {
|
|
|
- width2d: 150
|
|
|
+ width2d: 200
|
|
|
},
|
|
|
rectBorderThick: 1,
|
|
|
borderColor: {
|
|
@@ -76409,11 +76421,11 @@
|
|
|
b: 255,
|
|
|
a: 1.0
|
|
|
},
|
|
|
- textshadowColor: 'black',
|
|
|
+ //textshadowColor:'black',
|
|
|
backgroundColor: {
|
|
|
- r: 100,
|
|
|
- g: 100,
|
|
|
- b: 100,
|
|
|
+ r: 0,
|
|
|
+ g: 0,
|
|
|
+ b: 0,
|
|
|
a: 0.3
|
|
|
},
|
|
|
borderRadius: 6,
|
|
@@ -82498,84 +82510,6 @@
|
|
|
model.dispatchEvent('rotation_changed');
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
- /*
|
|
|
- for(let [model, keys] of this.pathKeys){//路径。开头结尾和别的衔接过渡
|
|
|
-
|
|
|
- keys.find(key=>{
|
|
|
- if(key.path.points.length < 2) return
|
|
|
- let startToFade = key.time - maxClipFadeTime/2
|
|
|
- let endFade = key.time + key.dur + maxClipFadeTime/2
|
|
|
- atPath = time >= key.time && time <= key.time + key.dur
|
|
|
- if(atPath){
|
|
|
- atPath = key //找到一个就退出
|
|
|
- return true
|
|
|
- }
|
|
|
- if(key.time + key.dur < time) lastPath = key
|
|
|
- else if(key.time > time && !nextPath) nextPath = key
|
|
|
-
|
|
|
- })
|
|
|
- pathStates.set(model,{atPath, lastPath, nextPath })
|
|
|
-
|
|
|
-
|
|
|
- if(atPath){//沿着curve行走,目视curve前方 (参照CameraAnimationCurve,搜quaFromCurveTan)
|
|
|
- let percent = THREE.Math.clamp((time - atPath.time) / atPath.dur, 0, 1)
|
|
|
- let {position , quaternion} = this.getPoseAtPathKey(atPath, percent, model) //模型文件先保证其center在脚底,如果要我手动将bound底部对齐路径高度再说
|
|
|
- model.position.copy(position);
|
|
|
- model.quaternion.copy(quaternion)
|
|
|
- model.dispatchEvent('position_changed') //暂时都这么写,以后再判断是否真的改变了
|
|
|
- model.dispatchEvent('rotation_changed')
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- for(let [model, keys] of this.poseKeys){
|
|
|
- if(keys.length == 0) continue
|
|
|
- let {atPath, lastPath, nextPath} = pathStates.get(model) || {}
|
|
|
-
|
|
|
- tweens.scale = new Tween(keys.map(e=>e.time), keys.map(e=>e.scale))
|
|
|
- model.scale.copy(tweens.scale.lerp(time))
|
|
|
- let pathToPoseKey = keys
|
|
|
- if(!atPath ){
|
|
|
- keys = keys.slice()
|
|
|
- let addPathToPoseKey = (pathKey, percent)=>{ //把当前前后的path姿态加入帧
|
|
|
- let {position , quaternion} = this.getPoseAtPathKey(pathKey, percent, model)
|
|
|
- let fakeKey = {
|
|
|
- isPath : true,
|
|
|
- time: pathKey.time + pathKey.dur * percent,
|
|
|
- pos:position , qua:quaternion
|
|
|
- }
|
|
|
- let index = keys.findIndex(e=>e.time > pathKey.time)
|
|
|
- if(index == -1){
|
|
|
- index = keys.length
|
|
|
- }
|
|
|
- keys = [...keys.slice(0,index), fakeKey, ...keys.slice(index,keys.length)]
|
|
|
- }
|
|
|
- lastPath && addPathToPoseKey(lastPath, 1)
|
|
|
- nextPath && addPathToPoseKey(nextPath, 0)
|
|
|
-
|
|
|
-
|
|
|
- tweens.pos = new Tween(keys.map(e=>e.time), keys.map(e=>e.pos))
|
|
|
- tweens.qua = new Tween(keys.map(e=>e.time), keys.map(e=>e.qua))
|
|
|
-
|
|
|
-
|
|
|
- let position = tweens.pos.lerp(time)
|
|
|
- let quaternion = tweens.qua.lerp(time)
|
|
|
-
|
|
|
- model.position.copy(position)
|
|
|
- model.quaternion.copy(quaternion)
|
|
|
-
|
|
|
- model.dispatchEvent('position_changed')
|
|
|
- model.dispatchEvent('rotation_changed')
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- } */
|
|
|
var _loop = function _loop(keys) {
|
|
|
if (keys.length == 0) return 1; // continue
|
|
|
var weights = keys.map((key, i) => {
|