From 56758759e50f3ca265310a1d4e72d834f6bfd31b Mon Sep 17 00:00:00 2001 From: Sam Gateau Date: Mon, 5 Jan 2015 15:02:12 -0800 Subject: [PATCH 1/3] making the sun position a direction --- interface/src/Application.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index c2ce4c9077..5620240f01 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -2505,8 +2505,10 @@ void Application::loadViewFrustum(Camera& camera, ViewFrustum& viewFrustum) { } glm::vec3 Application::getSunDirection() { - return glm::normalize(_environment.getClosestData(_myCamera.getPosition()).getSunLocation(_myCamera.getPosition()) - - _myCamera.getPosition()); + /* return glm::normalize(_environment.getClosestData(_myCamera.getPosition()).getSunLocation(_myCamera.getPosition()) - + _myCamera.getPosition());*/ + // Sun direction is in fact just the location of the sun relative to the origin + return glm::normalize(_environment.getClosestData(_myCamera.getPosition()).getSunLocation(_myCamera.getPosition())); } void Application::updateShadowMap() { From 2fdcbb1a97b74be66fd6589c68ebddef7839a278 Mon Sep 17 00:00:00 2001 From: Sam Gateau Date: Mon, 5 Jan 2015 16:46:42 -0800 Subject: [PATCH 2/3] changing the atmoshpere position --- interface/src/Application.cpp | 2 -- libraries/environment/src/EnvironmentData.cpp | 8 ++++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 5620240f01..ecce508acf 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -2505,8 +2505,6 @@ void Application::loadViewFrustum(Camera& camera, ViewFrustum& viewFrustum) { } glm::vec3 Application::getSunDirection() { - /* return glm::normalize(_environment.getClosestData(_myCamera.getPosition()).getSunLocation(_myCamera.getPosition()) - - _myCamera.getPosition());*/ // Sun direction is in fact just the location of the sun relative to the origin return glm::normalize(_environment.getClosestData(_myCamera.getPosition()).getSunLocation(_myCamera.getPosition())); } diff --git a/libraries/environment/src/EnvironmentData.cpp b/libraries/environment/src/EnvironmentData.cpp index b9b64f72d1..31b3aaa104 100644 --- a/libraries/environment/src/EnvironmentData.cpp +++ b/libraries/environment/src/EnvironmentData.cpp @@ -21,12 +21,12 @@ EnvironmentData::EnvironmentData(int id) : _flat(true), _gravity(0.0f), _atmosphereCenter(0, -1000, 0), - _atmosphereInnerRadius(1000), - _atmosphereOuterRadius(1025), + _atmosphereInnerRadius(1000.0), + _atmosphereOuterRadius(1100.0), _rayleighScattering(0.0025f), _mieScattering(0.0010f), _scatteringWavelengths(0.650f, 0.570f, 0.475f), - _sunLocation(1000, 1000, 0), + _sunLocation(1000, 900, 1000), _sunBrightness(20.0f) { } @@ -35,7 +35,7 @@ glm::vec3 EnvironmentData::getAtmosphereCenter(const glm::vec3& cameraPosition) } glm::vec3 EnvironmentData::getSunLocation(const glm::vec3& cameraPosition) const { - return _sunLocation + (_flat ? glm::vec3(cameraPosition.x, 0.0f, cameraPosition.z) : glm::vec3()); + return _sunLocation; } int EnvironmentData::getBroadcastData(unsigned char* destinationBuffer) const { From 4ffb3e4e7e29a4415621229e19266a0c29b37dea Mon Sep 17 00:00:00 2001 From: Sam Gateau Date: Mon, 5 Jan 2015 17:31:47 -0800 Subject: [PATCH 3/3] just do the sun location modification --- libraries/environment/src/EnvironmentData.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/environment/src/EnvironmentData.cpp b/libraries/environment/src/EnvironmentData.cpp index 31b3aaa104..17c66ce66a 100644 --- a/libraries/environment/src/EnvironmentData.cpp +++ b/libraries/environment/src/EnvironmentData.cpp @@ -22,7 +22,7 @@ EnvironmentData::EnvironmentData(int id) : _gravity(0.0f), _atmosphereCenter(0, -1000, 0), _atmosphereInnerRadius(1000.0), - _atmosphereOuterRadius(1100.0), + _atmosphereOuterRadius(1025.0), _rayleighScattering(0.0025f), _mieScattering(0.0010f), _scatteringWavelengths(0.650f, 0.570f, 0.475f),