From 12b04f38bdb0822d4b74408b2a1c22f8f64ed733 Mon Sep 17 00:00:00 2001 From: Micah Acinapura Date: Wed, 29 Jan 2020 21:43:06 -0500 Subject: [PATCH 01/10] macos compile and build (still needs ring shader const fix) --- apps/OpenSpace/CMakeLists.txt | 10 +++++++++- data/assets/base_profile.asset | 1 - include/openspace/scripting/scriptengine.h | 2 +- modules/globebrowsing/src/renderableglobe.cpp | 6 +++--- modules/globebrowsing/src/shadowcomponent.cpp | 2 +- modules/globebrowsing/src/tileprovider.cpp | 2 +- openspace.cfg | 2 +- src/interaction/navigationhandler.cpp | 6 +++--- src/interaction/navigationhandler_lua.inl | 2 +- src/interaction/orbitalnavigator.cpp | 8 ++++---- src/scripting/scriptengine.cpp | 2 +- src/util/versionchecker.cpp | 2 +- 12 files changed, 26 insertions(+), 19 deletions(-) diff --git a/apps/OpenSpace/CMakeLists.txt b/apps/OpenSpace/CMakeLists.txt index ba74ba4315..eaf641b286 100644 --- a/apps/OpenSpace/CMakeLists.txt +++ b/apps/OpenSpace/CMakeLists.txt @@ -72,7 +72,15 @@ if (SGCT_SPOUT_SUPPORT AND NOT OPENSPACE_MODULE_SPOUT) set(OPENSPACE_MODULE_SPOUT ON CACHE BOOL "Build OPENSPACE_MODULE_SPOUTModule" FORCE) endif () -set(MACOSX_BUNDLE_ICON_FILE openspace.icns) + +##### +# macos +##### +if (APPLE) + set(MACOSX_BUNDLE_ICON_FILE openspace.icns) + set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9" CACHE STRING "Minimum OS X deployment version" FORCE) + set(CMAKE_XCODE_ATTRIBUTE_OTHER_CODE_SIGN_FLAGS "--deep" CACHE STRING "Other Code Signing Flags" FORCE) +endif() create_new_application(OpenSpace ${SGCT_OPENVR_FILES} diff --git a/data/assets/base_profile.asset b/data/assets/base_profile.asset index 67e5ba0556..f4a9b7b265 100644 --- a/data/assets/base_profile.asset +++ b/data/assets/base_profile.asset @@ -15,7 +15,6 @@ asset.require('util/default_joystick') -- Load web gui asset.require('util/webgui') -asset.request('customization/globebrowsing') asset.onInitialize(function () openspace.setDefaultGuiSorting() diff --git a/include/openspace/scripting/scriptengine.h b/include/openspace/scripting/scriptengine.h index 0ca40db7f0..430b2da22c 100644 --- a/include/openspace/scripting/scriptengine.h +++ b/include/openspace/scripting/scriptengine.h @@ -50,7 +50,7 @@ namespace openspace::scripting { */ class ScriptEngine : public Syncable, public DocumentationGenerator { public: - using ScriptCallback = std::optional>; + using ScriptCallback = std::function; BooleanType(RemoteScripting); struct QueueItem { diff --git a/modules/globebrowsing/src/renderableglobe.cpp b/modules/globebrowsing/src/renderableglobe.cpp index 988f6f0caa..d2e075bfd0 100644 --- a/modules/globebrowsing/src/renderableglobe.cpp +++ b/modules/globebrowsing/src/renderableglobe.cpp @@ -186,7 +186,7 @@ namespace { constexpr openspace::properties::Property::PropertyInfo ShadowMappingInfo = { "ShadowMapping", - "Shadow Mapping", + "Shadow-Mapping", "Enables shadow mapping algorithm. Used by renderable rings too." }; @@ -303,7 +303,7 @@ BoundingHeights boundingHeightsForChunk(const Chunk& chunk, const LayerManager& const bool hasTileMetaData = chunkTile.tile.metaData.has_value(); if (goodTile && hasTileMetaData) { - const TileMetaData& tileMetaData = chunkTile.tile.metaData.value(); + const TileMetaData& tileMetaData = *chunkTile.tile.metaData; const float minValue = settings->performLayerSettings( tileMetaData.minValues[HeightChannel] @@ -524,7 +524,7 @@ RenderableGlobe::RenderableGlobe(const ghoul::Dictionary& dictionary) FloatProperty(OrenNayarRoughnessInfo, 0.f, 0.f, 1.f), IntProperty(NActiveLayersInfo, 0, 0, OpenGLCap.maxTextureUnits() / 3) }) - , _shadowMappingPropertyOwner({ "Shadow Mapping" }) + , _shadowMappingPropertyOwner({ "Shadow-Mapping" }) , _debugPropertyOwner({ "Debug" }) , _grid(DefaultSkirtedGridSegments, DefaultSkirtedGridSegments) , _leftRoot(Chunk(LeftHemisphereIndex)) diff --git a/modules/globebrowsing/src/shadowcomponent.cpp b/modules/globebrowsing/src/shadowcomponent.cpp index 2a2e5a9c7b..4e528f1ef0 100644 --- a/modules/globebrowsing/src/shadowcomponent.cpp +++ b/modules/globebrowsing/src/shadowcomponent.cpp @@ -166,7 +166,7 @@ documentation::Documentation ShadowComponent::Documentation() { } ShadowComponent::ShadowComponent(const ghoul::Dictionary& dictionary) - : properties::PropertyOwner({ "Shadows Component" }) + : properties::PropertyOwner({ "Shadows-Component" }) , _saveDepthTexture(SaveDepthTextureInfo) , _distanceFraction(DistanceFractionInfo, 20, 1, 10000) , _enabled({ "Enabled", "Enabled", "Enable/Disable Shadows" }, true) diff --git a/modules/globebrowsing/src/tileprovider.cpp b/modules/globebrowsing/src/tileprovider.cpp index ad72426685..46f7420b9f 100644 --- a/modules/globebrowsing/src/tileprovider.cpp +++ b/modules/globebrowsing/src/tileprovider.cpp @@ -168,7 +168,7 @@ bool initTexturesFromLoadedData(DefaultTileProvider& t) { if (tile) { const cache::ProviderTileKey key = { tile->tileIndex, t.uniqueIdentifier }; ghoul_assert(!t.tileCache->exist(key), "Tile must not be existing in cache"); - t.tileCache->createTileAndPut(key, std::move(tile.value())); + t.tileCache->createTileAndPut(key, std::move(*tile)); return true; } } diff --git a/openspace.cfg b/openspace.cfg index 058d110b52..bf18c5ab08 100644 --- a/openspace.cfg +++ b/openspace.cfg @@ -140,7 +140,7 @@ ModuleConfigurations = { WebSocketInterface = "DefaultWebSocketInterface" }, CefWebGui = { - GuiScale = 2.1, + GuiScale = 1.0, Enabled = true, Visible = true } diff --git a/src/interaction/navigationhandler.cpp b/src/interaction/navigationhandler.cpp index 9c85dbbd3a..0fc2d0e09a 100644 --- a/src/interaction/navigationhandler.cpp +++ b/src/interaction/navigationhandler.cpp @@ -77,7 +77,7 @@ ghoul::Dictionary NavigationHandler::NavigationState::dictionary() const { cameraDict.setValue(KeyAim, aim); } if (up.has_value()) { - cameraDict.setValue(KeyUp, up.value()); + cameraDict.setValue(KeyUp, *up); if (std::abs(yaw) > Epsilon) { cameraDict.setValue(KeyYaw, yaw); @@ -213,7 +213,7 @@ void NavigationHandler::updateCamera(double deltaTime) { ghoul_assert(_camera != nullptr, "Camera must not be nullptr"); if (_pendingNavigationState.has_value()) { - applyNavigationState(_pendingNavigationState.value()); + applyNavigationState(*_pendingNavigationState); _orbitalNavigator.resetVelocities(); _pendingNavigationState.reset(); } @@ -269,7 +269,7 @@ void NavigationHandler::applyNavigationState(const NavigationHandler::Navigation glm::dvec3(referenceFrameTransform * glm::dvec4(ns.position, 1.0)); glm::dvec3 up = ns.up.has_value() ? - glm::normalize(referenceFrameTransform * ns.up.value()) : + glm::normalize(referenceFrameTransform * *ns.up) : glm::dvec3(0.0, 1.0, 0.0); // Construct vectors of a "neutral" view, i.e. when the aim is centered in view. diff --git a/src/interaction/navigationhandler_lua.inl b/src/interaction/navigationhandler_lua.inl index c7fe94143d..2b37abbd58 100644 --- a/src/interaction/navigationhandler_lua.inl +++ b/src/interaction/navigationhandler_lua.inl @@ -101,7 +101,7 @@ int getNavigationState(lua_State* L) { if (state.up.has_value()) { ghoul::lua::push(L, "Up"); - pushVector(L, state.up.value()); + pushVector(L, *state.up); lua_rawset(L, -3); } if (state.yaw != 0) { diff --git a/src/interaction/orbitalnavigator.cpp b/src/interaction/orbitalnavigator.cpp index 29a0e2d844..ef27b995bc 100644 --- a/src/interaction/orbitalnavigator.cpp +++ b/src/interaction/orbitalnavigator.cpp @@ -424,7 +424,7 @@ void OrbitalNavigator::updateCameraStateFromStates(double deltaTime) { const glm::dvec3 prevCameraPosition = _camera->positionVec3(); const glm::dvec3 anchorDisplacement = _previousAnchorNodePosition.has_value() ? - (anchorPos - _previousAnchorNodePosition.value()) : + (anchorPos - *_previousAnchorNodePosition) : glm::dvec3(0.0); CameraPose pose = { @@ -464,10 +464,10 @@ void OrbitalNavigator::updateCameraStateFromStates(double deltaTime) { if (_aimNode && _aimNode != _anchorNode && hasPreviousPositions) { const glm::dvec3 aimPos = _aimNode->worldPosition(); const glm::dvec3 cameraToAnchor = - _previousAnchorNodePosition.value() - prevCameraPosition; + *_previousAnchorNodePosition - prevCameraPosition; Displacement anchorToAim = { - _previousAimNodePosition.value() - _previousAnchorNodePosition.value(), + *_previousAimNodePosition - *_previousAnchorNodePosition, aimPos - anchorPos }; @@ -502,7 +502,7 @@ void OrbitalNavigator::updateCameraStateFromStates(double deltaTime) { glm::quat_cast(_anchorNode->worldRotationMatrix()); glm::dquat anchorNodeRotationDiff = _previousAnchorNodeRotation.has_value() ? - _previousAnchorNodeRotation.value() * glm::inverse(anchorRotation) : + *_previousAnchorNodeRotation * glm::inverse(anchorRotation) : glm::dquat(); _previousAnchorNodeRotation = anchorRotation; diff --git a/src/scripting/scriptengine.cpp b/src/scripting/scriptengine.cpp index 8728f0d0a4..7acba93ab3 100644 --- a/src/scripting/scriptengine.cpp +++ b/src/scripting/scriptengine.cpp @@ -168,7 +168,7 @@ bool ScriptEngine::runScript(const std::string& script, ScriptCallback callback) if (callback) { ghoul::Dictionary returnValue = ghoul::lua::loadArrayDictionaryFromString(script, _state); - callback.value()(returnValue); + callback(returnValue); } else { ghoul::lua::runScript(_state, script); } diff --git a/src/util/versionchecker.cpp b/src/util/versionchecker.cpp index 6ab9ffad73..c8236ed8f8 100644 --- a/src/util/versionchecker.cpp +++ b/src/util/versionchecker.cpp @@ -132,7 +132,7 @@ void VersionChecker::cancel() { } VersionChecker::SemanticVersion VersionChecker::latestVersion() { - return _latestVersion.value(); + return *_latestVersion; } bool operator<(const VersionChecker::SemanticVersion a, From b6b1817160da896508c8a257150d9b0d5b5806d4 Mon Sep 17 00:00:00 2001 From: Jonathas Costa Date: Thu, 30 Jan 2020 15:10:15 -0500 Subject: [PATCH 02/10] Number of shadow samples are now a compiling constant. --- modules/globebrowsing/shaders/rings_fs.glsl | 24 +++++++------ modules/globebrowsing/src/ringscomponent.cpp | 37 ++++++++++++++------ modules/globebrowsing/src/ringscomponent.h | 4 +-- modules/globebrowsing/src/shadowcomponent.h | 11 +++--- 4 files changed, 46 insertions(+), 30 deletions(-) diff --git a/modules/globebrowsing/shaders/rings_fs.glsl b/modules/globebrowsing/shaders/rings_fs.glsl index bae6535326..608ac8e7aa 100644 --- a/modules/globebrowsing/shaders/rings_fs.glsl +++ b/modules/globebrowsing/shaders/rings_fs.glsl @@ -25,6 +25,8 @@ #include "PowerScaling/powerScaling_fs.hglsl" #include "fragment.glsl" +#define NSSamples #{nShadowSamples} + in vec2 vs_st; in float vs_screenSpaceDepth; in vec4 shadowCoords; @@ -36,7 +38,7 @@ uniform float transparency; uniform vec3 sunPosition; uniform float _nightFactor; -uniform int nShadowSamples; +//uniform int nShadowSamples; uniform float zFightingPercentage; // temp @@ -83,18 +85,18 @@ Fragment getFragment() { normalizedShadowCoords.w = 1.0; float sum = 0; - for (int i = 0; i < nShadowSamples; ++i) { - sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2(-nShadowSamples + i, -nShadowSamples + i)); - sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2(-nShadowSamples + i, 0)); - sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2(-nShadowSamples + i, nShadowSamples - i)); - sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( 0 , -nShadowSamples + i)); - sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( 0 , nShadowSamples - i)); - sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( nShadowSamples - i, -nShadowSamples + i)); - sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( nShadowSamples - i, 0)); - sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( nShadowSamples - i, nShadowSamples - i)); + for (int i = 0; i < NSSamples; ++i) { + sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2(-NSSamples + i, -NSSamples + i)); + sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2(-NSSamples + i, 0)); + sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2(-NSSamples + i, NSSamples - i)); + sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( 0 , -NSSamples + i)); + sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( 0 , NSSamples - i)); + sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( NSSamples - i, -NSSamples + i)); + sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( NSSamples - i, 0)); + sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( NSSamples - i, NSSamples - i)); } sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2(0, 0)); - shadow = sum / (8.0 * nShadowSamples + 1.f); + shadow = sum / (8.0 * NSSamples + 1.f); } // The normal for the one plane depends on whether we are dealing diff --git a/modules/globebrowsing/src/ringscomponent.cpp b/modules/globebrowsing/src/ringscomponent.cpp index ae65411e93..a0ad50e103 100644 --- a/modules/globebrowsing/src/ringscomponent.cpp +++ b/modules/globebrowsing/src/ringscomponent.cpp @@ -49,10 +49,12 @@ #include namespace { - constexpr const std::array UniformNames = { + constexpr const char* _loggerCat = "RingsComponent"; + + constexpr const std::array UniformNames = { "modelViewProjectionMatrix", "textureOffset", "transparency", "_nightFactor", "sunPosition", "ringTexture", "shadowMatrix", "shadowMapTexture", - "nShadowSamples", "zFightingPercentage" + "zFightingPercentage" }; constexpr const std::array GeomUniformNames = { @@ -243,6 +245,7 @@ void RingsComponent::initialize() { if (_ringsDictionary.hasKey(NumberShadowSamplesInfo.identifier)) { _nShadowSamples = _ringsDictionary.value(NumberShadowSamplesInfo.identifier); } + _nShadowSamples.onChange([this]() { compileShadowShader(); }); addProperty(_nShadowSamples); addProperty(_transparency); @@ -253,11 +256,7 @@ bool RingsComponent::isReady() const { } void RingsComponent::initializeGL() { - _shader = global::renderEngine.buildRenderProgram( - "RingsProgram", - absPath("${MODULE_GLOBEBROWSING}/shaders/rings_vs.glsl"), - absPath("${MODULE_GLOBEBROWSING}/shaders/rings_fs.glsl") - ); + compileShadowShader(); _geometryOnlyShader = global::renderEngine.buildRenderProgram( "RingsGeomOnlyProgram", @@ -326,7 +325,7 @@ void RingsComponent::draw(const RenderData& data, _shader->setUniform(_uniformCache.transparency, _transparency); _shader->setUniform(_uniformCache.nightFactor, _nightFactor); _shader->setUniform(_uniformCache.sunPosition, _sunPosition); - _shader->setUniform(_uniformCache.nShadowSamples, _nShadowSamples); + //_shader->setUniform(_uniformCache.nShadowSamples, _nShadowSamples); _shader->setUniform(_uniformCache.zFightingPercentage, _zFightingPercentage); ringTextureUnit.activate(); @@ -377,8 +376,8 @@ void RingsComponent::draw(const RenderData& data, void RingsComponent::update(const UpdateData& data) { if (_shader->isDirty()) { - _shader->rebuildFromFile(); - ghoul::opengl::updateUniformLocations(*_shader, _uniformCache, UniformNames); + //_shader->rebuildFromFile(); + compileShadowShader(); } if (_geometryOnlyShader->isDirty()) { @@ -474,6 +473,24 @@ void RingsComponent::createPlane() { ); } +void RingsComponent::compileShadowShader() { + ghoul::Dictionary dict; + dict.setValue("nShadowSamples", std::to_string(_nShadowSamples.value())); + + try { + _shader = global::renderEngine.buildRenderProgram( + "RingsProgram", + absPath("${MODULE_GLOBEBROWSING}/shaders/rings_vs.glsl"), + absPath("${MODULE_GLOBEBROWSING}/shaders/rings_fs.glsl"), + dict + ); + } + catch (const ghoul::RuntimeError& e) { + LERROR(e.message); + } + ghoul::opengl::updateUniformLocations(*_shader, _uniformCache, UniformNames); +} + bool RingsComponent::isEnabled() const { return _enabled; } diff --git a/modules/globebrowsing/src/ringscomponent.h b/modules/globebrowsing/src/ringscomponent.h index b42313e692..d0373325f0 100644 --- a/modules/globebrowsing/src/ringscomponent.h +++ b/modules/globebrowsing/src/ringscomponent.h @@ -77,6 +77,7 @@ public: private: void loadTexture(); void createPlane(); + void compileShadowShader(); properties::StringProperty _texturePath; properties::FloatProperty _size; @@ -90,8 +91,7 @@ private: std::unique_ptr _shader; std::unique_ptr _geometryOnlyShader; UniformCache(modelViewProjectionMatrix, textureOffset, transparency, nightFactor, - sunPosition, ringTexture, shadowMatrix, shadowMapTexture, nShadowSamples, - zFightingPercentage + sunPosition, ringTexture, shadowMatrix, shadowMapTexture, zFightingPercentage ) _uniformCache; UniformCache(modelViewProjectionMatrix, textureOffset, ringTexture) _geomUniformCache; diff --git a/modules/globebrowsing/src/shadowcomponent.h b/modules/globebrowsing/src/shadowcomponent.h index 6be4766419..4c6699d889 100644 --- a/modules/globebrowsing/src/shadowcomponent.h +++ b/modules/globebrowsing/src/shadowcomponent.h @@ -108,13 +108,10 @@ private: int _shadowDepthTextureWidth = 4096; bool _dynamicDepthTextureRes = true; - // All of these initializations should probably be 0 since they are GLuints? - GLuint _shadowDepthTexture = -1; - GLuint _positionInLightSpaceTexture = -1; - GLuint _shadowFBO = -1; - GLuint _firstPassSubroutine = -1; - GLuint _secondPassSubroutine = 1; - GLint _defaultFBO = -1; + GLuint _shadowDepthTexture = 0; + GLuint _positionInLightSpaceTexture = 0; + GLuint _shadowFBO = 0; + GLint _defaultFBO = 0; GLint _mViewport[4]; GLboolean _faceCulling; From 823e83047dcb069ff45ee063991336c6f2297ae3 Mon Sep 17 00:00:00 2001 From: Jonathas Costa Date: Thu, 30 Jan 2020 17:46:53 -0500 Subject: [PATCH 03/10] Second round adding constant parameters. --- .../globebrowsing/shaders/renderer_fs.glsl | 44 +++++++++++++------ modules/globebrowsing/shaders/rings_fs.glsl | 32 ++++++++------ modules/globebrowsing/src/renderableglobe.cpp | 10 ++++- modules/globebrowsing/src/ringscomponent.cpp | 7 +-- 4 files changed, 61 insertions(+), 32 deletions(-) diff --git a/modules/globebrowsing/shaders/renderer_fs.glsl b/modules/globebrowsing/shaders/renderer_fs.glsl index c08f078622..03276eac18 100644 --- a/modules/globebrowsing/shaders/renderer_fs.glsl +++ b/modules/globebrowsing/shaders/renderer_fs.glsl @@ -60,9 +60,13 @@ uniform float orenNayarRoughness; #endif #if SHADOW_MAPPING_ENABLED + +#define NSSamplesMinusOne #{nShadowSamples} +#define NSSamples (NSSamplesMinusOne + 1) + in vec4 shadowCoords; uniform sampler2DShadow shadowMapTexture; -uniform int nShadowSamples; +//uniform int nShadowSamples; uniform float zFightingPercentage; #endif @@ -273,19 +277,33 @@ Fragment getFragment() { normalizedShadowCoords.xy = normalizedShadowCoords.xy / normalizedShadowCoords.w; normalizedShadowCoords.w = 1.0; - float sum = 0; - for (int i = 0; i < nShadowSamples; ++i) { - sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2(-nShadowSamples + i, -nShadowSamples + i)); - sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2(-nShadowSamples + i, 0)); - sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2(-nShadowSamples + i, nShadowSamples - i)); - sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( 0 , -nShadowSamples + i)); - sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( 0 , nShadowSamples - i)); - sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( nShadowSamples - i, -nShadowSamples + i)); - sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( nShadowSamples - i, 0)); - sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( nShadowSamples - i, nShadowSamples - i)); - } + float sum = 0; + // for (int i = 0; i < nShadowSamples; ++i) { + // sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2(-nShadowSamples + i, -nShadowSamples + i)); + // sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2(-nShadowSamples + i, 0)); + // sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2(-nShadowSamples + i, nShadowSamples - i)); + // sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( 0 , -nShadowSamples + i)); + // sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( 0 , nShadowSamples - i)); + // sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( nShadowSamples - i, -nShadowSamples + i)); + // sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( nShadowSamples - i, 0)); + // sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( nShadowSamples - i, nShadowSamples - i)); + // } + // sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2(0, 0)); + // shadow = sum / (8.0 * nShadowSamples + 1.f); + + #for i in 0..#{nShadowSamples} + sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2(-NSSamples + #{i}, -NSSamples + #{i})); + sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2(-NSSamples + #{i}, 0)); + sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2(-NSSamples + #{i}, NSSamples - #{i})); + sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( 0 , -NSSamples + #{i})); + sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( 0 , NSSamples - #{i})); + sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( NSSamples - #{i}, -NSSamples + #{i})); + sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( NSSamples - #{i}, 0)); + sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( NSSamples - #{i}, NSSamples - #{i})); + //} + #endfor sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2(0, 0)); - shadow = sum / (8.0 * nShadowSamples + 1.f); + shadow = sum / (8.0 * NSSamples + 1.f); } frag.color.xyz *= shadow < 0.99 ? clamp(shadow + 0.3, 0.0, 1.0) : shadow; #endif diff --git a/modules/globebrowsing/shaders/rings_fs.glsl b/modules/globebrowsing/shaders/rings_fs.glsl index 608ac8e7aa..7aaa3f0e8d 100644 --- a/modules/globebrowsing/shaders/rings_fs.glsl +++ b/modules/globebrowsing/shaders/rings_fs.glsl @@ -25,7 +25,8 @@ #include "PowerScaling/powerScaling_fs.hglsl" #include "fragment.glsl" -#define NSSamples #{nShadowSamples} +#define NSSamplesMinusOne #{nShadowSamples} +#define NSSamples (NSSamplesMinusOne + 1) in vec2 vs_st; in float vs_screenSpaceDepth; @@ -44,6 +45,7 @@ uniform float zFightingPercentage; // temp in vec4 fragPosInLightSpace; + Fragment getFragment() { // Moving the origin to the center vec2 st = (vs_st - vec2(0.5)) * 2.0; @@ -85,20 +87,22 @@ Fragment getFragment() { normalizedShadowCoords.w = 1.0; float sum = 0; - for (int i = 0; i < NSSamples; ++i) { - sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2(-NSSamples + i, -NSSamples + i)); - sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2(-NSSamples + i, 0)); - sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2(-NSSamples + i, NSSamples - i)); - sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( 0 , -NSSamples + i)); - sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( 0 , NSSamples - i)); - sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( NSSamples - i, -NSSamples + i)); - sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( NSSamples - i, 0)); - sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( NSSamples - i, NSSamples - i)); - } + //for (int i = 0; i < NSSamples; ++i) { + #for i in 0..#{nShadowSamples} + sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2(-NSSamples + #{i}, -NSSamples + #{i})); + sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2(-NSSamples + #{i}, 0)); + sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2(-NSSamples + #{i}, NSSamples - #{i})); + sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( 0 , -NSSamples + #{i})); + sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( 0 , NSSamples - #{i})); + sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( NSSamples - #{i}, -NSSamples + #{i})); + sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( NSSamples - #{i}, 0)); + sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( NSSamples - #{i}, NSSamples - #{i})); + //} + #endfor sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2(0, 0)); - shadow = sum / (8.0 * NSSamples + 1.f); + shadow = clamp(sum / (8.0 * NSSamples + 1.f), 0.35, 1.0); } - + // The normal for the one plane depends on whether we are dealing // with a front facing or back facing fragment vec3 normal; @@ -119,7 +123,7 @@ Fragment getFragment() { Fragment frag; - frag.color = (0.65 * diffuse * shadow) + diffuse * 0.35; + frag.color = diffuse * shadow; frag.depth = vs_screenSpaceDepth; frag.gPosition = vec4(1e30, 1e30, 1e30, 1.0); frag.gNormal = vec4(normal, 1.0); diff --git a/modules/globebrowsing/src/renderableglobe.cpp b/modules/globebrowsing/src/renderableglobe.cpp index 988f6f0caa..b8357a6548 100644 --- a/modules/globebrowsing/src/renderableglobe.cpp +++ b/modules/globebrowsing/src/renderableglobe.cpp @@ -565,6 +565,9 @@ RenderableGlobe::RenderableGlobe(const ghoul::Dictionary& dictionary) _shadowMappingPropertyOwner.addProperty(_generalProperties.shadowMapping); _shadowMappingPropertyOwner.addProperty(_generalProperties.zFightingPercentage); _shadowMappingPropertyOwner.addProperty(_generalProperties.nShadowSamples); + _generalProperties.nShadowSamples.onChange([&]() { + _shadersNeedRecompilation = true; + }); addPropertySubOwner(_shadowMappingPropertyOwner); _generalProperties.targetLodScaleFactor.onChange([this]() { @@ -1330,7 +1333,7 @@ void RenderableGlobe::renderChunkGlobally(const Chunk& chunk, const RenderData& glBindTexture(GL_TEXTURE_2D, shadowData.shadowDepthTexture); program.setUniform("shadowMapTexture", shadowMapUnit); - program.setUniform("nShadowSamples", _generalProperties.nShadowSamples); + //program.setUniform("nShadowSamples", _generalProperties.nShadowSamples); program.setUniform("zFightingPercentage", _generalProperties.zFightingPercentage); } @@ -1458,7 +1461,7 @@ void RenderableGlobe::renderChunkLocally(const Chunk& chunk, const RenderData& d glBindTexture(GL_TEXTURE_2D, shadowData.shadowDepthTexture); program.setUniform("shadowMapTexture", shadowMapUnit); - program.setUniform("nShadowSamples", _generalProperties.nShadowSamples); + //program.setUniform("nShadowSamples", _generalProperties.nShadowSamples); program.setUniform("zFightingPercentage", _generalProperties.zFightingPercentage); } @@ -1726,6 +1729,9 @@ void RenderableGlobe::recompileShaders() { shaderDictionary.setValue(p.first, p.second); } + // Shadow Mapping Samples + shaderDictionary.setValue("nShadowSamples", _generalProperties.nShadowSamples - 1); + // // Create local shader // diff --git a/modules/globebrowsing/src/ringscomponent.cpp b/modules/globebrowsing/src/ringscomponent.cpp index a0ad50e103..afa5319d0d 100644 --- a/modules/globebrowsing/src/ringscomponent.cpp +++ b/modules/globebrowsing/src/ringscomponent.cpp @@ -176,7 +176,7 @@ RingsComponent::RingsComponent(const ghoul::Dictionary& dictionary) , _transparency(TransparencyInfo, 0.15f, 0.f, 1.f) , _enabled({ "Enabled", "Enabled", "Enable/Disable Rings" }, true) , _zFightingPercentage(ZFightingPercentageInfo, 0.995f, 0.000001f, 1.f) - , _nShadowSamples(NumberShadowSamplesInfo, 2, 1, 20) + , _nShadowSamples(NumberShadowSamplesInfo, 2, 1, 7) , _ringsDictionary(dictionary) { using ghoul::filesystem::File; @@ -327,7 +327,7 @@ void RingsComponent::draw(const RenderData& data, _shader->setUniform(_uniformCache.sunPosition, _sunPosition); //_shader->setUniform(_uniformCache.nShadowSamples, _nShadowSamples); _shader->setUniform(_uniformCache.zFightingPercentage, _zFightingPercentage); - + ringTextureUnit.activate(); _texture->bind(); _shader->setUniform(_uniformCache.ringTexture, ringTextureUnit); @@ -475,9 +475,10 @@ void RingsComponent::createPlane() { void RingsComponent::compileShadowShader() { ghoul::Dictionary dict; - dict.setValue("nShadowSamples", std::to_string(_nShadowSamples.value())); + dict.setValue("nShadowSamples", std::to_string(_nShadowSamples - 1)); try { + global::renderEngine.removeRenderProgram(_shader.get()); _shader = global::renderEngine.buildRenderProgram( "RingsProgram", absPath("${MODULE_GLOBEBROWSING}/shaders/rings_vs.glsl"), From 4651f6db3831033309230f8704bdd3c9811f6ed8 Mon Sep 17 00:00:00 2001 From: Jonathas Costa Date: Thu, 30 Jan 2020 18:10:16 -0500 Subject: [PATCH 04/10] Set the maximum number of samples to 7. --- modules/globebrowsing/src/renderableglobe.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/globebrowsing/src/renderableglobe.cpp b/modules/globebrowsing/src/renderableglobe.cpp index b8357a6548..0392bad123 100644 --- a/modules/globebrowsing/src/renderableglobe.cpp +++ b/modules/globebrowsing/src/renderableglobe.cpp @@ -517,7 +517,7 @@ RenderableGlobe::RenderableGlobe(const ghoul::Dictionary& dictionary) BoolProperty(EclipseHardShadowsInfo, false), BoolProperty(ShadowMappingInfo, false), FloatProperty(ZFightingPercentageInfo, 0.995f, 0.000001f, 1.f), - IntProperty(NumberShadowSamplesInfo, 5, 1, 20), + IntProperty(NumberShadowSamplesInfo, 5, 1, 7), FloatProperty(TargetLodScaleFactorInfo, 15.f, 1.f, 50.f), FloatProperty(CurrentLodScaleFactorInfo, 15.f, 1.f, 50.f), FloatProperty(CameraMinHeightInfo, 100.f, 0.f, 1000.f), From 9b43b083680f43254a2245821902e38c6cd0a0a2 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Fri, 31 Jan 2020 08:22:40 -0500 Subject: [PATCH 05/10] Convert property owner identifiers to camel case --- modules/globebrowsing/src/renderableglobe.cpp | 4 ++-- modules/globebrowsing/src/shadowcomponent.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/globebrowsing/src/renderableglobe.cpp b/modules/globebrowsing/src/renderableglobe.cpp index d2e075bfd0..626fa9c023 100644 --- a/modules/globebrowsing/src/renderableglobe.cpp +++ b/modules/globebrowsing/src/renderableglobe.cpp @@ -186,7 +186,7 @@ namespace { constexpr openspace::properties::Property::PropertyInfo ShadowMappingInfo = { "ShadowMapping", - "Shadow-Mapping", + "Shadow Mapping", "Enables shadow mapping algorithm. Used by renderable rings too." }; @@ -524,7 +524,7 @@ RenderableGlobe::RenderableGlobe(const ghoul::Dictionary& dictionary) FloatProperty(OrenNayarRoughnessInfo, 0.f, 0.f, 1.f), IntProperty(NActiveLayersInfo, 0, 0, OpenGLCap.maxTextureUnits() / 3) }) - , _shadowMappingPropertyOwner({ "Shadow-Mapping" }) + , _shadowMappingPropertyOwner({ "ShadowMapping" }) , _debugPropertyOwner({ "Debug" }) , _grid(DefaultSkirtedGridSegments, DefaultSkirtedGridSegments) , _leftRoot(Chunk(LeftHemisphereIndex)) diff --git a/modules/globebrowsing/src/shadowcomponent.cpp b/modules/globebrowsing/src/shadowcomponent.cpp index 4e528f1ef0..ffc8f89fe0 100644 --- a/modules/globebrowsing/src/shadowcomponent.cpp +++ b/modules/globebrowsing/src/shadowcomponent.cpp @@ -166,7 +166,7 @@ documentation::Documentation ShadowComponent::Documentation() { } ShadowComponent::ShadowComponent(const ghoul::Dictionary& dictionary) - : properties::PropertyOwner({ "Shadows-Component" }) + : properties::PropertyOwner({ "ShadowsComponent" }) , _saveDepthTexture(SaveDepthTextureInfo) , _distanceFraction(DistanceFractionInfo, 20, 1, 10000) , _enabled({ "Enabled", "Enabled", "Enable/Disable Shadows" }, true) From a69e9bc60fa4e5f1464e3ff1beff4da484022093 Mon Sep 17 00:00:00 2001 From: Micah Acinapura Date: Fri, 31 Jan 2020 10:15:48 -0500 Subject: [PATCH 06/10] added loading screen fix for hdpi --- src/rendering/loadingscreen.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/rendering/loadingscreen.cpp b/src/rendering/loadingscreen.cpp index 6ef24cdb46..959472f5d7 100644 --- a/src/rendering/loadingscreen.cpp +++ b/src/rendering/loadingscreen.cpp @@ -159,7 +159,7 @@ void LoadingScreen::render() { const glm::vec2 dpiScaling = global::windowDelegate.dpiScaling(); const glm::ivec2 res = - glm::vec2(global::windowDelegate.currentSubwindowSize()) / dpiScaling; + glm::vec2(global::windowDelegate.currentSubwindowSize()) * dpiScaling; float screenAspectRatio = static_cast(res.x) / static_cast(res.y); @@ -310,7 +310,6 @@ void LoadingScreen::render() { ProgressbarCenter.y + progressbarSize.y }; - for (Item& item : _items) { if (!item.hasLocation) { // Compute a new location From 1b4e32d8f232f087ff21de01e2af69f91a86a970 Mon Sep 17 00:00:00 2001 From: Micah Acinapura Date: Fri, 31 Jan 2020 10:28:37 -0500 Subject: [PATCH 07/10] cleanup of ringshader; fix singlefisheyegui --- config/single_fisheye_gui.xml | 3 +-- modules/globebrowsing/shaders/renderer_fs.glsl | 15 --------------- modules/globebrowsing/shaders/rings_fs.glsl | 3 --- modules/globebrowsing/src/ringscomponent.cpp | 2 -- 4 files changed, 1 insertion(+), 22 deletions(-) diff --git a/config/single_fisheye_gui.xml b/config/single_fisheye_gui.xml index f6ad4d9dd4..b4a201f4c6 100644 --- a/config/single_fisheye_gui.xml +++ b/config/single_fisheye_gui.xml @@ -34,8 +34,7 @@ - - + diff --git a/modules/globebrowsing/shaders/renderer_fs.glsl b/modules/globebrowsing/shaders/renderer_fs.glsl index 03276eac18..c32ab6bb8e 100644 --- a/modules/globebrowsing/shaders/renderer_fs.glsl +++ b/modules/globebrowsing/shaders/renderer_fs.glsl @@ -66,7 +66,6 @@ uniform float orenNayarRoughness; in vec4 shadowCoords; uniform sampler2DShadow shadowMapTexture; -//uniform int nShadowSamples; uniform float zFightingPercentage; #endif @@ -278,19 +277,6 @@ Fragment getFragment() { normalizedShadowCoords.w = 1.0; float sum = 0; - // for (int i = 0; i < nShadowSamples; ++i) { - // sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2(-nShadowSamples + i, -nShadowSamples + i)); - // sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2(-nShadowSamples + i, 0)); - // sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2(-nShadowSamples + i, nShadowSamples - i)); - // sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( 0 , -nShadowSamples + i)); - // sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( 0 , nShadowSamples - i)); - // sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( nShadowSamples - i, -nShadowSamples + i)); - // sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( nShadowSamples - i, 0)); - // sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( nShadowSamples - i, nShadowSamples - i)); - // } - // sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2(0, 0)); - // shadow = sum / (8.0 * nShadowSamples + 1.f); - #for i in 0..#{nShadowSamples} sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2(-NSSamples + #{i}, -NSSamples + #{i})); sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2(-NSSamples + #{i}, 0)); @@ -300,7 +286,6 @@ Fragment getFragment() { sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( NSSamples - #{i}, -NSSamples + #{i})); sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( NSSamples - #{i}, 0)); sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( NSSamples - #{i}, NSSamples - #{i})); - //} #endfor sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2(0, 0)); shadow = sum / (8.0 * NSSamples + 1.f); diff --git a/modules/globebrowsing/shaders/rings_fs.glsl b/modules/globebrowsing/shaders/rings_fs.glsl index 7aaa3f0e8d..3023de292f 100644 --- a/modules/globebrowsing/shaders/rings_fs.glsl +++ b/modules/globebrowsing/shaders/rings_fs.glsl @@ -39,7 +39,6 @@ uniform float transparency; uniform vec3 sunPosition; uniform float _nightFactor; -//uniform int nShadowSamples; uniform float zFightingPercentage; // temp @@ -87,7 +86,6 @@ Fragment getFragment() { normalizedShadowCoords.w = 1.0; float sum = 0; - //for (int i = 0; i < NSSamples; ++i) { #for i in 0..#{nShadowSamples} sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2(-NSSamples + #{i}, -NSSamples + #{i})); sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2(-NSSamples + #{i}, 0)); @@ -97,7 +95,6 @@ Fragment getFragment() { sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( NSSamples - #{i}, -NSSamples + #{i})); sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( NSSamples - #{i}, 0)); sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( NSSamples - #{i}, NSSamples - #{i})); - //} #endfor sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2(0, 0)); shadow = clamp(sum / (8.0 * NSSamples + 1.f), 0.35, 1.0); diff --git a/modules/globebrowsing/src/ringscomponent.cpp b/modules/globebrowsing/src/ringscomponent.cpp index afa5319d0d..a920af6b59 100644 --- a/modules/globebrowsing/src/ringscomponent.cpp +++ b/modules/globebrowsing/src/ringscomponent.cpp @@ -325,7 +325,6 @@ void RingsComponent::draw(const RenderData& data, _shader->setUniform(_uniformCache.transparency, _transparency); _shader->setUniform(_uniformCache.nightFactor, _nightFactor); _shader->setUniform(_uniformCache.sunPosition, _sunPosition); - //_shader->setUniform(_uniformCache.nShadowSamples, _nShadowSamples); _shader->setUniform(_uniformCache.zFightingPercentage, _zFightingPercentage); ringTextureUnit.activate(); @@ -376,7 +375,6 @@ void RingsComponent::draw(const RenderData& data, void RingsComponent::update(const UpdateData& data) { if (_shader->isDirty()) { - //_shader->rebuildFromFile(); compileShadowShader(); } From f15dc43e9dcbb7bd4daffd51d1558e49cc9d648f Mon Sep 17 00:00:00 2001 From: Micah Acinapura Date: Fri, 31 Jan 2020 10:31:41 -0500 Subject: [PATCH 08/10] uniform cleanup --- modules/globebrowsing/src/renderableglobe.cpp | 2 -- modules/globebrowsing/src/ringscomponent.cpp | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/modules/globebrowsing/src/renderableglobe.cpp b/modules/globebrowsing/src/renderableglobe.cpp index 84b2578442..44fb3d6041 100644 --- a/modules/globebrowsing/src/renderableglobe.cpp +++ b/modules/globebrowsing/src/renderableglobe.cpp @@ -1333,7 +1333,6 @@ void RenderableGlobe::renderChunkGlobally(const Chunk& chunk, const RenderData& glBindTexture(GL_TEXTURE_2D, shadowData.shadowDepthTexture); program.setUniform("shadowMapTexture", shadowMapUnit); - //program.setUniform("nShadowSamples", _generalProperties.nShadowSamples); program.setUniform("zFightingPercentage", _generalProperties.zFightingPercentage); } @@ -1461,7 +1460,6 @@ void RenderableGlobe::renderChunkLocally(const Chunk& chunk, const RenderData& d glBindTexture(GL_TEXTURE_2D, shadowData.shadowDepthTexture); program.setUniform("shadowMapTexture", shadowMapUnit); - //program.setUniform("nShadowSamples", _generalProperties.nShadowSamples); program.setUniform("zFightingPercentage", _generalProperties.zFightingPercentage); } diff --git a/modules/globebrowsing/src/ringscomponent.cpp b/modules/globebrowsing/src/ringscomponent.cpp index a920af6b59..65801085cf 100644 --- a/modules/globebrowsing/src/ringscomponent.cpp +++ b/modules/globebrowsing/src/ringscomponent.cpp @@ -326,7 +326,7 @@ void RingsComponent::draw(const RenderData& data, _shader->setUniform(_uniformCache.nightFactor, _nightFactor); _shader->setUniform(_uniformCache.sunPosition, _sunPosition); _shader->setUniform(_uniformCache.zFightingPercentage, _zFightingPercentage); - + ringTextureUnit.activate(); _texture->bind(); _shader->setUniform(_uniformCache.ringTexture, ringTextureUnit); From faccb3d948b6ac18f9abedd6183b7d2840589ff3 Mon Sep 17 00:00:00 2001 From: Micah Acinapura Date: Mon, 10 Feb 2020 16:55:21 -0500 Subject: [PATCH 09/10] conditional uniform set for macos --- modules/base/rendering/renderabletrail.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/base/rendering/renderabletrail.cpp b/modules/base/rendering/renderabletrail.cpp index b8904a9791..7a5ee1f9ed 100644 --- a/modules/base/rendering/renderabletrail.cpp +++ b/modules/base/rendering/renderabletrail.cpp @@ -366,10 +366,13 @@ void RenderableTrail::render(const RenderData& data, RendererTasks&) { p->setUniform(c.nVertices, nVertices); - glm::ivec2 resolution = global::renderEngine.renderingResolution(); - p->setUniform(c.resolution, resolution); - p->setUniform(c.lineWidth, ceil((2.f * 1.f + lw) * std::sqrt(2.f))); + #ifndef __APPLE__ + glm::ivec2 resolution = global::renderEngine.renderingResolution(); + p->setUniform(c.resolution, resolution); + + p->setUniform(c.lineWidth, ceil((2.f * 1.f + lw) * std::sqrt(2.f))); + #endif if (renderPoints) { // The stride parameter determines the distance between larger points and From cae91a5b7c5ed16fc0e5cc276a0759ab0ccc241b Mon Sep 17 00:00:00 2001 From: Micah Acinapura Date: Mon, 10 Feb 2020 16:55:48 -0500 Subject: [PATCH 10/10] univeral path for tle/iss --- .../scene/solarsystem/planets/earth/satellites/misc/iss.asset | 2 +- data/assets/util/tle_helper.asset | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/misc/iss.asset b/data/assets/scene/solarsystem/planets/earth/satellites/misc/iss.asset index 9fcc395747..4f36cfc683 100644 --- a/data/assets/scene/solarsystem/planets/earth/satellites/misc/iss.asset +++ b/data/assets/scene/solarsystem/planets/earth/satellites/misc/iss.asset @@ -20,7 +20,7 @@ local initializeAndAddNodes = function() local lineElement = satelliteHelper.makeSingleLineElement(tle, filename) local period = satelliteHelper.getPeriodFromElement(lineElement) - local path = tle .. "\\" .. filename + local path = tle .. "/" .. filename -- TLE data is only relevant in EarthInertial frame which means the model -- will inherit some irrelevant rotations from its parent. To get around that diff --git a/data/assets/util/tle_helper.asset b/data/assets/util/tle_helper.asset index 9aad298ebf..92293479c3 100644 --- a/data/assets/util/tle_helper.asset +++ b/data/assets/util/tle_helper.asset @@ -38,7 +38,7 @@ function isValidTLEFileFormat(lineArr) end local makeSingleLineElement = function(tle, filename) - local path = tle .. "\\" .. filename + local path = tle .. "/" .. filename local file = io.open(path, "r") assert(file, "File not found: " .. path)