(options: ExtSplatsOptions)
| 167 | } |
| 168 | |
| 169 | async asyncInitialize(options: ExtSplatsOptions) { |
| 170 | const { |
| 171 | url, |
| 172 | fileBytes, |
| 173 | fileType, |
| 174 | fileName, |
| 175 | stream, |
| 176 | streamLength, |
| 177 | construct, |
| 178 | lod, |
| 179 | nonLod, |
| 180 | lodAbove, |
| 181 | } = options; |
| 182 | this.lod = lod; |
| 183 | this.nonLod = nonLod; |
| 184 | |
| 185 | const loader = new SplatLoader(); |
| 186 | if (fileBytes || url || stream) { |
| 187 | await loader.loadInternalAsync({ |
| 188 | extSplats: this, |
| 189 | url, |
| 190 | fileBytes, |
| 191 | fileType, |
| 192 | fileName, |
| 193 | stream, |
| 194 | streamLength, |
| 195 | onProgress: options.onProgress, |
| 196 | lodAbove, |
| 197 | }); |
| 198 | } |
| 199 | |
| 200 | if (construct) { |
| 201 | const maybePromise = construct(this); |
| 202 | // If construct returns a promise, wait for it to complete |
| 203 | if (maybePromise instanceof Promise) { |
| 204 | await maybePromise; |
| 205 | } |
| 206 | } |
| 207 | } |
| 208 | |
| 209 | // Call this when you are finished with the PackedSplats and want to free |
| 210 | // any buffers it holds. |
no test coverage detected