WebGLRenderTarget.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. /**
  2. * @author szimek / https://github.com/szimek/
  3. * @author alteredq / http://alteredqualia.com/
  4. */
  5. THREE.WebGLRenderTarget = function ( width, height, options ) {
  6. this.uuid = THREE.Math.generateUUID();
  7. this.width = width;
  8. this.height = height;
  9. options = options || {};
  10. this.texture = new THREE.Texture( undefined, undefined, options.wrapS, options.wrapT, options.magFilter, options.minFilter !== undefined ? options.minFilter : THREE.LinearFilter, options.format, options.type, options.anisotropy );
  11. this.depthBuffer = options.depthBuffer !== undefined ? options.depthBuffer : true;
  12. this.stencilBuffer = options.stencilBuffer !== undefined ? options.stencilBuffer : true;
  13. this.shareDepthFrom = options.shareDepthFrom !== undefined ? options.shareDepthFrom : null;
  14. };
  15. THREE.WebGLRenderTarget.prototype = {
  16. constructor: THREE.WebGLRenderTarget,
  17. setSize: function ( width, height ) {
  18. if ( this.width !== width || this.height !== height ) {
  19. this.width = width;
  20. this.height = height;
  21. this.dispose();
  22. }
  23. },
  24. clone: function () {
  25. return new this.constructor().copy( this );
  26. },
  27. copy: function ( source ) {
  28. this.width = source.width;
  29. this.height = source.height;
  30. this.texture = source.texture.clone();
  31. this.depthBuffer = source.depthBuffer;
  32. this.stencilBuffer = source.stencilBuffer;
  33. this.shareDepthFrom = source.shareDepthFrom;
  34. return this;
  35. },
  36. dispose: function () {
  37. this.dispatchEvent( { type: 'dispose' } );
  38. },
  39. get wrapS() {
  40. return this.texture.wrapS;
  41. },
  42. set wrapS( wrapS ) {
  43. this.texture.wrapS = wrapS;
  44. },
  45. get wrapT() {
  46. return this.texture.wrapT;
  47. },
  48. set wrapT( wrapT ) {
  49. this.texture.wrapT = wrapT;
  50. },
  51. get magFilter() {
  52. return this.texture.magFilter;
  53. },
  54. set magFilter( magFilter ) {
  55. this.texture.magFilter = magFilter;
  56. },
  57. get minFilter() {
  58. return this.texture.minFilter;
  59. },
  60. set minFilter( minFilter ) {
  61. this.texture.minFilter = minFilter;
  62. },
  63. get anisotropy() {
  64. return this.texture.anisotropy;
  65. },
  66. set anisotropy( anisotropy ) {
  67. this.texture.anisotropy = anisotropy;
  68. },
  69. get offset() {
  70. return this.texture.offset;
  71. },
  72. set offset( offset ) {
  73. this.texture.offset = offset;
  74. },
  75. get repeat() {
  76. return this.texture.repeat;
  77. },
  78. set repeat( repeat ) {
  79. this.texture.repeat = repeat;
  80. },
  81. get format() {
  82. return this.texture.format;
  83. },
  84. set format( format ) {
  85. this.texture.format = format;
  86. },
  87. get type() {
  88. return this.texture.type;
  89. },
  90. set type( type ) {
  91. this.texture.type = type;
  92. },
  93. get generateMipmaps() {
  94. return this.texture.generateMipmaps;
  95. },
  96. set generateMipmaps( generateMipmaps ) {
  97. this.texture.generateMipmaps = generateMipmaps;
  98. }
  99. };
  100. THREE.EventDispatcher.prototype.apply( THREE.WebGLRenderTarget.prototype );