(texture)
| 2477 | setTextureParams(_texture) {} |
| 2478 | |
| 2479 | getSampler(texture) { |
| 2480 | const key = `${texture.minFilter}_${texture.magFilter}_${texture.wrapS}_${texture.wrapT}`; |
| 2481 | if (this.samplers.has(key)) { |
| 2482 | return this.samplers.get(key); |
| 2483 | } |
| 2484 | const constantMapping = { |
| 2485 | [constants.NEAREST]: 'nearest', |
| 2486 | [constants.LINEAR]: 'linear', |
| 2487 | [constants.CLAMP]: 'clamp-to-edge', |
| 2488 | [constants.REPEAT]: 'repeat', |
| 2489 | [constants.MIRROR]: 'mirror-repeat' |
| 2490 | } |
| 2491 | const sampler = this.device.createSampler({ |
| 2492 | magFilter: constantMapping[texture.magFilter], |
| 2493 | minFilter: constantMapping[texture.minFilter], |
| 2494 | addressModeU: constantMapping[texture.wrapS], |
| 2495 | addressModeV: constantMapping[texture.wrapT], |
| 2496 | }); |
| 2497 | this.samplers.set(key, sampler); |
| 2498 | return sampler; |
| 2499 | } |
| 2500 | |
| 2501 | bindTextureToShader(_texture, _sampler, _uniformName, _unit) {} |
| 2502 |
no test coverage detected