From fd2b0da76d6b40ec4bdde79585504d45099e2a7e Mon Sep 17 00:00:00 2001 From: Nissim Date: Mon, 16 Oct 2017 12:20:31 -0700 Subject: [PATCH] First version. --- libraries/model/src/model/Light.cpp | 2 +- scripts/system/html/entityProperties.html | 5 ++++ scripts/system/html/js/entityProperties.js | 31 ++++++++++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/libraries/model/src/model/Light.cpp b/libraries/model/src/model/Light.cpp index 19da084f84..9c3e0a5282 100755 --- a/libraries/model/src/model/Light.cpp +++ b/libraries/model/src/model/Light.cpp @@ -58,7 +58,7 @@ void Light::setOrientation(const glm::quat& orientation) { } void Light::setDirection(const Vec3& direction) { - _lightSchemaBuffer.edit().volume.direction = (direction); + _lightSchemaBuffer.edit().volume.direction = (_transform.getRotation() * direction); } const Vec3& Light::getDirection() const { diff --git a/scripts/system/html/entityProperties.html b/scripts/system/html/entityProperties.html index 43cd281bbd..4cfc71063f 100644 --- a/scripts/system/html/entityProperties.html +++ b/scripts/system/html/entityProperties.html @@ -514,6 +514,11 @@
+
+ Inherit + Off + On +
diff --git a/scripts/system/html/js/entityProperties.js b/scripts/system/html/js/entityProperties.js index aad26cc7ba..214438de77 100644 --- a/scripts/system/html/js/entityProperties.js +++ b/scripts/system/html/js/entityProperties.js @@ -146,6 +146,22 @@ function createEmitTextPropertyUpdateFunction(propertyName) { }; } +function createZoneComponentModeChangedFunction(zoneComponent, zoneComponentModeInherit, zoneComponentModeDisabled, zoneComponentModeEnabled) { + return function() { + var zoneComponentMode; + + if (zoneComponentModeInherit.checked) { + zoneComponentMode = 'inherit'; + } else if (zoneComponentModeDisabled.checked) { + zoneComponentMode = 'disabled'; + } else if (zoneComponentModeEnabled.checked) { + zoneComponentMode = 'enabled'; + } + + updateProperty(zoneComponent, zoneComponentMode); + } +} + function createEmitGroupTextPropertyUpdateFunction(group, propertyName) { return function() { var properties = {}; @@ -644,6 +660,11 @@ function loaded() { var elZoneSections = document.querySelectorAll(".zone-section"); allSections.push(elZoneSections); + + var elZoneKeyLightModeInherit = document.getElementById("property-zone-component-mode-inherit"); + var elZoneKeyLightModeDisabled = document.getElementById("property-zone-component-mode-disabled"); + var elZoneKeyLightModeEnabled = document.getElementById("property-zone-component-mode-enabled"); + var elZoneStageSunModelEnabled = document.getElementById("property-zone-stage-sun-model-enabled"); var elZoneKeyLightColor = document.getElementById("property-zone-key-light-color"); @@ -983,6 +1004,11 @@ function loaded() { elLightExponent.value = properties.exponent.toFixed(2); elLightCutoff.value = properties.cutoff.toFixed(2); } else if (properties.type == "Zone") { + + elZoneKeyLightModeInherit.checked = (properties.keyLightMode == 'inherit'); + elZoneKeyLightModeDisabled.checked = (properties.keyLightMode == 'disabled'); + elZoneKeyLightModeEnabled.checked = (properties.keyLightMode == 'enabled'); + elZoneStageSunModelEnabled.checked = properties.stage.sunModelEnabled; elZoneKeyLightColor.style.backgroundColor = "rgb(" + properties.keyLight.color.red + "," + properties.keyLight.color.green + "," + properties.keyLight.color.blue + ")"; elZoneKeyLightColorRed.value = properties.keyLight.color.red; @@ -1361,6 +1387,11 @@ function loaded() { } })); + var keyLightModeChanged = createZoneComponentModeChangedFunction('keyLightMode', elZoneKeyLightModeInherit, elZoneKeyLightModeDisabled, elZoneKeyLightModeEnabled) + elZoneKeyLightModeInherit.addEventListener('change', keyLightModeChanged); + elZoneKeyLightModeDisabled.addEventListener('change', keyLightModeChanged); + elZoneKeyLightModeEnabled.addEventListener('change', keyLightModeChanged); + elZoneStageSunModelEnabled.addEventListener('change', createEmitGroupCheckedPropertyUpdateFunction('stage', 'sunModelEnabled')); colorPickers.push($('#property-zone-key-light-color').colpick({ colorScheme: 'dark',