UniformsLib.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. import { Color } from '../../math/Color.js';
  2. import { Vector2 } from '../../math/Vector2.js';
  3. import { Matrix3 } from '../../math/Matrix3.js';
  4. /**
  5. * Uniforms library for shared webgl shaders
  6. */
  7. var UniformsLib = {
  8. common: {
  9. diffuse: { value: new Color( 0xeeeeee ) },
  10. opacity: { value: 1.0 },
  11. map: { value: null },
  12. uvTransform: { value: new Matrix3() },
  13. alphaMap: { value: null },
  14. },
  15. specularmap: {
  16. specularMap: { value: null },
  17. },
  18. envmap: {
  19. envMap: { value: null },
  20. flipEnvMap: { value: - 1 },
  21. reflectivity: { value: 1.0 },
  22. refractionRatio: { value: 0.98 }
  23. },
  24. aomap: {
  25. aoMap: { value: null },
  26. aoMapIntensity: { value: 1 }
  27. },
  28. lightmap: {
  29. lightMap: { value: null },
  30. lightMapIntensity: { value: 1 }
  31. },
  32. emissivemap: {
  33. emissiveMap: { value: null }
  34. },
  35. bumpmap: {
  36. bumpMap: { value: null },
  37. bumpScale: { value: 1 }
  38. },
  39. normalmap: {
  40. normalMap: { value: null },
  41. normalScale: { value: new Vector2( 1, 1 ) }
  42. },
  43. displacementmap: {
  44. displacementMap: { value: null },
  45. displacementScale: { value: 1 },
  46. displacementBias: { value: 0 }
  47. },
  48. roughnessmap: {
  49. roughnessMap: { value: null }
  50. },
  51. metalnessmap: {
  52. metalnessMap: { value: null }
  53. },
  54. gradientmap: {
  55. gradientMap: { value: null }
  56. },
  57. fog: {
  58. fogDensity: { value: 0.00025 },
  59. fogNear: { value: 1 },
  60. fogFar: { value: 2000 },
  61. fogColor: { value: new Color( 0xffffff ) }
  62. },
  63. lights: {
  64. ambientLightColor: { value: [] },
  65. directionalLights: { value: [], properties: {
  66. direction: {},
  67. color: {},
  68. shadow: {},
  69. shadowBias: {},
  70. shadowRadius: {},
  71. shadowMapSize: {}
  72. } },
  73. directionalShadowMap: { value: [] },
  74. directionalShadowMatrix: { value: [] },
  75. spotLights: { value: [], properties: {
  76. color: {},
  77. position: {},
  78. direction: {},
  79. distance: {},
  80. coneCos: {},
  81. penumbraCos: {},
  82. decay: {},
  83. shadow: {},
  84. shadowBias: {},
  85. shadowRadius: {},
  86. shadowMapSize: {}
  87. } },
  88. spotShadowMap: { value: [] },
  89. spotShadowMatrix: { value: [] },
  90. pointLights: { value: [], properties: {
  91. color: {},
  92. position: {},
  93. decay: {},
  94. distance: {},
  95. shadow: {},
  96. shadowBias: {},
  97. shadowRadius: {},
  98. shadowMapSize: {},
  99. shadowCameraNear: {},
  100. shadowCameraFar: {}
  101. } },
  102. pointShadowMap: { value: [] },
  103. pointShadowMatrix: { value: [] },
  104. hemisphereLights: { value: [], properties: {
  105. direction: {},
  106. skyColor: {},
  107. groundColor: {}
  108. } },
  109. // TODO (abelnation): RectAreaLight BRDF data needs to be moved from example to main src
  110. rectAreaLights: { value: [], properties: {
  111. color: {},
  112. position: {},
  113. width: {},
  114. height: {}
  115. } }
  116. },
  117. points: {
  118. diffuse: { value: new Color( 0xeeeeee ) },
  119. opacity: { value: 1.0 },
  120. size: { value: 1.0 },
  121. scale: { value: 1.0 },
  122. map: { value: null },
  123. uvTransform: { value: new Matrix3() }
  124. }
  125. };
  126. export { UniformsLib };