babylon.pointLight.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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.transferToEffect = function (effect, positionUniformName) {
  16. if (this.parent && this.parent.getWorldMatrix) {
  17. if (!this._transformedPosition) {
  18. this._transformedPosition = BABYLON.Vector3.Zero();
  19. }
  20. BABYLON.Vector3.TransformCoordinatesToRef(this.position, this.parent.getWorldMatrix(), this._transformedPosition);
  21. effect.setFloat4(positionUniformName, this._transformedPosition.x, this._transformedPosition.y, this._transformedPosition.z, 0);
  22. return;
  23. }
  24. effect.setFloat4(positionUniformName, this.position.x, this.position.y, this.position.z, 0);
  25. };
  26. PointLight.prototype.getShadowGenerator = function () {
  27. return null;
  28. };
  29. PointLight.prototype._getWorldMatrix = function () {
  30. if (!this._worldMatrix) {
  31. this._worldMatrix = BABYLON.Matrix.Identity();
  32. }
  33. BABYLON.Matrix.TranslationToRef(this.position.x, this.position.y, this.position.z, this._worldMatrix);
  34. return this._worldMatrix;
  35. };
  36. return PointLight;
  37. })(BABYLON.Light);
  38. BABYLON.PointLight = PointLight;
  39. })(BABYLON || (BABYLON = {}));
  40. //# sourceMappingURL=babylon.pointLight.js.map