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