From a232a1a0a777601b197f3da883ea693607693164 Mon Sep 17 00:00:00 2001 From: Kalle Bladin Date: Fri, 14 Jul 2017 22:48:32 +0200 Subject: [PATCH 1/2] Fix compilation warnings. --- .../globebrowsing/cache/texturecontainer.h | 3 ++- .../chunk/culling/frustumculler.cpp | 2 +- .../globebrowsing/globebrowsingmodule_lua.inl | 1 - modules/globebrowsing/globes/pointglobe.cpp | 22 +++++++++---------- modules/globebrowsing/meshes/trianglesoup.h | 1 - .../rendering/layer/layeradjustment.cpp | 10 ++++----- .../rendering/layer/layermanager.cpp | 3 +++ .../tile/rawtiledatareader/tiledatatype.cpp | 17 ++++++++++---- .../tile/tileprovider/defaulttileprovider.cpp | 2 -- .../tile/tileprovider/tileprovider.cpp | 4 ---- .../tile/tileprovider/tileproviderbylevel.cpp | 3 ++- 11 files changed, 37 insertions(+), 31 deletions(-) diff --git a/modules/globebrowsing/cache/texturecontainer.h b/modules/globebrowsing/cache/texturecontainer.h index 5035587abd..bcab70e17c 100644 --- a/modules/globebrowsing/cache/texturecontainer.h +++ b/modules/globebrowsing/cache/texturecontainer.h @@ -68,8 +68,9 @@ public: private: std::vector> _textures; - size_t _freeTexture; + const TileTextureInitData _initData; + size_t _freeTexture; size_t _numTextures; }; diff --git a/modules/globebrowsing/chunk/culling/frustumculler.cpp b/modules/globebrowsing/chunk/culling/frustumculler.cpp index 090d91ba4a..8d3c5ee849 100644 --- a/modules/globebrowsing/chunk/culling/frustumculler.cpp +++ b/modules/globebrowsing/chunk/culling/frustumculler.cpp @@ -40,7 +40,7 @@ bool FrustumCuller::isCullable(const Chunk& chunk, const RenderData& data) { // Calculate the MVP matrix glm::dmat4 modelTransform = chunk.owner().modelTransform(); glm::dmat4 viewTransform = glm::dmat4(data.camera.combinedViewMatrix()); - glm::dmat4 modelViewProjectionTransform = glm::dmat4(data.camera.projectionMatrix()) + glm::dmat4 modelViewProjectionTransform = glm::dmat4(data.camera.sgctInternal.projectionMatrix()) * viewTransform * modelTransform; const std::vector& corners = chunk.getBoundingPolyhedronCorners(); diff --git a/modules/globebrowsing/globebrowsingmodule_lua.inl b/modules/globebrowsing/globebrowsingmodule_lua.inl index c5fe4bf5db..0ac27b6baf 100644 --- a/modules/globebrowsing/globebrowsingmodule_lua.inl +++ b/modules/globebrowsing/globebrowsingmodule_lua.inl @@ -48,7 +48,6 @@ int addLayer(lua_State* L) { // Argument locations const int GlobeLocation = -3; const int LayerGroupLocation = -2; - const int DictionaryLocation = -1; int nArguments = lua_gettop(L); if (nArguments != 3) { diff --git a/modules/globebrowsing/globes/pointglobe.cpp b/modules/globebrowsing/globes/pointglobe.cpp index f1cc79a4c3..110571ae35 100644 --- a/modules/globebrowsing/globes/pointglobe.cpp +++ b/modules/globebrowsing/globes/pointglobe.cpp @@ -69,14 +69,14 @@ bool PointGlobe::initialize() { glBindVertexArray(_vaoID); - std::array quadVertexData = { - glm::vec2(-1.0f, -1.0f), - glm::vec2(1.0f, -1.0f), - glm::vec2(-1.0f, 1.0f), - glm::vec2(-1.0f, 1.0f), - glm::vec2(1.0f, -1.0f), - glm::vec2(1.0f, 1.0f) - }; + std::array quadVertexData = {{ + glm::vec2(-1.0f, -1.0f), + glm::vec2(1.0f, -1.0f), + glm::vec2(-1.0f, 1.0f), + glm::vec2(-1.0f, 1.0f), + glm::vec2(1.0f, -1.0f), + glm::vec2(1.0f, 1.0f) + }}; // Vertex buffer glBindBuffer(GL_ARRAY_BUFFER, _vertexBufferID); @@ -121,7 +121,7 @@ void PointGlobe::render(const RenderData& data) { float avgRadius = _owner.ellipsoid().averageRadius(); float lightIntensity = _lightIntensity.value() * data.modelTransform.scale * avgRadius / distanceToBody; float lightIntensityClamped = glm::min(lightIntensity, _intensityClamp.value()); - float lightOverflow = glm::max(lightIntensity - lightIntensityClamped, 0.0f); + //float lightOverflow = glm::max(lightIntensity - lightIntensityClamped, 0.0f); float billboardRadius = lightIntensityClamped * distanceToBody; glm::dmat4 scaleTransform = glm::scale(glm::dmat4(1.0), glm::dvec3(billboardRadius)); @@ -134,8 +134,8 @@ void PointGlobe::render(const RenderData& data) { glm::inverse(rotationTransform) * scaleTransform; // Scale glm::dmat4 modelViewTransform = data.camera.combinedViewMatrix() * modelTransform; - glm::vec3 directionToSun = glm::normalize(glm::vec3(0) - glm::vec3(bodyPosition)); - glm::vec3 directionToSunViewSpace = glm::mat3(data.camera.combinedViewMatrix()) * directionToSun; + //glm::vec3 directionToSun = glm::normalize(glm::vec3(0) - glm::vec3(bodyPosition)); + //glm::vec3 directionToSunViewSpace = glm::mat3(data.camera.combinedViewMatrix()) * directionToSun; _programObject->setUniform("lightIntensityClamped", lightIntensityClamped); diff --git a/modules/globebrowsing/meshes/trianglesoup.h b/modules/globebrowsing/meshes/trianglesoup.h index d754b0b244..5085003cec 100644 --- a/modules/globebrowsing/meshes/trianglesoup.h +++ b/modules/globebrowsing/meshes/trianglesoup.h @@ -83,7 +83,6 @@ protected: GLfloat position[4]; GLfloat texture[2]; GLfloat normal[3]; - private: GLubyte padding[28]; // Pads the struct out to 64 bytes for performance increase }; diff --git a/modules/globebrowsing/rendering/layer/layeradjustment.cpp b/modules/globebrowsing/rendering/layer/layeradjustment.cpp index 80b038612b..fad6678097 100644 --- a/modules/globebrowsing/rendering/layer/layeradjustment.cpp +++ b/modules/globebrowsing/rendering/layer/layeradjustment.cpp @@ -35,11 +35,6 @@ namespace { LayerAdjustment::LayerAdjustment() : properties::PropertyOwner("adjustment") - , _typeOption( - "type", - "Type", - properties::OptionProperty::DisplayType::Dropdown - ) , chromaKeyColor( "chromaKeyColor", "Chroma key color", @@ -54,6 +49,11 @@ LayerAdjustment::LayerAdjustment() 0, 1 ) + , _typeOption( + "type", + "Type", + properties::OptionProperty::DisplayType::Dropdown + ) , _onChangeCallback([](){}) { // Add options to option properties diff --git a/modules/globebrowsing/rendering/layer/layermanager.cpp b/modules/globebrowsing/rendering/layer/layermanager.cpp index b3f2aabb8a..b2a2a98e24 100644 --- a/modules/globebrowsing/rendering/layer/layermanager.cpp +++ b/modules/globebrowsing/rendering/layer/layermanager.cpp @@ -149,6 +149,9 @@ TileTextureInitData LayerManager::getTileTextureInitData(layergroupid::GroupID i } default: { ghoul_assert(false, "Unknown layer group ID"); + size_t tileSize = preferredTileSize ? preferredTileSize : 512; + return TileTextureInitData(tileSize, tileSize, GL_UNSIGNED_BYTE, + ghoul::opengl::Texture::Format::BGRA); } } } diff --git a/modules/globebrowsing/tile/rawtiledatareader/tiledatatype.cpp b/modules/globebrowsing/tile/rawtiledatareader/tiledatatype.cpp index 03a08c4ed0..4278175d9b 100644 --- a/modules/globebrowsing/tile/rawtiledatareader/tiledatatype.cpp +++ b/modules/globebrowsing/tile/rawtiledatareader/tiledatatype.cpp @@ -415,7 +415,10 @@ size_t numberOfRasters(ghoul::opengl::Texture::Format format) { case ghoul::opengl::Texture::Format::BGR: return 3; case ghoul::opengl::Texture::Format::RGBA:; // Intentional fallthrough case ghoul::opengl::Texture::Format::BGRA: return 4; - default: ghoul_assert(false, "Unknown format"); + default: { + ghoul_assert(false, "Unknown format"); + return 0; + } } } @@ -430,8 +433,10 @@ size_t numberOfBytes(GLenum glType) { case GL_HALF_FLOAT: return sizeof(GLhalf); case GL_FLOAT: return sizeof(GLfloat); case GL_DOUBLE: return sizeof(GLdouble); - default: + default: { ghoul_assert(false, "Unknown data type"); + return 0; + } } } @@ -447,8 +452,10 @@ size_t getMaximumValue(GLenum glType) { return size_t(1) << 32; case GL_INT: return 1 << 31; - default: + default: { ghoul_assert(false, "Unknown data type"); + return 0; + } } } @@ -470,8 +477,10 @@ float interpretFloat(GLenum glType, const char* src) { return static_cast(*reinterpret_cast(src)); case GL_DOUBLE: return static_cast(*reinterpret_cast(src)); - default: + default: { ghoul_assert(false, "Unknown data type"); + return 0; + } } } diff --git a/modules/globebrowsing/tile/tileprovider/defaulttileprovider.cpp b/modules/globebrowsing/tile/tileprovider/defaulttileprovider.cpp index 63496682e5..e7343007f0 100644 --- a/modules/globebrowsing/tile/tileprovider/defaulttileprovider.cpp +++ b/modules/globebrowsing/tile/tileprovider/defaulttileprovider.cpp @@ -197,8 +197,6 @@ void DefaultTileProvider::initTexturesFromLoadedData() { void DefaultTileProvider::initAsyncTileDataReader(TileTextureInitData initData) { std::string _loggerCat = "DefaultTileProvider : " + _name; - RawTileDataReader* tileDataReader = nullptr; - RawTileDataReader::PerformPreprocessing preprocess = _performPreProcessing ? RawTileDataReader::PerformPreprocessing::Yes : RawTileDataReader::PerformPreprocessing::No; diff --git a/modules/globebrowsing/tile/tileprovider/tileprovider.cpp b/modules/globebrowsing/tile/tileprovider/tileprovider.cpp index b0798b4929..31f4eadc26 100644 --- a/modules/globebrowsing/tile/tileprovider/tileprovider.cpp +++ b/modules/globebrowsing/tile/tileprovider/tileprovider.cpp @@ -34,10 +34,6 @@ #include -namespace { - const char* KeyType = "Type"; -} - namespace openspace { namespace globebrowsing { namespace tileprovider { diff --git a/modules/globebrowsing/tile/tileprovider/tileproviderbylevel.cpp b/modules/globebrowsing/tile/tileprovider/tileproviderbylevel.cpp index 92438fbeb3..28304146bf 100644 --- a/modules/globebrowsing/tile/tileprovider/tileproviderbylevel.cpp +++ b/modules/globebrowsing/tile/tileprovider/tileproviderbylevel.cpp @@ -29,6 +29,8 @@ #include namespace { + const char* _loggerCat = "TileProviderByLevel"; + const char* KeyProviders = "LevelTileProviders"; const char* KeyMaxLevel = "MaxLevel"; const char* KeyTileProvider = "TileProvider"; @@ -46,7 +48,6 @@ TileProviderByLevel::TileProviderByLevel(const ghoul::Dictionary& dictionary) layergroupid::GroupID layerGroupID; dictionary.getValue(KeyLayerGroupID, layerGroupID); - const char* _loggerCat = ("TileProviderByLevel" + name).c_str(); ghoul::Dictionary providers; if (dictionary.hasKeyAndValue(KeyProviders)) { From 0dc96c3bc82c525205c5096aaba78f69ff35ee42 Mon Sep 17 00:00:00 2001 From: Matthew Territo Date: Fri, 14 Jul 2017 18:22:02 -0600 Subject: [PATCH 2/2] default, osirisrex, & satellites --- data/scene/default.scene | 2 +- data/scene/osirisrex.scene | 2 +- data/scene/satellites.scene | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/data/scene/default.scene b/data/scene/default.scene index 3714385858..981cbf87ab 100644 --- a/data/scene/default.scene +++ b/data/scene/default.scene @@ -29,7 +29,7 @@ function postInitialization() openspace.addVirtualProperty("BoolProperty", "Show Trails", "*Trail.renderable.enabled", true, nil, nil) - openspace.resetCameraDirection() + openspace.navigation.resetCameraDirection() openspace.printInfo("Done setting default values") end diff --git a/data/scene/osirisrex.scene b/data/scene/osirisrex.scene index f5fff215a9..79c1e58e67 100644 --- a/data/scene/osirisrex.scene +++ b/data/scene/osirisrex.scene @@ -46,7 +46,7 @@ function postInitialization() openspace.printInfo("Done setting default values") openspace.loadMission("${OPENSPACE_DATA}/scene/missions/osirisrex/osirisrex/osirisrex.mission") - openspace.resetCameraDirection() + openspace.navigation.resetCameraDirection() end return { diff --git a/data/scene/satellites.scene b/data/scene/satellites.scene index 20eed4c4d4..5e09f29196 100644 --- a/data/scene/satellites.scene +++ b/data/scene/satellites.scene @@ -32,7 +32,7 @@ function postInitialization() openspace.setPropertyValue("EarthTrail.renderable.enabled", false) openspace.setPropertyValue("Earth.renderable.performShading", false) - openspace.resetCameraDirection() + openspace.navigation.resetCameraDirection() openspace.printInfo("Done setting default values")