You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Effect.js 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /**
  2. * @Author: Caven
  3. * @Date: 2020-08-14 23:49:14
  4. */
  5. import BlackAndWhite from './type/BlackAndWhite'
  6. import Bloom from './type/Bloom'
  7. import Brightness from './type/Brightness'
  8. import DepthOfField from './type/DepthOfField'
  9. import LensFlare from './type/LensFlare'
  10. import NightVision from './type/NightVision'
  11. import Silhouette from './type/Silhouette'
  12. class Effect {
  13. constructor() {
  14. this._comps = {
  15. blackAndWhite: new BlackAndWhite(),
  16. bloom: new Bloom(),
  17. brightness: new Brightness(),
  18. depthOfField: new DepthOfField(),
  19. lensFlare: new LensFlare(),
  20. night: new NightVision(),
  21. silhouette: new Silhouette()
  22. }
  23. }
  24. get blackAndWhite() {
  25. return this._comps.blackAndWhite
  26. }
  27. get bloom() {
  28. return this._comps.bloom
  29. }
  30. get brightness() {
  31. return this._comps.brightness
  32. }
  33. get depthOfField() {
  34. return this._comps.depthOfField
  35. }
  36. get lensFlare() {
  37. return this._comps.lensFlare
  38. }
  39. get night() {
  40. return this._comps.night
  41. }
  42. get silhouette() {
  43. return this._comps.silhouette
  44. }
  45. /**
  46. *
  47. * @param viewer
  48. */
  49. install(viewer) {
  50. Object.keys(this._comps).forEach(key => {
  51. this._comps[key].addTo(viewer)
  52. })
  53. Object.defineProperty(viewer, 'effect', {
  54. value: this,
  55. writable: false
  56. })
  57. }
  58. }
  59. export default Effect