babylon.light.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. var BABYLON = BABYLON || {};
  2. (function () {
  3. BABYLON.Light = function (name, scene) {
  4. this.name = name;
  5. this.id = name;
  6. this._childrenFlag = true;
  7. this._scene = scene;
  8. scene.lights.push(this);
  9. // Animations
  10. this.animations = [];
  11. // Exclusions
  12. this.excludedMeshes = [];
  13. };
  14. BABYLON.Light.prototype = Object.create(BABYLON.Node.prototype);
  15. // Members
  16. BABYLON.Light.prototype.intensity = 1.0;
  17. // Properties
  18. BABYLON.Light.prototype.getScene = function () {
  19. return this._scene;
  20. };
  21. BABYLON.Light.prototype.getShadowGenerator = function() {
  22. return this._shadowGenerator;
  23. };
  24. // Methods
  25. BABYLON.Light.prototype.transferToEffect = function() {
  26. };
  27. BABYLON.Light.prototype.getWorldMatrix = function() {
  28. var worldMatrix = this._getWorldMatrix();
  29. if (this.parent && this.parent.getWorldMatrix) {
  30. if (!this._parentedWorldMatrix) {
  31. this._parentedWorldMatrix = BABYLON.Matrix.Identity();
  32. }
  33. worldMatrix.multiplyToRef(this.parent.getWorldMatrix(), this._parentedWorldMatrix);
  34. return this._parentedWorldMatrix;
  35. }
  36. return worldMatrix;
  37. };
  38. BABYLON.Light.prototype.dispose = function () {
  39. if (this._shadowGenerator) {
  40. this._shadowGenerator.dispose();
  41. this._shadowGenerator = null;
  42. }
  43. // Remove from scene
  44. var index = this._scene.lights.indexOf(this);
  45. this._scene.lights.splice(index, 1);
  46. };
  47. })();