(levels)
| 330 | } |
| 331 | |
| 332 | init(levels) { |
| 333 | // Handle both ImageData array (WebGL) and WebGPU texture object |
| 334 | if (Array.isArray(levels)) { |
| 335 | // WebGL path: levels is array of ImageData |
| 336 | const firstLevel = levels[0]; |
| 337 | this.width = firstLevel.width; |
| 338 | this.height = firstLevel.height; |
| 339 | |
| 340 | // Let renderer create the mipmap texture handle |
| 341 | this.textureHandle = this._renderer.createMipmapTextureHandle({ |
| 342 | levels: levels, |
| 343 | format: this.format, |
| 344 | dataType: this.dataType, |
| 345 | width: this.width, |
| 346 | height: this.height, |
| 347 | }); |
| 348 | } else { |
| 349 | // WebGPU path: levels is a mipmapData object with pre-built GPU texture |
| 350 | this.width = levels.size; |
| 351 | this.height = levels.size; |
| 352 | |
| 353 | // Let renderer create the texture handle from the GPU texture |
| 354 | this.textureHandle = this._renderer.createMipmapTextureHandle({ |
| 355 | gpuTexture: levels.gpuTexture, |
| 356 | format: levels.format, |
| 357 | dataType: 'uint8', |
| 358 | width: this.width, |
| 359 | height: this.height, |
| 360 | }); |
| 361 | } |
| 362 | |
| 363 | this._renderer.setTextureParams(this, { |
| 364 | minFilter: this.minFilter, |
| 365 | magFilter: this.magFilter, |
| 366 | wrapS: this.wrapS, |
| 367 | wrapT: this.wrapT |
| 368 | }); |
| 369 | } |
| 370 | |
| 371 | update() {} |
| 372 | } |
nothing calls this directly
no test coverage detected