Merge pull request #4808 from ZappoMan/moreZoneProperties

add has stars to edit.js & fix background mode: nothing bug
This commit is contained in:
Philip Rosedale 2015-05-08 17:10:45 -07:00
commit 72e1ea688a
3 changed files with 42 additions and 8 deletions

View file

@ -26,6 +26,20 @@
); );
}; };
} }
function createEmitGroupCheckedPropertyUpdateFunction(group, propertyName) {
return function() {
var properties = {};
properties[group] = {};
properties[group][propertyName] = this.checked;
EventBridge.emitWebEvent(
JSON.stringify({
type: "update",
properties: properties
})
);
};
}
function createEmitNumberPropertyUpdateFunction(propertyName) { function createEmitNumberPropertyUpdateFunction(propertyName) {
return function() { return function() {
EventBridge.emitWebEvent( EventBridge.emitWebEvent(
@ -286,6 +300,8 @@
var elZoneAtmosphereScatteringWavelengthsX = document.getElementById("property-zone-atmosphere-scattering-wavelengths-x"); var elZoneAtmosphereScatteringWavelengthsX = document.getElementById("property-zone-atmosphere-scattering-wavelengths-x");
var elZoneAtmosphereScatteringWavelengthsY = document.getElementById("property-zone-atmosphere-scattering-wavelengths-y"); var elZoneAtmosphereScatteringWavelengthsY = document.getElementById("property-zone-atmosphere-scattering-wavelengths-y");
var elZoneAtmosphereScatteringWavelengthsZ = document.getElementById("property-zone-atmosphere-scattering-wavelengths-z"); var elZoneAtmosphereScatteringWavelengthsZ = document.getElementById("property-zone-atmosphere-scattering-wavelengths-z");
var elZoneAtmosphereHasStars = document.getElementById("property-zone-atmosphere-has-stars");
if (window.EventBridge !== undefined) { if (window.EventBridge !== undefined) {
EventBridge.scriptEventReceived.connect(function(data) { EventBridge.scriptEventReceived.connect(function(data) {
@ -486,7 +502,7 @@
elZoneAtmosphereScatteringWavelengthsX.value = properties.atmosphere.scatteringWavelengths.x; elZoneAtmosphereScatteringWavelengthsX.value = properties.atmosphere.scatteringWavelengths.x;
elZoneAtmosphereScatteringWavelengthsY.value = properties.atmosphere.scatteringWavelengths.y; elZoneAtmosphereScatteringWavelengthsY.value = properties.atmosphere.scatteringWavelengths.y;
elZoneAtmosphereScatteringWavelengthsZ.value = properties.atmosphere.scatteringWavelengths.z; elZoneAtmosphereScatteringWavelengthsZ.value = properties.atmosphere.scatteringWavelengths.z;
elZoneAtmosphereHasStars.checked = properties.atmosphere.hasStars;
} }
@ -650,6 +666,8 @@
elZoneAtmosphereScatteringWavelengthsX.addEventListener('change', zoneAtmosphereScatterWavelengthsChangeFunction); elZoneAtmosphereScatteringWavelengthsX.addEventListener('change', zoneAtmosphereScatterWavelengthsChangeFunction);
elZoneAtmosphereScatteringWavelengthsY.addEventListener('change', zoneAtmosphereScatterWavelengthsChangeFunction); elZoneAtmosphereScatteringWavelengthsY.addEventListener('change', zoneAtmosphereScatterWavelengthsChangeFunction);
elZoneAtmosphereScatteringWavelengthsZ.addEventListener('change', zoneAtmosphereScatterWavelengthsChangeFunction); elZoneAtmosphereScatteringWavelengthsZ.addEventListener('change', zoneAtmosphereScatterWavelengthsChangeFunction);
elZoneAtmosphereHasStars.addEventListener('change', createEmitGroupCheckedPropertyUpdateFunction('atmosphere','hasStars'));
elMoveSelectionToGrid.addEventListener("click", function() { elMoveSelectionToGrid.addEventListener("click", function() {
EventBridge.emitWebEvent(JSON.stringify({ EventBridge.emitWebEvent(JSON.stringify({
@ -1136,23 +1154,29 @@
<div class="zone-section property"> <div class="zone-section property">
<div class="label">Atmosphere Mie Scattering</div> <div class="label">Atmosphere Mie Scattering</div>
<div class="value"> <div class="value">
<input class="coord" type='number' id="property-zone-atmosphere-mie-scattering" min="0" max="0.5" step="0.001"></input> <input class="coord no-spin" type='number' id="property-zone-atmosphere-mie-scattering" min="0" max="0.5" step="any"></input>
</div> </div>
</div> </div>
<div class="zone-section property"> <div class="zone-section property">
<div class="label">Atmosphere Rayleigh Scattering</div> <div class="label">Atmosphere Rayleigh Scattering</div>
<div class="value"> <div class="value">
<input class="coord" type='number' id="property-zone-atmosphere-rayleigh-scattering" min="0" max="0.5" step="0.001"></input> <input class="coord no-spin" type='number' id="property-zone-atmosphere-rayleigh-scattering" min="0" max="0.5" step="any"></input>
</div> </div>
</div> </div>
<div class="zone-section property"> <div class="zone-section property">
<div class="label">Atmosphere Scattering Wavelenghts</div> <div class="label">Atmosphere Scattering Wavelenghts</div>
<div class="value"> <div class="value">
<div class="input-area">X <br><input class="coord" type='number' id="property-zone-atmosphere-scattering-wavelengths-x" min="0" max="1" step="0.001"></input></div> <div class="input-area">X <br><input class="coord no-spin" type='number' id="property-zone-atmosphere-scattering-wavelengths-x" min="0" max="1" step="any"></input></div>
<div class="input-area">Y <br><input class="coord" type='number' id="property-zone-atmosphere-scattering-wavelengths-y" min="0" max="1" step="0.001"></input></div> <div class="input-area">Y <br><input class="coord no-spin" type='number' id="property-zone-atmosphere-scattering-wavelengths-y" min="0" max="1" step="any"></input></div>
<div class="input-area">Z <br><input class="coord" type='number' id="property-zone-atmosphere-scattering-wavelengths-z" min="0" max="1" step="0.001"></input></div> <div class="input-area">Z <br><input class="coord no-spin" type='number' id="property-zone-atmosphere-scattering-wavelengths-z" min="0" max="1" step="any"></input></div>
</div> </div>
</div> </div>
<div class="zone-section property">
<span class="label">Atmosphere Has Stars</span>
<span class="value">
<input type='checkbox' id="property-zone-atmosphere-has-stars">
</span>
</div>
</div> </div>

View file

@ -121,6 +121,14 @@ input.coord {
display: block; display: block;
} }
input.no-spin::-webkit-outer-spin-button,
input.no-spin::-webkit-inner-spin-button {
display: none;
-webkit-appearance: none;
-moz-appearance: none;
margin: 0; /* <-- Apparently some margin are still there even though it's hidden */
}
table#entity-table { table#entity-table {
border-collapse: collapse; border-collapse: collapse;
font-family: Sans-Serif; font-family: Sans-Serif;

View file

@ -450,8 +450,8 @@ void EntityTreeRenderer::render(RenderArgs::RenderMode renderMode,
} else { } else {
_viewState->endOverrideEnvironmentData(); _viewState->endOverrideEnvironmentData();
auto stage = scene->getSkyStage();
if (_bestZone->getBackgroundMode() == BACKGROUND_MODE_SKYBOX) { if (_bestZone->getBackgroundMode() == BACKGROUND_MODE_SKYBOX) {
auto stage = scene->getSkyStage();
stage->getSkybox()->setColor(_bestZone->getSkyboxProperties().getColorVec3()); stage->getSkybox()->setColor(_bestZone->getSkyboxProperties().getColorVec3());
if (_bestZone->getSkyboxProperties().getURL().isEmpty()) { if (_bestZone->getSkyboxProperties().getURL().isEmpty()) {
stage->getSkybox()->clearCubemap(); stage->getSkybox()->clearCubemap();
@ -461,6 +461,8 @@ void EntityTreeRenderer::render(RenderArgs::RenderMode renderMode,
stage->getSkybox()->setCubemap(cubeMap->getGPUTexture()); stage->getSkybox()->setCubemap(cubeMap->getGPUTexture());
} }
stage->setBackgroundMode(model::SunSkyStage::SKY_BOX); stage->setBackgroundMode(model::SunSkyStage::SKY_BOX);
} else {
stage->setBackgroundMode(model::SunSkyStage::SKY_DOME); // let the application atmosphere through
} }
} }
@ -478,7 +480,7 @@ void EntityTreeRenderer::render(RenderArgs::RenderMode renderMode,
_hasPreviousZone = false; _hasPreviousZone = false;
} }
_viewState->endOverrideEnvironmentData(); _viewState->endOverrideEnvironmentData();
scene->getSkyStage()->setBackgroundMode(model::SunSkyStage::SKY_DOME); scene->getSkyStage()->setBackgroundMode(model::SunSkyStage::SKY_DOME); // let the application atmosphere through
} }
// we must call endScene while we still have the tree locked so that no one deletes a model // we must call endScene while we still have the tree locked so that no one deletes a model