babylon.hemisphericLight.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. var __extends = (this && 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. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  5. };
  6. var BABYLON;
  7. (function (BABYLON) {
  8. var HemisphericLight = (function (_super) {
  9. __extends(HemisphericLight, _super);
  10. function HemisphericLight(name, direction, scene) {
  11. _super.call(this, name, scene);
  12. this.direction = direction;
  13. this.groundColor = new BABYLON.Color3(0.0, 0.0, 0.0);
  14. }
  15. HemisphericLight.prototype.setDirectionToTarget = function (target) {
  16. this.direction = BABYLON.Vector3.Normalize(target.subtract(BABYLON.Vector3.Zero()));
  17. return this.direction;
  18. };
  19. HemisphericLight.prototype.getShadowGenerator = function () {
  20. return null;
  21. };
  22. HemisphericLight.prototype.transferToEffect = function (effect, directionUniformName, groundColorUniformName) {
  23. var normalizeDirection = BABYLON.Vector3.Normalize(this.direction);
  24. effect.setFloat4(directionUniformName, normalizeDirection.x, normalizeDirection.y, normalizeDirection.z, 0);
  25. effect.setColor3(groundColorUniformName, this.groundColor.scale(this.intensity));
  26. };
  27. HemisphericLight.prototype._getWorldMatrix = function () {
  28. if (!this._worldMatrix) {
  29. this._worldMatrix = BABYLON.Matrix.Identity();
  30. }
  31. return this._worldMatrix;
  32. };
  33. HemisphericLight.prototype.serialize = function () {
  34. var serializationObject = _super.prototype.serialize.call(this);
  35. serializationObject.type = 3;
  36. serializationObject.direction = this.direction.asArray();
  37. serializationObject.groundColor = this.groundColor.asArray();
  38. return serializationObject;
  39. };
  40. return HemisphericLight;
  41. })(BABYLON.Light);
  42. BABYLON.HemisphericLight = HemisphericLight;
  43. })(BABYLON || (BABYLON = {}));
  44. //# sourceMappingURL=babylon.hemisphericLight.js.map