@@ -217,12 +217,11 @@ class GSplatSogsData {
217217 destroyed = false ;
218218
219219 /**
220- * Cached number of spherical harmonics bands.
220+ * Number of spherical harmonics bands.
221221 *
222222 * @type {number }
223- * @private
224223 */
225- _shBands = 0 ;
224+ shBands = 0 ;
226225
227226 _destroyGpuResources ( ) {
228227 this . means_l ?. destroy ( ) ;
@@ -237,6 +236,13 @@ class GSplatSogsData {
237236 this . packedShN ?. destroy ( ) ;
238237 }
239238
239+ // calculate the number of bands given the centroids texture width
240+ static calcBands ( centroidsWidth ) {
241+ // sh palette has 64 sh entries per row: 192 = 1 band (64*3), 512 = 2 bands (64*8), 960 = 3 bands (64*15)
242+ const shBandsWidths = { 192 : 1 , 512 : 2 , 960 : 3 } ;
243+ return shBandsWidths [ centroidsWidth ] ?? 0 ;
244+ }
245+
240246 destroy ( ) {
241247 // Remove devicerestored listener if it was registered
242248 this . deviceRestoredEvent ?. off ( ) ;
@@ -293,10 +299,6 @@ class GSplatSogsData {
293299 return true ;
294300 }
295301
296- get shBands ( ) {
297- return this . _shBands ;
298- }
299-
300302 async decompress ( ) {
301303 const members = [
302304 'x' , 'y' , 'z' ,
@@ -543,11 +545,6 @@ class GSplatSogsData {
543545
544546 if ( this . destroyed || ! device || device . _destroyed ) return ;
545547
546- // Cache shBands from sh_centroids texture width before source textures may be destroyed
547- // sh palette has 64 sh entries per row: 192 = 1 band (64*3), 512 = 2 bands (64*8), 960 = 3 bands (64*15)
548- const shBandsWidths = { 192 : 1 , 512 : 2 , 960 : 3 } ;
549- this . _shBands = shBandsWidths [ this . sh_centroids ?. width ] ?? 0 ;
550-
551548 // Include URL in texture name for debugging
552549 const urlSuffix = this . url ? `_${ this . url } ` : '' ;
553550
0 commit comments