refined the names of the key light porperties in Stage

This commit is contained in:
Sam Gateau 2015-04-21 11:04:14 -07:00
parent 34e64e5007
commit 48364cb598
5 changed files with 40 additions and 40 deletions

View file

@ -73,33 +73,33 @@ function runStageTime() {
} }
Script.setInterval(runStageTime, tickTackPeriod); Script.setInterval(runStageTime, tickTackPeriod);
panel.newCheckbox("Enable Earth Sun Model", panel.newCheckbox("Enable Sun Model",
function(value) { Scene.setStageEarthSunModelEnable((value != 0)); }, function(value) { Scene.setStageSunModelEnable((value != 0)); },
function() { return Scene.isStageEarthSunModelEnabled(); }, function() { return Scene.isStageSunModelEnabled(); },
function(value) { return (value); } function(value) { return (value); }
); );
panel.newDirectionBox("Light Direction", panel.newDirectionBox("Light Direction",
function(value) { Scene.setSunDirection(value); }, function(value) { Scene.setKeyLightDirection(value); },
function() { return Scene.getSunDirection(); }, function() { return Scene.getKeyLightDirection(); },
function(value) { return value.x.toFixed(2) + "," + value.y.toFixed(2) + "," + value.z.toFixed(2); } function(value) { return value.x.toFixed(2) + "," + value.y.toFixed(2) + "," + value.z.toFixed(2); }
); );
panel.newSlider("Light Intensity", 0.0, 5, panel.newSlider("Light Intensity", 0.0, 5,
function(value) { Scene.setSunIntensity(value); }, function(value) { Scene.setKeyLightIntensity(value); },
function() { return Scene.getSunIntensity(); }, function() { return Scene.getKeyLightIntensity(); },
function(value) { return (value).toFixed(2); } function(value) { return (value).toFixed(2); }
); );
panel.newSlider("Ambient Light Intensity", 0.0, 1.0, panel.newSlider("Ambient Light Intensity", 0.0, 1.0,
function(value) { Scene.setSunAmbientIntensity(value); }, function(value) { Scene.setKeyLightAmbientIntensity(value); },
function() { return Scene.getSunAmbientIntensity(); }, function() { return Scene.getKeyLightAmbientIntensity(); },
function(value) { return (value).toFixed(2); } function(value) { return (value).toFixed(2); }
); );
panel.newColorBox("Light Color", panel.newColorBox("Light Color",
function(value) { Scene.setSunColor(value); }, function(value) { Scene.setKeyLightColor(value); },
function() { return Scene.getSunColor(); }, function() { return Scene.getKeyLightColor(); },
function(value) { return (value); } // "(" + value.x + "," = value.y + "," + value.z + ")"; } function(value) { return (value); } // "(" + value.x + "," = value.y + "," + value.z + ")"; }
); );

View file

