babylon.hemisphericLight.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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 __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  7. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  8. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  9. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  10. return c > 3 && r && Object.defineProperty(target, key, r), r;
  11. };
  12. var BABYLON;
  13. (function (BABYLON) {
  14. var HemisphericLight = (function (_super) {
  15. __extends(HemisphericLight, _super);
  16. function HemisphericLight(name, direction, scene) {
  17. _super.call(this, name, scene);
  18. this.groundColor = new BABYLON.Color3(0.0, 0.0, 0.0);
  19. this.direction = direction;
  20. }
  21. HemisphericLight.prototype.setDirectionToTarget = function (target) {
  22. this.direction = BABYLON.Vector3.Normalize(target.subtract(BABYLON.Vector3.Zero()));
  23. return this.direction;
  24. };
  25. HemisphericLight.prototype.getShadowGenerator = function () {
  26. return null;
  27. };
  28. HemisphericLight.prototype.transferToEffect = function (effect, directionUniformName, groundColorUniformName) {
  29. var normalizeDirection = BABYLON.Vector3.Normalize(this.direction);
  30. effect.setFloat4(directionUniformName, normalizeDirection.x, normalizeDirection.y, normalizeDirection.z, 0);
  31. effect.setColor3(groundColorUniformName, this.groundColor.scale(this.intensity));
  32. };
  33. HemisphericLight.prototype._getWorldMatrix = function () {
  34. if (!this._worldMatrix) {
  35. this._worldMatrix = BABYLON.Matrix.Identity();
  36. }
  37. return this._worldMatrix;
  38. };
  39. HemisphericLight.prototype.getTypeID = function () {
  40. return 3;
  41. };
  42. __decorate([
  43. BABYLON.serializeAsColor3()
  44. ], HemisphericLight.prototype, "groundColor", void 0);
  45. __decorate([
  46. BABYLON.serializeAsVector3()
  47. ], HemisphericLight.prototype, "direction", void 0);
  48. return HemisphericLight;
  49. }(BABYLON.Light));
  50. BABYLON.HemisphericLight = HemisphericLight;
  51. })(BABYLON || (BABYLON = {}));