|
@@ -8,8 +8,8 @@ export default class ConvertViews extends THREE.EventDispatcher{
|
|
constructor( ) {
|
|
constructor( ) {
|
|
super()
|
|
super()
|
|
this.settings = {
|
|
this.settings = {
|
|
- durations : {flyToPano:1000, dolly:60, bimAniOrigin:1000}
|
|
|
|
-
|
|
|
|
|
|
+ durations : {flyToPano:1000, dolly:20, bimAniOrigin:1000},
|
|
|
|
+ checkModeDelay : 1000,
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -257,28 +257,33 @@ export default class ConvertViews extends THREE.EventDispatcher{
|
|
targetApp.CLOUD.GlobalData.WalkRotationSpeed = -0.2 //反向一下
|
|
targetApp.CLOUD.GlobalData.WalkRotationSpeed = -0.2 //反向一下
|
|
}
|
|
}
|
|
|
|
|
|
- //this.syncView(sourceApp, targetApp)
|
|
|
|
- if(targetApp.sceneType == 'bim' /* || this.ifCanChangePos(targetApp) */){
|
|
|
|
|
|
+
|
|
|
|
+ if(targetApp.sceneType == 'bim' ){
|
|
|
|
|
|
this.syncPosRot(sourceFakeApp.viewInfo, targetApp, convertInfo)
|
|
this.syncPosRot(sourceFakeApp.viewInfo, targetApp, convertInfo)
|
|
|
|
|
|
}else if(targetApp.sceneType == 'laser' ){
|
|
}else if(targetApp.sceneType == 'laser' ){
|
|
- setTimeout(()=>{//一开始虽然是点云模式,但过后又变成showPano所以是没加载好
|
|
|
|
- if(this.ifCanChangePos(targetApp) ){
|
|
|
|
|
|
+ selectBestPose() //刚好在点位上的话这句设置完就正确了
|
|
|
|
+ setTimeout(()=>{ //刚开始总是showPointCloud (且稍后会自动飞到某点)所以需要延时
|
|
|
|
+ this.laserCancelFly(targetApp)
|
|
|
|
+ if(this.ifCanChangePos(targetApp)){//点云模式的话
|
|
this.syncPosRot(sourceFakeApp.viewInfo, targetApp, convertInfo)
|
|
this.syncPosRot(sourceFakeApp.viewInfo, targetApp, convertInfo)
|
|
}else{
|
|
}else{
|
|
- selectBestPose()
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
- },1000)
|
|
|
|
|
|
+ },this.settings.checkModeDelay+10)
|
|
}else{//bim -> 固定点位
|
|
}else{//bim -> 固定点位
|
|
selectBestPose()
|
|
selectBestPose()
|
|
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
+ laserCancelFly(app){
|
|
|
|
+ app.viewer.images360.cancelFlyToPano()
|
|
|
|
+ app.viewer.mainViewport.view.cancelFlying()
|
|
|
|
+ }
|
|
|
|
|
|
bindWithBim(sourceApp, targetApp, panoData ) {
|
|
bindWithBim(sourceApp, targetApp, panoData ) {
|
|
//if (!this.player1.model.panos.list.length || !this.player2.model.panos.list.length) return
|
|
//if (!this.player1.model.panos.list.length || !this.player2.model.panos.list.length) return
|
|
@@ -398,20 +403,20 @@ export default class ConvertViews extends THREE.EventDispatcher{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- //补充control
|
|
|
|
|
|
+ //将第一人称control补充完:
|
|
|
|
|
|
-
|
|
|
|
- let baseSpeed = THREE.MathUtils.clamp( modelSize.length() / 10, 1, 10)
|
|
|
|
-
|
|
|
|
|
|
+ //scroll
|
|
|
|
+ let baseSpeed = THREE.MathUtils.clamp( Math.sqrt(modelSize.length()) / 5, 0.3, 8) //在modelBound中时的速度
|
|
|
|
+ //console.log('baseSpeed',baseSpeed)
|
|
let dom = bimViewer.getDomElement();
|
|
let dom = bimViewer.getDomElement();
|
|
dom.addEventListener('mousewheel', e => { //原版滚轮不能缩放,自己加一个
|
|
dom.addEventListener('mousewheel', e => { //原版滚轮不能缩放,自己加一个
|
|
if(e.wheelDelta == 0)return //mac
|
|
if(e.wheelDelta == 0)return //mac
|
|
let info = bimViewer.getCameraStatus()
|
|
let info = bimViewer.getCameraStatus()
|
|
let dis = modelBound.distanceToPoint(info.position)
|
|
let dis = modelBound.distanceToPoint(info.position)
|
|
- let speed = baseSpeed + dis / 8
|
|
|
|
|
|
+ let speed = baseSpeed + dis / 6
|
|
//console.log('speed', speed)
|
|
//console.log('speed', speed)
|
|
|
|
|
|
- this.bimFlyTo({forwardDis: e.wheelDelta > 0 ? speed : -speed, duration:this.settings.durations.dolly, radius:dis})
|
|
|
|
|
|
+ this.bimFlyTo({forwardDis: e.wheelDelta > 0 ? speed : -speed, duration:this.settings.durations.dolly , minRadius : baseSpeed})
|
|
})
|
|
})
|
|
|
|
|
|
//右键pan
|
|
//右键pan
|
|
@@ -792,13 +797,13 @@ export default class ConvertViews extends THREE.EventDispatcher{
|
|
let position = data.position
|
|
let position = data.position
|
|
if(!position){
|
|
if(!position){
|
|
position = new THREE.Vector3().addVectors(info.position, dir.clone().multiplyScalar(data.forwardDis))//forwardDis:前进距离
|
|
position = new THREE.Vector3().addVectors(info.position, dir.clone().multiplyScalar(data.forwardDis))//forwardDis:前进距离
|
|
- radius = Math.max(radius-data.forwardDis, 0.7)
|
|
|
|
|
|
+ radius = Math.max(radius-data.forwardDis, data.minRadius || 0.7)
|
|
}
|
|
}
|
|
if(data.duration != void 0){
|
|
if(data.duration != void 0){
|
|
bimViewer.getViewer().animator.setDuration(data.duration)//滚轮缩放时长,原先:1000
|
|
bimViewer.getViewer().animator.setDuration(data.duration)//滚轮缩放时长,原先:1000
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
|
|
+ //console.log('radius',radius)
|
|
|
|
|
|
let target = new THREE.Vector3().addVectors(position, dir.clone().multiplyScalar(radius))
|
|
let target = new THREE.Vector3().addVectors(position, dir.clone().multiplyScalar(radius))
|
|
let msg = {//不能修改
|
|
let msg = {//不能修改
|
|
@@ -814,7 +819,7 @@ export default class ConvertViews extends THREE.EventDispatcher{
|
|
|
|
|
|
flyToPano(app, panoId, o={}){
|
|
flyToPano(app, panoId, o={}){
|
|
if(app.sceneType == 'laser'){
|
|
if(app.sceneType == 'laser'){
|
|
- app.viewer.images360.cancelFlyToPano()
|
|
|
|
|
|
+ this.laserCancelFly(app)//app.viewer.images360.cancelFlyToPano()
|
|
app.viewer.images360.flyToPano(Object.assign({},{
|
|
app.viewer.images360.flyToPano(Object.assign({},{
|
|
pano: app.viewer.images360.getPano(panoId)
|
|
pano: app.viewer.images360.getPano(panoId)
|
|
},o))
|
|
},o))
|
|
@@ -951,3 +956,73 @@ note:
|
|
(所以只需要实时检测相机是否改变, hasChanged后发送)
|
|
(所以只需要实时检测相机是否改变, hasChanged后发送)
|
|
|
|
|
|
*/
|
|
*/
|
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ 其他代码:
|
|
|
|
+
|
|
|
|
+ initTagAdd(){
|
|
|
|
+ let markerConfig = new Bimface.Plugins.Marker3D.Marker3DContainerConfig();
|
|
|
|
+ markerConfig.viewer = this.viewer;
|
|
|
|
+ let tags = new Bimface.Plugins.Marker3D.Marker3DContainer(markerConfig);
|
|
|
|
+ console.log('tags',tags)
|
|
|
|
+
|
|
|
|
+ this.addEventListener('addTag',(e)=>{
|
|
|
|
+ if(this.targetPano[e.index].tag){
|
|
|
|
+ tags.removeItemById(this.targetPano[e.index].tag.id)
|
|
|
|
+ }
|
|
|
|
+ let position = new THREE.Vector3
|
|
|
|
+ if(e.position){
|
|
|
|
+ position.copy(e.position)
|
|
|
|
+ }else{
|
|
|
|
+ let currStatus = this.viewer.getCameraStatus()
|
|
|
|
+ position.copy(currStatus.position)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ let marker3dConfig = new Bimface.Plugins.Marker3D.Marker3DConfig();
|
|
|
|
+
|
|
|
|
+ marker3dConfig.src = 'images/hotpoint'+ e.index +'.png'//"http://static.bimface.com/resources/3DMarker/warner/warner_red.png";
|
|
|
|
+
|
|
|
|
+ marker3dConfig.worldPosition = new THREE.Vector3().copy(position)
|
|
|
|
+ marker3dConfig.worldPosition.z -= belowHeight
|
|
|
|
+ marker3dConfig.tooltip = '此为漫游点'+e.index //三维标签的提示
|
|
|
|
+ let tag = new Bimface.Plugins.Marker3D.Marker3D(marker3dConfig);
|
|
|
|
+ tags.addItem(tag);
|
|
|
|
+ this.viewer.clearSelectedComponents();
|
|
|
|
+ this.viewer.render();
|
|
|
|
+ this.targetPano[e.index].tag = tag
|
|
|
|
+ this.updatePanoMatch(position, e.index )
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ this.viewer.addEventListener( Bimface.Viewer.Viewer3DEvent.MouseClicked, (objectData)=>{
|
|
|
|
+
|
|
|
|
+ let position = objectData.worldPosition.clone().add({x:0,y:0,z:height});
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ addMesh(cameraData){
|
|
|
|
+
|
|
|
|
+ var mesh = new Bimface.Plugins.Geometry.Plane({
|
|
|
|
+ type:'rectangle', points:[{x:-0.1,y:-0.1,z:0},{x:0.1,y:0.1,z:0}]
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ var extObjMng = new Bimface.Plugins.ExternalObject.ExternalObjectManager(viewer2);
|
|
|
|
+ extObjMng.loadObject({ name: 'plane', object: mesh});//作为外部构件添加到场景中
|
|
|
|
+
|
|
|
|
+ //mesh.children[0].position.copy(cameraData.position).setZ(0.5)
|
|
|
|
+ mesh.children[0].up.set(0,0,1)
|
|
|
|
+ mesh.children[0].rotation.set(0,0,Math.PI/2)
|
|
|
|
+
|
|
|
|
+ this.plane = mesh
|
|
|
|
+ window.extObjMng = extObjMng
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ */
|