babylon.pointLight.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. var __extends = this.__extends || function (d, b) {
  2. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  3. function __() { this.constructor = d; }
  4. __.prototype = b.prototype;
  5. d.prototype = new __();
  6. };
  7. var BABYLON;
  8. (function (BABYLON) {
  9. var PointLight = (function (_super) {
  10. __extends(PointLight, _super);
  11. function PointLight(name, position, scene) {
  12. _super.call(this, name, scene);
  13. this.position = position;
  14. }
  15. PointLight.prototype.getAbsolutePosition = function () {
  16. return this._transformedPosition ? this._transformedPosition : this.position;
  17. };
  18. PointLight.prototype.transferToEffect = function (effect, positionUniformName) {
  19. if (this.parent && this.parent.getWorldMatrix) {
  20. if (!this._transformedPosition) {
  21. this._transformedPosition = BABYLON.Vector3.Zero();
  22. }
  23. BABYLON.Vector3.TransformCoordinatesToRef(this.position, this.parent.getWorldMatrix(), this._transformedPosition);
  24. effect.setFloat4(positionUniformName, this._transformedPosition.x, this._transformedPosition.y, this._transformedPosition.z, 0);
  25. return;
  26. }
  27. effect.setFloat4(positionUniformName, this.position.x, this.position.y, this.position.z, 0);
  28. };
  29. PointLight.prototype.getShadowGenerator = function () {
  30. return null;
  31. };
  32. PointLight.prototype._getWorldMatrix = function () {
  33. if (!this._worldMatrix) {
  34. this._worldMatrix = BABYLON.Matrix.Identity();
  35. }
  36. BABYLON.Matrix.TranslationToRef(this.position.x, this.position.y, this.position.z, this._worldMatrix);
  37. return this._worldMatrix;
  38. };
  39. return PointLight;
  40. })(BABYLON.Light);
  41. BABYLON.PointLight = PointLight;
  42. })(BABYLON || (BABYLON = {}));
  43. //# sourceMappingURL=babylon.pointLight.js.map