babylon.hemisphericLight.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. "use strict";
  2. var BABYLON = BABYLON || {};
  3. (function () {
  4. BABYLON.HemisphericLight = function (name, direction, scene) {
  5. BABYLON.Light.call(this, name, scene);
  6. this.direction = direction;
  7. this.diffuse = new BABYLON.Color3(1.0, 1.0, 1.0);
  8. this.specular = new BABYLON.Color3(1.0, 1.0, 1.0);
  9. this.groundColor = new BABYLON.Color3(0.0, 0.0, 0.0);
  10. };
  11. BABYLON.HemisphericLight.prototype = Object.create(BABYLON.Light.prototype);
  12. // Properties
  13. BABYLON.HemisphericLight.prototype.getShadowGenerator = function () {
  14. return null;
  15. };
  16. // Methods
  17. BABYLON.HemisphericLight.prototype._getWorldMatrix = function () {
  18. if (!this._worldMatrix) {
  19. this._worldMatrix = BABYLON.Matrix.Identity();
  20. }
  21. return this._worldMatrix;
  22. };
  23. BABYLON.HemisphericLight.prototype.transferToEffect = function (effect, directionUniformName, groundColorUniformName) {
  24. var normalizeDirection = BABYLON.Vector3.Normalize(this.direction);
  25. effect.setFloat4(directionUniformName, normalizeDirection.x, normalizeDirection.y, normalizeDirection.z, 0);
  26. effect.setColor3(groundColorUniformName, this.groundColor.scale(this.intensity));
  27. };
  28. })();