babylon.hemisphericLight.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536
  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. return HemisphericLight;
  34. })(BABYLON.Light);
  35. BABYLON.HemisphericLight = HemisphericLight;
  36. })(BABYLON || (BABYLON = {}));