pointLight.d.ts 4.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. import type { Scene } from "../scene";
  2. import { Matrix, Vector3 } from "../Maths/math.vector";
  3. import type { AbstractMesh } from "../Meshes/abstractMesh";
  4. import { ShadowLight } from "./shadowLight";
  5. import type { Effect } from "../Materials/effect";
  6. /**
  7. * A point light is a light defined by an unique point in world space.
  8. * The light is emitted in every direction from this point.
  9. * A good example of a point light is a standard light bulb.
  10. * Documentation: https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction
  11. */
  12. export declare class PointLight extends ShadowLight {
  13. private _shadowAngle;
  14. /**
  15. * Getter: In case of direction provided, the shadow will not use a cube texture but simulate a spot shadow as a fallback
  16. * This specifies what angle the shadow will use to be created.
  17. *
  18. * It default to 90 degrees to work nicely with the cube texture generation for point lights shadow maps.
  19. */
  20. get shadowAngle(): number;
  21. /**
  22. * Setter: In case of direction provided, the shadow will not use a cube texture but simulate a spot shadow as a fallback
  23. * This specifies what angle the shadow will use to be created.
  24. *
  25. * It default to 90 degrees to work nicely with the cube texture generation for point lights shadow maps.
  26. */
  27. set shadowAngle(value: number);
  28. /**
  29. * Gets the direction if it has been set.
  30. * In case of direction provided, the shadow will not use a cube texture but simulate a spot shadow as a fallback
  31. */
  32. get direction(): Vector3;
  33. /**
  34. * In case of direction provided, the shadow will not use a cube texture but simulate a spot shadow as a fallback
  35. */
  36. set direction(value: Vector3);
  37. /**
  38. * Creates a PointLight object from the passed name and position (Vector3) and adds it in the scene.
  39. * A PointLight emits the light in every direction.
  40. * It can cast shadows.
  41. * If the scene camera is already defined and you want to set your PointLight at the camera position, just set it :
  42. * ```javascript
  43. * var pointLight = new PointLight("pl", camera.position, scene);
  44. * ```
  45. * Documentation : https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction
  46. * @param name The light friendly name
  47. * @param position The position of the point light in the scene
  48. * @param scene The scene the lights belongs to
  49. */
  50. constructor(name: string, position: Vector3, scene?: Scene);
  51. /**
  52. * Returns the string "PointLight"
  53. * @returns the class name
  54. */
  55. getClassName(): string;
  56. /**
  57. * Returns the integer 0.
  58. * @returns The light Type id as a constant defines in Light.LIGHTTYPEID_x
  59. */
  60. getTypeID(): number;
  61. /**
  62. * Specifies whether or not the shadowmap should be a cube texture.
  63. * @returns true if the shadowmap needs to be a cube texture.
  64. */
  65. needCube(): boolean;
  66. /**
  67. * Returns a new Vector3 aligned with the PointLight cube system according to the passed cube face index (integer).
  68. * @param faceIndex The index of the face we are computed the direction to generate shadow
  69. * @returns The set direction in 2d mode otherwise the direction to the cubemap face if needCube() is true
  70. */
  71. getShadowDirection(faceIndex?: number): Vector3;
  72. /**
  73. * Sets the passed matrix "matrix" as a left-handed perspective projection matrix with the following settings :
  74. * - fov = PI / 2
  75. * - aspect ratio : 1.0
  76. * - z-near and far equal to the active camera minZ and maxZ.
  77. * Returns the PointLight.
  78. * @param matrix
  79. * @param viewMatrix
  80. * @param renderList
  81. */
  82. protected _setDefaultShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): void;
  83. protected _buildUniformLayout(): void;
  84. /**
  85. * Sets the passed Effect "effect" with the PointLight transformed position (or position, if none) and passed name (string).
  86. * @param effect The effect to update
  87. * @param lightIndex The index of the light in the effect to update
  88. * @returns The point light
  89. */
  90. transferToEffect(effect: Effect, lightIndex: string): PointLight;
  91. transferToNodeMaterialEffect(effect: Effect, lightDataUniformName: string): this;
  92. /**
  93. * Prepares the list of defines specific to the light type.
  94. * @param defines the list of defines
  95. * @param lightIndex defines the index of the light for the effect
  96. */
  97. prepareLightSpecificDefines(defines: any, lightIndex: number): void;
  98. }