ChainableEffect.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /**
  2. * @author takahirox / http://github.com/takahirox/
  3. *
  4. * ChainableEffect provides an abilily to apply two or more Effects
  5. * by enabling Effects which inherit ChainableEffect
  6. * to be used from other Effects.
  7. *
  8. * How to use: example - applies both VREffect and OutlineEffect
  9. * (OutlineEffect inherits ChainableEffect)
  10. *
  11. * function init() {
  12. *
  13. * renderer = new THREE.WebGLRenderer();
  14. * effect = new THREE.VREffect( new THREE.OutlineEffect( renderer ) );
  15. *
  16. * }
  17. *
  18. * function render() {
  19. *
  20. * effect.render( scene, camera );
  21. *
  22. * }
  23. */
  24. THREE.ChainableEffect = function ( renderer ) {
  25. this.autoClear = renderer.autoClear;
  26. this.domElement = renderer.domElement;
  27. this.shadowMap = renderer.shadowMap;
  28. this.getPixelRatio = function () {
  29. return renderer.getPixelRatio();
  30. };
  31. this.setPixelRatio = function ( value ) {
  32. renderer.setPixelRatio( value );
  33. };
  34. this.getSize = function () {
  35. return renderer.getSize();
  36. };
  37. this.setSize = function ( width, height, updateStyle ) {
  38. renderer.setSize( width, height, updateStyle );
  39. };
  40. this.setViewport = function ( x, y, width, height ) {
  41. renderer.setViewport( x, y, width, height );
  42. };
  43. this.setScissor = function ( x, y, width, height ) {
  44. renderer.setScissor( x, y, width, height );
  45. };
  46. this.setScissorTest = function ( boolean ) {
  47. renderer.setScissorTest( boolean );
  48. };
  49. this.clear = function ( color, depth, stencil ) {
  50. renderer.clear( color, depth, stencil );
  51. };
  52. this.render = function ( scene, camera, renderTarget, forceClear ) {
  53. renderer.render( scene, camera, renderTarget, forceClear );
  54. };
  55. this.setRenderTarget = function ( renderTarget ) {
  56. renderer.setRenderTarget( renderTarget );
  57. };
  58. };