Spaces:
Running
Running
File size: 1,464 Bytes
2b7aae2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | import { WebGLRenderTarget } from './WebGLRenderTarget.js';
class WebGLMultipleRenderTargets extends WebGLRenderTarget {
constructor(width, height, count) {
super(width, height);
const texture = this.texture;
this.texture = [];
for (let i = 0; i < count; i++) {
this.texture[i] = texture.clone();
}
}
setSize(width, height, depth = 1) {
if (this.width !== width || this.height !== height || this.depth !== depth) {
this.width = width;
this.height = height;
this.depth = depth;
for (let i = 0, il = this.texture.length; i < il; i++) {
this.texture[i].image.width = width;
this.texture[i].image.height = height;
this.texture[i].image.depth = depth;
}
this.dispose();
}
this.viewport.set(0, 0, width, height);
this.scissor.set(0, 0, width, height);
return this;
}
copy(source) {
this.dispose();
this.width = source.width;
this.height = source.height;
this.depth = source.depth;
this.viewport.set(0, 0, this.width, this.height);
this.scissor.set(0, 0, this.width, this.height);
this.depthBuffer = source.depthBuffer;
this.stencilBuffer = source.stencilBuffer;
this.depthTexture = source.depthTexture;
this.texture.length = 0;
for (let i = 0, il = source.texture.length; i < il; i++) {
this.texture[i] = source.texture[i].clone();
}
return this;
}
}
WebGLMultipleRenderTargets.prototype.isWebGLMultipleRenderTargets = true;
export { WebGLMultipleRenderTargets };
|