diff --git a/data/assets/scene/solarsystem/missions/newhorizons/hydra.asset b/data/assets/scene/solarsystem/missions/newhorizons/hydra.asset index 81c84a67c4..67a779a3db 100644 --- a/data/assets/scene/solarsystem/missions/newhorizons/hydra.asset +++ b/data/assets/scene/solarsystem/missions/newhorizons/hydra.asset @@ -56,7 +56,8 @@ local HydraText = { Size = 10.0^6.3, Origin = "Center", Billboard = true, - Texture = textures .. "/Hydra-Text.png" + Texture = textures .. "/Hydra-Text.png", + BlendMode = "Additive" }, GuiPath = "/Solar System/Dwarf Planets/Pluto" } diff --git a/data/assets/scene/solarsystem/missions/newhorizons/nix.asset b/data/assets/scene/solarsystem/missions/newhorizons/nix.asset index 8989c57c3b..449f759893 100644 --- a/data/assets/scene/solarsystem/missions/newhorizons/nix.asset +++ b/data/assets/scene/solarsystem/missions/newhorizons/nix.asset @@ -47,7 +47,8 @@ local NixText = { Size = 10^6.3, Origin = "Center", Billboard = true, - Texture = textures .. "/Nix-Text.png" + Texture = textures .. "/Nix-Text.png", + BlendMode = "Additive" }, GuiPath = "/Solar System/Dwarf Planets/Pluto" } diff --git a/data/assets/scene/solarsystem/missions/newhorizons/pluto.asset b/data/assets/scene/solarsystem/missions/newhorizons/pluto.asset index 41a69bfb21..d5c3531670 100644 --- a/data/assets/scene/solarsystem/missions/newhorizons/pluto.asset +++ b/data/assets/scene/solarsystem/missions/newhorizons/pluto.asset @@ -182,14 +182,15 @@ local Pluto = { } local PlutoBarycenterLabel = { - Name = "PlutoBarycenterLabel", - Parent = transforms.PlutoBarycenter.Name, - Renderable = { - Type = "RenderablePlane", - Billboard = true, - Size = 5E4, - Texture = encounterTextures .. "/barycenter.png" - }, + Name = "PlutoBarycenterLabel", + Parent = transforms.PlutoBarycenter.Name, + Renderable = { + Type = "RenderablePlane", + Billboard = true, + Size = 5E4, + Texture = encounterTextures .. "/barycenter.png", + BlendMode = "Additive" + }, GuiPath = "/Solar System/Dwarf Planets/Pluto" } diff --git a/modules/base/rendering/renderableplane.cpp b/modules/base/rendering/renderableplane.cpp index 667b07701d..d4a1ac821c 100644 --- a/modules/base/rendering/renderableplane.cpp +++ b/modules/base/rendering/renderableplane.cpp @@ -307,7 +307,7 @@ void RenderablePlane::loadTexture() { // Textures of planets looks much smoother with AnisotropicMipMap rather than // linear - texture->setFilter(ghoul::opengl::Texture::FilterMode::Linear); + texture->setFilter(ghoul::opengl::Texture::FilterMode::LinearMipMap); _texture = std::move(texture); diff --git a/modules/base/rendering/renderablesphere.cpp b/modules/base/rendering/renderablesphere.cpp index 59926706fe..da2abe5e17 100644 --- a/modules/base/rendering/renderablesphere.cpp +++ b/modules/base/rendering/renderablesphere.cpp @@ -394,7 +394,7 @@ void RenderableSphere::loadTexture() { // linear // TODO: AnisotropicMipMap crashes on ATI cards ---abock //texture->setFilter(ghoul::opengl::Texture::FilterMode::AnisotropicMipMap); - texture->setFilter(ghoul::opengl::Texture::FilterMode::Linear); + texture->setFilter(ghoul::opengl::Texture::FilterMode::LinearMipMap); _texture = std::move(texture); } diff --git a/modules/base/rendering/screenspaceframebuffer.cpp b/modules/base/rendering/screenspaceframebuffer.cpp index bb8a86e577..3fcf28e0a9 100644 --- a/modules/base/rendering/screenspaceframebuffer.cpp +++ b/modules/base/rendering/screenspaceframebuffer.cpp @@ -183,7 +183,7 @@ void ScreenSpaceFramebuffer::createFramebuffer() { 1 )); _texture->uploadTexture(); - _texture->setFilter(ghoul::opengl::Texture::FilterMode::Linear); + _texture->setFilter(ghoul::opengl::Texture::FilterMode::LinearMipMap); _framebuffer->attachTexture(_texture.get(), GL_COLOR_ATTACHMENT0); _framebuffer->deactivate(); } diff --git a/modules/base/rendering/screenspaceimagelocal.cpp b/modules/base/rendering/screenspaceimagelocal.cpp index 459d52dee7..2d4f41d3df 100644 --- a/modules/base/rendering/screenspaceimagelocal.cpp +++ b/modules/base/rendering/screenspaceimagelocal.cpp @@ -120,7 +120,7 @@ void ScreenSpaceImageLocal::update() { // Textures of planets looks much smoother with AnisotropicMipMap rather than // linear - texture->setFilter(ghoul::opengl::Texture::FilterMode::Linear); + texture->setFilter(ghoul::opengl::Texture::FilterMode::LinearMipMap); _texture = std::move(texture); _textureIsDirty = false; diff --git a/modules/base/rendering/screenspaceimageonline.cpp b/modules/base/rendering/screenspaceimageonline.cpp index 41d1906374..8d8e5e9b8a 100644 --- a/modules/base/rendering/screenspaceimageonline.cpp +++ b/modules/base/rendering/screenspaceimageonline.cpp @@ -146,7 +146,7 @@ void ScreenSpaceImageOnline::update() { // Textures of planets looks much smoother with AnisotropicMipMap rather // than linear - texture->setFilter(ghoul::opengl::Texture::FilterMode::Linear); + texture->setFilter(ghoul::opengl::Texture::FilterMode::LinearMipMap); _texture = std::move(texture); _textureIsDirty = false; diff --git a/modules/digitaluniverse/rendering/renderableplanescloud.cpp b/modules/digitaluniverse/rendering/renderableplanescloud.cpp index a85ae05f8a..06b032dbd9 100644 --- a/modules/digitaluniverse/rendering/renderableplanescloud.cpp +++ b/modules/digitaluniverse/rendering/renderableplanescloud.cpp @@ -943,7 +943,7 @@ bool RenderablePlanesCloud::loadTextures() { ); auto it = p.first; it->second->uploadTexture(); - it->second->setFilter(ghoul::opengl::Texture::FilterMode::Linear); + it->second->setFilter(ghoul::opengl::Texture::FilterMode::LinearMipMap); } } } diff --git a/modules/globebrowsing/tile/tileprovider/tileprovider.cpp b/modules/globebrowsing/tile/tileprovider/tileprovider.cpp index be6babd764..9292f7b479 100644 --- a/modules/globebrowsing/tile/tileprovider/tileprovider.cpp +++ b/modules/globebrowsing/tile/tileprovider/tileprovider.cpp @@ -169,7 +169,7 @@ void TileProvider::initializeDefaultTile() { _defaultTileTexture->setDataOwnership(Texture::TakeOwnership::Yes); _defaultTileTexture->setPixelData(pixels); _defaultTileTexture->uploadTexture(); - _defaultTileTexture->setFilter(ghoul::opengl::Texture::FilterMode::Linear); + _defaultTileTexture->setFilter(ghoul::opengl::Texture::FilterMode::LinearMipMap); // Create tile _defaultTile = Tile(_defaultTileTexture.get(), nullptr, Tile::Status::OK); diff --git a/modules/iswa/rendering/datacygnet.cpp b/modules/iswa/rendering/datacygnet.cpp index 1c8a1903f9..6ff40e42a2 100644 --- a/modules/iswa/rendering/datacygnet.cpp +++ b/modules/iswa/rendering/datacygnet.cpp @@ -135,7 +135,7 @@ bool DataCygnet::updateTexture(){ if (texture) { texture->uploadTexture(); - texture->setFilter(ghoul::opengl::Texture::FilterMode::Linear); + texture->setFilter(ghoul::opengl::Texture::FilterMode::LinearMipMap); _textures[option] = std::move(texture); } } else { diff --git a/modules/iswa/rendering/texturecygnet.cpp b/modules/iswa/rendering/texturecygnet.cpp index 1f484d6f55..3077da4912 100644 --- a/modules/iswa/rendering/texturecygnet.cpp +++ b/modules/iswa/rendering/texturecygnet.cpp @@ -51,7 +51,7 @@ bool TextureCygnet::updateTexture() { LDEBUG("Loaded texture from image iswa cygnet with id: '" << _data->id << "'"); texture->uploadTexture(); // Textures of planets looks much smoother with AnisotropicMipMap - texture->setFilter(ghoul::opengl::Texture::FilterMode::Linear); + texture->setFilter(ghoul::opengl::Texture::FilterMode::LinearMipMap); _textures[0] = std::move(texture); } diff --git a/modules/space/rendering/renderableplanet.cpp b/modules/space/rendering/renderableplanet.cpp index 33c9c312d6..82d25b074d 100644 --- a/modules/space/rendering/renderableplanet.cpp +++ b/modules/space/rendering/renderableplanet.cpp @@ -637,7 +637,7 @@ void RenderablePlanet::loadTexture() { // linear // TODO: AnisotropicMipMap crashes on ATI cards ---abock //_texture->setFilter(ghoul::opengl::Texture::FilterMode::AnisotropicMipMap); - _texture->setFilter(ghoul::opengl::Texture::FilterMode::Linear); + _texture->setFilter(ghoul::opengl::Texture::FilterMode::LinearMipMap); } } @@ -650,7 +650,7 @@ void RenderablePlanet::loadTexture() { if (_nightTexture) { LDEBUG("Loaded texture from '" << _nightTexturePath << "'"); _nightTexture->uploadTexture(); - _nightTexture->setFilter(ghoul::opengl::Texture::FilterMode::Linear); + _nightTexture->setFilter(ghoul::opengl::Texture::FilterMode::LinearMipMap); //_nightTexture->setFilter( // ghoul::opengl::Texture::FilterMode::AnisotropicMipMap //); diff --git a/modules/spacecraftinstruments/rendering/renderablemodelprojection.cpp b/modules/spacecraftinstruments/rendering/renderablemodelprojection.cpp index 9cb7ac32dc..b95ffebffa 100644 --- a/modules/spacecraftinstruments/rendering/renderablemodelprojection.cpp +++ b/modules/spacecraftinstruments/rendering/renderablemodelprojection.cpp @@ -393,17 +393,22 @@ void RenderableModelProjection::update(const UpdateData& data) { ); } - _time = data.time.j2000Seconds(); + const double time = data.time.j2000Seconds(); - if (openspace::ImageSequencer::ref().isReady()) { - openspace::ImageSequencer::ref().updateSequencer(_time); - if (_projectionComponent.doesPerformProjection()) { - _capture = openspace::ImageSequencer::ref().getImagePaths( - _imageTimes, - _projectionComponent.projecteeId(), - _projectionComponent.instrumentId() - ); + // Only project new images if time changed since last update. + if (time != _time) { + if (openspace::ImageSequencer::ref().isReady()) { + openspace::ImageSequencer::ref().updateSequencer(time); + if (_projectionComponent.doesPerformProjection()) { + _capture = openspace::ImageSequencer::ref().getImagePaths( + _imageTimes, + _projectionComponent.projecteeId(), + _projectionComponent.instrumentId(), + _time + ); + } } + _time = time; } _stateMatrix = data.modelTransform.rotation; @@ -544,7 +549,7 @@ bool RenderableModelProjection::loadTextures() { if (_baseTexture) { LDEBUG("Loaded texture from '" << absPath(_colorTexturePath) << "'"); _baseTexture->uploadTexture(); - _baseTexture->setFilter(ghoul::opengl::Texture::FilterMode::Linear); + _baseTexture->setFilter(ghoul::opengl::Texture::FilterMode::LinearMipMap); } } diff --git a/modules/spacecraftinstruments/rendering/renderableplaneprojection.cpp b/modules/spacecraftinstruments/rendering/renderableplaneprojection.cpp index c80ba21abb..2951dcd22f 100644 --- a/modules/spacecraftinstruments/rendering/renderableplaneprojection.cpp +++ b/modules/spacecraftinstruments/rendering/renderableplaneprojection.cpp @@ -200,7 +200,7 @@ void RenderablePlaneProjection::loadTexture() { texture->uploadTexture(); // TODO: AnisotropicMipMap crashes on ATI cards ---abock //texture->setFilter(ghoul::opengl::Texture::FilterMode::AnisotropicMipMap); - texture->setFilter(ghoul::opengl::Texture::FilterMode::Linear); + texture->setFilter(ghoul::opengl::Texture::FilterMode::LinearMipMap); _texture = std::move(texture); delete _textureFile; diff --git a/modules/spacecraftinstruments/rendering/renderableplanetprojection.cpp b/modules/spacecraftinstruments/rendering/renderableplanetprojection.cpp index 09abc8a2cb..3430224be6 100644 --- a/modules/spacecraftinstruments/rendering/renderableplanetprojection.cpp +++ b/modules/spacecraftinstruments/rendering/renderableplanetprojection.cpp @@ -533,6 +533,10 @@ void RenderablePlanetProjection::render(const RenderData& data, RendererTasks&) _projectionComponent.clearAllProjections(); } + if (_projectionComponent.needsMipMapGeneration()) { + _projectionComponent.generateMipMap(); + } + _camScaling = data.camera.scaling(); _up = data.camera.lookUpVectorCameraSpace(); @@ -681,18 +685,22 @@ void RenderablePlanetProjection::update(const UpdateData& data) { _projectionComponent.update(); - _time = data.time.j2000Seconds(); - _capture = false; + const double time = data.time.j2000Seconds(); - if (openspace::ImageSequencer::ref().isReady()){ - openspace::ImageSequencer::ref().updateSequencer(_time); - if (_projectionComponent.doesPerformProjection()) { - _capture = openspace::ImageSequencer::ref().getImagePaths( - _imageTimes, - _projectionComponent.projecteeId(), - _projectionComponent.instrumentId() - ); + // Only project new images if time changed since last update. + if (time != _time) { + if (openspace::ImageSequencer::ref().isReady()) { + openspace::ImageSequencer::ref().updateSequencer(time); + if (_projectionComponent.doesPerformProjection()) { + _capture = openspace::ImageSequencer::ref().getImagePaths( + _imageTimes, + _projectionComponent.projecteeId(), + _projectionComponent.instrumentId(), + _time + ); + } } + _time = time; } _stateMatrix = data.modelTransform.rotation; @@ -711,8 +719,8 @@ void RenderablePlanetProjection::loadColorTexture() { ); if (_baseTexture) { ghoul::opengl::convertTextureFormat(*_baseTexture, Texture::Format::RGB); - _baseTexture->setFilter(Texture::FilterMode::Linear); _baseTexture->uploadTexture(); + _baseTexture->setFilter(Texture::FilterMode::LinearMipMap); } } } diff --git a/modules/spacecraftinstruments/util/imagesequencer.cpp b/modules/spacecraftinstruments/util/imagesequencer.cpp index aa15134905..263f569097 100644 --- a/modules/spacecraftinstruments/util/imagesequencer.cpp +++ b/modules/spacecraftinstruments/util/imagesequencer.cpp @@ -59,7 +59,6 @@ ImageSequencer* ImageSequencer::_instance = nullptr; ImageSequencer::ImageSequencer() : _currentTime(0.0) - , _previousTime(0.0) , _intervalLength(0.0) , _nextCapture(0.0) , _hasData(false) @@ -86,10 +85,7 @@ bool ImageSequencer::isReady() { } void ImageSequencer::updateSequencer(const Time& time) { - if (_currentTime != time.j2000Seconds()) { - _previousTime = _currentTime; - _currentTime = time.j2000Seconds(); - } + _currentTime = time.j2000Seconds(); } std::pair ImageSequencer::getNextTarget() { @@ -275,7 +271,8 @@ float ImageSequencer::instrumentActiveTime(const std::string& instrumentID) cons bool ImageSequencer::getImagePaths(std::vector& captures, std::string projectee, - std::string instrumentRequest){ + std::string instrumentRequest, + double sinceTime) { // check if this instance is either in range or // a valid candidate to recieve data @@ -286,7 +283,7 @@ bool ImageSequencer::getImagePaths(std::vector& captures, //if (!Time::ref().timeJumped() && projectee == getCurrentTarget().second) if (_subsetMap[projectee]._range.includes(_currentTime) || - _subsetMap[projectee]._range.includes(_previousTime)){ + _subsetMap[projectee]._range.includes(sinceTime)){ auto compareTime = [](const Image &a, const Image &b)->bool{ return a.timeRange.start < b.timeRange.start; @@ -299,7 +296,7 @@ bool ImageSequencer::getImagePaths(std::vector& captures, std::vector captureTimes; // what to look for Image findPrevious, findCurrent; - findPrevious.timeRange.start = _previousTime; + findPrevious.timeRange.start = sinceTime; findCurrent.timeRange.start = _currentTime; // find the two iterators that correspond to the latest time jump diff --git a/modules/spacecraftinstruments/util/imagesequencer.h b/modules/spacecraftinstruments/util/imagesequencer.h index 7f680c294f..930cae3e36 100644 --- a/modules/spacecraftinstruments/util/imagesequencer.h +++ b/modules/spacecraftinstruments/util/imagesequencer.h @@ -126,8 +126,9 @@ public: * returns false and no projections will occur. */ bool getImagePaths(std::vector& captures, - std::string projectee, - std::string instrumentRequest); + std::string projectee, + std::string instrumentRequest, + double sinceTime); /* * returns true if instrumentID is within a capture range. diff --git a/modules/spacecraftinstruments/util/projectioncomponent.cpp b/modules/spacecraftinstruments/util/projectioncomponent.cpp index b1ad293898..a460ca38f0 100644 --- a/modules/spacecraftinstruments/util/projectioncomponent.cpp +++ b/modules/spacecraftinstruments/util/projectioncomponent.cpp @@ -405,7 +405,7 @@ bool ProjectionComponent::initializeGL() { texture->uploadTexture(); // TODO: AnisotropicMipMap crashes on ATI cards ---abock //_textureProj->setFilter(ghoul::opengl::Texture::FilterMode::AnisotropicMipMap); - texture->setFilter(Texture::FilterMode::Linear); + texture->setFilter(Texture::FilterMode::LinearMipMap); texture->setWrapping(Texture::WrappingMode::ClampToBorder); } _placeholderTexture = std::move(texture); @@ -731,6 +731,8 @@ void ProjectionComponent::imageProjectEnd() { glBindFramebuffer(GL_FRAMEBUFFER, _defaultFBO); glViewport(_viewport[0], _viewport[1], _viewport[2], _viewport[3]); + + _mipMapDirty = true; } void ProjectionComponent::update() { @@ -867,6 +869,10 @@ bool ProjectionComponent::needsClearProjection() const { return _clearAllProjections; } +bool ProjectionComponent::needsMipMapGeneration() const { + return _mipMapDirty; +} + float ProjectionComponent::projectionFading() const { return _projectionFading; } @@ -934,6 +940,12 @@ void ProjectionComponent::clearAllProjections() { m_viewport[2], m_viewport[3]); _clearAllProjections = false; + _mipMapDirty = true; +} + +void ProjectionComponent::generateMipMap() { + _projectionTexture->setFilter(ghoul::opengl::Texture::FilterMode::LinearMipMap); + _mipMapDirty = false; } std::shared_ptr ProjectionComponent::loadProjectionTexture( @@ -957,7 +969,7 @@ std::shared_ptr ProjectionComponent::loadProjectionTextu texture->uploadTexture(); // TODO: AnisotropicMipMap crashes on ATI cards ---abock //_textureProj->setFilter(ghoul::opengl::Texture::FilterMode::AnisotropicMipMap); - texture->setFilter(Texture::FilterMode::Linear); + texture->setFilter(Texture::FilterMode::LinearMipMap); texture->setWrapping(Texture::WrappingMode::ClampToBorder); } return std::move(texture); diff --git a/modules/spacecraftinstruments/util/projectioncomponent.h b/modules/spacecraftinstruments/util/projectioncomponent.h index 9fbfb35d0b..f4b5bb0848 100644 --- a/modules/spacecraftinstruments/util/projectioncomponent.h +++ b/modules/spacecraftinstruments/util/projectioncomponent.h @@ -83,11 +83,13 @@ public: bool doesPerformProjection() const; bool needsClearProjection() const; + bool needsMipMapGeneration() const; float projectionFading() const; bool needsShadowMap() const; void clearAllProjections(); + void generateMipMap(); ghoul::opengl::Texture& projectionTexture() const; @@ -113,6 +115,7 @@ protected: properties::IVec2Property _textureSize; properties::TriggerProperty _applyTextureSize; bool _textureSizeDirty; + bool _mipMapDirty; std::unique_ptr _projectionTexture; std::shared_ptr _placeholderTexture;