@ -250,8 +250,8 @@ void SunSkyStage::setOriginLocation(float longitude, float latitude, float altit
invalidate(); invalidate();
} }
void SunSkyStage::setEarthSunModelEnable(bool isEnabled) { void SunSkyStage::setSunModelEnable(bool isEnabled) {
_earthSunModelEnable = isEnabled; _sunModelEnable = isEnabled;
invalidate(); invalidate();
} }
@ -266,7 +266,7 @@ void SunSkyStage::setSunAmbientIntensity(float intensity) {
} }
void SunSkyStage::setSunDirection(const Vec3& direction) { void SunSkyStage::setSunDirection(const Vec3& direction) {
if (!isEarthSunModelEnabled()) { if (!isSunModelEnabled()) {
_sunLight->setDirection(direction); _sunLight->setDirection(direction);
} }
} }
@ -286,7 +286,7 @@ void SunSkyStage::updateGraphicsObject() const {
// And update the sunLAtitude as the declinaison depending of the time of the year // And update the sunLAtitude as the declinaison depending of the time of the year
_earthSunModel.setSunLatitude(evalSunDeclinaison(_yearTime)); _earthSunModel.setSunLatitude(evalSunDeclinaison(_yearTime));
if (isEarthSunModelEnabled()) { if (isSunModelEnabled()) {
Vec3d sunLightDir = -_earthSunModel.getSurfaceSunDir(); Vec3d sunLightDir = -_earthSunModel.getSurfaceSunDir();
_sunLight->setDirection(Vec3(sunLightDir.x, sunLightDir.y, sunLightDir.z)); _sunLight->setDirection(Vec3(sunLightDir.x, sunLightDir.y, sunLightDir.z));

View file

@ -204,8 +204,8 @@ public:
float getOriginSurfaceAltitude() const { return _earthSunModel.getAltitude(); } float getOriginSurfaceAltitude() const { return _earthSunModel.getAltitude(); }
// Enable / disable the effect of the time and location on the sun direction and color // Enable / disable the effect of the time and location on the sun direction and color
void setEarthSunModelEnable(bool isEnabled); void setSunModelEnable(bool isEnabled);
bool isEarthSunModelEnabled() const { return _earthSunModelEnable; } bool isSunModelEnabled() const { return _sunModelEnable; }
// Sun properties // Sun properties
void setSunColor(const Vec3& color); void setSunColor(const Vec3& color);
@ -236,7 +236,7 @@ protected:
float _dayTime = 12.0f; float _dayTime = 12.0f;
int _yearTime = 0; int _yearTime = 0;
mutable EarthSunModel _earthSunModel; mutable EarthSunModel _earthSunModel;
bool _earthSunModelEnable = true; bool _sunModelEnable = true;
mutable bool _invalid = true; mutable bool _invalid = true;
void invalidate() const { _invalid = true; } void invalidate() const { _invalid = true; }

View file

@ -46,44 +46,44 @@ int SceneScriptingInterface::getStageYearTime() const {
return _skyStage->getYearTime(); return _skyStage->getYearTime();
} }
void SceneScriptingInterface::setSunColor(const glm::vec3& color) { void SceneScriptingInterface::setKeyLightColor(const glm::vec3& color) {
_skyStage->setSunColor(color); _skyStage->setSunColor(color);
} }
glm::vec3 SceneScriptingInterface::getSunColor() const { glm::vec3 SceneScriptingInterface::getKeyLightColor() const {
return _skyStage->getSunColor(); return _skyStage->getSunColor();
} }
void SceneScriptingInterface::setSunIntensity(float intensity) { void SceneScriptingInterface::setKeyLightIntensity(float intensity) {
_skyStage->setSunIntensity(intensity); _skyStage->setSunIntensity(intensity);
} }
float SceneScriptingInterface::getSunIntensity() const { float SceneScriptingInterface::getKeyLightIntensity() const {
return _skyStage->getSunIntensity(); return _skyStage->getSunIntensity();
} }
void SceneScriptingInterface::setSunAmbientIntensity(float intensity) { void SceneScriptingInterface::setKeyLightAmbientIntensity(float intensity) {
_skyStage->setSunAmbientIntensity(intensity); _skyStage->setSunAmbientIntensity(intensity);
} }
float SceneScriptingInterface::getSunAmbientIntensity() const { float SceneScriptingInterface::getKeyLightAmbientIntensity() const {
return _skyStage->getSunAmbientIntensity(); return _skyStage->getSunAmbientIntensity();
} }
void SceneScriptingInterface::setSunDirection(const glm::vec3& direction) { void SceneScriptingInterface::setKeyLightDirection(const glm::vec3& direction) {
_skyStage->setSunDirection(direction); _skyStage->setSunDirection(direction);
} }
glm::vec3 SceneScriptingInterface::getSunDirection() const { glm::vec3 SceneScriptingInterface::getKeyLightDirection() const {
return _skyStage->getSunDirection(); return _skyStage->getSunDirection();
} }
void SceneScriptingInterface::setStageEarthSunModelEnable(bool isEnabled) { void SceneScriptingInterface::setStageSunModelEnable(bool isEnabled) {
_skyStage->setEarthSunModelEnable(isEnabled); _skyStage->setSunModelEnable(isEnabled);
} }
bool SceneScriptingInterface::isStageEarthSunModelEnabled() const { bool SceneScriptingInterface::isStageSunModelEnabled() const {
return _skyStage->isEarthSunModelEnabled(); return _skyStage->isSunModelEnabled();
} }
model::SunSkyStagePointer SceneScriptingInterface::getSkyStage() const { model::SunSkyStagePointer SceneScriptingInterface::getSkyStage() const {

View file

@ -38,21 +38,21 @@ public:
Q_INVOKABLE void setStageYearTime(int day); Q_INVOKABLE void setStageYearTime(int day);
Q_INVOKABLE int getStageYearTime() const; Q_INVOKABLE int getStageYearTime() const;
Q_INVOKABLE void setStageEarthSunModelEnable(bool isEnabled); Q_INVOKABLE void setStageSunModelEnable(bool isEnabled);
Q_INVOKABLE bool isStageEarthSunModelEnabled() const; Q_INVOKABLE bool isStageSunModelEnabled() const;
Q_INVOKABLE void setSunColor(const glm::vec3& color); Q_INVOKABLE void setKeyLightColor(const glm::vec3& color);
Q_INVOKABLE glm::vec3 getSunColor() const; Q_INVOKABLE glm::vec3 getKeyLightColor() const;
Q_INVOKABLE void setSunIntensity(float intensity); Q_INVOKABLE void setKeyLightIntensity(float intensity);
Q_INVOKABLE float getSunIntensity() const; Q_INVOKABLE float getKeyLightIntensity() const;
Q_INVOKABLE void setSunAmbientIntensity(float intensity); Q_INVOKABLE void setKeyLightAmbientIntensity(float intensity);
Q_INVOKABLE float getSunAmbientIntensity() const; Q_INVOKABLE float getKeyLightAmbientIntensity() const;
// Only valid if stage Earth Sun model is disabled // Only valid if stage Earth Sun model is disabled
Q_INVOKABLE void setSunDirection(const glm::vec3& direction); Q_INVOKABLE void setKeyLightDirection(const glm::vec3& direction);
Q_INVOKABLE glm::vec3 getSunDirection() const; Q_INVOKABLE glm::vec3 getKeyLightDirection() const;