|
|
@@ -33,7 +33,7 @@ let cameraModel
|
|
|
|
|
|
//接收4dkk的监控 暂不支持修改 可以直接加到模型上,注意所附模型旋转90度后角度才对。
|
|
|
export default class Monitor extends THREE.Object3D{
|
|
|
- constructor(data){
|
|
|
+ constructor(data, model){
|
|
|
super()
|
|
|
|
|
|
warnHls()
|
|
|
@@ -44,12 +44,12 @@ export default class Monitor extends THREE.Object3D{
|
|
|
/* for(let i in data){
|
|
|
this[i] = data[i]
|
|
|
} */
|
|
|
- this.sid = data.sid
|
|
|
- this.fov = data.fov
|
|
|
- this.cylinderNear = data.near || 0.03
|
|
|
- this.cylinderFar = data.far || 3
|
|
|
|
|
|
+ this.fov = data.data.fov
|
|
|
+ this.cylinderNear = data.data.near || 0.03
|
|
|
+ this.cylinderFar = data.data.far || 3
|
|
|
|
|
|
+ model.add(this)
|
|
|
|
|
|
|
|
|
this.video = videoPlayer.getVideo(data.video,this)
|
|
|
@@ -145,27 +145,37 @@ export default class Monitor extends THREE.Object3D{
|
|
|
|
|
|
|
|
|
{
|
|
|
- this.posOri = data.posOri || new THREE.Vector3()
|
|
|
- this.posOffset = data.posOffset || new THREE.Vector3()
|
|
|
+
|
|
|
+ let offset = new THREE.Vector3
|
|
|
+ if(model.fileType == '3dTiles'){
|
|
|
+ offset.fromArray(model.runtime.getTileset().tileset.root.boundingVolume.box.slice(0,3))//必须要平移一段才能重合
|
|
|
+ //offset.copy(Potree.math.convertVector.ZupToYup(offset))
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ this.posOri = new THREE.Vector3(parseFloat(data.data['posOri-x']), parseFloat(data.data['posOri-y']), parseFloat(data.data['posOri-z'])),
|
|
|
+ this.posOffset = new THREE.Vector3(parseFloat(data.data['posOffset-x']), parseFloat(data.data['posOffset-y']), parseFloat(data.data['posOffset-z'])),
|
|
|
+
|
|
|
// data.position && this.position.copy(data.position)
|
|
|
- this.position.copy(this.posOri).add(this.posOffset)
|
|
|
+ this.position.copy(this.posOri).add(this.posOffset).sub(offset)
|
|
|
|
|
|
-
|
|
|
+
|
|
|
// target的优先级大于rotation
|
|
|
if (data.target) {
|
|
|
- this.target = data.target
|
|
|
+ this.target = data.data.target
|
|
|
+ this.target.sub(offset)
|
|
|
this.lookAt(data.target)
|
|
|
} else {
|
|
|
- data.rotation && this.quaternion.setFromEuler(data.rotation)
|
|
|
+ data.data.rotation && this.quaternion.setFromEuler(data.data.rotation)
|
|
|
this.target = new THREE.Vector3(0, 0, -1).applyQuaternion(this.quaternion).add(this.position)
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.roll = 0
|
|
|
- data.pitch && (this.pitch = data.pitch)
|
|
|
- data.yaw && (this.yaw = data.yaw)
|
|
|
- data.roll && this.setRoll(this.data.roll)
|
|
|
+ data.data.pitch && (this.pitch = data.data.pitch)
|
|
|
+ data.data.yaw && (this.yaw = data.data.yaw)
|
|
|
+ data.data.roll && this.setRoll(this.data.data.roll)
|
|
|
}
|
|
|
|
|
|
|