(options: ExtSplatsOptions)
| 139 | } |
| 140 | |
| 141 | initialize(options: ExtSplatsOptions) { |
| 142 | this.extra = options.extra ?? {}; |
| 143 | this.lodSplats = options.lodSplats; |
| 144 | |
| 145 | if (options.extArrays) { |
| 146 | this.extArrays = options.extArrays; |
| 147 | this.maxSplats = Math.floor( |
| 148 | Math.min(this.extArrays[0].length / 4, this.extArrays[1].length / 4), |
| 149 | ); |
| 150 | this.numSplats = options.numSplats ?? this.maxSplats; |
| 151 | |
| 152 | // Calculate number of horizontal texture rows that could fit in array. |
| 153 | // A properly initialized packedArray should already take into account the |
| 154 | // width and height of the texture and be rounded up with padding. |
| 155 | this.maxSplats = |
| 156 | Math.floor(this.maxSplats / SPLAT_TEX_WIDTH) * SPLAT_TEX_WIDTH; |
| 157 | this.numSplats = Math.min( |
| 158 | this.maxSplats, |
| 159 | options.numSplats ?? Number.POSITIVE_INFINITY, |
| 160 | ); |
| 161 | this.updateTextures(); |
| 162 | } else { |
| 163 | this.maxSplats = options.maxSplats ?? 0; |
| 164 | this.numSplats = 0; |
| 165 | this.extArrays = [new Uint32Array(0), new Uint32Array(0)]; |
| 166 | } |
| 167 | } |
| 168 | |
| 169 | async asyncInitialize(options: ExtSplatsOptions) { |
| 170 | const { |
no test coverage detected