mirror of
https://github.com/openglobus/openglobus.git
synced 2025-12-08 19:25:27 +00:00
Changed setPosition to setPosition3v in the lightSource .
This commit is contained in:
parent
1b72ef45a6
commit
42856fdfe3
@ -124,9 +124,9 @@ class Sun extends Control {
|
||||
this._k -= 0.01;
|
||||
var rot = Quat.getRotationBetweenVectors(this.sunlight._position.normal(), pos.normal());
|
||||
var r = rot.slerp(Quat.IDENTITY, this._k).normalize();
|
||||
this.sunlight.setPosition(r.mulVec3(this.sunlight._position));
|
||||
this.sunlight.setPosition3v(r.mulVec3(this.sunlight._position));
|
||||
} else {
|
||||
this.sunlight.setPosition(pos);
|
||||
this.sunlight.setPosition3v(pos);
|
||||
}
|
||||
} else {
|
||||
this._k = 1;
|
||||
@ -134,18 +134,18 @@ class Sun extends Control {
|
||||
this._f -= 0.01;
|
||||
var rot = Quat.getRotationBetweenVectors(this.sunlight._position.normal(), getSunPosition(this._currDate).normal());
|
||||
var r = rot.slerp(Quat.IDENTITY, this._f).normalize();
|
||||
this.sunlight.setPosition(r.mulVec3(this.sunlight._position));
|
||||
this.sunlight.setPosition3v(r.mulVec3(this.sunlight._position));
|
||||
} else {
|
||||
if (Math.abs(this._currDate - this._prevDate) > 0.00034 && this._active || this._lightOn) {
|
||||
this._lightOn = false;
|
||||
this._prevDate = this._currDate;
|
||||
this.sunlight.setPosition(getSunPosition(this._currDate));
|
||||
this.sunlight.setPosition3v(getSunPosition(this._currDate));
|
||||
this._f = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.sunlight.setPosition(getSunPosition(this._currDate));
|
||||
this.sunlight.setPosition3v(getSunPosition(this._currDate));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -161,13 +161,26 @@ class LightSource {
|
||||
* @param {og.Vec3} position - Light position or direction vector.
|
||||
* @returns {og.LightSource}
|
||||
*/
|
||||
setPosition(position) {
|
||||
setPosition3v(position) {
|
||||
this._position.x = position.x;
|
||||
this._position.y = position.y;
|
||||
this._position.z = position.z;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set light source position, or if it is a directional type sets light direction vector.
|
||||
* @public
|
||||
* @param {og.Vec3} position - Light position or direction vector.
|
||||
* @returns {og.LightSource}
|
||||
*/
|
||||
setPosition(x, y, z) {
|
||||
this._position.x = x;
|
||||
this._position.y = y;
|
||||
this._position.z = z;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns light source position, or if it is a directional type sets light direction vector.
|
||||
* @public
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user