From 87ecaf0ceb8dfc1bd9fafa53cde085b49a767262 Mon Sep 17 00:00:00 2001
From: Mathias Paulin <mathias.paulin@irit.fr>
Date: Wed, 7 Apr 2021 19:09:01 +0200
Subject: [PATCH] Fix Point cloud parameter provider for custom pass

---
 .../RadiumNBR/Passes/CustomAttribToColorPass.cpp     | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/libRender/RadiumNBR/Passes/CustomAttribToColorPass.cpp b/src/libRender/RadiumNBR/Passes/CustomAttribToColorPass.cpp
index fd42a97..911902a 100644
--- a/src/libRender/RadiumNBR/Passes/CustomAttribToColorPass.cpp
+++ b/src/libRender/RadiumNBR/Passes/CustomAttribToColorPass.cpp
@@ -186,8 +186,15 @@ bool CustomAttribToColorPass::buildRenderTechnique(
              {"CustomAtt2ClrPass::CustomColorProgram" + ro->getName()} ) )
     {
         rt.setConfiguration( *cfg, passIndex() );
-        // TODO : is this really usefull ?
-        rt.setParametersProvider( mat, passIndex() );
+        std::shared_ptr<Ra::Engine::Data::ShaderParameterProvider> paramProvider = mat;
+        auto pointCloudConst =
+            dynamic_cast<const Ra::Engine::Scene::PointCloudComponent*>( ro->getComponent() );
+        auto pointCloud = const_cast<Ra::Engine::Scene::PointCloudComponent*>( pointCloudConst );
+        if ( pointCloud )
+        {
+            paramProvider = std::make_shared<PointCloudParameterProvider>( mat, pointCloud );
+        }
+        rt.setParametersProvider( paramProvider, passIndex() );
     }
     else
     {
@@ -370,7 +377,6 @@ bool CustomAttribToColorPass::buildRenderTechnique(
                                        geometryShadersource + m_customGeometryAttrib );
             // construct the parameter provider for the technique
             paramProvider = std::make_shared<PointCloudParameterProvider>( mat, pointCloud );
-            pointCloud->setSplatSize( 0.025 );
         }
         // Add to the ShaderConfigManager
         Ra::Engine::Data::ShaderConfigurationFactory::addConfiguration( theConfig );
-- 
GitLab