content/hifi-content/dave/walk-tools/walkTools/libraries/three.js/renderers/WebGLRenderTarget.js
2022-02-13 22:49:05 +01:00

84 lines
2.1 KiB
JavaScript

/**
* @author szimek / https://github.com/szimek/
* @author alteredq / http://alteredqualia.com/
*/
THREE.WebGLRenderTarget = function ( width, height, options ) {
this.width = width;
this.height = height;
options = options || {};
this.wrapS = options.wrapS !== undefined ? options.wrapS : THREE.ClampToEdgeWrapping;
this.wrapT = options.wrapT !== undefined ? options.wrapT : THREE.ClampToEdgeWrapping;
this.magFilter = options.magFilter !== undefined ? options.magFilter : THREE.LinearFilter;
this.minFilter = options.minFilter !== undefined ? options.minFilter : THREE.LinearMipMapLinearFilter;
this.anisotropy = options.anisotropy !== undefined ? options.anisotropy : 1;
this.offset = new THREE.Vector2( 0, 0 );
this.repeat = new THREE.Vector2( 1, 1 );
this.format = options.format !== undefined ? options.format : THREE.RGBAFormat;
this.type = options.type !== undefined ? options.type : THREE.UnsignedByteType;
this.depthBuffer = options.depthBuffer !== undefined ? options.depthBuffer : true;
this.stencilBuffer = options.stencilBuffer !== undefined ? options.stencilBuffer : true;
this.generateMipmaps = true;
this.shareDepthFrom = options.shareDepthFrom !== undefined ? options.shareDepthFrom : null;
};
THREE.WebGLRenderTarget.prototype = {
constructor: THREE.WebGLRenderTarget,
setSize: function ( width, height ) {
this.width = width;
this.height = height;
},
clone: function () {
var tmp = new THREE.WebGLRenderTarget( this.width, this.height );
tmp.wrapS = this.wrapS;
tmp.wrapT = this.wrapT;
tmp.magFilter = this.magFilter;
tmp.minFilter = this.minFilter;
tmp.anisotropy = this.anisotropy;
tmp.offset.copy( this.offset );
tmp.repeat.copy( this.repeat );
tmp.format = this.format;
tmp.type = this.type;
tmp.depthBuffer = this.depthBuffer;
tmp.stencilBuffer = this.stencilBuffer;
tmp.generateMipmaps = this.generateMipmaps;
tmp.shareDepthFrom = this.shareDepthFrom;
return tmp;
},
dispose: function () {
this.dispatchEvent( { type: 'dispose' } );
}
};
THREE.EventDispatcher.prototype.apply( THREE.WebGLRenderTarget.prototype );