xzw 2 tahun lalu
induk
melakukan
5b32031641
3 mengubah file dengan 622 tambahan dan 264 penghapusan
  1. 604 215
      public/lib/potree/potree.js
  2. 1 1
      public/lib/potree/potree.js.map
  3. 17 48
      src/sdk/cover/index.js

File diff ditekan karena terlalu besar
+ 604 - 215
public/lib/potree/potree.js


File diff ditekan karena terlalu besar
+ 1 - 1
public/lib/potree/potree.js.map


+ 17 - 48
src/sdk/cover/index.js

@@ -492,13 +492,22 @@ export const enter = (dom, isLocal) => {
                 model.addEventListener('changeSelect',(e)=>{
                     bus.emit('changeSelect',e.selected)
                 }) 
+                let lastState={ } 
                 model.addEventListener('transformChanged',(e)=>{
-                    bus.emit('transformChanged', {
-                        position : model.position.clone(),
-                        scale: model.scale.x * 100,
-                        rotation: model.rotation.clone(),
-                        //bottom: model.btmHeight
-                    })
+                    let msg = {}
+                    if(!lastState.position || !model.position.equals(lastState.position)){
+                        lastState.position = msg.position = model.position.clone() 
+                    }
+                    if(!lastState.rotation || !model.rotation.equals(lastState.rotation)){
+                        lastState.rotation = msg.rotation = model.rotation.clone()
+                    }
+                    if(lastState.scale == void 0 || model.scale.x * 100 != lastState.scale){
+                        lastState.scale = msg.scale = model.scale.x * 100
+                    }
+                     
+                    msg = Potree.Common.CloneObject(msg)
+                    console.log(msg)
+                    bus.emit('transformChanged', msg )
                 }) 
                 spliceFromArr(model,true)
                 
@@ -571,59 +580,19 @@ export const enter = (dom, isLocal) => {
                 changeOpacity(opacity){ //见笔记:透明物体的材质设置
                     if(opacity == void 0)opacity = 100
                     opacity/=100
-                    
                     MergeEditor.changeOpacity(model, opacity)
-                    
-                    /* if(model){
-                        if(model.isPointcloud){ 
-                            model.changePointOpacity(opacity) 
-                            //MergeEditor.updateEdgeStrength()
-                        }else{
-                            //model.traverse(e=>e.material && setOp(e, opacity))
-                            model.traverse(mesh=>{
-                                if(mesh.material){ 
-                                
-                                    mesh.material.opacity = opacity
-                                    if(opacity<1){
-                                        mesh.material.transparent = true 
-                                        if(model.isPointcloud){
-                                            mesh.changePointOpacity(opacity)  
-                                        }else{
-                                            mesh.material.opacity = opacity
-                                        }
-                                        
-                                        mesh.renderOrder = Potree.config.renderOrders.model+1 
-                                        mesh.material.depthWrite = false
-                                    }else{
-                                        mesh.material.transparent = false
-                                        mesh.renderOrder = Potree.config.renderOrders.model
-                                        mesh.material.depthWrite = true
-                                    }
-                                
-                                }
-                            })
-                        }  
-                         
-                        model.opacity = opacity//记录在最外层
-                    } */
-                     
                 },
                 changeBottom(z){
                     /* model && MergeEditor.setModelBtmHeight(model,z)
                     model.dispatchEvent('transformChanged') //改了position */
                 },
                 changePosition(pos){//校准取消时执行
-                    //if(MergeEditor.selected == model){
-                        //console.log('pos',pos.x, pos.y, pos.z)
-                    //} 
+                    console.log('changePosition',pos.x, pos.y, pos.z)
                     model && model.position.copy(pos)
                     model.dispatchEvent({type:'position_changed'}) 
                 }, 
                 changeRotation(rot){//校准取消时执行 
-                    //if(MergeEditor.selected == model){
-                        //console.log('rot', rot.x, rot.y, rot.z)
-                    //}
-                 
+                    console.log('changeRotation',rot.x, rot.y, rot.z)
                     model && model.rotation.setFromVector3(rot) 
                     model.dispatchEvent({type:'rotation_changed'})  
                 },