Skip to content
Snippets Groups Projects
Commit bb2214c3 authored by Mathias Paulin's avatar Mathias Paulin :speech_balloon:
Browse files

Fix envmap opengl initialisation

parent 6753d808
Branches
No related tags found
No related merge requests found
......@@ -80,6 +80,8 @@ void VisualizationController::update( const Ra::Engine::Data::ViewingParameters&
auto defColor = Ra::Core::Utils::Color::linearRGBTosRGB( m_renderer->getBackgroundColor() );
m_clearPass->setBackground( defColor );
}
// TODO : do this only once ?
if ( m_envmap ) { m_envmap->updateGL(); }
};
void VisualizationController::resize( int w, int h ){
......@@ -125,6 +127,7 @@ void VisualizationController::setEnvMap( const std::string& files ) {
m_clearPass->setEnvMap( nullptr );
m_customPass->setEnvMap( nullptr );
m_hasEnvMap = false;
m_envmap = nullptr;
}
else
{
......@@ -138,9 +141,9 @@ void VisualizationController::setEnvMap( const std::string& files ) {
if ( ext != "pfm" ) { t = EnvMap::EnvMapType::ENVMAP_LATLON; }
}
// for now, only skyboxes are managed
auto e = std::make_shared<EnvMap>( files, t, true );
m_clearPass->setEnvMap( e );
m_customPass->setEnvMap( e );
m_envmap = std::make_shared<EnvMap>( files, t, true );
m_clearPass->setEnvMap( m_envmap );
m_customPass->setEnvMap( m_envmap );
m_hasEnvMap = true;
}
}
......
#include <RadiumNBR/NodeBasedRenderer.hpp>
#include <RadiumNBR/EnvMap.hpp>
namespace RadiumNBR {
class CustomAttribToColorPass;
class ClearPass;
......@@ -74,6 +76,9 @@ class NodeBasedRenderer_LIBRARY_API VisualizationController
/// Is an envmap attached to the renderer
bool m_hasEnvMap{false};
/// The Environment to used for skybox display
std::shared_ptr<EnvMap> m_envmap{nullptr};
};
} // namespace RadiumNBR
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment