|
@@ -226,71 +226,84 @@ export default class ConvertViews extends THREE.EventDispatcher{
|
|
|
let needBindEvent = !this.targetApp // 若targetApp存在表明targetApp的dom未换掉,事件还存在
|
|
|
this.sourceApp = sourceApp
|
|
|
this.targetApp = targetApp
|
|
|
-
|
|
|
+ let data = this.getCameraData(sourceApp)
|
|
|
|
|
|
bimViewer = this.bimViewer = targetApp.viewer
|
|
|
-
|
|
|
- this.needConvertAxis = sourceApp.sceneType == 'kankan' && targetApp.sceneType == 'bim'// Y朝上需要转换
|
|
|
-
|
|
|
- this.lastCamStatus = bimViewer.getCameraStatus()
|
|
|
- targetPano && this.computeShift(sourcePano, targetPano)
|
|
|
-
|
|
|
bimViewer.setNavigationMode(targetApp.Glodon.Bimface.Viewer.NavigationMode3D.Walk)
|
|
|
- bimViewer.setFlySpeedRate(5)
|
|
|
+ bimViewer.setFlySpeedRate(3)
|
|
|
bimViewer.getViewer().setTransitionAnimationState(false) //setCameraStatus瞬间变化相机 ,or setCameraAnimation?
|
|
|
-
|
|
|
- bimViewer.addEventListener('Rendered', (e)=>{//反向改变左侧相机
|
|
|
-
|
|
|
- let info = bimViewer.getCameraStatus()
|
|
|
- let poseChanged = !math.closeTo(this.lastCamStatus.position, info.position)
|
|
|
- || !math.closeTo(this.lastCamStatus.target, info.target)
|
|
|
- || !math.closeTo(this.lastCamStatus.fov, info.fov)
|
|
|
-
|
|
|
- if(poseChanged){
|
|
|
- if(this.leftCanChangePos()){
|
|
|
- this.send(info)
|
|
|
- this.lastCamStatus = info
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
+
|
|
|
+ let camera = bimViewer.getViewer().camera
|
|
|
+ if(camera.fov != data.fov){
|
|
|
+ camera.fov = data.fov
|
|
|
+ camera.updateProjectionMatrix()
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if(targetPano){
|
|
|
+ this.needConvertAxis = sourceApp.sceneType == 'kankan' && targetApp.sceneType == 'bim'// Y朝上需要转换
|
|
|
|
|
|
- })
|
|
|
- if(sourceApp.sceneType == 'laser'){
|
|
|
- this.sourceDom = this.sourceApp.viewer.inputHandler.domElement
|
|
|
- sourceApp.viewer.addEventListener('camera_changed', e => {
|
|
|
- targetApp && this.receive(this.getCameraData(sourceApp))
|
|
|
- })
|
|
|
- //master.viewer.images360.isAtPano() || master.Potree.settings.displayMode == 'showPanos'
|
|
|
- /* if(this.lastBimStatus){
|
|
|
- this.lastBimStatus
|
|
|
- let pano
|
|
|
- if(this.lastBimStatus.panoId != void 0) pano = this.sourceApp.viewer.images360.panos[this.lastBimStatus.panoId]
|
|
|
- this.sourceApp.viewer.dispatchEvent({type:'camera_changed',changeInfo:{quaternionChanged:true},viewport:this.sourceApp.viewer.mainViewport }) //朝向位置同步
|
|
|
+ this.lastCamStatus = bimViewer.getCameraStatus()
|
|
|
+ this.computeShift(sourcePano, targetPano)
|
|
|
+ bimViewer.addEventListener('Rendered', (e)=>{//反向改变左侧相机
|
|
|
+
|
|
|
+ let info = bimViewer.getCameraStatus()
|
|
|
+ let poseChanged = !math.closeTo(this.lastCamStatus.position, info.position)
|
|
|
+ || !math.closeTo(this.lastCamStatus.target, info.target)
|
|
|
+ || !math.closeTo(this.lastCamStatus.fov, info.fov)
|
|
|
+
|
|
|
+ if(poseChanged){
|
|
|
+ if(this.leftCanChangePos()){
|
|
|
+ this.send(info)
|
|
|
+ this.lastCamStatus = info
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ })
|
|
|
+ if(sourceApp.sceneType == 'laser'){
|
|
|
+ this.sourceDom = this.sourceApp.viewer.inputHandler.domElement
|
|
|
+ sourceApp.viewer.addEventListener('camera_changed', e => {
|
|
|
+ targetApp && this.receive(this.getCameraData(sourceApp))
|
|
|
+ })
|
|
|
+ //master.viewer.images360.isAtPano() || master.Potree.settings.displayMode == 'showPanos'
|
|
|
+ /* if(this.lastBimStatus){
|
|
|
+ this.lastBimStatus
|
|
|
+ let pano
|
|
|
+ if(this.lastBimStatus.panoId != void 0) pano = this.sourceApp.viewer.images360.panos[this.lastBimStatus.panoId]
|
|
|
+ this.sourceApp.viewer.dispatchEvent({type:'camera_changed',changeInfo:{quaternionChanged:true},viewport:this.sourceApp.viewer.mainViewport }) //朝向位置同步
|
|
|
+
|
|
|
+ pano && customer.viewer.images360.flyToPano({pano, duration: 0 })
|
|
|
+ } */
|
|
|
+
|
|
|
|
|
|
- pano && customer.viewer.images360.flyToPano({pano, duration: 0 })
|
|
|
- } */
|
|
|
+ }else if(sourceApp.sceneType == 'kankan'){
|
|
|
+ let player = this.sourceApp.app.core.get('Player')
|
|
|
+ this.sourceDom = player.domElement
|
|
|
+ var cameraMove = (e)=>{//暂时只有漫游模式
|
|
|
+ if(!e.hasChanged.cameraChanged2)return
|
|
|
+ this.receive(this.getCameraData(sourceApp))
|
|
|
+ }
|
|
|
+ player.on("update",cameraMove)
|
|
|
+ }
|
|
|
|
|
|
+ /* bimViewer.addEventListener(targetApp.Glodon.Bimface.Viewer.Viewer3DEvent.ViewAdded,
|
|
|
+ ()=>{
|
|
|
+ this.loaded = true
|
|
|
+ if(this.firstData){
|
|
|
+ this.receive(this.firstData)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ) */
|
|
|
|
|
|
- }else if(sourceApp.sceneType == 'kankan'){
|
|
|
- let player = this.sourceApp.app.core.get('Player')
|
|
|
- this.sourceDom = player.domElement
|
|
|
- var cameraMove = (e)=>{//暂时只有漫游模式
|
|
|
- if(!e.hasChanged.cameraChanged2)return
|
|
|
- this.receive(this.getCameraData(sourceApp))
|
|
|
- }
|
|
|
- player.on("update",cameraMove)
|
|
|
+ needBindEvent && this.bindCamEvent()
|
|
|
+ this.loaded = true
|
|
|
+ this.receive(data)
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
- /* bimViewer.addEventListener(targetApp.Glodon.Bimface.Viewer.Viewer3DEvent.ViewAdded,
|
|
|
- ()=>{
|
|
|
- this.loaded = true
|
|
|
- if(this.firstData){
|
|
|
- this.receive(this.firstData)
|
|
|
- }
|
|
|
- }
|
|
|
- ) */
|
|
|
- this.loaded = true
|
|
|
- this.receive(this.getCameraData(sourceApp))
|
|
|
- needBindEvent && this.bindCamEvent()
|
|
|
|
|
|
}
|
|
|
|