lightConstants.d.ts 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /** Defines the cross module constantsused by lights to avoid circular dependencies */
  2. export declare class LightConstants {
  3. /**
  4. * Falloff Default: light is falling off following the material specification:
  5. * standard material is using standard falloff whereas pbr material can request special falloff per materials.
  6. */
  7. static readonly FALLOFF_DEFAULT = 0;
  8. /**
  9. * Falloff Physical: light is falling off following the inverse squared distance law.
  10. */
  11. static readonly FALLOFF_PHYSICAL = 1;
  12. /**
  13. * Falloff gltf: light is falling off as described in the gltf moving to PBR document
  14. * to enhance interoperability with other engines.
  15. */
  16. static readonly FALLOFF_GLTF = 2;
  17. /**
  18. * Falloff Standard: light is falling off like in the standard material
  19. * to enhance interoperability with other materials.
  20. */
  21. static readonly FALLOFF_STANDARD = 3;
  22. /**
  23. * If every light affecting the material is in this lightmapMode,
  24. * material.lightmapTexture adds or multiplies
  25. * (depends on material.useLightmapAsShadowmap)
  26. * after every other light calculations.
  27. */
  28. static readonly LIGHTMAP_DEFAULT = 0;
  29. /**
  30. * material.lightmapTexture as only diffuse lighting from this light
  31. * adds only specular lighting from this light
  32. * adds dynamic shadows
  33. */
  34. static readonly LIGHTMAP_SPECULAR = 1;
  35. /**
  36. * material.lightmapTexture as only lighting
  37. * no light calculation from this light
  38. * only adds dynamic shadows from this light
  39. */
  40. static readonly LIGHTMAP_SHADOWSONLY = 2;
  41. /**
  42. * Each light type uses the default quantity according to its type:
  43. * point/spot lights use luminous intensity
  44. * directional lights use illuminance
  45. */
  46. static readonly INTENSITYMODE_AUTOMATIC = 0;
  47. /**
  48. * lumen (lm)
  49. */
  50. static readonly INTENSITYMODE_LUMINOUSPOWER = 1;
  51. /**
  52. * candela (lm/sr)
  53. */
  54. static readonly INTENSITYMODE_LUMINOUSINTENSITY = 2;
  55. /**
  56. * lux (lm/m^2)
  57. */
  58. static readonly INTENSITYMODE_ILLUMINANCE = 3;
  59. /**
  60. * nit (cd/m^2)
  61. */
  62. static readonly INTENSITYMODE_LUMINANCE = 4;
  63. /**
  64. * Light type const id of the point light.
  65. */
  66. static readonly LIGHTTYPEID_POINTLIGHT = 0;
  67. /**
  68. * Light type const id of the directional light.
  69. */
  70. static readonly LIGHTTYPEID_DIRECTIONALLIGHT = 1;
  71. /**
  72. * Light type const id of the spot light.
  73. */
  74. static readonly LIGHTTYPEID_SPOTLIGHT = 2;
  75. /**
  76. * Light type const id of the hemispheric light.
  77. */
  78. static readonly LIGHTTYPEID_HEMISPHERICLIGHT = 3;
  79. /**
  80. * Sort function to order lights for rendering.
  81. * @param a First Light object to compare to second.
  82. * @param b Second Light object to compare first.
  83. * @returns -1 to reduce's a's index relative to be, 0 for no change, 1 to increase a's index relative to b.
  84. */
  85. static CompareLightsPriority(a: ISortableLight, b: ISortableLight): number;
  86. }
  87. /**
  88. * Defines the common interface of sortable lights
  89. */
  90. export interface ISortableLight {
  91. /**
  92. * Gets or sets whether or not the shadows are enabled for this light. This can help turning off/on shadow without detaching
  93. * the current shadow generator.
  94. */
  95. shadowEnabled: boolean;
  96. /**
  97. * Defines the rendering priority of the lights. It can help in case of fallback or number of lights
  98. * exceeding the number allowed of the materials.
  99. */
  100. renderPriority: number;
  101. }