WebGLRenderTarget.js 1.8 KB

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