WebGLRenderTarget.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /**
  2. * @author szimek / https://github.com/szimek/
  3. * @author alteredq / http://alteredqualia.com/
  4. */
  5. THREE.WebGLRenderTarget = function ( width, height, options ) {
  6. this.width = width;
  7. this.height = height;
  8. options = options || {};
  9. this.wrapS = options.wrapS !== undefined ? options.wrapS : THREE.ClampToEdgeWrapping;
  10. this.wrapT = options.wrapT !== undefined ? options.wrapT : THREE.ClampToEdgeWrapping;
  11. this.magFilter = options.magFilter !== undefined ? options.magFilter : THREE.LinearFilter;
  12. this.minFilter = options.minFilter !== undefined ? options.minFilter : THREE.LinearMipMapLinearFilter;
  13. this.anisotropy = options.anisotropy !== undefined ? options.anisotropy : 1;
  14. this.offset = new THREE.Vector2( 0, 0 );
  15. this.repeat = new THREE.Vector2( 1, 1 );
  16. this.format = options.format !== undefined ? options.format : THREE.RGBAFormat;
  17. this.type = options.type !== undefined ? options.type : THREE.UnsignedByteType;
  18. this.depthBuffer = options.depthBuffer !== undefined ? options.depthBuffer : true;
  19. this.stencilBuffer = options.stencilBuffer !== undefined ? options.stencilBuffer : true;
  20. this.generateMipmaps = true;
  21. };
  22. THREE.WebGLRenderTarget.prototype.clone = function() {
  23. var tmp = new THREE.WebGLRenderTarget( this.width, this.height );
  24. tmp.wrapS = this.wrapS;
  25. tmp.wrapT = this.wrapT;
  26. tmp.magFilter = this.magFilter;
  27. tmp.minFilter = this.minFilter;
  28. tmp.anisotropy = this.anisotropy;
  29. tmp.offset.copy( this.offset );
  30. tmp.repeat.copy( this.repeat );
  31. tmp.format = this.format;
  32. tmp.type = this.type;
  33. tmp.depthBuffer = this.depthBuffer;
  34. tmp.stencilBuffer = this.stencilBuffer;
  35. tmp.generateMipmaps = this.generateMipmaps;
  36. return tmp;
  37. };