xzw пре 2 месеци
родитељ
комит
9eed3aa4b4

+ 23 - 5
examples/splatter.html

@@ -83,7 +83,7 @@
     
     Potree.settings.showStats  = true
     Potree.config.view.near = 0.001,  Potree.config.view.far = 1e3  //same as splatter 
-    let log =  browser.isMobile() 
+    let log = 0// browser.isMobile() 
     if(log){//
         //window.addEventListener("load", ()=>{
             var textarea = document.createElement('textarea');
@@ -194,7 +194,7 @@
         }
     }[splatId]
     
-    
+    Potree.settings.number = splatId == 'rly-jb1' ? 'SG-t-WSs5eaQJLoc' : splatId
     
     
     let applyConfig = (config)=>{
@@ -206,7 +206,9 @@
     
     if(splatId!=''){
         let path = browser.urlHasValue('gsPath', true) 
-        if(!path){ 
+        if(path){
+            path = Potree.Common.replaceAll(path,'{splatId}',splatId)
+        }else{ 
             if(urlAtSplatter){
                 path = Potree.resourcePath + '../../../../examples/tomcat/splatter.app/data/' + splatId  
             }else{
@@ -251,14 +253,30 @@
                 btn2.value = btn2.value == '停sort' ? '开sort' : '停sort' 
                 viewer.splatter.renderer.lodder.pauseSort = btn2.value == '停sort' ? 0 : 1
             }*/
-            btn2.value = 'switchColl' 
+            btn2.value = 'toggleMesh' 
             btn2.onclick = ()=>{ 
                 viewer.collider.toggleMesh()
             }
             
             browser.urlHasValue('character') && viewer.setControls(viewer.characterCtrl)
          
-            
+         
+            let modeBtn = document.createElement('input')
+            btn2.parentElement.appendChild(modeBtn) 
+            modeBtn.style.width = '60px'
+            modeBtn.style.right = '5px' 
+            modeBtn.style.top = '5px' 
+            modeBtn.style['z-index'] = 10000;
+            modeBtn.style['position'] = 'absolute';
+            modeBtn.value = '枢轴模式'
+            let firstControl = viewer.controls
+            viewer.orbitControls.constantlyForward = true
+            viewer.orbitControls.progression = true
+            modeBtn.onclick = ()=>{ 
+                modeBtn.value = modeBtn.value == '枢轴模式' ? '第一人称' : '枢轴模式' 
+                viewer.setControls(modeBtn.value == '枢轴模式' ? firstControl : viewer.orbitControls)
+                viewer.mainViewport.view.radius = 10 //for orbit
+            }
             
             
             

+ 7 - 7
libs/three.js/3dtiles/three-loader-3dtiles.esm.js

@@ -9494,7 +9494,7 @@ class TileHeader {
       this.content = await load(contentUrl, loader, options);
 
         // !zeg改
-        if (/* this.tileset.options. */maxDepth < this.depth && this.type == 'scenegraph') {//有的场景depth为1的不是mesh,只是json,即实际最低depth>1
+        if (/* this.tileset.options. */maxDepth < this.depth && this.type == 'scenegraph' && this.parent.type == 'scenegraph') {//如果limit2了,就只加载到最低层的mesh
             this.unloadContent()
             return false
         }
@@ -10426,7 +10426,7 @@ class Tileset3D extends EventDispatcher{//xzw add EventDispatcher
     this.stats.get(TILES_GPU_MEMORY, 'memory');
   }
 
-  _initializeTileHeaders(tilesetJson, parentTileHeader) {
+  _initializeTileHeaders(tilesetJson, parentTileHeader) {//初始化该tileset的层级结构?
        
     const rootTile = new TileHeader(this, tilesetJson.root, parentTileHeader, parentTileHeader == void 0 && 'root_'+tilesetSid++);
 
@@ -10445,14 +10445,14 @@ class Tileset3D extends EventDispatcher{//xzw add EventDispatcher
         const children = tile.header.children || [];
 
         // !zeg改  
-        if(tile.depth < /* this.options. */maxDepth){                                     
+        //if(tile.depth < /* this.options. */maxDepth){                                     
             for (const childHeader of children) {
               const childTile = new TileHeader(this, childHeader, tile);
               tile.children.push(childTile);
               childTile.depth = tile.depth + 1;
               stack.push(childTile);
             }
-        }
+        //}
         window.maxTileDepth = Math.max(window.maxTileDepth||0,   tile.depth)
       }
     }
@@ -17647,7 +17647,7 @@ class Loader3DTiles {
                         }
                     }
                     if (tileContent) {
-                        tileContent.visible = false; 
+                        Potree.Utils.updateVisible(tileContent,'self',false)    
                         renderMap[tile.id] = tileContent;
                         tileContent.name = tile.id //add
                         tileContent.tile = tile //add
@@ -17833,7 +17833,7 @@ class Loader3DTiles {
                             // Make sure it's visible 
                             if(!renderMap[tile.id].visible){
                                 if(viewer.visiVertexCount<maxVertexVisi){
-                                    renderMap[tile.id].visible = true;
+                                    Potree.Utils.updateVisible(renderMap[tile.id],'self',true)   
                                     viewer.visiVertexCount += tile.posCount   //renderMap[tile.id].vertexCount  //xzw add
                                     options.debug && (boxMap[tile.id].material.opacity = 1 , boxMap[tile.id].children[0].sprite.material.opacity = 1 )
                                 }else{
@@ -17849,7 +17849,7 @@ class Loader3DTiles {
                     else {
                         if (renderMap[tile.id]) {
                             if(renderMap[tile.id].visible){
-                                renderMap[tile.id].visible = false;
+                                Potree.Utils.updateVisible(renderMap[tile.id],'self',false)   
                                 options.debug && (boxMap[tile.id].material.opacity = 0.1, boxMap[tile.id].children[0].sprite.material.opacity = 0.1)
                                 
                                 viewer.visiVertexCount -= tile.posCount //renderMap[tile.id].vertexCount  //xzw add

+ 1 - 1
libs/three.js/build/three.module.js

@@ -23574,7 +23574,7 @@ function WebGLRenderer( parameters ) {
 		_this.info = info;
 
         _this._textures = textures;//xzw add 
-        
+        _this._webglUtils = utils;//xzw add 
 	}
 
 	initGLContext();

+ 1 - 1
src/Potree.js

@@ -43,7 +43,7 @@ export * from "./ProfileRequest.js";
 export * from "./custom/objects/TextSprite.js";
 //export * from "./custom/objects/3dgs/Splat.js";
 export * from "./custom/objects/3dgs/splatter/SplatterThree.js";
-
+export * from "./custom/objects/3dgs/splatter/SplatterMesh.js";
 
 export * from "./utils.js";
 export * from "./Version.js";

+ 5 - 5
src/custom/objects/3dgs/splatter/SplatterThree.js

@@ -2188,14 +2188,14 @@ class Renderer {
     update() {
         this.onupdate()
     }
-    texChangePart(A, g, I, B, C, Q) {
+    texChangePart(blockNum, r, tex, glFormat, glType, data) {
         let E = this.gl
           , i = this.dataset
           , o = savePixelStoreState(E);
         resetPixelStoreState(E),
-        E.bindTexture(E.TEXTURE_2D, I),
+        E.bindTexture(E.TEXTURE_2D, tex),
         E.pixelStorei(E.UNPACK_ALIGNMENT, 1),
-        E.texSubImage2D(E.TEXTURE_2D, 0, 0, A * i.blockHeight * g, i.texWidth * g, i.blockHeight * g, B, C, Q),
+        E.texSubImage2D(E.TEXTURE_2D, 0, 0, blockNum * i.blockHeight * r, i.texWidth * r, i.blockHeight * r, glFormat, glType, data),
         E.bindTexture(E.TEXTURE_2D, null),
         restorePixelStoreState(E, o)
     }
@@ -2299,12 +2299,12 @@ class Renderer {
         Q.uniform1i(E.getUniformLoc("mode"), C),
         Q.drawArrays(Q.TRIANGLE_FAN, 0, 4)
     } */
-    createTexture(A, g, I, B, C) {
+    createTexture(w, h, glInternalFormat, glFormat, glType) {
         let Q = this.gl
           , E = Q.TEXTURE_2D
           , i = Q.createTexture();
         return Q.bindTexture(E, i),
-        Q.texImage2D(E, 0, I, A, g, 0, B, C, null),
+        Q.texImage2D(E, 0, glInternalFormat, w, h, 0, glFormat, glType, null),
         this.texParameteri(E, Q.NEAREST),
         Q.bindTexture(E, null),
         i

+ 1 - 1
src/navigation/CharacterControl.js

@@ -288,7 +288,7 @@ export class CharacterControl extends THREE.EventDispatcher{
         }  
          
         
-        if ( actionState !== 'Idle'){  
+        if ( actionState !== 'Idle' && this.model){  
             //console.log('s',speed, actionState) 
             let s = speed * ( actionState == 'Walk' ? 20 : 5)
             this.currentAction.setEffectiveTimeScale(s)  //add