Merge pull request #4671 from samcake/orange

Refine the naming of the "keyLight" of the domain and the upcoming ZoneEntity
This commit is contained in:
Brad Hefta-Gaub 2015-04-21 11:24:52 -07:00
commit 578c67e051
5 changed files with 43 additions and 41 deletions

View file

@ -73,33 +73,33 @@ function runStageTime() {
}
Script.setInterval(runStageTime, tickTackPeriod);
panel.newCheckbox("Enable Earth Sun Model",
function(value) { Scene.setStageEarthSunModelEnable((value != 0)); },
function() { return Scene.isStageEarthSunModelEnabled(); },
panel.newCheckbox("Enable Sun Model",
function(value) { Scene.setStageSunModelEnable((value != 0)); },
function() { return Scene.isStageSunModelEnabled(); },
function(value) { return (value); }
);
panel.newDirectionBox("Light Direction",
function(value) { Scene.setSunDirection(value); },
function() { return Scene.getSunDirection(); },
function(value) { Scene.setKeyLightDirection(value); },
function() { return Scene.getKeyLightDirection(); },
function(value) { return value.x.toFixed(2) + "," + value.y.toFixed(2) + "," + value.z.toFixed(2); }
);
panel.newSlider("Light Intensity", 0.0, 5,
function(value) { Scene.setSunIntensity(value); },
function() { return Scene.getSunIntensity(); },
function(value) { Scene.setKeyLightIntensity(value); },
function() { return Scene.getKeyLightIntensity(); },
function(value) { return (value).toFixed(2); }
);
panel.newSlider("Ambient Light Intensity", 0.0, 1.0,
function(value) { Scene.setSunAmbientIntensity(value); },
function() { return Scene.getSunAmbientIntensity(); },
function(value) { Scene.setKeyLightAmbientIntensity(value); },
function() { return Scene.getKeyLightAmbientIntensity(); },
function(value) { return (value).toFixed(2); }
);
panel.newColorBox("Light Color",
function(value) { Scene.setSunColor(value); },
function() { return Scene.getSunColor(); },
function(value) { Scene.setKeyLightColor(value); },
function() { return Scene.getKeyLightColor(); },
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();
}
void SunSkyStage::setEarthSunModelEnable(bool isEnabled) {
_earthSunModelEnable = isEnabled;
void SunSkyStage::setSunModelEnable(bool isEnabled) {
_sunModelEnable = isEnabled;
invalidate();
}
@ -266,7 +266,7 @@ void SunSkyStage::setSunAmbientIntensity(float intensity) {
}
void SunSkyStage::setSunDirection(const Vec3& direction) {
if (!isEarthSunModelEnabled()) {
if (!isSunModelEnabled()) {
_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
_earthSunModel.setSunLatitude(evalSunDeclinaison(_yearTime));
if (isEarthSunModelEnabled()) {
if (isSunModelEnabled()) {
Vec3d sunLightDir = -_earthSunModel.getSurfaceSunDir();
_sunLight->setDirection(Vec3(sunLightDir.x, sunLightDir.y, sunLightDir.z));

View file

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

View file

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

View file

@ -38,21 +38,23 @@ public:
Q_INVOKABLE void setStageYearTime(int day);
Q_INVOKABLE int getStageYearTime() const;
Q_INVOKABLE void setStageEarthSunModelEnable(bool isEnabled);
Q_INVOKABLE bool isStageEarthSunModelEnabled() const;
// Enable/disable the stage sun model which uses the key light to simulate
// the sun light based on the location of the stage trelative to earth and the current time
Q_INVOKABLE void setStageSunModelEnable(bool isEnabled);
Q_INVOKABLE bool isStageSunModelEnabled() const;
Q_INVOKABLE void setSunColor(const glm::vec3& color);
Q_INVOKABLE glm::vec3 getSunColor() const;
Q_INVOKABLE void setSunIntensity(float intensity);
Q_INVOKABLE float getSunIntensity() const;
Q_INVOKABLE void setSunAmbientIntensity(float intensity);
Q_INVOKABLE float getSunAmbientIntensity() const;
Q_INVOKABLE void setKeyLightColor(const glm::vec3& color);
Q_INVOKABLE glm::vec3 getKeyLightColor() const;
Q_INVOKABLE void setKeyLightIntensity(float intensity);
Q_INVOKABLE float getKeyLightIntensity() const;
Q_INVOKABLE void setKeyLightAmbientIntensity(float intensity);
Q_INVOKABLE float getKeyLightAmbientIntensity() const;
// Only valid if stage Earth Sun model is disabled
Q_INVOKABLE void setSunDirection(const glm::vec3& direction);
// setKeyLightDIrection is only effective if stage Sun model is disabled
Q_INVOKABLE void setKeyLightDirection(const glm::vec3& direction);
Q_INVOKABLE glm::vec3 getSunDirection() const;
Q_INVOKABLE glm::vec3 getKeyLightDirection() const;