|
@@ -3292,12 +3292,12 @@ export class Viewer extends ViewerBase{
|
|
|
Potree.Utils.updateVisible(e, 'screenshot', true)
|
|
|
})
|
|
|
}else{
|
|
|
- viewer.scene.measurements.forEach((e)=>{
|
|
|
- e.edgeLabels.forEach(label=>{
|
|
|
+ /* viewer.scene.measurements.forEach((e)=>{
|
|
|
+ e.edgeLabels.forEach(label=>{
|
|
|
label.backgroundColor.a = label._oldA ;//透明的抗锯齿渲染会变黑,所以去除透明
|
|
|
label.updateTexture()
|
|
|
})
|
|
|
- })
|
|
|
+ }) */
|
|
|
}
|
|
|
|
|
|
Potree.Utils.updateVisible(this.reticule, 'screenshot', true)
|
|
@@ -3380,13 +3380,13 @@ export class Viewer extends ViewerBase{
|
|
|
Potree.Utils.updateVisible(e, 'screenshot', false)
|
|
|
})
|
|
|
}else{
|
|
|
- viewer.scene.measurements.forEach((e)=>{
|
|
|
+ /* viewer.scene.measurements.forEach((e)=>{
|
|
|
e.edgeLabels.forEach(label=>{
|
|
|
label._oldA = label.backgroundColor.a
|
|
|
label.backgroundColor.a = 1 ;//透明的抗锯齿渲染会变黑,所以去除透明
|
|
|
label.updateTexture()
|
|
|
})
|
|
|
- })
|
|
|
+ }) */
|
|
|
}
|
|
|
Potree.Utils.updateVisible(this.reticule, 'screenshot', false)//令reticule不可见
|
|
|
|
|
@@ -4710,246 +4710,32 @@ export class Viewer extends ViewerBase{
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
- addFire(){
|
|
|
-
|
|
|
- if(Potree.settings.number == 't-CwfhfqJ'){
|
|
|
- let position = Potree.Utils.datasetPosTransform({
|
|
|
- pointcloud:viewer.scene.pointclouds[0],
|
|
|
- position: new THREE.Vector3(4.4318,-0.580291847759, -0.78),
|
|
|
- fromDataset:true
|
|
|
- })
|
|
|
-
|
|
|
- viewer.modules.ParticleEditor.addParticle( {
|
|
|
- type:'fire',
|
|
|
- positions:[position],
|
|
|
- radius:0.42,
|
|
|
- height:10,
|
|
|
- })
|
|
|
-
|
|
|
- viewer.modules.ParticleEditor.addParticle( {
|
|
|
- type:'smoke',
|
|
|
- positions: [ new THREE.Vector3().addVectors(position,new THREE.Vector3(0,0,0.3))],
|
|
|
- positionStyle : 'sphere' ,
|
|
|
- positionRadius : 0.3,
|
|
|
- sizeTween: [[0, 0.3, 0.9, 1], [0.05, 0.1, 1, 0.8]],
|
|
|
- opacityBase : 0.2,
|
|
|
- opacityTween :[ [0, 0.3, 0.7, 0.95, 1], [0, 0.2, 1 , 0.1, 0] ],
|
|
|
- velocityBase : new THREE.Vector3( 0, 0, 1),
|
|
|
- velocitySpread : new THREE.Vector3( 0.2, 0.2, -0.3),
|
|
|
- accelerationBase : 0.2,
|
|
|
- accelerationSpread : 0.7,
|
|
|
- radius:0,
|
|
|
- //particlesPerSecond : 30,
|
|
|
- particleDeathAge : 3.0,
|
|
|
- })
|
|
|
-
|
|
|
- viewer.modules.ParticleEditor.addParticle( {
|
|
|
- type:'explode',
|
|
|
- name:'fire splash',
|
|
|
- position: new THREE.Vector3().addVectors(position,new THREE.Vector3(0,0,0.3)),
|
|
|
- size: 0.1,
|
|
|
- sizeRange: 0.3,
|
|
|
- sizeTween:[[0, 0.05, 0.3, 0.45], [0, 0.02, 0.1, 0.05] ],
|
|
|
- opacityTween: [[0, 0.05, 0.3, 0.45], [1, 1, 0.5, 0]] ,
|
|
|
- speed : 1, //sphere
|
|
|
- speedRange : 4,
|
|
|
- radius: 0.1,
|
|
|
- acceleration : 0.3,
|
|
|
- accelerationRange : 1,
|
|
|
- particleSpaceTime:0,
|
|
|
- strength:4,
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- addVideo(){
|
|
|
- if(Potree.settings.number != 'SS-t-P6zBR73Gke')return
|
|
|
- var geo = new THREE.PlaneGeometry(1, 1, 1, 1)
|
|
|
-
|
|
|
- var videoInfo = this.videoInfo = [
|
|
|
- {
|
|
|
- id: '40-2',
|
|
|
- url: 'https://laser-oss.4dkankan.com/testdata/SS-t-P6zBR73Gke/temp/poi/2022/05/10/0aabafee-36b8-455d-9c11-0780bf694786.mp4',
|
|
|
- rotation:[-1.494468618954883, -1.4987317433158989, -3.061254983446741],
|
|
|
- position:[ 19.801820617361624, 2.884673619844108, -0.03362305858221648],
|
|
|
- scale:[3.5741423153151763, 2.8738725275578703, 1],
|
|
|
- },
|
|
|
-
|
|
|
-
|
|
|
- {
|
|
|
- id: 40,
|
|
|
- /* rotation:[-1.534692822378723, 0.01083403560862361, 3.141535283661569],
|
|
|
- position:[17.2934294239949861, 2.413510747928117, -0.008057029580231356], */
|
|
|
- url: 'https://laser-oss.4dkankan.com/testdata/SS-t-P6zBR73Gke/temp/poi/2022/05/09/7896d6ef-a2d6-4fd7-949c-768782a5b484.mp4',
|
|
|
-
|
|
|
- rotation:[-1.5487684197910518, 0.021848470169552752, -3.1387534893955236],
|
|
|
- position:[17.277316608096, 2.0840432922115846, -0.0931149415437065],
|
|
|
- scale:[2.0821757723834047, 0.6129478480765236, 1],
|
|
|
- visibles: [40]
|
|
|
- },
|
|
|
-
|
|
|
- ]
|
|
|
- let add = (info)=>{
|
|
|
- var video = $(`<video controls="controls" loop autoplay x5-playsinline="" webkit-playsinline="true" playsinline="true" controlslist="nodownload"></video>`)[0]
|
|
|
- video.setAttribute("crossOrigin", 'Anonymous')
|
|
|
- video.src = info.url || Potree.resourcePath+`/video/${Potree.settings.number}/${info.id}.mp4`
|
|
|
-
|
|
|
- var map = new THREE.VideoTexture(video);
|
|
|
- var plane = this.videoPlane = new THREE.Mesh(geo, new THREE.MeshBasicMaterial({
|
|
|
- color:"#ffffff",
|
|
|
- transparent: !0,
|
|
|
- depthTest:false,
|
|
|
- opacity:0 ,
|
|
|
- //side:2,
|
|
|
- map
|
|
|
- }))
|
|
|
- plane.position.fromArray(info.position)
|
|
|
- plane.rotation.fromArray(info.rotation)
|
|
|
- info.scale && plane.scale.fromArray(info.scale)
|
|
|
- this.scene.scene.add(plane)
|
|
|
- info.plane = plane
|
|
|
- plane.boundingBox = new THREE.Box3(new THREE.Vector3(0,-0.5,0),new THREE.Vector3(1,-0.4,0.2))
|
|
|
- video.addEventListener('loadeddata', function(e) {
|
|
|
- video.play()
|
|
|
- if(!info.visibles/* ||!viewer.images360.currentPano || info.visibles.includes(viewer.images360.currentPano.id) */){
|
|
|
- plane.material.opacity = 1
|
|
|
- }
|
|
|
-
|
|
|
- info.scale || plane.scale.set(video.videoWidth/1000,video.videoHeight/1000,1) // 1080 * 1920
|
|
|
- console.log('video loadeddata', info.id)
|
|
|
- })
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- if(info.visibles){
|
|
|
- this.images360.addEventListener('flyToPano' ,(e)=>{//飞之前
|
|
|
- if(info.visibles.includes(e.toPano.pano.id)){ //出现
|
|
|
- setTimeout(()=>{
|
|
|
- plane.visible = true;
|
|
|
- video.currentTime = 0
|
|
|
- video.play();
|
|
|
- if(video.paused){
|
|
|
- var startPlay = ()=>{
|
|
|
- plane.visible && video.play()
|
|
|
- this.removeEventListener('global_mousedown', startPlay)
|
|
|
- }
|
|
|
- this.addEventListener('global_mousedown', startPlay)
|
|
|
- }
|
|
|
- Potree.settings.zoom.enabled = false
|
|
|
-
|
|
|
- transitions.start(lerp.property(plane.material, "opacity", 1 ) , e.toPano.duration*0.4 , ()=>{
|
|
|
-
|
|
|
- }, 0, easing['easeInOutQuad'])
|
|
|
- }, e.toPano.duration*0.6) //时间上不能和消失的重叠 延迟
|
|
|
-
|
|
|
- }else{
|
|
|
- //消失
|
|
|
- transitions.start(lerp.property(plane.material, "opacity", 0, ) , e.toPano.duration*0.4, ()=>{
|
|
|
- if(!info){
|
|
|
- plane.visible = false
|
|
|
- video.pause()
|
|
|
- Potree.settings.zoom.enabled = true
|
|
|
- }
|
|
|
- }, 0, easing['easeInOutQuad'])
|
|
|
- }
|
|
|
-
|
|
|
- })
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- var startPlay = ()=>{
|
|
|
- video.play()
|
|
|
- //video.pause()
|
|
|
- //video.currentTime = 0.1;
|
|
|
- this.removeEventListener('global_mousedown', startPlay)
|
|
|
- }
|
|
|
-
|
|
|
- this.addEventListener('global_mousedown', startPlay)
|
|
|
- Potree.settings.isTest && plane.addEventListener('select',(e)=>{console.log(e)})
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- videoInfo.forEach(info=>{
|
|
|
- add(info)
|
|
|
- })
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- /* this.images360.addEventListener('flyToPano' ,(e)=>{//飞之前
|
|
|
- if(Potree.settings.displayMode != 'showPanos') return
|
|
|
- let info = videoInfo[e.toPano.pano.id]
|
|
|
- if(info ){ //出现
|
|
|
- setTimeout(()=>{
|
|
|
- plane.visible = true;
|
|
|
- plane.position.fromArray(info.position)
|
|
|
- plane.rotation.fromArray(info.rotation)
|
|
|
-
|
|
|
- video.src = Potree.resourcePath+`/video/${Potree.settings.number}/${e.toPano.pano.id}.mp4`
|
|
|
- video.play();
|
|
|
- video.currentTime = 0
|
|
|
- Potree.settings.zoom.enabled = false
|
|
|
-
|
|
|
- transitions.start(lerp.property(plane.material, "opacity", 1 ) , e.toPano.duration*0.4 , ()=>{
|
|
|
-
|
|
|
- }, 0, easing['easeInOutQuad'])
|
|
|
- }, e.toPano.duration*0.6) //时间上不能和消失的重叠 延迟
|
|
|
-
|
|
|
-
|
|
|
+ setDisplay(state, cause='setDisplay'){//如果创建了iframe,主页的需要隐藏的话需要释放一些内存出来。iframe关闭前也释放下比较保险
|
|
|
+ state = !!state
|
|
|
+ this.objs.children.forEach(e=>{
|
|
|
+ if(e.fileType == '3dTiles'){
|
|
|
+ let tileset = e.runtime.getTileset()
|
|
|
+ Potree.Utils.updateVisible(e, cause, state)
|
|
|
+ if(!state) tileset._cache.trim(); //使下一次update时dispose所有不可见的tiles
|
|
|
+ e.runtime.update(16, this.renderer, this.mainViewport.camera, true)
|
|
|
+ if(state) this.dispatchEvent('content_changed')
|
|
|
}
|
|
|
-
|
|
|
- //消失
|
|
|
- transitions.start(lerp.property(plane.material, "opacity", 0, ) , e.toPano.duration*0.4, ()=>{
|
|
|
- if(!info){
|
|
|
- plane.visible = false
|
|
|
- video.pause()
|
|
|
- Potree.settings.zoom.enabled = true
|
|
|
- }
|
|
|
- }, 0, easing['easeInOutQuad'])
|
|
|
-
|
|
|
-
|
|
|
})
|
|
|
|
|
|
|
|
|
+ if(state){
|
|
|
+ Potree.pointBudget = 6*1000*1000 //先随便写一个, 随后mergeEditor.updateMemoryUsage
|
|
|
+ }else{
|
|
|
+ Potree.pointBudget = 0
|
|
|
+ Potree.updatePointClouds(this.scene.pointclouds, this.mainViewport.camera, this.mainViewport.resolution )
|
|
|
+ }
|
|
|
+ this.dispatchEvent({type:'setDisplay',state})
|
|
|
|
|
|
- this.images360.addEventListener('endChangeMode',(e)=>{ //暂时不处理初始加载时就在有视频的点位上的情况
|
|
|
- if(e.mode == 'showPanos'){
|
|
|
- let info = videoInfo[this.images360.currentPano.id]
|
|
|
- if(info ){ //出现
|
|
|
- plane.visible = true;
|
|
|
- plane.position.fromArray(info.position)
|
|
|
- plane.rotation.fromArray(info.rotation)
|
|
|
- plane.material.opacity = 0
|
|
|
-
|
|
|
- video.src = Potree.resourcePath+`/video/${Potree.settings.number}/${this.images360.currentPano.id}.mp4`
|
|
|
- video.play();
|
|
|
- video.currentTime = 0
|
|
|
- Potree.settings.zoom.enabled = false
|
|
|
-
|
|
|
- transitions.start(lerp.property(plane.material, "opacity", 1, (e)=>{console.log('fadeIn',e)}) , 300 , ()=>{
|
|
|
-
|
|
|
- }, 0, easing['easeInOutQuad'])
|
|
|
-
|
|
|
- }
|
|
|
- }else{
|
|
|
- plane.visible = false;
|
|
|
- Potree.settings.zoom.enabled = true
|
|
|
- }
|
|
|
-
|
|
|
- })
|
|
|
-
|
|
|
- */
|
|
|
+ this.paused = !state
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
addSprite(e){//api
|
|
|
let sprite
|
|
|
|