diff --git a/assignment-client/CMakeLists.txt b/assignment-client/CMakeLists.txt index 3c102e1f02..1b5840c3c8 100644 --- a/assignment-client/CMakeLists.txt +++ b/assignment-client/CMakeLists.txt @@ -4,7 +4,7 @@ setup_hifi_project(Core Gui Network Script Quick Widgets WebSockets) # link in the shared libraries link_hifi_libraries( - audio avatars octree environment gpu model fbx entities + audio avatars octree gpu model fbx entities networking animation recording shared script-engine embedded-webserver controllers physics ) diff --git a/assignment-client/src/octree/OctreeServer.h b/assignment-client/src/octree/OctreeServer.h index 2aabb97428..f1aa9531e8 100644 --- a/assignment-client/src/octree/OctreeServer.h +++ b/assignment-client/src/octree/OctreeServer.h @@ -21,7 +21,6 @@ #include #include -#include #include "OctreePersistThread.h" #include "OctreeSendThread.h" diff --git a/examples/edit.js b/examples/edit.js index 41f25cb2e5..6c24d00449 100644 --- a/examples/edit.js +++ b/examples/edit.js @@ -1659,29 +1659,6 @@ PropertiesTool = function(opts) { }); } } - } else if (data.action == "centerAtmosphereToZone") { - if (selectionManager.hasSelection()) { - selectionManager.saveProperties(); - for (var i = 0; i < selectionManager.selections.length; i++) { - var properties = selectionManager.savedProperties[selectionManager.selections[i]]; - if (properties.type == "Zone") { - var centerOfZone = properties.boundingBox.center; - var atmosphereCenter = { - x: centerOfZone.x, - y: centerOfZone.y - properties.atmosphere.innerRadius, - z: centerOfZone.z - }; - - Entities.editEntity(selectionManager.selections[i], { - atmosphere: { - center: atmosphereCenter - }, - }); - } - } - pushCommandForSelections(); - selectionManager._update(); - } } } }); diff --git a/examples/example/entities/changingAtmosphereExample.js b/examples/example/entities/changingAtmosphereExample.js deleted file mode 100644 index 02103fc0fb..0000000000 --- a/examples/example/entities/changingAtmosphereExample.js +++ /dev/null @@ -1,71 +0,0 @@ -// -// changingAtmosphereExample.js -// examples -// -// Created by Brad Hefta-Gaub on 4/16/15. -// Copyright 2015 High Fidelity, Inc. -// -// This is an example script that demonstrates creating a zone using the atmosphere features that changes scatter properties -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/"; - -var count = 0; -var stopAfter = 10000; - -var zoneEntityA = Entities.addEntity({ - type: "Zone", - position: { x: 1000, y: 1000, z: 1000}, - dimensions: { x: 2000, y: 2000, z: 2000 }, - keyLightColor: { red: 255, green: 0, blue: 0 }, - stageSunModelEnabled: false, - shapeType: "sphere", - backgroundMode: "atmosphere", - atmosphere: { - center: { x: 1000, y: 0, z: 1000}, - innerRadius: 1000.0, - outerRadius: 1025.0, - rayleighScattering: 0.0025, // Meaningful values 0 to ~0.01 - mieScattering: 0.0010, // Meaningful values 0 to ~0.01 - - // First two, Meaningful values 0 to 1 each, blue, purple; third meaningful 0.3 to 1 - affects shape - scatteringWavelengths: { x: 0.650, y: 0.570, z: 0.475 }, - hasStars: true - }, - stage: { - latitude: 37.777, - longitude: 122.407, - altitude: 0.03, - day: 183, - hour: 5, - sunModelEnabled: true - } -}); - - -// register the call back so it fires before each data send -Script.update.connect(function(deltaTime) { - // stop it... - if (count >= stopAfter) { - print("calling Script.stop()"); - Script.stop(); - } - count++; - var rayleighScattering = (count / 100000) % 0.01; - var mieScattering = (count / 100000) % 0.01; - var waveX = (count / 2000) % 1; - var waveZ = ((count / 2000) % 0.7) + 0.3; - - Entities.editEntity(zoneEntityA, { - atmosphere: { - rayleighScattering: rayleighScattering, - mieScattering: mieScattering, - scatteringWavelengths: { x: waveX, y: waveX, z: waveZ } - }, - - }); -}); - diff --git a/examples/example/entities/zoneAtmosphereExample.js b/examples/example/entities/zoneAtmosphereExample.js deleted file mode 100644 index dfebf09f2a..0000000000 --- a/examples/example/entities/zoneAtmosphereExample.js +++ /dev/null @@ -1,65 +0,0 @@ -// -// zoneAtmosphereExample.js -// examples -// -// Created by Brad Hefta-Gaub on 4/16/15. -// Copyright 2015 High Fidelity, Inc. -// -// This is an example script that demonstrates creating a zone using the atmosphere features -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/"; - -var count = 0; -var stopAfter = 10000; - -var zoneEntityA = Entities.addEntity({ - type: "Zone", - position: { x: 1000, y: 1000, z: 1000}, - dimensions: { x: 2000, y: 2000, z: 2000 }, - keyLightColor: { red: 255, green: 0, blue: 0 }, - stageSunModelEnabled: false, - shapeType: "sphere", - backgroundMode: "atmosphere", - atmosphere: { - center: { x: 1000, y: 0, z: 1000}, - innerRadius: 1000.0, - outerRadius: 1025.0, - rayleighScattering: 0.0025, - mieScattering: 0.0010, - scatteringWavelengths: { x: 0.650, y: 0.570, z: 0.475 }, - hasStars: false - }, - stage: { - latitude: 37.777, - longitude: 122.407, - altitude: 0.03, - day: 60, - hour: 0, - sunModelEnabled: true - } -}); - - -// register the call back so it fires before each data send -Script.update.connect(function(deltaTime) { - // stop it... - if (count >= stopAfter) { - print("calling Script.stop()"); - Script.stop(); - } - count++; - var newHour = (count / 10) % 24; - var newIntensity = ((count / 10) % 24) / 24; - print("newHour:" + newHour); - print("newIntensity:" + newIntensity); - - Entities.editEntity(zoneEntityA, { - stageHour: newHour, - keyLightIntensity: newIntensity - }); -}); - diff --git a/examples/html/entityProperties.html b/examples/html/entityProperties.html index 9ced830e0c..898f2bea6d 100644 --- a/examples/html/entityProperties.html +++ b/examples/html/entityProperties.html @@ -360,20 +360,6 @@ var elZoneSkyboxColorBlue = document.getElementById("property-zone-skybox-color-blue"); var elZoneSkyboxURL = document.getElementById("property-zone-skybox-url"); - var elZoneAtmosphereCenterX = document.getElementById("property-zone-atmosphere-center-x"); - var elZoneAtmosphereCenterY = document.getElementById("property-zone-atmosphere-center-y"); - var elZoneAtmosphereCenterZ = document.getElementById("property-zone-atmosphere-center-z"); - var elCenterAtmosphereToZone = document.getElementById("center-atmosphere-in-zone"); - - var elZoneAtmosphereInnerRadius = document.getElementById("property-zone-atmosphere-inner-radius"); - var elZoneAtmosphereOuterRadius = document.getElementById("property-zone-atmosphere-outer-radius"); - var elZoneAtmosphereMieScattering = document.getElementById("property-zone-atmosphere-mie-scattering"); - var elZoneAtmosphereRayleighScattering = document.getElementById("property-zone-atmosphere-rayleigh-scattering"); - var elZoneAtmosphereScatteringWavelengthsX = document.getElementById("property-zone-atmosphere-scattering-wavelengths-x"); - var elZoneAtmosphereScatteringWavelengthsY = document.getElementById("property-zone-atmosphere-scattering-wavelengths-y"); - var elZoneAtmosphereScatteringWavelengthsZ = document.getElementById("property-zone-atmosphere-scattering-wavelengths-z"); - var elZoneAtmosphereHasStars = document.getElementById("property-zone-atmosphere-has-stars"); - var elPolyVoxSections = document.querySelectorAll(".poly-vox-section"); allSections.push(elPolyVoxSections); var elVoxelVolumeSizeX = document.getElementById("property-voxel-volume-size-x"); @@ -606,20 +592,7 @@ elZoneSkyboxColorBlue.value = properties.skybox.color.blue; elZoneSkyboxURL.value = properties.skybox.url; - elZoneAtmosphereCenterX.value = properties.atmosphere.center.x; - elZoneAtmosphereCenterY.value = properties.atmosphere.center.y; - elZoneAtmosphereCenterZ.value = properties.atmosphere.center.z; - elZoneAtmosphereInnerRadius.value = properties.atmosphere.innerRadius; - elZoneAtmosphereOuterRadius.value = properties.atmosphere.outerRadius; - elZoneAtmosphereMieScattering.value = properties.atmosphere.mieScattering; - elZoneAtmosphereRayleighScattering.value = properties.atmosphere.rayleighScattering; - elZoneAtmosphereScatteringWavelengthsX.value = properties.atmosphere.scatteringWavelengths.x; - elZoneAtmosphereScatteringWavelengthsY.value = properties.atmosphere.scatteringWavelengths.y; - elZoneAtmosphereScatteringWavelengthsZ.value = properties.atmosphere.scatteringWavelengths.z; - elZoneAtmosphereHasStars.checked = properties.atmosphere.hasStars; - showElements(document.getElementsByClassName('skybox-section'), elZoneBackgroundMode.value == 'skybox'); - showElements(document.getElementsByClassName('atmosphere-section'), elZoneBackgroundMode.value == 'atmosphere'); } else if (properties.type == "ParticleEffect") { for (var i = 0; i < elParticleSections.length; i++) { elParticleSections[i].style.display = 'block'; @@ -874,25 +847,6 @@ elZoneSkyboxURL.addEventListener('change', createEmitGroupTextPropertyUpdateFunction('skybox','url')); - var zoneAtmosphereCenterChangeFunction = createEmitGroupVec3PropertyUpdateFunction( - 'atmosphere','center', elZoneAtmosphereCenterX, elZoneAtmosphereCenterY, elZoneAtmosphereCenterZ); - elZoneAtmosphereCenterX.addEventListener('change', zoneAtmosphereCenterChangeFunction); - elZoneAtmosphereCenterY.addEventListener('change', zoneAtmosphereCenterChangeFunction); - elZoneAtmosphereCenterZ.addEventListener('change', zoneAtmosphereCenterChangeFunction); - - - elZoneAtmosphereInnerRadius.addEventListener('change', createEmitGroupNumberPropertyUpdateFunction('atmosphere','innerRadius')); - elZoneAtmosphereOuterRadius.addEventListener('change', createEmitGroupNumberPropertyUpdateFunction('atmosphere','outerRadius')); - elZoneAtmosphereMieScattering.addEventListener('change', createEmitGroupNumberPropertyUpdateFunction('atmosphere','mieScattering')); - elZoneAtmosphereRayleighScattering.addEventListener('change', createEmitGroupNumberPropertyUpdateFunction('atmosphere','rayleighScattering')); - var zoneAtmosphereScatterWavelengthsChangeFunction = createEmitGroupVec3PropertyUpdateFunction( - 'atmosphere','scatteringWavelengths', elZoneAtmosphereScatteringWavelengthsX, - elZoneAtmosphereScatteringWavelengthsY, elZoneAtmosphereScatteringWavelengthsZ); - elZoneAtmosphereScatteringWavelengthsX.addEventListener('change', zoneAtmosphereScatterWavelengthsChangeFunction); - elZoneAtmosphereScatteringWavelengthsY.addEventListener('change', zoneAtmosphereScatterWavelengthsChangeFunction); - elZoneAtmosphereScatteringWavelengthsZ.addEventListener('change', zoneAtmosphereScatterWavelengthsChangeFunction); - elZoneAtmosphereHasStars.addEventListener('change', createEmitGroupCheckedPropertyUpdateFunction('atmosphere','hasStars')); - var voxelVolumeSizeChangeFunction = createEmitVec3PropertyUpdateFunction( 'voxelVolumeSize', elVoxelVolumeSizeX, elVoxelVolumeSizeY, elVoxelVolumeSizeZ); elVoxelVolumeSizeX.addEventListener('change', voxelVolumeSizeChangeFunction); @@ -934,12 +888,6 @@ action: "reloadScript" })); }); - elCenterAtmosphereToZone.addEventListener("click", function() { - EventBridge.emitWebEvent(JSON.stringify({ - type: "action", - action: "centerAtmosphereToZone", - })); - }); elPreviewCameraButton.addEventListener("click", function() { EventBridge.emitWebEvent(JSON.stringify({ type: "action", @@ -1601,7 +1549,6 @@ @@ -1626,61 +1573,6 @@ - - -
- -
- -
-
Atmosphere Center
-
-
X
-
Y
-
Z
-
- -
-
-
-
-
Atmosphere Inner Radius
-
- -
-
-
-
Atmosphere Outer Radius
-
- -
-
-
-
Atmosphere Mie Scattering
-
- -
-
-
-
Atmosphere Rayleigh Scattering
-
- -
-
-
-
Atmosphere Scattering Wavelenghts
-
-
X
-
Y
-
Z
-
-
- diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index 7b0545c277..b4ce53b92a 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -129,7 +129,7 @@ if (WIN32) endif() # link required hifi libraries -link_hifi_libraries(shared octree environment gpu gl procedural model render +link_hifi_libraries(shared octree gpu gl procedural model render recording fbx networking model-networking entities avatars audio audio-client animation script-engine physics render-utils entities-renderer ui auto-updater diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index d9e8d67bca..80654c2e08 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -1880,12 +1880,6 @@ void Application::keyPressEvent(QKeyEvent* event) { break; } - case Qt::Key_A: - if (isShifted) { - Menu::getInstance()->triggerOption(MenuOption::Atmosphere); - } - break; - case Qt::Key_Backslash: Menu::getInstance()->triggerOption(MenuOption::Chat); break; @@ -2693,8 +2687,6 @@ void Application::init() { // Make sure Login state is up to date DependencyManager::get()->toggleLoginDialog(); - _environment.init(); - DependencyManager::get()->init(); DependencyManager::get()->init(); @@ -3615,10 +3607,6 @@ public: typedef Payload::DataPointer Pointer; Stars _stars; - Environment* _environment; - - BackgroundRenderData(Environment* environment) : _environment(environment) { - } static render::ItemID _item; // unique WorldBoxRenderData }; @@ -3660,63 +3648,8 @@ namespace render { "Application::payloadRender() ... stars..."); // should be the first rendering pass - w/o depth buffer / lighting - // compute starfield alpha based on distance from atmosphere - float alpha = 1.0f; - bool hasStars = true; - - if (Menu::getInstance()->isOptionChecked(MenuOption::Atmosphere)) { - // TODO: handle this correctly for zones - const EnvironmentData& closestData = background->_environment->getClosestData(args->_viewFrustum->getPosition()); // was theCamera instead of _viewFrustum - - if (closestData.getHasStars()) { - const float APPROXIMATE_DISTANCE_FROM_HORIZON = 0.1f; - const float DOUBLE_APPROXIMATE_DISTANCE_FROM_HORIZON = 0.2f; - - glm::vec3 sunDirection = (args->_viewFrustum->getPosition()/*getAvatarPosition()*/ - closestData.getSunLocation()) - / closestData.getAtmosphereOuterRadius(); - float height = glm::distance(args->_viewFrustum->getPosition()/*theCamera.getPosition()*/, closestData.getAtmosphereCenter()); - if (height < closestData.getAtmosphereInnerRadius()) { - // If we're inside the atmosphere, then determine if our keyLight is below the horizon - alpha = 0.0f; - - if (sunDirection.y > -APPROXIMATE_DISTANCE_FROM_HORIZON) { - float directionY = glm::clamp(sunDirection.y, - -APPROXIMATE_DISTANCE_FROM_HORIZON, APPROXIMATE_DISTANCE_FROM_HORIZON) - + APPROXIMATE_DISTANCE_FROM_HORIZON; - alpha = (directionY / DOUBLE_APPROXIMATE_DISTANCE_FROM_HORIZON); - } - - - } else if (height < closestData.getAtmosphereOuterRadius()) { - alpha = (height - closestData.getAtmosphereInnerRadius()) / - (closestData.getAtmosphereOuterRadius() - closestData.getAtmosphereInnerRadius()); - - if (sunDirection.y > -APPROXIMATE_DISTANCE_FROM_HORIZON) { - float directionY = glm::clamp(sunDirection.y, - -APPROXIMATE_DISTANCE_FROM_HORIZON, APPROXIMATE_DISTANCE_FROM_HORIZON) - + APPROXIMATE_DISTANCE_FROM_HORIZON; - alpha = (directionY / DOUBLE_APPROXIMATE_DISTANCE_FROM_HORIZON); - } - } - } else { - hasStars = false; - } - } - - // finally render the starfield - if (hasStars) { - background->_stars.render(args, alpha); - } - - // draw the sky dome - if (/*!selfAvatarOnly &&*/ Menu::getInstance()->isOptionChecked(MenuOption::Atmosphere)) { - PerformanceTimer perfTimer("atmosphere"); - PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), - "Application::displaySide() ... atmosphere..."); - - background->_environment->renderAtmospheres(batch, *(args->_viewFrustum)); - } - + static const float alpha = 1.0f; + background->_stars.render(args, alpha); } } break; @@ -3756,12 +3689,10 @@ void Application::displaySide(RenderArgs* renderArgs, Camera& theCamera, bool se // Background rendering decision if (BackgroundRenderData::_item == 0) { - auto backgroundRenderData = make_shared(&_environment); + auto backgroundRenderData = make_shared(); auto backgroundRenderPayload = make_shared(backgroundRenderData); BackgroundRenderData::_item = _main3DScene->allocateID(); pendingChanges.resetItem(BackgroundRenderData::_item, backgroundRenderPayload); - } else { - } // Assuming nothing get's rendered through that @@ -3801,7 +3732,6 @@ void Application::displaySide(RenderArgs* renderArgs, Camera& theCamera, bool se DependencyManager::get()->setAmbientLightMode(getRenderAmbientLight()); auto skyStage = DependencyManager::get()->getSkyStage(); DependencyManager::get()->setGlobalLight(skyStage->getSunLight()->getDirection(), skyStage->getSunLight()->getColor(), skyStage->getSunLight()->getIntensity(), skyStage->getSunLight()->getAmbientIntensity()); - DependencyManager::get()->setGlobalAtmosphere(skyStage->getAtmosphere()); auto skybox = model::SkyboxPointer(); if (skyStage->getBackgroundMode() == model::SunSkyStage::SKY_BOX) { diff --git a/interface/src/Application.h b/interface/src/Application.h index efcefa0c6e..71946497d5 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -44,7 +44,6 @@ #include "avatar/MyAvatar.h" #include "Bookmarks.h" #include "Camera.h" -#include "Environment.h" #include "FileLogger.h" #include "gpu/Context.h" #include "Menu.h" @@ -172,8 +171,6 @@ public: virtual QThread* getMainThread() { return thread(); } virtual PickRay computePickRay(float x, float y) const; virtual glm::vec3 getAvatarPosition() const; - virtual void overrideEnvironmentData(const EnvironmentData& newData) { _environment.override(newData); } - virtual void endOverrideEnvironmentData() { _environment.endOverride(); } virtual qreal getDevicePixelRatio(); void setActiveDisplayPlugin(const QString& pluginName); @@ -440,8 +437,6 @@ private: float _rotateMirror; float _raiseMirror; - Environment _environment; - QSet _keysPressed; bool _enableProcessOctreeThread; diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp index 377d97bc30..591cea5731 100644 --- a/interface/src/Menu.cpp +++ b/interface/src/Menu.cpp @@ -323,7 +323,6 @@ Menu::Menu() { // Developer > Render >>> MenuWrapper* renderOptionsMenu = developerMenu->addMenu("Render"); - addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::Atmosphere, 0, true); addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::WorldAxes); addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::DebugAmbientOcclusion); addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::Antialiasing); diff --git a/interface/src/Menu.h b/interface/src/Menu.h index 6bf66f1200..84f3b90b9b 100644 --- a/interface/src/Menu.h +++ b/interface/src/Menu.h @@ -154,7 +154,6 @@ namespace MenuOption { const QString AnimDebugDrawPosition= "Debug Draw Position"; const QString Antialiasing = "Antialiasing"; const QString AssetMigration = "ATP Asset Migration"; - const QString Atmosphere = "Atmosphere"; const QString Attachments = "Attachments..."; const QString AudioNetworkStats = "Audio Network Stats"; const QString AudioNoiseReduction = "Audio Noise Reduction"; diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index b1688b8f9e..82809cb7a5 100644 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -43,7 +43,6 @@ #include "Application.h" #include "devices/Faceshift.h" #include "AvatarManager.h" -#include "Environment.h" #include "Menu.h" #include "MyAvatar.h" #include "Physics.h" diff --git a/libraries/entities-renderer/src/EntityTreeRenderer.cpp b/libraries/entities-renderer/src/EntityTreeRenderer.cpp index a2c1cf27c2..0ea35e6c5a 100644 --- a/libraries/entities-renderer/src/EntityTreeRenderer.cpp +++ b/libraries/entities-renderer/src/EntityTreeRenderer.cpp @@ -277,8 +277,7 @@ void EntityTreeRenderer::applyZonePropertiesToScene(std::shared_ptrendOverrideEnvironmentData(); - skyStage->setBackgroundMode(model::SunSkyStage::SKY_DOME); // let the application atmosphere through + skyStage->setBackgroundMode(model::SunSkyStage::SKY_DOME); // let the application background through return; // Early exit } @@ -308,28 +307,6 @@ void EntityTreeRenderer::applyZonePropertiesToScene(std::shared_ptrsetDay(zone->getStageProperties().calculateDay()); switch (zone->getBackgroundMode()) { - case BACKGROUND_MODE_ATMOSPHERE: { - EnvironmentData data = zone->getEnvironmentData(); - glm::vec3 keyLightDirection = sceneKeyLight->getDirection(); - glm::vec3 inverseKeyLightDirection = keyLightDirection * -1.0f; - - // NOTE: is this right? It seems like the "sun" should be based on the center of the - // atmosphere, not where the camera is. - glm::vec3 keyLightLocation = _viewState->getAvatarPosition() + - (inverseKeyLightDirection * data.getAtmosphereOuterRadius()); - - data.setSunLocation(keyLightLocation); - - const float KEY_LIGHT_INTENSITY_TO_SUN_BRIGHTNESS_RATIO = 20.0f; - float sunBrightness = sceneKeyLight->getIntensity() * KEY_LIGHT_INTENSITY_TO_SUN_BRIGHTNESS_RATIO; - data.setSunBrightness(sunBrightness); - - _viewState->overrideEnvironmentData(data); - skyStage->setBackgroundMode(model::SunSkyStage::SKY_DOME); - _pendingSkyboxTexture = false; - _skyboxTexture.clear(); - break; - } case BACKGROUND_MODE_SKYBOX: { auto skybox = std::dynamic_pointer_cast(skyStage->getSkybox()); skybox->setColor(zone->getSkyboxProperties().getColorVec3()); @@ -360,13 +337,13 @@ void EntityTreeRenderer::applyZonePropertiesToScene(std::shared_ptrendOverrideEnvironmentData(); skyStage->setBackgroundMode(model::SunSkyStage::SKY_BOX); break; } + case BACKGROUND_MODE_INHERIT: - _viewState->endOverrideEnvironmentData(); - skyStage->setBackgroundMode(model::SunSkyStage::SKY_DOME); // let the application atmosphere through + default: + skyStage->setBackgroundMode(model::SunSkyStage::SKY_DOME); // let the application background through _pendingSkyboxTexture = false; _skyboxTexture.clear(); break; diff --git a/libraries/entities/CMakeLists.txt b/libraries/entities/CMakeLists.txt index 26e90f5d41..7bea5c6088 100644 --- a/libraries/entities/CMakeLists.txt +++ b/libraries/entities/CMakeLists.txt @@ -1,6 +1,6 @@ set(TARGET_NAME entities) setup_hifi_library(Network Script) -link_hifi_libraries(avatars shared audio octree gpu model fbx networking animation environment) +link_hifi_libraries(avatars shared audio octree gpu model fbx networking animation) target_bullet() diff --git a/libraries/entities/src/AtmospherePropertyGroup.cpp b/libraries/entities/src/AtmospherePropertyGroup.cpp deleted file mode 100644 index 8e7a5a5262..0000000000 --- a/libraries/entities/src/AtmospherePropertyGroup.cpp +++ /dev/null @@ -1,230 +0,0 @@ -// -// AtmospherePropertyGroup.cpp -// libraries/entities/src -// -// Created by Brad Hefta-Gaub on 12/4/13. -// Copyright 2013 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -#include - -#include "AtmospherePropertyGroup.h" -#include "EntityItemProperties.h" -#include "EntityItemPropertiesMacros.h" - -const glm::vec3 AtmospherePropertyGroup::DEFAULT_CENTER = glm::vec3(0.0f, -1000.0f, 0.0f); -const float AtmospherePropertyGroup::DEFAULT_INNER_RADIUS = 1000.0f; -const float AtmospherePropertyGroup::DEFAULT_OUTER_RADIUS = 1025.0f; -const float AtmospherePropertyGroup::DEFAULT_RAYLEIGH_SCATTERING = 0.0025f; -const float AtmospherePropertyGroup::DEFAULT_MIE_SCATTERING = 0.0010f; -const glm::vec3 AtmospherePropertyGroup::DEFAULT_SCATTERING_WAVELENGTHS = glm::vec3(0.650f, 0.570f, 0.475f); -const bool AtmospherePropertyGroup::DEFAULT_HAS_STARS = true; - -void AtmospherePropertyGroup::copyToScriptValue(const EntityPropertyFlags& desiredProperties, QScriptValue& properties, QScriptEngine* engine, bool skipDefaults, EntityItemProperties& defaultEntityProperties) const { - COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_ATMOSPHERE_CENTER, Atmosphere, atmosphere, Center, center); - COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_ATMOSPHERE_INNER_RADIUS, Atmosphere, atmosphere, InnerRadius, innerRadius); - COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_ATMOSPHERE_OUTER_RADIUS, Atmosphere, atmosphere, OuterRadius, outerRadius); - COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_ATMOSPHERE_MIE_SCATTERING, Atmosphere, atmosphere, MieScattering, mieScattering); - COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_ATMOSPHERE_RAYLEIGH_SCATTERING, Atmosphere, atmosphere, RayleighScattering, rayleighScattering); - COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_ATMOSPHERE_SCATTERING_WAVELENGTHS, Atmosphere, atmosphere, ScatteringWavelengths, scatteringWavelengths); - COPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(PROP_ATMOSPHERE_HAS_STARS, Atmosphere, atmosphere, HasStars, hasStars); -} - -void AtmospherePropertyGroup::copyFromScriptValue(const QScriptValue& object, bool& _defaultSettings) { - COPY_GROUP_PROPERTY_FROM_QSCRIPTVALUE(atmosphere, center, glmVec3, setCenter); - COPY_GROUP_PROPERTY_FROM_QSCRIPTVALUE(atmosphere, innerRadius, float, setInnerRadius); - COPY_GROUP_PROPERTY_FROM_QSCRIPTVALUE(atmosphere, outerRadius, float, setOuterRadius); - COPY_GROUP_PROPERTY_FROM_QSCRIPTVALUE(atmosphere, mieScattering, float, setMieScattering); - COPY_GROUP_PROPERTY_FROM_QSCRIPTVALUE(atmosphere, rayleighScattering, float, setRayleighScattering); - COPY_GROUP_PROPERTY_FROM_QSCRIPTVALUE(atmosphere, scatteringWavelengths, glmVec3, setScatteringWavelengths); - COPY_GROUP_PROPERTY_FROM_QSCRIPTVALUE(atmosphere, hasStars, bool, setHasStars); -} - -void AtmospherePropertyGroup::debugDump() const { - qDebug() << " AtmospherePropertyGroup: ---------------------------------------------"; - qDebug() << " Center:" << getCenter() << " has changed:" << centerChanged(); - qDebug() << " Inner Radius:" << getInnerRadius() << " has changed:" << innerRadiusChanged(); - qDebug() << " Outer Radius:" << getOuterRadius() << " has changed:" << outerRadiusChanged(); - qDebug() << " Mie Scattering:" << getMieScattering() << " has changed:" << mieScatteringChanged(); - qDebug() << " Rayleigh Scattering:" << getRayleighScattering() << " has changed:" << rayleighScatteringChanged(); - qDebug() << " Scattering Wavelengths:" << getScatteringWavelengths() << " has changed:" << scatteringWavelengthsChanged(); - qDebug() << " Has Stars:" << getHasStars() << " has changed:" << hasStarsChanged(); -} - -void AtmospherePropertyGroup::listChangedProperties(QList& out) { - if (centerChanged()) { - out << "center"; - } - if (innerRadiusChanged()) { - out << "innerRadius"; - } - if (outerRadiusChanged()) { - out << "outerRadius"; - } - if (mieScatteringChanged()) { - out << "mieScattering"; - } - if (rayleighScatteringChanged()) { - out << "rayleighScattering"; - } - if (scatteringWavelengthsChanged()) { - out << "scatteringWavelengths"; - } - if (hasStarsChanged()) { - out << "hasStars"; - } -} - -bool AtmospherePropertyGroup::appendToEditPacket(OctreePacketData* packetData, - EntityPropertyFlags& requestedProperties, - EntityPropertyFlags& propertyFlags, - EntityPropertyFlags& propertiesDidntFit, - int& propertyCount, - OctreeElement::AppendState& appendState) const { - - bool successPropertyFits = true; - - APPEND_ENTITY_PROPERTY(PROP_ATMOSPHERE_CENTER, getCenter()); - APPEND_ENTITY_PROPERTY(PROP_ATMOSPHERE_INNER_RADIUS, getInnerRadius()); - APPEND_ENTITY_PROPERTY(PROP_ATMOSPHERE_OUTER_RADIUS, getOuterRadius()); - APPEND_ENTITY_PROPERTY(PROP_ATMOSPHERE_MIE_SCATTERING, getMieScattering()); - APPEND_ENTITY_PROPERTY(PROP_ATMOSPHERE_RAYLEIGH_SCATTERING, getRayleighScattering()); - APPEND_ENTITY_PROPERTY(PROP_ATMOSPHERE_SCATTERING_WAVELENGTHS, getScatteringWavelengths()); - APPEND_ENTITY_PROPERTY(PROP_ATMOSPHERE_HAS_STARS, getHasStars()); - - return true; -} - - -bool AtmospherePropertyGroup::decodeFromEditPacket(EntityPropertyFlags& propertyFlags, const unsigned char*& dataAt , int& processedBytes) { - - int bytesRead = 0; - bool overwriteLocalData = true; - bool somethingChanged = false; - - READ_ENTITY_PROPERTY(PROP_ATMOSPHERE_CENTER, glm::vec3, setCenter); - READ_ENTITY_PROPERTY(PROP_ATMOSPHERE_INNER_RADIUS, float, setInnerRadius); - READ_ENTITY_PROPERTY(PROP_ATMOSPHERE_OUTER_RADIUS, float, setOuterRadius); - READ_ENTITY_PROPERTY(PROP_ATMOSPHERE_MIE_SCATTERING, float, setMieScattering); - READ_ENTITY_PROPERTY(PROP_ATMOSPHERE_RAYLEIGH_SCATTERING, float, setRayleighScattering); - READ_ENTITY_PROPERTY(PROP_ATMOSPHERE_SCATTERING_WAVELENGTHS, glm::vec3, setScatteringWavelengths); - READ_ENTITY_PROPERTY(PROP_ATMOSPHERE_HAS_STARS, bool, setHasStars); - - DECODE_GROUP_PROPERTY_HAS_CHANGED(PROP_ATMOSPHERE_CENTER, Center); - DECODE_GROUP_PROPERTY_HAS_CHANGED(PROP_ATMOSPHERE_INNER_RADIUS, InnerRadius); - DECODE_GROUP_PROPERTY_HAS_CHANGED(PROP_ATMOSPHERE_OUTER_RADIUS, OuterRadius); - DECODE_GROUP_PROPERTY_HAS_CHANGED(PROP_ATMOSPHERE_MIE_SCATTERING, MieScattering); - DECODE_GROUP_PROPERTY_HAS_CHANGED(PROP_ATMOSPHERE_RAYLEIGH_SCATTERING, RayleighScattering); - DECODE_GROUP_PROPERTY_HAS_CHANGED(PROP_ATMOSPHERE_SCATTERING_WAVELENGTHS, ScatteringWavelengths); - DECODE_GROUP_PROPERTY_HAS_CHANGED(PROP_ATMOSPHERE_HAS_STARS, HasStars); - - processedBytes += bytesRead; - - Q_UNUSED(somethingChanged); - - return true; -} - -void AtmospherePropertyGroup::markAllChanged() { - _centerChanged = true; - _innerRadiusChanged = true; - _outerRadiusChanged = true; - _mieScatteringChanged = true; - _rayleighScatteringChanged = true; - _scatteringWavelengthsChanged = true; - _hasStarsChanged = true; -} - -EntityPropertyFlags AtmospherePropertyGroup::getChangedProperties() const { - EntityPropertyFlags changedProperties; - - CHECK_PROPERTY_CHANGE(PROP_ATMOSPHERE_CENTER, center); - CHECK_PROPERTY_CHANGE(PROP_ATMOSPHERE_INNER_RADIUS, innerRadius); - CHECK_PROPERTY_CHANGE(PROP_ATMOSPHERE_OUTER_RADIUS, outerRadius); - CHECK_PROPERTY_CHANGE(PROP_ATMOSPHERE_MIE_SCATTERING, mieScattering); - CHECK_PROPERTY_CHANGE(PROP_ATMOSPHERE_RAYLEIGH_SCATTERING, rayleighScattering); - CHECK_PROPERTY_CHANGE(PROP_ATMOSPHERE_SCATTERING_WAVELENGTHS, scatteringWavelengths); - CHECK_PROPERTY_CHANGE(PROP_ATMOSPHERE_HAS_STARS, hasStars); - - return changedProperties; -} - -void AtmospherePropertyGroup::getProperties(EntityItemProperties& properties) const { - COPY_ENTITY_GROUP_PROPERTY_TO_PROPERTIES(Atmosphere, Center, getCenter); - COPY_ENTITY_GROUP_PROPERTY_TO_PROPERTIES(Atmosphere, InnerRadius, getInnerRadius); - COPY_ENTITY_GROUP_PROPERTY_TO_PROPERTIES(Atmosphere, OuterRadius, getOuterRadius); - COPY_ENTITY_GROUP_PROPERTY_TO_PROPERTIES(Atmosphere, MieScattering, getMieScattering); - COPY_ENTITY_GROUP_PROPERTY_TO_PROPERTIES(Atmosphere, MieScattering, getMieScattering); - COPY_ENTITY_GROUP_PROPERTY_TO_PROPERTIES(Atmosphere, RayleighScattering, getRayleighScattering); - COPY_ENTITY_GROUP_PROPERTY_TO_PROPERTIES(Atmosphere, ScatteringWavelengths, getScatteringWavelengths); - COPY_ENTITY_GROUP_PROPERTY_TO_PROPERTIES(Atmosphere, HasStars, getHasStars); -} - -bool AtmospherePropertyGroup::setProperties(const EntityItemProperties& properties) { - bool somethingChanged = false; - - SET_ENTITY_GROUP_PROPERTY_FROM_PROPERTIES(Atmosphere, Center, center, setCenter); - SET_ENTITY_GROUP_PROPERTY_FROM_PROPERTIES(Atmosphere, InnerRadius, innerRadius, setInnerRadius); - SET_ENTITY_GROUP_PROPERTY_FROM_PROPERTIES(Atmosphere, OuterRadius, outerRadius, setOuterRadius); - SET_ENTITY_GROUP_PROPERTY_FROM_PROPERTIES(Atmosphere, MieScattering, mieScattering, setMieScattering); - SET_ENTITY_GROUP_PROPERTY_FROM_PROPERTIES(Atmosphere, RayleighScattering, rayleighScattering, setRayleighScattering); - SET_ENTITY_GROUP_PROPERTY_FROM_PROPERTIES(Atmosphere, ScatteringWavelengths, scatteringWavelengths, setScatteringWavelengths); - SET_ENTITY_GROUP_PROPERTY_FROM_PROPERTIES(Atmosphere, HasStars, hasStars, setHasStars); - - return somethingChanged; -} - -EntityPropertyFlags AtmospherePropertyGroup::getEntityProperties(EncodeBitstreamParams& params) const { - EntityPropertyFlags requestedProperties; - - requestedProperties += PROP_ATMOSPHERE_CENTER; - requestedProperties += PROP_ATMOSPHERE_INNER_RADIUS; - requestedProperties += PROP_ATMOSPHERE_OUTER_RADIUS; - requestedProperties += PROP_ATMOSPHERE_MIE_SCATTERING; - requestedProperties += PROP_ATMOSPHERE_RAYLEIGH_SCATTERING; - requestedProperties += PROP_ATMOSPHERE_SCATTERING_WAVELENGTHS; - requestedProperties += PROP_ATMOSPHERE_HAS_STARS; - - return requestedProperties; -} - -void AtmospherePropertyGroup::appendSubclassData(OctreePacketData* packetData, EncodeBitstreamParams& params, - EntityTreeElementExtraEncodeData* entityTreeElementExtraEncodeData, - EntityPropertyFlags& requestedProperties, - EntityPropertyFlags& propertyFlags, - EntityPropertyFlags& propertiesDidntFit, - int& propertyCount, - OctreeElement::AppendState& appendState) const { - - bool successPropertyFits = true; - - APPEND_ENTITY_PROPERTY(PROP_ATMOSPHERE_CENTER, getCenter()); - APPEND_ENTITY_PROPERTY(PROP_ATMOSPHERE_INNER_RADIUS, getInnerRadius()); - APPEND_ENTITY_PROPERTY(PROP_ATMOSPHERE_OUTER_RADIUS, getOuterRadius()); - APPEND_ENTITY_PROPERTY(PROP_ATMOSPHERE_MIE_SCATTERING, getMieScattering()); - APPEND_ENTITY_PROPERTY(PROP_ATMOSPHERE_RAYLEIGH_SCATTERING, getRayleighScattering()); - APPEND_ENTITY_PROPERTY(PROP_ATMOSPHERE_SCATTERING_WAVELENGTHS, getScatteringWavelengths()); - APPEND_ENTITY_PROPERTY(PROP_ATMOSPHERE_HAS_STARS, getHasStars()); -} - -int AtmospherePropertyGroup::readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead, - ReadBitstreamToTreeParams& args, - EntityPropertyFlags& propertyFlags, bool overwriteLocalData, - bool& somethingChanged) { - - int bytesRead = 0; - const unsigned char* dataAt = data; - - READ_ENTITY_PROPERTY(PROP_ATMOSPHERE_CENTER, glm::vec3, setCenter); - READ_ENTITY_PROPERTY(PROP_ATMOSPHERE_INNER_RADIUS, float, setInnerRadius); - READ_ENTITY_PROPERTY(PROP_ATMOSPHERE_OUTER_RADIUS, float, setOuterRadius); - READ_ENTITY_PROPERTY(PROP_ATMOSPHERE_MIE_SCATTERING, float, setMieScattering); - READ_ENTITY_PROPERTY(PROP_ATMOSPHERE_RAYLEIGH_SCATTERING, float, setRayleighScattering); - READ_ENTITY_PROPERTY(PROP_ATMOSPHERE_SCATTERING_WAVELENGTHS, glm::vec3, setScatteringWavelengths); - READ_ENTITY_PROPERTY(PROP_ATMOSPHERE_HAS_STARS, bool, setHasStars); - - return bytesRead; -} diff --git a/libraries/entities/src/AtmospherePropertyGroup.h b/libraries/entities/src/AtmospherePropertyGroup.h deleted file mode 100644 index 1d43c848b8..0000000000 --- a/libraries/entities/src/AtmospherePropertyGroup.h +++ /dev/null @@ -1,109 +0,0 @@ -// -// AtmospherePropertyGroup.h -// libraries/entities/src -// -// Created by Brad Hefta-Gaub on 12/4/13. -// Copyright 2013 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -#ifndef hifi_AtmospherePropertyGroup_h -#define hifi_AtmospherePropertyGroup_h - -#include - -#include "PropertyGroup.h" -#include "EntityItemPropertiesMacros.h" - -class EntityItemProperties; -class EncodeBitstreamParams; -class OctreePacketData; -class EntityTreeElementExtraEncodeData; -class ReadBitstreamToTreeParams; - -#include -#include - - -/* - -#include - -#include -#include -#include - -#include -#include // for SittingPoint -#include -#include -#include - -#include "EntityItemID.h" -#include "AtmospherePropertyGroupMacros.h" -#include "EntityTypes.h" -*/ - - -class AtmospherePropertyGroup : public PropertyGroup { -public: - // EntityItemProperty related helpers - virtual void copyToScriptValue(const EntityPropertyFlags& desiredProperties, QScriptValue& properties, QScriptEngine* engine, bool skipDefaults, EntityItemProperties& defaultEntityProperties) const; - virtual void copyFromScriptValue(const QScriptValue& object, bool& _defaultSettings); - virtual void debugDump() const; - virtual void listChangedProperties(QList& out); - - virtual bool appendToEditPacket(OctreePacketData* packetData, - EntityPropertyFlags& requestedProperties, - EntityPropertyFlags& propertyFlags, - EntityPropertyFlags& propertiesDidntFit, - int& propertyCount, - OctreeElement::AppendState& appendState) const; - - virtual bool decodeFromEditPacket(EntityPropertyFlags& propertyFlags, const unsigned char*& dataAt , int& processedBytes); - virtual void markAllChanged(); - virtual EntityPropertyFlags getChangedProperties() const; - - // EntityItem related helpers - // methods for getting/setting all properties of an entity - virtual void getProperties(EntityItemProperties& propertiesOut) const; - - /// returns true if something changed - virtual bool setProperties(const EntityItemProperties& properties); - - virtual EntityPropertyFlags getEntityProperties(EncodeBitstreamParams& params) const; - - virtual void appendSubclassData(OctreePacketData* packetData, EncodeBitstreamParams& params, - EntityTreeElementExtraEncodeData* entityTreeElementExtraEncodeData, - EntityPropertyFlags& requestedProperties, - EntityPropertyFlags& propertyFlags, - EntityPropertyFlags& propertiesDidntFit, - int& propertyCount, - OctreeElement::AppendState& appendState) const; - - virtual int readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead, - ReadBitstreamToTreeParams& args, - EntityPropertyFlags& propertyFlags, bool overwriteLocalData, - bool& somethingChanged); - - - static const glm::vec3 DEFAULT_CENTER; - static const float DEFAULT_INNER_RADIUS; - static const float DEFAULT_OUTER_RADIUS; - static const float DEFAULT_RAYLEIGH_SCATTERING; - static const float DEFAULT_MIE_SCATTERING; - static const glm::vec3 DEFAULT_SCATTERING_WAVELENGTHS; - static const bool DEFAULT_HAS_STARS; - - DEFINE_PROPERTY_REF(PROP_ATMOSPHERE_CENTER, Center, center, glm::vec3, DEFAULT_CENTER); - DEFINE_PROPERTY(PROP_ATMOSPHERE_INNER_RADIUS, InnerRadius, innerRadius, float, DEFAULT_INNER_RADIUS); - DEFINE_PROPERTY(PROP_ATMOSPHERE_OUTER_RADIUS, OuterRadius, outerRadius, float, DEFAULT_OUTER_RADIUS); - DEFINE_PROPERTY(PROP_ATMOSPHERE_MIE_SCATTERING, MieScattering, mieScattering, float, DEFAULT_MIE_SCATTERING); - DEFINE_PROPERTY(PROP_ATMOSPHERE_RAYLEIGH_SCATTERING, RayleighScattering, rayleighScattering, float, DEFAULT_RAYLEIGH_SCATTERING); - DEFINE_PROPERTY_REF(PROP_ATMOSPHERE_SCATTERING_WAVELENGTHS, ScatteringWavelengths, scatteringWavelengths, glm::vec3, DEFAULT_SCATTERING_WAVELENGTHS); - DEFINE_PROPERTY(PROP_ATMOSPHERE_HAS_STARS, HasStars, hasStars, bool, DEFAULT_HAS_STARS); -}; - -#endif // hifi_AtmospherePropertyGroup_h diff --git a/libraries/entities/src/EntityItemProperties.cpp b/libraries/entities/src/EntityItemProperties.cpp index 9c1a770e19..6644f28139 100644 --- a/libraries/entities/src/EntityItemProperties.cpp +++ b/libraries/entities/src/EntityItemProperties.cpp @@ -25,7 +25,6 @@ #include "PolyLineEntityItem.h" AnimationPropertyGroup EntityItemProperties::_staticAnimation; -AtmospherePropertyGroup EntityItemProperties::_staticAtmosphere; SkyboxPropertyGroup EntityItemProperties::_staticSkybox; StagePropertyGroup EntityItemProperties::_staticStage; KeyLightPropertyGroup EntityItemProperties::_staticKeyLight; @@ -79,7 +78,6 @@ void EntityItemProperties::debugDump() const { qCDebug(entities) << " _compoundShapeURL=" << _compoundShapeURL; getAnimation().debugDump(); - getAtmosphere().debugDump(); getSkybox().debugDump(); getKeyLight().debugDump(); @@ -186,39 +184,26 @@ void EntityItemProperties::setShapeTypeFromString(const QString& shapeName) { } } -const char* backgroundModeNames[] = {"inherit", "atmosphere", "skybox" }; - -QHash stringToBackgroundModeLookup; - -void addBackgroundMode(BackgroundMode type) { - stringToBackgroundModeLookup[backgroundModeNames[type]] = type; -} - -void buildStringToBackgroundModeLookup() { - addBackgroundMode(BACKGROUND_MODE_INHERIT); - addBackgroundMode(BACKGROUND_MODE_ATMOSPHERE); - addBackgroundMode(BACKGROUND_MODE_SKYBOX); -} +using BackgroundPair = std::pair; +const std::array BACKGROUND_MODES = { + BackgroundPair { BACKGROUND_MODE_INHERIT, { "inherit" } }, + BackgroundPair { BACKGROUND_MODE_SKYBOX, { "skybox" } } +}; QString EntityItemProperties::getBackgroundModeAsString() const { - if (_backgroundMode < sizeof(backgroundModeNames) / sizeof(char *)) - return QString(backgroundModeNames[_backgroundMode]); - return QString(backgroundModeNames[BACKGROUND_MODE_INHERIT]); + return BACKGROUND_MODES[_backgroundMode].second; } QString EntityItemProperties::getBackgroundModeString(BackgroundMode mode) { - if (mode < sizeof(backgroundModeNames) / sizeof(char *)) - return QString(backgroundModeNames[mode]); - return QString(backgroundModeNames[BACKGROUND_MODE_INHERIT]); + return BACKGROUND_MODES[mode].second; } void EntityItemProperties::setBackgroundModeFromString(const QString& backgroundMode) { - if (stringToBackgroundModeLookup.empty()) { - buildStringToBackgroundModeLookup(); - } - auto backgroundModeItr = stringToBackgroundModeLookup.find(backgroundMode.toLower()); - if (backgroundModeItr != stringToBackgroundModeLookup.end()) { - _backgroundMode = backgroundModeItr.value(); + auto result = std::find_if(BACKGROUND_MODES.begin(), BACKGROUND_MODES.end(), [&](const BackgroundPair& pair) { + return (pair.second == backgroundMode); + }); + if (result != BACKGROUND_MODES.end()) { + _backgroundMode = result->first; _backgroundModeChanged = true; } } @@ -326,7 +311,6 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const { changedProperties += _animation.getChangedProperties(); changedProperties += _keyLight.getChangedProperties(); - changedProperties += _atmosphere.getChangedProperties(); changedProperties += _skybox.getChangedProperties(); changedProperties += _stage.getChangedProperties(); @@ -475,7 +459,6 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_BACKGROUND_MODE, backgroundMode, getBackgroundModeAsString()); _stage.copyToScriptValue(_desiredProperties, properties, engine, skipDefaults, defaultEntityProperties); - _atmosphere.copyToScriptValue(_desiredProperties, properties, engine, skipDefaults, defaultEntityProperties); _skybox.copyToScriptValue(_desiredProperties, properties, engine, skipDefaults, defaultEntityProperties); } @@ -668,7 +651,6 @@ void EntityItemProperties::copyFromScriptValue(const QScriptValue& object, bool _animation.copyFromScriptValue(object, _defaultSettings); _keyLight.copyFromScriptValue(object, _defaultSettings); - _atmosphere.copyFromScriptValue(object, _defaultSettings); _skybox.copyFromScriptValue(object, _defaultSettings); _stage.copyFromScriptValue(object, _defaultSettings); @@ -854,14 +836,6 @@ void EntityItemProperties::entityPropertyFlagsFromScriptValue(const QScriptValue ADD_GROUP_PROPERTY_TO_MAP(PROP_ANIMATION_LAST_FRAME, Animation, animation, LastFrame, lastFrame); ADD_GROUP_PROPERTY_TO_MAP(PROP_ANIMATION_HOLD, Animation, animation, Hold, hold); - ADD_GROUP_PROPERTY_TO_MAP(PROP_ATMOSPHERE_CENTER, Atmosphere, atmosphere, Center, center); - ADD_GROUP_PROPERTY_TO_MAP(PROP_ATMOSPHERE_INNER_RADIUS, Atmosphere, atmosphere, InnerRadius, innerRadius); - ADD_GROUP_PROPERTY_TO_MAP(PROP_ATMOSPHERE_OUTER_RADIUS, Atmosphere, atmosphere, OuterRadius, outerRadius); - ADD_GROUP_PROPERTY_TO_MAP(PROP_ATMOSPHERE_MIE_SCATTERING, Atmosphere, atmosphere, MieScattering, mieScattering); - ADD_GROUP_PROPERTY_TO_MAP(PROP_ATMOSPHERE_RAYLEIGH_SCATTERING, Atmosphere, atmosphere, RayleighScattering, rayleighScattering); - ADD_GROUP_PROPERTY_TO_MAP(PROP_ATMOSPHERE_SCATTERING_WAVELENGTHS, Atmosphere, atmosphere, ScatteringWavelengths, scatteringWavelengths); - ADD_GROUP_PROPERTY_TO_MAP(PROP_ATMOSPHERE_HAS_STARS, Atmosphere, atmosphere, HasStars, hasStars); - ADD_GROUP_PROPERTY_TO_MAP(PROP_SKYBOX_COLOR, Skybox, skybox, Color, color); ADD_GROUP_PROPERTY_TO_MAP(PROP_SKYBOX_URL, Skybox, skybox, URL, url); @@ -1110,9 +1084,6 @@ bool EntityItemProperties::encodeEntityEditPacket(PacketType command, EntityItem APPEND_ENTITY_PROPERTY(PROP_BACKGROUND_MODE, (uint32_t)properties.getBackgroundMode()); - _staticAtmosphere.setProperties(properties); - _staticAtmosphere.appendToEditPacket(packetData, requestedProperties, propertyFlags, propertiesDidntFit, propertyCount, appendState); - _staticSkybox.setProperties(properties); _staticSkybox.appendToEditPacket(packetData, requestedProperties, propertyFlags, propertiesDidntFit, propertyCount, appendState); } @@ -1397,7 +1368,6 @@ bool EntityItemProperties::decodeEntityEditPacket(const unsigned char* data, int READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_SHAPE_TYPE, ShapeType, setShapeType); READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_COMPOUND_SHAPE_URL, QString, setCompoundShapeURL); READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_BACKGROUND_MODE, BackgroundMode, setBackgroundMode); - properties.getAtmosphere().decodeFromEditPacket(propertyFlags, dataAt , processedBytes); properties.getSkybox().decodeFromEditPacket(propertyFlags, dataAt , processedBytes); } @@ -1549,7 +1519,6 @@ void EntityItemProperties::markAllChanged() { _backgroundModeChanged = true; _animation.markAllChanged(); - _atmosphere.markAllChanged(); _skybox.markAllChanged(); _stage.markAllChanged(); @@ -1910,7 +1879,6 @@ QList EntityItemProperties::listChangedProperties() { getAnimation().listChangedProperties(out); getKeyLight().listChangedProperties(out); - getAtmosphere().listChangedProperties(out); getSkybox().listChangedProperties(out); getStage().listChangedProperties(out); diff --git a/libraries/entities/src/EntityItemProperties.h b/libraries/entities/src/EntityItemProperties.h index 0f0bab5fdd..ff288fbe95 100644 --- a/libraries/entities/src/EntityItemProperties.h +++ b/libraries/entities/src/EntityItemProperties.h @@ -30,7 +30,6 @@ #include #include "AnimationPropertyGroup.h" -#include "AtmospherePropertyGroup.h" #include "EntityItemID.h" #include "EntityItemPropertiesDefaults.h" #include "EntityItemPropertiesMacros.h" @@ -171,7 +170,6 @@ public: DEFINE_PROPERTY_REF(PROP_NAME, Name, name, QString, ENTITY_ITEM_DEFAULT_NAME); DEFINE_PROPERTY_REF_ENUM(PROP_BACKGROUND_MODE, BackgroundMode, backgroundMode, BackgroundMode, BACKGROUND_MODE_INHERIT); DEFINE_PROPERTY_GROUP(Stage, stage, StagePropertyGroup); - DEFINE_PROPERTY_GROUP(Atmosphere, atmosphere, AtmospherePropertyGroup); DEFINE_PROPERTY_GROUP(Skybox, skybox, SkyboxPropertyGroup); DEFINE_PROPERTY_GROUP(Animation, animation, AnimationPropertyGroup); DEFINE_PROPERTY_REF(PROP_SOURCE_URL, SourceUrl, sourceUrl, QString, ""); @@ -419,7 +417,6 @@ inline QDebug operator<<(QDebug debug, const EntityItemProperties& properties) { DEBUG_PROPERTY_IF_CHANGED(debug, properties, JointTranslations, jointTranslations, ""); properties.getAnimation().debugDump(); - properties.getAtmosphere().debugDump(); properties.getSkybox().debugDump(); properties.getStage().debugDump(); diff --git a/libraries/entities/src/EntityPropertyFlags.h b/libraries/entities/src/EntityPropertyFlags.h index ac0a65aa27..b60fc6174c 100644 --- a/libraries/entities/src/EntityPropertyFlags.h +++ b/libraries/entities/src/EntityPropertyFlags.h @@ -197,13 +197,6 @@ enum EntityPropertyList { PROP_STAGE_DAY = PROP_LINEAR_ATTENUATION_UNUSED, PROP_STAGE_HOUR = PROP_QUADRATIC_ATTENUATION_UNUSED, PROP_STAGE_AUTOMATIC_HOURDAY = PROP_ANIMATION_FRAME_INDEX, - PROP_ATMOSPHERE_CENTER = PROP_MAX_PARTICLES, - PROP_ATMOSPHERE_INNER_RADIUS = PROP_LIFESPAN, - PROP_ATMOSPHERE_OUTER_RADIUS = PROP_EMIT_RATE, - PROP_ATMOSPHERE_MIE_SCATTERING = PROP_EMIT_SPEED, - PROP_ATMOSPHERE_RAYLEIGH_SCATTERING = PROP_EMIT_STRENGTH, - PROP_ATMOSPHERE_SCATTERING_WAVELENGTHS = PROP_EMIT_ACCELERATION, - PROP_ATMOSPHERE_HAS_STARS = PROP_PARTICLE_RADIUS, PROP_BACKGROUND_MODE = PROP_MODEL_URL, PROP_SKYBOX_COLOR = PROP_ANIMATION_URL, PROP_SKYBOX_URL = PROP_ANIMATION_FPS, diff --git a/libraries/entities/src/ZoneEntityItem.cpp b/libraries/entities/src/ZoneEntityItem.cpp index 41f722fe36..6aabef5cc0 100644 --- a/libraries/entities/src/ZoneEntityItem.cpp +++ b/libraries/entities/src/ZoneEntityItem.cpp @@ -41,26 +41,6 @@ ZoneEntityItem::ZoneEntityItem(const EntityItemID& entityItemID) : EntityItem(en _backgroundMode = BACKGROUND_MODE_INHERIT; } - -EnvironmentData ZoneEntityItem::getEnvironmentData() const { - EnvironmentData result; - - result.setAtmosphereCenter(_atmosphereProperties.getCenter()); - result.setAtmosphereInnerRadius(_atmosphereProperties.getInnerRadius()); - result.setAtmosphereOuterRadius(_atmosphereProperties.getOuterRadius()); - result.setRayleighScattering(_atmosphereProperties.getRayleighScattering()); - result.setMieScattering(_atmosphereProperties.getMieScattering()); - result.setScatteringWavelengths(_atmosphereProperties.getScatteringWavelengths()); - result.setHasStars(_atmosphereProperties.getHasStars()); - - // NOTE: The sunLocation and SunBrightness will be overwritten in the EntityTreeRenderer to use the - // keyLight details from the scene interface - //result.setSunLocation(1000, 900, 1000)); - //result.setSunBrightness(20.0f); - - return result; -} - EntityItemProperties ZoneEntityItem::getProperties(EntityPropertyFlags desiredProperties) const { EntityItemProperties properties = EntityItem::getProperties(desiredProperties); // get the properties from our base class @@ -73,7 +53,6 @@ EntityItemProperties ZoneEntityItem::getProperties(EntityPropertyFlags desiredPr COPY_ENTITY_PROPERTY_TO_PROPERTIES(compoundShapeURL, getCompoundShapeURL); COPY_ENTITY_PROPERTY_TO_PROPERTIES(backgroundMode, getBackgroundMode); - _atmosphereProperties.getProperties(properties); _skyboxProperties.getProperties(properties); return properties; @@ -91,10 +70,9 @@ bool ZoneEntityItem::setProperties(const EntityItemProperties& properties) { SET_ENTITY_PROPERTY_FROM_PROPERTIES(compoundShapeURL, setCompoundShapeURL); SET_ENTITY_PROPERTY_FROM_PROPERTIES(backgroundMode, setBackgroundMode); - bool somethingChangedInAtmosphere = _atmosphereProperties.setProperties(properties); bool somethingChangedInSkybox = _skyboxProperties.setProperties(properties); - somethingChanged = somethingChanged || somethingChangedInKeyLight || somethingChangedInStage || somethingChangedInAtmosphere || somethingChangedInSkybox; + somethingChanged = somethingChanged || somethingChangedInKeyLight || somethingChangedInStage || somethingChangedInSkybox; if (somethingChanged) { bool wantDebug = false; @@ -133,12 +111,6 @@ int ZoneEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data, READ_ENTITY_PROPERTY(PROP_COMPOUND_SHAPE_URL, QString, setCompoundShapeURL); READ_ENTITY_PROPERTY(PROP_BACKGROUND_MODE, BackgroundMode, setBackgroundMode); - int bytesFromAtmosphere = _atmosphereProperties.readEntitySubclassDataFromBuffer(dataAt, (bytesLeftToRead - bytesRead), args, - propertyFlags, overwriteLocalData, somethingChanged); - - bytesRead += bytesFromAtmosphere; - dataAt += bytesFromAtmosphere; - int bytesFromSkybox = _skyboxProperties.readEntitySubclassDataFromBuffer(dataAt, (bytesLeftToRead - bytesRead), args, propertyFlags, overwriteLocalData, somethingChanged); bytesRead += bytesFromSkybox; @@ -158,7 +130,6 @@ EntityPropertyFlags ZoneEntityItem::getEntityProperties(EncodeBitstreamParams& p requestedProperties += PROP_COMPOUND_SHAPE_URL; requestedProperties += PROP_BACKGROUND_MODE; requestedProperties += _stageProperties.getEntityProperties(params); - requestedProperties += _atmosphereProperties.getEntityProperties(params); requestedProperties += _skyboxProperties.getEntityProperties(params); return requestedProperties; @@ -185,9 +156,6 @@ void ZoneEntityItem::appendSubclassData(OctreePacketData* packetData, EncodeBits APPEND_ENTITY_PROPERTY(PROP_COMPOUND_SHAPE_URL, getCompoundShapeURL()); APPEND_ENTITY_PROPERTY(PROP_BACKGROUND_MODE, (uint32_t)getBackgroundMode()); // could this be a uint16?? - _atmosphereProperties.appendSubclassData(packetData, params, modelTreeElementExtraEncodeData, requestedProperties, - propertyFlags, propertiesDidntFit, propertyCount, appendState); - _skyboxProperties.appendSubclassData(packetData, params, modelTreeElementExtraEncodeData, requestedProperties, propertyFlags, propertiesDidntFit, propertyCount, appendState); @@ -203,7 +171,6 @@ void ZoneEntityItem::debugDump() const { _keyLightProperties.debugDump(); _stageProperties.debugDump(); - _atmosphereProperties.debugDump(); _skyboxProperties.debugDump(); } diff --git a/libraries/entities/src/ZoneEntityItem.h b/libraries/entities/src/ZoneEntityItem.h index bf323248c0..0326a0f441 100644 --- a/libraries/entities/src/ZoneEntityItem.h +++ b/libraries/entities/src/ZoneEntityItem.h @@ -12,10 +12,7 @@ #ifndef hifi_ZoneEntityItem_h #define hifi_ZoneEntityItem_h -#include - #include "KeyLightPropertyGroup.h" -#include "AtmospherePropertyGroup.h" #include "EntityItem.h" #include "EntityTree.h" #include "SkyboxPropertyGroup.h" @@ -70,8 +67,6 @@ public: void setBackgroundMode(BackgroundMode value) { _backgroundMode = value; } BackgroundMode getBackgroundMode() const { return _backgroundMode; } - EnvironmentData getEnvironmentData() const; - const AtmospherePropertyGroup& getAtmosphereProperties() const { return _atmosphereProperties; } const SkyboxPropertyGroup& getSkyboxProperties() const { return _skyboxProperties; } const StagePropertyGroup& getStageProperties() const { return _stageProperties; } @@ -95,7 +90,6 @@ protected: BackgroundMode _backgroundMode = BACKGROUND_MODE_INHERIT; StagePropertyGroup _stageProperties; - AtmospherePropertyGroup _atmosphereProperties; SkyboxPropertyGroup _skyboxProperties; static bool _drawZoneBoundaries; diff --git a/libraries/environment/CMakeLists.txt b/libraries/environment/CMakeLists.txt deleted file mode 100644 index 11538a8f2b..0000000000 --- a/libraries/environment/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -set(TARGET_NAME environment) -setup_hifi_library() -link_hifi_libraries(shared networking) diff --git a/libraries/environment/src/EnvironmentData.cpp b/libraries/environment/src/EnvironmentData.cpp deleted file mode 100644 index 7a0bd29bc0..0000000000 --- a/libraries/environment/src/EnvironmentData.cpp +++ /dev/null @@ -1,118 +0,0 @@ -// -// EnvironmentData.cpp -// libraries/environment/src -// -// Created by Andrzej Kapolka on 5/6/13. -// Copyright 2013 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -#include - -#include "EnvironmentData.h" - -// initial values from Sean O'Neil's GPU Gems entry (http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter16.html), -// GameEngine.cpp -EnvironmentData::EnvironmentData(int id) : - _id(id), - _flat(true), - _gravity(0.0f), - _atmosphereCenter(0, -1000, 0), - _atmosphereInnerRadius(1000.0), - _atmosphereOuterRadius(1025.0), - _rayleighScattering(0.0025f), - _mieScattering(0.0010f), - _scatteringWavelengths(0.650f, 0.570f, 0.475f), - _sunLocation(1000, 900, 1000), - _sunBrightness(20.0f), - _hasStars(true) { -} - -glm::vec3 EnvironmentData::getAtmosphereCenter(const glm::vec3& cameraPosition) const { - return _atmosphereCenter + (_flat ? glm::vec3(cameraPosition.x, 0.0f, cameraPosition.z) : glm::vec3()); -} - -glm::vec3 EnvironmentData::getSunLocation(const glm::vec3& cameraPosition) const { - return _sunLocation; -} - -size_t EnvironmentData::getBroadcastData(unsigned char* destinationBuffer) const { - unsigned char* bufferStart = destinationBuffer; - - memcpy(destinationBuffer, &_id, sizeof(_id)); - destinationBuffer += sizeof(_id); - - memcpy(destinationBuffer, &_flat, sizeof(_flat)); - destinationBuffer += sizeof(_flat); - - memcpy(destinationBuffer, &_gravity, sizeof(_gravity)); - destinationBuffer += sizeof(_gravity); - - memcpy(destinationBuffer, &_atmosphereCenter, sizeof(_atmosphereCenter)); - destinationBuffer += sizeof(_atmosphereCenter); - - memcpy(destinationBuffer, &_atmosphereInnerRadius, sizeof(_atmosphereInnerRadius)); - destinationBuffer += sizeof(_atmosphereInnerRadius); - - memcpy(destinationBuffer, &_atmosphereOuterRadius, sizeof(_atmosphereOuterRadius)); - destinationBuffer += sizeof(_atmosphereOuterRadius); - - memcpy(destinationBuffer, &_rayleighScattering, sizeof(_rayleighScattering)); - destinationBuffer += sizeof(_rayleighScattering); - - memcpy(destinationBuffer, &_mieScattering, sizeof(_mieScattering)); - destinationBuffer += sizeof(_mieScattering); - - memcpy(destinationBuffer, &_scatteringWavelengths, sizeof(_scatteringWavelengths)); - destinationBuffer += sizeof(_scatteringWavelengths); - - memcpy(destinationBuffer, &_sunLocation, sizeof(_sunLocation)); - destinationBuffer += sizeof(_sunLocation); - - memcpy(destinationBuffer, &_sunBrightness, sizeof(_sunBrightness)); - destinationBuffer += sizeof(_sunBrightness); - - return destinationBuffer - bufferStart; -} - -size_t EnvironmentData::parseData(const unsigned char* sourceBuffer, int numBytes) { - const unsigned char* startPosition = sourceBuffer; - - memcpy(&_id, sourceBuffer, sizeof(_id)); - sourceBuffer += sizeof(_id); - - memcpy(&_flat, sourceBuffer, sizeof(_flat)); - sourceBuffer += sizeof(_flat); - - memcpy(&_gravity, sourceBuffer, sizeof(_gravity)); - sourceBuffer += sizeof(_gravity); - - memcpy(&_atmosphereCenter, sourceBuffer, sizeof(_atmosphereCenter)); - sourceBuffer += sizeof(_atmosphereCenter); - - memcpy(&_atmosphereInnerRadius, sourceBuffer, sizeof(_atmosphereInnerRadius)); - sourceBuffer += sizeof(_atmosphereInnerRadius); - - memcpy(&_atmosphereOuterRadius, sourceBuffer, sizeof(_atmosphereOuterRadius)); - sourceBuffer += sizeof(_atmosphereOuterRadius); - - memcpy(&_rayleighScattering, sourceBuffer, sizeof(_rayleighScattering)); - sourceBuffer += sizeof(_rayleighScattering); - - memcpy(&_mieScattering, sourceBuffer, sizeof(_mieScattering)); - sourceBuffer += sizeof(_mieScattering); - - memcpy(&_scatteringWavelengths, sourceBuffer, sizeof(_scatteringWavelengths)); - sourceBuffer += sizeof(_scatteringWavelengths); - - memcpy(&_sunLocation, sourceBuffer, sizeof(_sunLocation)); - sourceBuffer += sizeof(_sunLocation); - - memcpy(&_sunBrightness, sourceBuffer, sizeof(_sunBrightness)); - sourceBuffer += sizeof(_sunBrightness); - - return sourceBuffer - startPosition; -} - diff --git a/libraries/environment/src/EnvironmentData.h b/libraries/environment/src/EnvironmentData.h deleted file mode 100644 index daed752d4c..0000000000 --- a/libraries/environment/src/EnvironmentData.h +++ /dev/null @@ -1,83 +0,0 @@ -// -// EnvironmentData.h -// libraries/environment/src -// -// Created by Andrzej Kapolka on 5/6/13. -// Copyright 2013 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -#ifndef hifi_EnvironmentData_h -#define hifi_EnvironmentData_h - -#include - -class EnvironmentData { -public: - - EnvironmentData(int id = 0); - - void setID(int id) { _id = id; } - int getID() const { return _id; } - - void setFlat(bool flat) { _flat = flat; } - bool isFlat() const { return _flat; } - - void setGravity(float gravity) { _gravity = gravity; } - float getGravity() const { return _gravity; } - - void setHasStars(bool value) { _hasStars = value; } - bool getHasStars() const { return _hasStars; } - - void setAtmosphereCenter(const glm::vec3& center) { _atmosphereCenter = center; } - void setAtmosphereInnerRadius(float radius) { _atmosphereInnerRadius = radius; } - void setAtmosphereOuterRadius(float radius) { _atmosphereOuterRadius = radius; } - const glm::vec3& getAtmosphereCenter() const { return _atmosphereCenter; } - float getAtmosphereInnerRadius() const { return _atmosphereInnerRadius; } - float getAtmosphereOuterRadius() const { return _atmosphereOuterRadius; } - - void setRayleighScattering(float scattering) { _rayleighScattering = scattering; } - void setMieScattering(float scattering) { _mieScattering = scattering; } - float getRayleighScattering() const { return _rayleighScattering; } - float getMieScattering() const { return _mieScattering; } - - void setScatteringWavelengths(const glm::vec3& wavelengths) { _scatteringWavelengths = wavelengths; } - const glm::vec3& getScatteringWavelengths() const { return _scatteringWavelengths; } - - void setSunLocation(const glm::vec3& location) { _sunLocation = location; } - void setSunBrightness(float brightness) { _sunBrightness = brightness; } - const glm::vec3& getSunLocation() const { return _sunLocation; } - float getSunBrightness() const { return _sunBrightness; } - - glm::vec3 getAtmosphereCenter(const glm::vec3& cameraPosition) const; - glm::vec3 getSunLocation(const glm::vec3& cameraPosition) const; - - size_t getBroadcastData(unsigned char* destinationBuffer) const; - size_t parseData(const unsigned char* sourceBuffer, int numBytes); - -private: - - int _id; - - bool _flat; - - float _gravity; - - glm::vec3 _atmosphereCenter; - float _atmosphereInnerRadius; - float _atmosphereOuterRadius; - - float _rayleighScattering; - float _mieScattering; - - glm::vec3 _scatteringWavelengths; - - glm::vec3 _sunLocation; - float _sunBrightness; - - bool _hasStars; -}; - -#endif // hifi_EnvironmentData_h diff --git a/libraries/model/src/model/Atmosphere.slh b/libraries/model/src/model/Atmosphere.slh deleted file mode 100755 index b8f390de0a..0000000000 --- a/libraries/model/src/model/Atmosphere.slh +++ /dev/null @@ -1,245 +0,0 @@ - -<@if not MODEL_ATMOSPHERE_SLH@> -<@def MODEL_ATMOSPHERE_SLH@> - - - -struct Atmosphere { - vec4 _invWaveLength; - vec4 _radiuses; - vec4 _scales; - vec4 _scatterings; - vec4 _control; -}; - -const int numSamples = 2; - -vec3 getAtmosphereInvWaveLength(Atmosphere a) { return a._invWaveLength.xyz; } // 1 / pow(wavelength, 4) for the red, green, and blue channels - -float getAtmosphereInnerRadius(Atmosphere a) { return a._radiuses.x; } // The inner (planetary) radius -float getAtmosphereOuterRadius(Atmosphere a) { return a._radiuses.y; } // The outer (atmosphere) radius - -float getAtmosphereScale(Atmosphere a) { return a._scales.x; } // 1 / (outerRadius - innerRadius) -float getAtmosphereScaleDepth(Atmosphere a) { return a._scales.y; } // The scale depth (i.e. the altitude at which the atmosphere's average density is found) -float getAtmosphereScaleOverScaleDepth(Atmosphere a) { return a._scales.z; } // scale / scaleDepth - -vec4 getAtmosphereScattering(Atmosphere a) { return a._scatterings; } // The full Mie and Rayleigh scattering coefficients -float getAtmosphereKrESun(Atmosphere a) { return a._scatterings.x; } // Kr * ESun -float getAtmosphereKmESun(Atmosphere a) { return a._scatterings.y; } // Km * ESun -float getAtmosphereKr4PI(Atmosphere a) { return a._scatterings.z; } // Kr * 4 * PI -float getAtmosphereKm4PI(Atmosphere a) { return a._scatterings.w; } // Km * 4 * PI - -float getAtmosphereNumSamples(Atmosphere a) { return a._control.x; } // numSamples -vec2 getAtmosphereGAndG2(Atmosphere a) { return a._control.yz; } // g and g2 - -float atmosphereScale(float scaleDepth, float fCos) -{ - float x = 1.0 - fCos; - return scaleDepth * exp(-0.00287 + x*(0.459 + x*(3.83 + x*(-6.80 + x*5.25)))); -} - -vec4 evalAtmosphereContribution(Atmosphere atmospheric, vec3 position, vec3 cameraPos, vec3 lightPos) { - float fInnerRadius = getAtmosphereInnerRadius(atmospheric); - float fSamples = getAtmosphereNumSamples(atmospheric); - - vec3 v3InvWavelength = getAtmosphereInvWaveLength(atmospheric); - vec4 scatteringCoefs = getAtmosphereScattering(atmospheric); - float fKrESun = scatteringCoefs.x; - float fKmESun = scatteringCoefs.y; - float fKr4PI = scatteringCoefs.z; - float fKm4PI = scatteringCoefs.w; - - vec2 gAndg2 = getAtmosphereGAndG2(atmospheric); - float g = gAndg2.x; - float g2 = gAndg2.y; - - float fScale = getAtmosphereScale(atmospheric); - float fScaleDepth = getAtmosphereScaleDepth(atmospheric); - float fScaleOverScaleDepth = getAtmosphereScaleOverScaleDepth(atmospheric); - - // Get the ray from the camera to the vertex, and its length (which is the far point of the ray passing through the atmosphere) - vec3 v3Pos = position; - vec3 v3Ray = v3Pos - cameraPos; - float fFar = length(v3Ray); - v3Ray /= fFar; - - // Calculate the ray's starting position, then calculate its scattering offset - vec3 v3Start = cameraPos; - float fHeight = length(v3Start); - float fDepthStart = exp(fScaleOverScaleDepth * (fInnerRadius - fHeight)); - float fStartAngle = dot(v3Ray, v3Start) / fHeight; - float fStartOffset = fDepthStart * atmosphereScale(fScaleDepth, fStartAngle); - - // Initialize the scattering loop variables - //gl_FrontColor = vec4(0.0, 0.0, 0.0, 0.0); - float fSampleLength = fFar / fSamples; - float fScaledLength = fSampleLength * fScale; - - vec3 v3SampleRay = v3Ray * fSampleLength; - vec3 v3SamplePoint = v3Start + v3SampleRay * 0.5; - - // Now loop through the sample rays - vec3 v3FrontColor = vec3(0.0, 0.0, 0.0); - // int nSamples = numSamples; - int nSamples = int(fSamples); - for(int i=0; i -uniform atmosphereBuffer { - Atmosphere _atmosphere; -}; -Atmosphere getAtmosphere() { - return _atmosphere; -} -<@else@> -uniform vec4 atmosphereBuffer[9]; -Atmosphere getAtmosphere() { - Atmosphere atmosphere; - atmosphere._invWaveLength = atmosphereBuffer[0]; - atmosphere._radiuses = atmosphereBuffer[1]; - atmosphere._scales = atmosphereBuffer[2]; - atmosphere._scatterings = atmosphereBuffer[3]; - atmosphere._control = atmosphereBuffer[4]; - - return atmosphere; -} -<@endif@> - - - -<@endif@> diff --git a/libraries/model/src/model/Stage.cpp b/libraries/model/src/model/Stage.cpp index 47d3ba3063..0ff613bd4b 100644 --- a/libraries/model/src/model/Stage.cpp +++ b/libraries/model/src/model/Stage.cpp @@ -133,56 +133,6 @@ void EarthSunModel::setSunLongitude(float lon) { invalidate(); } -Atmosphere::Atmosphere() { - // only if created from nothing shall we create the Buffer to store the properties - Data data; - _dataBuffer = gpu::BufferView(std::make_shared(sizeof(Data), (const gpu::Byte*) &data)); - - setScatteringWavelength(_scatteringWavelength); - setRayleighScattering(_rayleighScattering); - setInnerOuterRadiuses(getInnerRadius(), getOuterRadius()); -} - -void Atmosphere::setScatteringWavelength(Vec3 wavelength) { - _scatteringWavelength = wavelength; - Data& data = editData(); - data._invWaveLength = Vec4(1.0f / powf(wavelength.x, 4.0f), 1.0f / powf(wavelength.y, 4.0f), 1.0f / powf(wavelength.z, 4.0f), 0.0f); -} - -void Atmosphere::setRayleighScattering(float scattering) { - _rayleighScattering = scattering; - updateScattering(); -} - -void Atmosphere::setMieScattering(float scattering) { - _mieScattering = scattering; - updateScattering(); -} - -void Atmosphere::setSunBrightness(float brightness) { - _sunBrightness = brightness; - updateScattering(); -} - -void Atmosphere::updateScattering() { - Data& data = editData(); - - data._scatterings.x = getRayleighScattering() * getSunBrightness(); - data._scatterings.y = getMieScattering() * getSunBrightness(); - - data._scatterings.z = getRayleighScattering() * 4.0f * glm::pi(); - data._scatterings.w = getMieScattering() * 4.0f * glm::pi(); -} - -void Atmosphere::setInnerOuterRadiuses(float inner, float outer) { - Data& data = editData(); - data._radiuses.x = inner; - data._radiuses.y = outer; - data._scales.x = 1.0f / (outer - inner); - data._scales.z = data._scales.x / data._scales.y; -} - - const int NUM_DAYS_PER_YEAR = 365; const float NUM_HOURS_PER_DAY = 24.0f; const float NUM_HOURS_PER_HALF_DAY = NUM_HOURS_PER_DAY * 0.5f; diff --git a/libraries/model/src/model/Stage.h b/libraries/model/src/model/Stage.h index bf586b6b55..912a7b77a8 100644 --- a/libraries/model/src/model/Stage.h +++ b/libraries/model/src/model/Stage.h @@ -107,60 +107,6 @@ protected: static Mat4d evalWorldToGeoLocationMat(double longitude, double latitude, double altitude, double scale); }; - -class Atmosphere { -public: - - Atmosphere(); - Atmosphere(const Atmosphere& atmosphere); - Atmosphere& operator= (const Atmosphere& atmosphere); - virtual ~Atmosphere() {}; - - - void setScatteringWavelength(Vec3 wavelength); - const Vec3& getScatteringWavelength() const { return _scatteringWavelength; } - - void setRayleighScattering(float scattering); - float getRayleighScattering() const { return _rayleighScattering; } - - void setMieScattering(float scattering); - float getMieScattering() const { return _mieScattering; } - - void setSunBrightness(float brightness); - float getSunBrightness() const { return _sunBrightness; } - - void setInnerOuterRadiuses(float inner, float outer); - float getInnerRadius() const { return getData()._radiuses.x; } - float getOuterRadius() const { return getData()._radiuses.y; } - - // Data to access the attribute values of the atmosphere - class Data { - public: - Vec4 _invWaveLength = Vec4(0.0f); - Vec4 _radiuses = Vec4(6000.0f, 6025.0f, 0.0f, 0.0f); - Vec4 _scales = Vec4(0.0f, 0.25f, 0.0f, 0.0f); - Vec4 _scatterings = Vec4(0.0f); - Vec4 _control = Vec4(2.0f, -0.990f, -0.990f*-0.990f, 0.f); - - Data() {} - }; - - const UniformBufferView& getDataBuffer() const { return _dataBuffer; } - -protected: - UniformBufferView _dataBuffer; - Vec3 _scatteringWavelength = Vec3(0.650f, 0.570f, 0.475f); - float _rayleighScattering = 0.0025f; - float _mieScattering = 0.0010f; - float _sunBrightness = 20.0f; - - const Data& getData() const { return _dataBuffer.get(); } - Data& editData() { return _dataBuffer.edit(); } - - void updateScattering(); -}; -typedef std::shared_ptr< Atmosphere > AtmospherePointer; - // Sun sky stage generates the rendering primitives to display a scene realistically // at the specified location and time around earth class SunSkyStage { @@ -209,7 +155,6 @@ public: const Vec3& getSunDirection() const { return getSunLight()->getDirection(); } LightPointer getSunLight() const { valid(); return _sunLight; } - AtmospherePointer getAtmosphere() const { valid(); return _atmosphere; } enum BackgroundMode { NO_BACKGROUND = 0, @@ -229,7 +174,6 @@ protected: BackgroundMode _backgroundMode = SKY_BOX; LightPointer _sunLight; - AtmospherePointer _atmosphere; mutable SkyboxPointer _skybox; float _dayTime = 12.0f; diff --git a/libraries/networking/src/udt/PacketHeaders.cpp b/libraries/networking/src/udt/PacketHeaders.cpp index 46bf41398c..4e6418279d 100644 --- a/libraries/networking/src/udt/PacketHeaders.cpp +++ b/libraries/networking/src/udt/PacketHeaders.cpp @@ -41,7 +41,7 @@ PacketVersion versionForPacketType(PacketType packetType) { case PacketType::EntityAdd: case PacketType::EntityEdit: case PacketType::EntityData: - return VERSION_ENTITITES_HAVE_COLLISION_MASK; + return VERSION_ATMOSPHERE_REMOVED; case PacketType::AvatarData: case PacketType::BulkAvatarData: return static_cast(AvatarMixerPacketVersion::SoftAttachmentSupport); diff --git a/libraries/networking/src/udt/PacketHeaders.h b/libraries/networking/src/udt/PacketHeaders.h index b8637e85cb..af3fd49710 100644 --- a/libraries/networking/src/udt/PacketHeaders.h +++ b/libraries/networking/src/udt/PacketHeaders.h @@ -165,6 +165,7 @@ const PacketVersion VERSION_ENTITIES_REMOVED_START_AUTOMATICALLY_FROM_ANIMATION_ const PacketVersion VERSION_MODEL_ENTITIES_JOINTS_ON_WIRE = 53; const PacketVersion VERSION_ENTITITES_HAVE_QUERY_BOX = 54; const PacketVersion VERSION_ENTITITES_HAVE_COLLISION_MASK = 55; +const PacketVersion VERSION_ATMOSPHERE_REMOVED = 56; enum class AvatarMixerPacketVersion : PacketVersion { TranslationSupport = 17, diff --git a/libraries/render-utils/CMakeLists.txt b/libraries/render-utils/CMakeLists.txt index c74089a238..c4f28aeffd 100644 --- a/libraries/render-utils/CMakeLists.txt +++ b/libraries/render-utils/CMakeLists.txt @@ -3,7 +3,7 @@ AUTOSCRIBE_SHADER_LIB(gpu model render) # pull in the resources.qrc file qt5_add_resources(QT_RESOURCES_FILE "${CMAKE_CURRENT_SOURCE_DIR}/res/fonts/fonts.qrc") setup_hifi_library(Widgets OpenGL Network Qml Quick Script) -link_hifi_libraries(shared gpu procedural model model-networking render environment animation fbx) +link_hifi_libraries(shared gpu procedural model model-networking render animation fbx) target_nsight() target_oglplus() diff --git a/libraries/render-utils/src/AbstractViewStateInterface.h b/libraries/render-utils/src/AbstractViewStateInterface.h index 1a4cfde16f..815cb45423 100644 --- a/libraries/render-utils/src/AbstractViewStateInterface.h +++ b/libraries/render-utils/src/AbstractViewStateInterface.h @@ -24,7 +24,6 @@ class Transform; class QThread; class ViewFrustum; class PickRay; -class EnvironmentData; /// Interface provided by Application to other objects that need access to the current view state details class AbstractViewStateInterface { @@ -32,10 +31,6 @@ public: /// gets the current view frustum for rendering the view state virtual ViewFrustum* getCurrentViewFrustum() = 0; - /// overrides environment data - virtual void overrideEnvironmentData(const EnvironmentData& newData) = 0; - virtual void endOverrideEnvironmentData() = 0; - /// gets the shadow view frustum for rendering the view state virtual ViewFrustum* getShadowViewFrustum() = 0; diff --git a/libraries/render-utils/src/DeferredLightingEffect.cpp b/libraries/render-utils/src/DeferredLightingEffect.cpp index 5af89e7afc..68b9c52cad 100644 --- a/libraries/render-utils/src/DeferredLightingEffect.cpp +++ b/libraries/render-utils/src/DeferredLightingEffect.cpp @@ -42,7 +42,6 @@ struct LightLocations { int radius; int ambientSphere; int lightBufferUnit; - int atmosphereBufferUnit; int texcoordMat; int coneParam; int deferredTransformBuffer; @@ -329,10 +328,7 @@ void DeferredLightingEffect::render(RenderArgs* args) { if (locations->lightBufferUnit >= 0) { batch.setUniformBuffer(locations->lightBufferUnit, globalLight->getSchemaBuffer()); } - - if (_atmosphere && (locations->atmosphereBufferUnit >= 0)) { - batch.setUniformBuffer(locations->atmosphereBufferUnit, _atmosphere->getDataBuffer()); - } + } { @@ -497,10 +493,8 @@ static void loadLightProgram(const char* vertSource, const char* fragSource, boo slotBindings.insert(gpu::Shader::Binding(std::string("skyboxMap"), 5)); static const int LIGHT_GPU_SLOT = 3; - static const int ATMOSPHERE_GPU_SLOT = 4; static const int DEFERRED_TRANSFORM_BUFFER_SLOT = 2; slotBindings.insert(gpu::Shader::Binding(std::string("lightBuffer"), LIGHT_GPU_SLOT)); - slotBindings.insert(gpu::Shader::Binding(std::string("atmosphereBufferUnit"), ATMOSPHERE_GPU_SLOT)); slotBindings.insert(gpu::Shader::Binding(std::string("deferredTransformBuffer"), DEFERRED_TRANSFORM_BUFFER_SLOT)); gpu::Shader::makeProgram(*program, slotBindings); @@ -512,7 +506,6 @@ static void loadLightProgram(const char* vertSource, const char* fragSource, boo locations->coneParam = program->getUniforms().findLocation("coneParam"); locations->lightBufferUnit = program->getBuffers().findLocation("lightBuffer"); - locations->atmosphereBufferUnit = program->getBuffers().findLocation("atmosphereBufferUnit"); locations->deferredTransformBuffer = program->getBuffers().findLocation("deferredTransformBuffer"); locations->shadowTransformBuffer = program->getBuffers().findLocation("shadowTransformBuffer"); diff --git a/libraries/render-utils/src/DeferredLightingEffect.h b/libraries/render-utils/src/DeferredLightingEffect.h index d11dee7d49..1443ce3e71 100644 --- a/libraries/render-utils/src/DeferredLightingEffect.h +++ b/libraries/render-utils/src/DeferredLightingEffect.h @@ -49,7 +49,6 @@ public: // update global lighting void setAmbientLightMode(int preset); void setGlobalLight(const glm::vec3& direction, const glm::vec3& diffuse, float intensity, float ambientIntensity); - void setGlobalAtmosphere(const model::AtmospherePointer& atmosphere) { _atmosphere = atmosphere; } void setGlobalSkybox(const model::SkyboxPointer& skybox); const LightStage& getLightStage() { return _lightStage; } @@ -84,7 +83,6 @@ private: std::vector _spotLights; int _ambientLightMode = 0; - model::AtmospherePointer _atmosphere; model::SkyboxPointer _skybox; // Class describing the uniform buffer with all the parameters common to the deferred shaders diff --git a/libraries/render-utils/src/Environment.cpp b/libraries/render-utils/src/Environment.cpp deleted file mode 100644 index f7327a2b72..0000000000 --- a/libraries/render-utils/src/Environment.cpp +++ /dev/null @@ -1,256 +0,0 @@ -// -// Environment.cpp -// interface/src -// -// Created by Andrzej Kapolka on 5/6/13. -// Copyright 2013 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -#include -#include -#include - -#include "GeometryCache.h" -#include -#include -#include -#include -#include -#include - -#include "Environment.h" - -#include "SkyFromSpace_vert.h" -#include "SkyFromSpace_frag.h" -#include "SkyFromAtmosphere_vert.h" -#include "SkyFromAtmosphere_frag.h" - -Environment::Environment() - : _initialized(false) { -} - -Environment::~Environment() { -} - -void Environment::init() { - if (_initialized) { - return; - } - - setupAtmosphereProgram(SkyFromSpace_vert, SkyFromSpace_frag, _skyFromSpaceProgram, _skyFromSpaceUniformLocations); - setupAtmosphereProgram(SkyFromAtmosphere_vert, SkyFromAtmosphere_frag, _skyFromAtmosphereProgram, _skyFromAtmosphereUniformLocations); - - // start off with a default-constructed environment data - _data[QUuid()][0]; - - _initialized = true; -} - -void Environment::setupAtmosphereProgram(const char* vertSource, const char* fragSource, gpu::PipelinePointer& pipeline, int* locations) { - - auto VS = gpu::Shader::createVertex(std::string(vertSource)); - auto PS = gpu::Shader::createPixel(std::string(fragSource)); - - gpu::ShaderPointer program = gpu::Shader::createProgram(VS, PS); - - gpu::Shader::BindingSet slotBindings; - gpu::Shader::makeProgram(*program, slotBindings); - - auto state = std::make_shared(); - - state->setCullMode(gpu::State::CULL_NONE); - state->setStencilTest(true, 0xFF, gpu::State::StencilTest(0, 0xFF, gpu::EQUAL, gpu::State::STENCIL_OP_KEEP, gpu::State::STENCIL_OP_KEEP, gpu::State::STENCIL_OP_KEEP)); - state->setBlendFunction(true, - gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA, - gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE); - - pipeline = gpu::Pipeline::create(program, state); - - locations[CAMERA_POS_LOCATION] = program->getUniforms().findLocation("v3CameraPos"); - locations[LIGHT_POS_LOCATION] = program->getUniforms().findLocation("v3LightPos"); - locations[INV_WAVELENGTH_LOCATION] = program->getUniforms().findLocation("v3InvWavelength"); - locations[CAMERA_HEIGHT2_LOCATION] = program->getUniforms().findLocation("fCameraHeight2"); - locations[OUTER_RADIUS_LOCATION] = program->getUniforms().findLocation("fOuterRadius"); - locations[OUTER_RADIUS2_LOCATION] = program->getUniforms().findLocation("fOuterRadius2"); - locations[INNER_RADIUS_LOCATION] = program->getUniforms().findLocation("fInnerRadius"); - locations[KR_ESUN_LOCATION] = program->getUniforms().findLocation("fKrESun"); - locations[KM_ESUN_LOCATION] = program->getUniforms().findLocation("fKmESun"); - locations[KR_4PI_LOCATION] = program->getUniforms().findLocation("fKr4PI"); - locations[KM_4PI_LOCATION] = program->getUniforms().findLocation("fKm4PI"); - locations[SCALE_LOCATION] = program->getUniforms().findLocation("fScale"); - locations[SCALE_DEPTH_LOCATION] = program->getUniforms().findLocation("fScaleDepth"); - locations[SCALE_OVER_SCALE_DEPTH_LOCATION] = program->getUniforms().findLocation("fScaleOverScaleDepth"); - locations[G_LOCATION] = program->getUniforms().findLocation("g"); - locations[G2_LOCATION] = program->getUniforms().findLocation("g2"); -} - -void Environment::resetToDefault() { - _data.clear(); - _data[QUuid()][0]; -} - -void Environment::renderAtmospheres(gpu::Batch& batch, ViewFrustum& viewFrustum) { - // get the lock for the duration of the call - QMutexLocker locker(&_mutex); - - if (_environmentIsOverridden) { - renderAtmosphere(batch, viewFrustum, _overrideData); - } else { - foreach (const ServerData& serverData, _data) { - // TODO: do something about EnvironmentData - foreach (const EnvironmentData& environmentData, serverData) { - renderAtmosphere(batch, viewFrustum, environmentData); - } - } - } -} - -EnvironmentData Environment::getClosestData(const glm::vec3& position) { - if (_environmentIsOverridden) { - return _overrideData; - } - - // get the lock for the duration of the call - QMutexLocker locker(&_mutex); - - EnvironmentData closest; - float closestDistance = FLT_MAX; - foreach (const ServerData& serverData, _data) { - foreach (const EnvironmentData& environmentData, serverData) { - float distance = glm::distance(position, environmentData.getAtmosphereCenter(position)) - - environmentData.getAtmosphereOuterRadius(); - if (distance < closestDistance) { - closest = environmentData; - closestDistance = distance; - } - } - } - return closest; -} - - -// NOTE: Deprecated - I'm leaving this in for now, but it's not actually used. I made it private -// so that if anyone wants to start using this in the future they will consider how to make it -// work with new physics systems. -glm::vec3 Environment::getGravity (const glm::vec3& position) { - // - // 'Default' gravity pulls you downward in Y when you are near the X/Z plane - const glm::vec3 DEFAULT_GRAVITY(0.0f, -1.0f, 0.0f); - glm::vec3 gravity(DEFAULT_GRAVITY); - float DEFAULT_SURFACE_RADIUS = 30.0f; - float gravityStrength; - - // Weaken gravity with height - if (position.y > 0.0f) { - gravityStrength = 1.0f / powf((DEFAULT_SURFACE_RADIUS + position.y) / DEFAULT_SURFACE_RADIUS, 2.0f); - gravity *= gravityStrength; - } - - // get the lock for the duration of the call - QMutexLocker locker(&_mutex); - - foreach (const ServerData& serverData, _data) { - foreach (const EnvironmentData& environmentData, serverData) { - glm::vec3 vector = environmentData.getAtmosphereCenter(position) - position; - float surfaceRadius = environmentData.getAtmosphereInnerRadius(); - if (glm::length(vector) <= surfaceRadius) { - // At or inside a planet, gravity is as set for the planet - gravity += glm::normalize(vector) * environmentData.getGravity(); - } else { - // Outside a planet, the gravity falls off with distance - gravityStrength = 1.0f / powf(glm::length(vector) / surfaceRadius, 2.0f); - gravity += glm::normalize(vector) * environmentData.getGravity() * gravityStrength; - } - } - } - - return gravity; -} - -bool Environment::findCapsulePenetration(const glm::vec3& start, const glm::vec3& end, - float radius, glm::vec3& penetration) { - // collide with the "floor" - bool found = findCapsulePlanePenetration(start, end, radius, glm::vec4(0.0f, 1.0f, 0.0f, 0.0f), penetration); - - glm::vec3 middle = (start + end) * 0.5f; - - // get the lock for the duration of the call - QMutexLocker locker(&_mutex); - - foreach (const ServerData& serverData, _data) { - foreach (const EnvironmentData& environmentData, serverData) { - if (environmentData.getGravity() == 0.0f) { - continue; // don't bother colliding with gravity-less environments - } - glm::vec3 environmentPenetration; - if (findCapsuleSpherePenetration(start, end, radius, environmentData.getAtmosphereCenter(middle), - environmentData.getAtmosphereInnerRadius(), environmentPenetration)) { - penetration = addPenetrations(penetration, environmentPenetration); - found = true; - } - } - } - return found; -} - -void Environment::renderAtmosphere(gpu::Batch& batch, ViewFrustum& viewFrustum, const EnvironmentData& data) { - glm::vec3 center = data.getAtmosphereCenter(); - - // transform the model transform to the center of our atmosphere - Transform transform; - transform.setTranslation(center); - batch.setModelTransform(transform); - - // Make sure our view and projection transforms are correct for our viewFrustum - Transform viewTransform; - viewFrustum.evalViewTransform(viewTransform); - batch.setViewTransform(viewTransform); - - glm::mat4 projMat; - viewFrustum.evalProjectionMatrix(projMat); - batch.setProjectionTransform(projMat); - - glm::vec3 relativeCameraPos = viewFrustum.getPosition() - center; - float height = glm::length(relativeCameraPos); - - // use the appropriate shader depending on whether we're inside or outside - int* locations; - if (height < data.getAtmosphereOuterRadius()) { - batch.setPipeline(_skyFromAtmosphereProgram); - locations = _skyFromAtmosphereUniformLocations; - } else { - batch.setPipeline(_skyFromSpaceProgram); - locations = _skyFromSpaceUniformLocations; - } - - - // the constants here are from Sean O'Neil's GPU Gems entry - // (http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter16.html), GameEngine.cpp - batch._glUniform3f(locations[CAMERA_POS_LOCATION], relativeCameraPos.x, relativeCameraPos.y, relativeCameraPos.z); - glm::vec3 lightDirection = glm::normalize(data.getSunLocation()); - batch._glUniform3f(locations[LIGHT_POS_LOCATION], lightDirection.x, lightDirection.y, lightDirection.z); - batch._glUniform3f(locations[INV_WAVELENGTH_LOCATION], - 1 / powf(data.getScatteringWavelengths().r, 4.0f), - 1 / powf(data.getScatteringWavelengths().g, 4.0f), - 1 / powf(data.getScatteringWavelengths().b, 4.0f)); - batch._glUniform1f(locations[CAMERA_HEIGHT2_LOCATION], height * height); - batch._glUniform1f(locations[OUTER_RADIUS_LOCATION], data.getAtmosphereOuterRadius()); - batch._glUniform1f(locations[OUTER_RADIUS2_LOCATION], data.getAtmosphereOuterRadius() * data.getAtmosphereOuterRadius()); - batch._glUniform1f(locations[INNER_RADIUS_LOCATION], data.getAtmosphereInnerRadius()); - batch._glUniform1f(locations[KR_ESUN_LOCATION], data.getRayleighScattering() * data.getSunBrightness()); - batch._glUniform1f(locations[KM_ESUN_LOCATION], data.getMieScattering() * data.getSunBrightness()); - batch._glUniform1f(locations[KR_4PI_LOCATION], data.getRayleighScattering() * 4.0f * PI); - batch._glUniform1f(locations[KM_4PI_LOCATION], data.getMieScattering() * 4.0f * PI); - batch._glUniform1f(locations[SCALE_LOCATION], 1.0f / (data.getAtmosphereOuterRadius() - data.getAtmosphereInnerRadius())); - batch._glUniform1f(locations[SCALE_DEPTH_LOCATION], 0.25f); - batch._glUniform1f(locations[SCALE_OVER_SCALE_DEPTH_LOCATION], - (1.0f / (data.getAtmosphereOuterRadius() - data.getAtmosphereInnerRadius())) / 0.25f); - batch._glUniform1f(locations[G_LOCATION], -0.990f); - batch._glUniform1f(locations[G2_LOCATION], -0.990f * -0.990f); - - batch._glColor4f(1.0f, 0.0f, 0.0f, 0.5f); - DependencyManager::get()->renderSphere(batch); //Draw a unit sphere -} diff --git a/libraries/render-utils/src/Environment.h b/libraries/render-utils/src/Environment.h deleted file mode 100644 index af5a3c3df5..0000000000 --- a/libraries/render-utils/src/Environment.h +++ /dev/null @@ -1,85 +0,0 @@ -// -// Environment.h -// interface/src -// -// Created by Andrzej Kapolka on 5/6/13. -// Copyright 2013 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -#ifndef hifi_Environment_h -#define hifi_Environment_h - -#include -#include - -#include -#include - -#include - -class ViewFrustum; - -class Environment { -public: - Environment(); - ~Environment(); - - void init(); - void resetToDefault(); - void renderAtmospheres(gpu::Batch& batch, ViewFrustum& viewFrustum); - - void override(const EnvironmentData& overrideData) { _overrideData = overrideData; _environmentIsOverridden = true; } - void endOverride() { _environmentIsOverridden = false; } - - EnvironmentData getClosestData(const glm::vec3& position); - -private: - glm::vec3 getGravity (const glm::vec3& position); // NOTE: Deprecated - bool findCapsulePenetration(const glm::vec3& start, - const glm::vec3& end, float radius, glm::vec3& penetration); // NOTE: Deprecated - - void renderAtmosphere(gpu::Batch& batch, ViewFrustum& viewFrustum, const EnvironmentData& data); - - bool _initialized; - - enum { - CAMERA_POS_LOCATION, - LIGHT_POS_LOCATION, - INV_WAVELENGTH_LOCATION, - CAMERA_HEIGHT2_LOCATION, - OUTER_RADIUS_LOCATION, - OUTER_RADIUS2_LOCATION, - INNER_RADIUS_LOCATION, - KR_ESUN_LOCATION, - KM_ESUN_LOCATION, - KR_4PI_LOCATION, - KM_4PI_LOCATION, - SCALE_LOCATION, - SCALE_DEPTH_LOCATION, - SCALE_OVER_SCALE_DEPTH_LOCATION, - G_LOCATION, - G2_LOCATION, - LOCATION_COUNT - }; - - void setupAtmosphereProgram(const char* vertSource, const char* fragSource, gpu::PipelinePointer& pipelineProgram, int* locations); - - - gpu::PipelinePointer _skyFromAtmosphereProgram; - gpu::PipelinePointer _skyFromSpaceProgram; - int _skyFromAtmosphereUniformLocations[LOCATION_COUNT]; - int _skyFromSpaceUniformLocations[LOCATION_COUNT]; - - typedef QHash ServerData; - - QHash _data; - EnvironmentData _overrideData; - bool _environmentIsOverridden = false; - - QMutex _mutex; -}; - -#endif // hifi_Environment_h diff --git a/libraries/render-utils/src/SkyFromAtmosphere.slf b/libraries/render-utils/src/SkyFromAtmosphere.slf deleted file mode 100755 index 10b39dc210..0000000000 --- a/libraries/render-utils/src/SkyFromAtmosphere.slf +++ /dev/null @@ -1,113 +0,0 @@ -<@include gpu/Config.slh@> -<$VERSION_HEADER$> - -// -// For licensing information, see http://http.developer.nvidia.com/GPUGems/gpugems_app01.html: -// -// NVIDIA Statement on the Software -// -// The source code provided is freely distributable, so long as the NVIDIA header remains unaltered and user modifications are -// detailed. -// -// No Warranty -// -// THE SOFTWARE AND ANY OTHER MATERIALS PROVIDED BY NVIDIA ON THE ENCLOSED CD-ROM ARE PROVIDED "AS IS." NVIDIA DISCLAIMS ALL -// WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF TITLE, MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// -// Limitation of Liability -// -// NVIDIA SHALL NOT BE LIABLE TO ANY USER, DEVELOPER, DEVELOPER'S CUSTOMERS, OR ANY OTHER PERSON OR ENTITY CLAIMING THROUGH OR -// UNDER DEVELOPER FOR ANY LOSS OF PROFITS, INCOME, SAVINGS, OR ANY OTHER CONSEQUENTIAL, INCIDENTAL, SPECIAL, PUNITIVE, DIRECT -// OR INDIRECT DAMAGES (WHETHER IN AN ACTION IN CONTRACT, TORT OR BASED ON A WARRANTY), EVEN IF NVIDIA HAS BEEN ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF THE ESSENTIAL PURPOSE OF ANY -// LIMITED REMEDY. IN NO EVENT SHALL NVIDIA'S AGGREGATE LIABILITY TO DEVELOPER OR ANY OTHER PERSON OR ENTITY CLAIMING THROUGH -// OR UNDER DEVELOPER EXCEED THE AMOUNT OF MONEY ACTUALLY PAID BY DEVELOPER TO NVIDIA FOR THE SOFTWARE OR ANY OTHER MATERIALS. -// - -// -// Atmospheric scattering fragment shader -// -// Author: Sean O'Neil -// -// Copyright (c) 2004 Sean O'Neil -// - -uniform vec3 v3CameraPos; // The camera's current position -uniform vec3 v3InvWavelength; // 1 / pow(wavelength, 4) for the red, green, and blue channels -uniform float fInnerRadius; // The inner (planetary) radius -uniform float fKrESun; // Kr * ESun -uniform float fKmESun; // Km * ESun -uniform float fKr4PI; // Kr * 4 * PI -uniform float fKm4PI; // Km * 4 * PI -uniform float fScale; // 1 / (fOuterRadius - fInnerRadius) -uniform float fScaleDepth; // The scale depth (i.e. the altitude at which the atmosphere's average density is found) -uniform float fScaleOverScaleDepth; // fScale / fScaleDepth - -const int nSamples = 2; -const float fSamples = 2.0; - -uniform vec3 v3LightPos; -uniform float g; -uniform float g2; - -in vec3 position; -out vec4 outFragColor; - - -float scale(float fCos) -{ - float x = 1.0 - fCos; - return fScaleDepth * exp(-0.00287 + x*(0.459 + x*(3.83 + x*(-6.80 + x*5.25)))); -} - - -void main (void) -{ - // Get the ray from the camera to the vertex, and its length (which is the far point of the ray passing through the atmosphere) - vec3 v3Pos = position; - vec3 v3Ray = v3Pos - v3CameraPos; - float fFar = length(v3Ray); - v3Ray /= fFar; - - // Calculate the ray's starting position, then calculate its scattering offset - vec3 v3Start = v3CameraPos; - float fHeight = length(v3Start); - float fDepth = exp(fScaleOverScaleDepth * (fInnerRadius - fHeight)); - float fStartAngle = dot(v3Ray, v3Start) / fHeight; - float fStartOffset = fDepth * scale(fStartAngle); - - // Initialize the scattering loop variables - //gl_FrontColor = vec4(0.0, 0.0, 0.0, 0.0); - float fSampleLength = fFar / fSamples; - float fScaledLength = fSampleLength * fScale; - vec3 v3SampleRay = v3Ray * fSampleLength; - vec3 v3SamplePoint = v3Start + v3SampleRay * 0.5; - - // Now loop through the sample rays - vec3 v3FrontColor = vec3(0.0, 0.0, 0.0); - for(int i=0; i -<$VERSION_HEADER$> - -// -// For licensing information, see http://http.developer.nvidia.com/GPUGems/gpugems_app01.html: -// -// NVIDIA Statement on the Software -// -// The source code provided is freely distributable, so long as the NVIDIA header remains unaltered and user modifications are -// detailed. -// -// No Warranty -// -// THE SOFTWARE AND ANY OTHER MATERIALS PROVIDED BY NVIDIA ON THE ENCLOSED CD-ROM ARE PROVIDED "AS IS." NVIDIA DISCLAIMS ALL -// WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF TITLE, MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// -// Limitation of Liability -// -// NVIDIA SHALL NOT BE LIABLE TO ANY USER, DEVELOPER, DEVELOPER'S CUSTOMERS, OR ANY OTHER PERSON OR ENTITY CLAIMING THROUGH OR -// UNDER DEVELOPER FOR ANY LOSS OF PROFITS, INCOME, SAVINGS, OR ANY OTHER CONSEQUENTIAL, INCIDENTAL, SPECIAL, PUNITIVE, DIRECT -// OR INDIRECT DAMAGES (WHETHER IN AN ACTION IN CONTRACT, TORT OR BASED ON A WARRANTY), EVEN IF NVIDIA HAS BEEN ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF THE ESSENTIAL PURPOSE OF ANY -// LIMITED REMEDY. IN NO EVENT SHALL NVIDIA'S AGGREGATE LIABILITY TO DEVELOPER OR ANY OTHER PERSON OR ENTITY CLAIMING THROUGH -// OR UNDER DEVELOPER EXCEED THE AMOUNT OF MONEY ACTUALLY PAID BY DEVELOPER TO NVIDIA FOR THE SOFTWARE OR ANY OTHER MATERIALS. -// - -// -// Atmospheric scattering vertex shader -// -// Author: Sean O'Neil -// -// Copyright (c) 2004 Sean O'Neil -// - -<@include gpu/Inputs.slh@> -<@include gpu/Transform.slh@> -<$declareStandardTransform()$> - -uniform vec3 v3CameraPos; // The camera's current position -uniform vec3 v3LightPos; // The direction vector to the light source -uniform vec3 v3InvWavelength; // 1 / pow(wavelength, 4) for the red, green, and blue channels -uniform float fOuterRadius; // The outer (atmosphere) radius -uniform float fInnerRadius; // The inner (planetary) radius -uniform float fKrESun; // Kr * ESun -uniform float fKmESun; // Km * ESun -uniform float fKr4PI; // Kr * 4 * PI -uniform float fKm4PI; // Km * 4 * PI -uniform float fScale; // 1 / (fOuterRadius - fInnerRadius) -uniform float fScaleDepth; // The scale depth (i.e. the altitude at which the atmosphere's average density is found) -uniform float fScaleOverScaleDepth; // fScale / fScaleDepth - - -const int nSamples = 2; -const float fSamples = 2.0; - -out vec3 position; - -void main(void) -{ - // Get the ray from the camera to the vertex, and its length (which is the far point of the ray passing through the atmosphere) - position = inPosition.xyz * fOuterRadius; - - // standard transform - TransformCamera cam = getTransformCamera(); - TransformObject obj = getTransformObject(); - vec4 v4pos = vec4(position, 1.0); - <$transformModelToClipPos(cam, obj, v4pos, gl_Position)$> -} diff --git a/libraries/render-utils/src/SkyFromSpace.slf b/libraries/render-utils/src/SkyFromSpace.slf deleted file mode 100755 index 42282fe08b..0000000000 --- a/libraries/render-utils/src/SkyFromSpace.slf +++ /dev/null @@ -1,119 +0,0 @@ -<@include gpu/Config.slh@> -<$VERSION_HEADER$> - -// -// For licensing information, see http://http.developer.nvidia.com/GPUGems/gpugems_app01.html: -// -// NVIDIA Statement on the Software -// -// The source code provided is freely distributable, so long as the NVIDIA header remains unaltered and user modifications are -// detailed. -// -// No Warranty -// -// THE SOFTWARE AND ANY OTHER MATERIALS PROVIDED BY NVIDIA ON THE ENCLOSED CD-ROM ARE PROVIDED "AS IS." NVIDIA DISCLAIMS ALL -// WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF TITLE, MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// -// Limitation of Liability -// -// NVIDIA SHALL NOT BE LIABLE TO ANY USER, DEVELOPER, DEVELOPER'S CUSTOMERS, OR ANY OTHER PERSON OR ENTITY CLAIMING THROUGH OR -// UNDER DEVELOPER FOR ANY LOSS OF PROFITS, INCOME, SAVINGS, OR ANY OTHER CONSEQUENTIAL, INCIDENTAL, SPECIAL, PUNITIVE, DIRECT -// OR INDIRECT DAMAGES (WHETHER IN AN ACTION IN CONTRACT, TORT OR BASED ON A WARRANTY), EVEN IF NVIDIA HAS BEEN ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF THE ESSENTIAL PURPOSE OF ANY -// LIMITED REMEDY. IN NO EVENT SHALL NVIDIA'S AGGREGATE LIABILITY TO DEVELOPER OR ANY OTHER PERSON OR ENTITY CLAIMING THROUGH -// OR UNDER DEVELOPER EXCEED THE AMOUNT OF MONEY ACTUALLY PAID BY DEVELOPER TO NVIDIA FOR THE SOFTWARE OR ANY OTHER MATERIALS. -// - -// -// Atmospheric scattering fragment shader -// -// Author: Sean O'Neil -// -// Copyright (c) 2004 Sean O'Neil -// - -uniform vec3 v3CameraPos; // The camera's current position -uniform vec3 v3LightPos; // The direction vector to the light source -uniform vec3 v3InvWavelength; // 1 / pow(wavelength, 4) for the red, green, and blue channels -uniform float fCameraHeight2; // fCameraHeight^2 -uniform float fOuterRadius; // The outer (atmosphere) radius -uniform float fOuterRadius2; // fOuterRadius^2 -uniform float fInnerRadius; // The inner (planetary) radius -uniform float fKrESun; // Kr * ESun -uniform float fKmESun; // Km * ESun -uniform float fKr4PI; // Kr * 4 * PI -uniform float fKm4PI; // Km * 4 * PI -uniform float fScale; // 1 / (fOuterRadius - fInnerRadius) -uniform float fScaleDepth; // The scale depth (i.e. the altitude at which the atmosphere's average density is found) -uniform float fScaleOverScaleDepth; // fScale / fScaleDepth - -uniform float g; -uniform float g2; - -const int nSamples = 2; -const float fSamples = 2.0; - -in vec3 position; - -out vec4 outFragColor; - -float scale(float fCos) -{ - float x = 1.0 - fCos; - return fScaleDepth * exp(-0.00287 + x*(0.459 + x*(3.83 + x*(-6.80 + x*5.25)))); -} - - -void main (void) -{ - // Get the ray from the camera to the vertex and its length (which is the far point of the ray passing through the atmosphere) - vec3 v3Pos = position; - vec3 v3Ray = v3Pos - v3CameraPos; - float fFar = length(v3Ray); - v3Ray /= fFar; - - // Calculate the closest intersection of the ray with the outer atmosphere (which is the near point of the ray passing through the atmosphere) - float B = 2.0 * dot(v3CameraPos, v3Ray); - float C = fCameraHeight2 - fOuterRadius2; - float fDet = max(0.0, B*B - 4.0 * C); - float fNear = 0.5 * (-B - sqrt(fDet)); - - // Calculate the ray's starting position, then calculate its scattering offset - vec3 v3Start = v3CameraPos + v3Ray * fNear; - fFar -= fNear; - float fStartAngle = dot(v3Ray, v3Start) / fOuterRadius; - float fStartDepth = exp(-1.0 / fScaleDepth); - float fStartOffset = fStartDepth * scale(fStartAngle); - - // Initialize the scattering loop variables - //gl_FrontColor = vec4(0.0, 0.0, 0.0, 0.0); - float fSampleLength = fFar / fSamples; - float fScaledLength = fSampleLength * fScale; - vec3 v3SampleRay = v3Ray * fSampleLength; - vec3 v3SamplePoint = v3Start + v3SampleRay * 0.5; - - // Now loop through the sample rays - vec3 v3FrontColor = vec3(0.0, 0.0, 0.0); - for(int i=0; i -<$VERSION_HEADER$> -// Generated on <$_SCRIBE_DATE$> -// -// For licensing information, see http://http.developer.nvidia.com/GPUGems/gpugems_app01.html: -// -// NVIDIA Statement on the Software -// -// The source code provided is freely distributable, so long as the NVIDIA header remains unaltered and user modifications are -// detailed. -// -// No Warranty -// -// THE SOFTWARE AND ANY OTHER MATERIALS PROVIDED BY NVIDIA ON THE ENCLOSED CD-ROM ARE PROVIDED "AS IS." NVIDIA DISCLAIMS ALL -// WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF TITLE, MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// -// Limitation of Liability -// -// NVIDIA SHALL NOT BE LIABLE TO ANY USER, DEVELOPER, DEVELOPER'S CUSTOMERS, OR ANY OTHER PERSON OR ENTITY CLAIMING THROUGH OR -// UNDER DEVELOPER FOR ANY LOSS OF PROFITS, INCOME, SAVINGS, OR ANY OTHER CONSEQUENTIAL, INCIDENTAL, SPECIAL, PUNITIVE, DIRECT -// OR INDIRECT DAMAGES (WHETHER IN AN ACTION IN CONTRACT, TORT OR BASED ON A WARRANTY), EVEN IF NVIDIA HAS BEEN ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF THE ESSENTIAL PURPOSE OF ANY -// LIMITED REMEDY. IN NO EVENT SHALL NVIDIA'S AGGREGATE LIABILITY TO DEVELOPER OR ANY OTHER PERSON OR ENTITY CLAIMING THROUGH -// OR UNDER DEVELOPER EXCEED THE AMOUNT OF MONEY ACTUALLY PAID BY DEVELOPER TO NVIDIA FOR THE SOFTWARE OR ANY OTHER MATERIALS. -// - -// -// Atmospheric scattering vertex shader -// -// Author: Sean O'Neil -// -// Copyright (c) 2004 Sean O'Neil -// - -<@include gpu/Inputs.slh@> -<@include gpu/Transform.slh@> -<$declareStandardTransform()$> - -uniform float fOuterRadius; // The outer (atmosphere) radius - -out vec3 position; - - -void main(void) { - position = inPosition.xyz * fOuterRadius; - - // standard transform - TransformCamera cam = getTransformCamera(); - TransformObject obj = getTransformObject(); - vec4 v4pos = vec4(position, 1.0); - <$transformModelToClipPos(cam, obj, v4pos, gl_Position)$> -} diff --git a/libraries/script-engine/src/SceneScriptingInterface.cpp b/libraries/script-engine/src/SceneScriptingInterface.cpp index 062e502d6e..b2f3824221 100644 --- a/libraries/script-engine/src/SceneScriptingInterface.cpp +++ b/libraries/script-engine/src/SceneScriptingInterface.cpp @@ -104,8 +104,6 @@ bool SceneScripting::Stage::isSunModelEnabled() const { void SceneScripting::Stage::setBackgroundMode(const QString& mode) { if (mode == QString("inherit")) { _skyStage->setBackgroundMode(model::SunSkyStage::NO_BACKGROUND); - } else if (mode == QString("atmosphere")) { - _skyStage->setBackgroundMode(model::SunSkyStage::SKY_DOME); } else if (mode == QString("skybox")) { _skyStage->setBackgroundMode(model::SunSkyStage::SKY_BOX); } @@ -115,8 +113,6 @@ QString SceneScripting::Stage::getBackgroundMode() const { switch (_skyStage->getBackgroundMode()) { case model::SunSkyStage::NO_BACKGROUND: return QString("inherit"); - case model::SunSkyStage::SKY_DOME: - return QString("atmosphere"); case model::SunSkyStage::SKY_BOX: return QString("skybox"); default: diff --git a/libraries/shared/src/BackgroundMode.h b/libraries/shared/src/BackgroundMode.h index 661fe0f849..e6e585d9d8 100644 --- a/libraries/shared/src/BackgroundMode.h +++ b/libraries/shared/src/BackgroundMode.h @@ -13,8 +13,9 @@ enum BackgroundMode { BACKGROUND_MODE_INHERIT, - BACKGROUND_MODE_ATMOSPHERE, BACKGROUND_MODE_SKYBOX, + + BACKGROUND_MODE_ITEM_COUNT, }; diff --git a/libraries/ui/src/OffscreenUi.cpp b/libraries/ui/src/OffscreenUi.cpp index 7849bf5b95..8f70931085 100644 --- a/libraries/ui/src/OffscreenUi.cpp +++ b/libraries/ui/src/OffscreenUi.cpp @@ -238,7 +238,12 @@ void OffscreenUi::createDesktop(const QUrl& url) { qDebug() << "Desktop already created"; return; } +#ifdef DEBUG + getRootContext()->setContextProperty("DebugQML", QVariant(true)); +#else getRootContext()->setContextProperty("DebugQML", QVariant(false)); +#endif + _desktop = dynamic_cast(load(url)); Q_ASSERT(_desktop); getRootContext()->setContextProperty("desktop", _desktop); diff --git a/tests/entities/CMakeLists.txt b/tests/entities/CMakeLists.txt index 81b8b86368..b12771b368 100644 --- a/tests/entities/CMakeLists.txt +++ b/tests/entities/CMakeLists.txt @@ -7,6 +7,6 @@ setup_hifi_project(Network Script) set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "Tests/manual-tests/") # link in the shared libraries -link_hifi_libraries(entities avatars shared octree gpu model fbx networking animation environment) +link_hifi_libraries(entities avatars shared octree gpu model fbx networking animation) package_libraries_for_deployment() diff --git a/tests/octree/CMakeLists.txt b/tests/octree/CMakeLists.txt index 9f9315ba2b..224b97c75c 100644 --- a/tests/octree/CMakeLists.txt +++ b/tests/octree/CMakeLists.txt @@ -2,7 +2,7 @@ # Declare dependencies macro (setup_testcase_dependencies) # link in the shared libraries - link_hifi_libraries(shared octree gpu model fbx networking environment entities avatars audio animation script-engine physics) + link_hifi_libraries(shared octree gpu model fbx networking entities avatars audio animation script-engine physics) package_libraries_for_deployment() endmacro () diff --git a/tests/shaders/CMakeLists.txt b/tests/shaders/CMakeLists.txt index 3ba29c5626..e95970dd53 100644 --- a/tests/shaders/CMakeLists.txt +++ b/tests/shaders/CMakeLists.txt @@ -8,7 +8,7 @@ set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "Tests/manual-tests/") #include_oglplus() # link in the shared libraries -link_hifi_libraries(shared octree environment gl gpu model render fbx networking entities +link_hifi_libraries(shared octree gl gpu model render fbx networking entities script-engine physics render-utils entities-renderer) diff --git a/tests/shaders/src/main.cpp b/tests/shaders/src/main.cpp index 0c63ee77c1..93fc5d02a2 100644 --- a/tests/shaders/src/main.cpp +++ b/tests/shaders/src/main.cpp @@ -84,11 +84,6 @@ #include "overlay3D_vert.h" #include "overlay3D_frag.h" -#include "SkyFromSpace_vert.h" -#include "SkyFromSpace_frag.h" -#include "SkyFromAtmosphere_vert.h" -#include "SkyFromAtmosphere_frag.h" - #include "Skybox_vert.h" #include "Skybox_frag.h" @@ -220,9 +215,6 @@ void QTestWindow::draw() { testShaderBuild(overlay3D_vert, overlay3D_frag); - testShaderBuild(SkyFromSpace_vert, SkyFromSpace_frag); - testShaderBuild(SkyFromAtmosphere_vert, SkyFromAtmosphere_frag); - testShaderBuild(Skybox_vert, Skybox_frag); testShaderBuild(paintStroke_vert,paintStroke_frag);