diff --git a/Sofa/Component/Constraint/Lagrangian/Correction/src/sofa/component/constraint/lagrangian/correction/GenericConstraintCorrection.cpp b/Sofa/Component/Constraint/Lagrangian/Correction/src/sofa/component/constraint/lagrangian/correction/GenericConstraintCorrection.cpp index 9250a7f9a21..a33a1426633 100644 --- a/Sofa/Component/Constraint/Lagrangian/Correction/src/sofa/component/constraint/lagrangian/correction/GenericConstraintCorrection.cpp +++ b/Sofa/Component/Constraint/Lagrangian/Correction/src/sofa/component/constraint/lagrangian/correction/GenericConstraintCorrection.cpp @@ -44,7 +44,6 @@ using sofa::core::MultiVecDerivId; using sofa::core::MultiVecCoordId; using sofa::core::ExecParams; using sofa::linearalgebra::BaseVector; -using sofa::core::RegisterObject; using sofa::core::ConstMultiVecDerivId; using sofa::core::VecDerivId; using sofa::core::VecCoordId; diff --git a/Sofa/GL/Component/Engine/src/sofa/gl/component/engine/TextureInterpolation.cpp b/Sofa/GL/Component/Engine/src/sofa/gl/component/engine/TextureInterpolation.cpp index 9e956210411..0f63ad74ebf 100644 --- a/Sofa/GL/Component/Engine/src/sofa/gl/component/engine/TextureInterpolation.cpp +++ b/Sofa/GL/Component/Engine/src/sofa/gl/component/engine/TextureInterpolation.cpp @@ -29,12 +29,13 @@ namespace sofa::gl::component::engine using namespace sofa::defaulttype; -int TextureInterpolationClass = core::RegisterObject("Create texture coordinate for a given field") +void registerTextureInterpolation(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Create texture coordinate for a given field.") .add< TextureInterpolation >() .add< TextureInterpolation >() - .add< TextureInterpolation >() - - ; + .add< TextureInterpolation >()); +} template class SOFA_GL_COMPONENT_ENGINE_API TextureInterpolation ; template class SOFA_GL_COMPONENT_ENGINE_API TextureInterpolation ; diff --git a/Sofa/GL/Component/Engine/src/sofa/gl/component/engine/init.cpp b/Sofa/GL/Component/Engine/src/sofa/gl/component/engine/init.cpp index 4688d160de2..6faf66d3c00 100644 --- a/Sofa/GL/Component/Engine/src/sofa/gl/component/engine/init.cpp +++ b/Sofa/GL/Component/Engine/src/sofa/gl/component/engine/init.cpp @@ -21,22 +21,24 @@ ******************************************************************************/ #include +#include +#include + namespace sofa::gl::component::engine { - + +extern void registerTextureInterpolation(sofa::core::ObjectFactory* factory); + extern "C" { SOFA_EXPORT_DYNAMIC_LIBRARY void initExternalModule(); SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleName(); SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleVersion(); + SOFA_EXPORT_DYNAMIC_LIBRARY void registerObjects(sofa::core::ObjectFactory* factory); } void initExternalModule() { - static bool first = true; - if (first) - { - first = false; - } + init(); } const char* getModuleName() @@ -49,9 +51,21 @@ const char* getModuleVersion() return MODULE_VERSION; } +void registerObjects(sofa::core::ObjectFactory* factory) +{ + registerTextureInterpolation(factory); +} + void init() { - initExternalModule(); + static bool first = true; + if (first) + { + // make sure that this plugin is registered into the PluginManager + sofa::helper::system::PluginManager::getInstance().registerPlugin(MODULE_NAME); + + first = false; + } } } // namespace sofa::gl::component::engine diff --git a/Sofa/GL/Component/Rendering2D/src/sofa/gl/component/rendering2d/OglColorMap.cpp b/Sofa/GL/Component/Rendering2D/src/sofa/gl/component/rendering2d/OglColorMap.cpp index 91ba9cc396f..69d0ec4f219 100644 --- a/Sofa/GL/Component/Rendering2D/src/sofa/gl/component/rendering2d/OglColorMap.cpp +++ b/Sofa/GL/Component/Rendering2D/src/sofa/gl/component/rendering2d/OglColorMap.cpp @@ -33,10 +33,11 @@ namespace sofa::gl::component::rendering2d { -int OglColorMapClass = core::RegisterObject("Provides color palette and support for conversion of numbers to colors.") - .add< OglColorMap >() - .addAlias("ColorMap") - ; +void registerOglColorMap(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Provides color palette and support for conversion of numbers to colors.") + .add< OglColorMap >()); +} OglColorMap::OglColorMap() : d_paletteSize(initData(&d_paletteSize, (unsigned int)256, "paletteSize", "How many colors to use")) diff --git a/Sofa/GL/Component/Rendering2D/src/sofa/gl/component/rendering2d/OglLabel.cpp b/Sofa/GL/Component/Rendering2D/src/sofa/gl/component/rendering2d/OglLabel.cpp index 3fc2f572017..6440e50fc4a 100644 --- a/Sofa/GL/Component/Rendering2D/src/sofa/gl/component/rendering2d/OglLabel.cpp +++ b/Sofa/GL/Component/Rendering2D/src/sofa/gl/component/rendering2d/OglLabel.cpp @@ -169,9 +169,10 @@ void OglLabel::setColor(float r, float g, float b, float a) d_color.endEdit(); } - -int OglLabelClass = core::RegisterObject("Display 2D text in the viewport.") - .add< OglLabel >() - ; +void registerOglLabel(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Display 2D text in the viewport.") + .add< OglLabel >()); +} } // namespace sofa::gl::component::rendering2d diff --git a/Sofa/GL/Component/Rendering2D/src/sofa/gl/component/rendering2d/OglViewport.cpp b/Sofa/GL/Component/Rendering2D/src/sofa/gl/component/rendering2d/OglViewport.cpp index a92369c0701..308f5c65d16 100644 --- a/Sofa/GL/Component/Rendering2D/src/sofa/gl/component/rendering2d/OglViewport.cpp +++ b/Sofa/GL/Component/Rendering2D/src/sofa/gl/component/rendering2d/OglViewport.cpp @@ -36,11 +36,11 @@ namespace sofa::gl::component::rendering2d using namespace sofa::type; using namespace sofa::defaulttype; -//Register OglViewport in the Object Factory -int OglViewportClass = core::RegisterObject("OglViewport") - .add< OglViewport >() - ; - +void registerOglViewport(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Set an additional viewport into the main one.") + .add< OglViewport >()); +} OglViewport::OglViewport() :p_screenPosition(initData(&p_screenPosition, "screenPosition", "Viewport position")) diff --git a/Sofa/GL/Component/Rendering2D/src/sofa/gl/component/rendering2d/init.cpp b/Sofa/GL/Component/Rendering2D/src/sofa/gl/component/rendering2d/init.cpp index 946bd4ea4ea..e47fe395cfe 100644 --- a/Sofa/GL/Component/Rendering2D/src/sofa/gl/component/rendering2d/init.cpp +++ b/Sofa/GL/Component/Rendering2D/src/sofa/gl/component/rendering2d/init.cpp @@ -21,22 +21,25 @@ ******************************************************************************/ #include #include +#include + namespace sofa::gl::component::rendering2d { - + +extern void registerOglColorMap(sofa::core::ObjectFactory* factory); +extern void registerOglLabel(sofa::core::ObjectFactory* factory); +extern void registerOglViewport(sofa::core::ObjectFactory* factory); + extern "C" { SOFA_EXPORT_DYNAMIC_LIBRARY void initExternalModule(); SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleName(); SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleVersion(); + SOFA_EXPORT_DYNAMIC_LIBRARY void registerObjects(sofa::core::ObjectFactory* factory); } void initExternalModule() { - static bool first = true; - if (first) - { - first = false; - } + init(); } const char* getModuleName() @@ -49,9 +52,23 @@ const char* getModuleVersion() return MODULE_VERSION; } +void registerObjects(sofa::core::ObjectFactory* factory) +{ + registerOglColorMap(factory); + registerOglLabel(factory); + registerOglViewport(factory); +} + void init() { - initExternalModule(); + static bool first = true; + if (first) + { + // make sure that this plugin is registered into the PluginManager + sofa::helper::system::PluginManager::getInstance().registerPlugin(MODULE_NAME); + + first = false; + } } } // namespace sofa::gl::component::rendering2d diff --git a/Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/ClipPlane.cpp b/Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/ClipPlane.cpp index ad064008db7..a5dd1b92113 100644 --- a/Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/ClipPlane.cpp +++ b/Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/ClipPlane.cpp @@ -28,10 +28,11 @@ using sofa::core::objectmodel::ComponentState ; namespace sofa::gl::component::rendering3d { -int ClipPlaneClass = core::RegisterObject("OpenGL Clipping Plane") - .add< ClipPlane >() - ; - +void registerClipPlane(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Define arbitrary clipping plane into OpenGL.") + .add< ClipPlane >()); +} ClipPlane::ClipPlane() : position(initData(&position, sofa::type::Vec3(0,0,0), "position", "Point crossed by the clipping plane")) diff --git a/Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/DataDisplay.cpp b/Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/DataDisplay.cpp index 6a86c95dc95..7e7e93ef1b3 100644 --- a/Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/DataDisplay.cpp +++ b/Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/DataDisplay.cpp @@ -35,9 +35,11 @@ using namespace sofa::type; using namespace sofa::defaulttype; using sofa::gl::component::rendering2d::OglColorMap; -int DataDisplayClass = core::RegisterObject("Rendering of meshes colored by data") - .add< DataDisplay >() - ; +void registerDataDisplay(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Color rendering of data associated with a mesh.") + .add< DataDisplay >()); +} DataDisplay::DataDisplay() : f_maximalRange(initData(&f_maximalRange, true, "maximalRange", "Keep the maximal range through all timesteps")) diff --git a/Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/MergeVisualModels.cpp b/Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/MergeVisualModels.cpp index 27853164a34..fbea7871606 100644 --- a/Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/MergeVisualModels.cpp +++ b/Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/MergeVisualModels.cpp @@ -25,9 +25,10 @@ namespace sofa::gl::component::rendering3d { -int MergeVisualModelsClass = core::RegisterObject("Merge several visual models") - .add< MergeVisualModels >(true); - - +void registerMergeVisualModels(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Merge several visual models.") + .add< MergeVisualModels >()); +} } // namespace sofa::gl::component::rendering3d diff --git a/Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/OglCylinderModel.cpp b/Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/OglCylinderModel.cpp index 8042ea05b97..9067ba2522b 100644 --- a/Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/OglCylinderModel.cpp +++ b/Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/OglCylinderModel.cpp @@ -31,9 +31,11 @@ namespace sofa::gl::component::rendering3d { -int OglCylinderModelClass = core::RegisterObject("A simple visualization for set of cylinder.") - .add< OglCylinderModel >() - ; +void registerOglCylinderModel(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("OpenGL-based visualization for a cylinders over edges.") + .add< OglCylinderModel >()); +} using namespace sofa::defaulttype; using namespace sofa::core::topology; diff --git a/Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/OglModel.cpp b/Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/OglModel.cpp index 67003a663e8..1f88ebc2905 100644 --- a/Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/OglModel.cpp +++ b/Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/OglModel.cpp @@ -38,9 +38,11 @@ using sofa::type::RGBAColor; using sofa::type::Material; using namespace sofa::type; -int OglModelClass = core::RegisterObject("Generic visual model for OpenGL display") - .add< OglModel >(); - +void registerOglModel(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Generic visual model for OpenGL display.") + .add< OglModel >()); +} OglModel::OglModel() : blendTransparency(initData(&blendTransparency, true, "blendTranslucency", "Blend transparent parts")) diff --git a/Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/OglSceneFrame.cpp b/Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/OglSceneFrame.cpp index f2bba6ceb04..5e6e47ccc7a 100644 --- a/Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/OglSceneFrame.cpp +++ b/Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/OglSceneFrame.cpp @@ -26,9 +26,11 @@ namespace sofa::gl::component::rendering3d { -int OglSceneFrameClass = core::RegisterObject("Display a frame at the corner of the scene view") - .add< OglSceneFrame >() - ; +void registerOglSceneFrame(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Display a frame at the corner of the scene view.") + .add< OglSceneFrame >()); +} using namespace sofa::defaulttype; diff --git a/Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/PointSplatModel.cpp b/Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/PointSplatModel.cpp index b8c3235f58d..896a44cedee 100644 --- a/Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/PointSplatModel.cpp +++ b/Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/PointSplatModel.cpp @@ -41,10 +41,11 @@ namespace sofa::gl::component::rendering3d { -int PointSplatModelClass = core::RegisterObject("A simple visualization for a cloud of points.") - .add< PointSplatModel >() - .addAlias("PointSplat") - ; +void registerPointSplatModel(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Visualization for a cloud of points using splatting.") + .add< PointSplatModel >()); +} using namespace sofa::defaulttype; using namespace sofa::core::topology; diff --git a/Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/SlicedVolumetricModel.cpp b/Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/SlicedVolumetricModel.cpp index b73c505fcb9..6a5a5782422 100644 --- a/Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/SlicedVolumetricModel.cpp +++ b/Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/SlicedVolumetricModel.cpp @@ -44,9 +44,11 @@ namespace sofa::gl::component::rendering3d { -int SlicedVolumetricModelClass = core::RegisterObject("A simple visualization for a cloud of points.") - .add< SlicedVolumetricModel >() - ; +void registerSlicedVolumetricModel(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Sliced visualization for a volumetric model defined with hexahedra.") + .add< SlicedVolumetricModel >()); +} using namespace sofa::defaulttype; using namespace sofa::core::topology; diff --git a/Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/init.cpp b/Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/init.cpp index 5156beca33d..a4096afa836 100644 --- a/Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/init.cpp +++ b/Sofa/GL/Component/Rendering3D/src/sofa/gl/component/rendering3d/init.cpp @@ -21,22 +21,30 @@ ******************************************************************************/ #include #include +#include + namespace sofa::gl::component::rendering3d { - + +extern void registerClipPlane(sofa::core::ObjectFactory* factory); +extern void registerDataDisplay(sofa::core::ObjectFactory* factory); +extern void registerMergeVisualModels(sofa::core::ObjectFactory* factory); +extern void registerOglCylinderModel(sofa::core::ObjectFactory* factory); +extern void registerOglModel(sofa::core::ObjectFactory* factory); +extern void registerOglSceneFrame(sofa::core::ObjectFactory* factory); +extern void registerPointSplatModel(sofa::core::ObjectFactory* factory); +extern void registerSlicedVolumetricModel(sofa::core::ObjectFactory* factory); + extern "C" { SOFA_EXPORT_DYNAMIC_LIBRARY void initExternalModule(); SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleName(); SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleVersion(); + SOFA_EXPORT_DYNAMIC_LIBRARY void registerObjects(sofa::core::ObjectFactory* factory); } void initExternalModule() { - static bool first = true; - if (first) - { - first = false; - } + init(); } const char* getModuleName() @@ -49,9 +57,28 @@ const char* getModuleVersion() return MODULE_VERSION; } +void registerObjects(sofa::core::ObjectFactory* factory) +{ + registerClipPlane(factory); + registerDataDisplay(factory); + registerMergeVisualModels(factory); + registerOglCylinderModel(factory); + registerOglModel(factory); + registerOglSceneFrame(factory); + registerPointSplatModel(factory); + registerSlicedVolumetricModel(factory); +} + void init() { - initExternalModule(); + static bool first = true; + if (first) + { + // make sure that this plugin is registered into the PluginManager + sofa::helper::system::PluginManager::getInstance().registerPlugin(MODULE_NAME); + + first = false; + } } } // namespace sofa::gl::component::rendering3d diff --git a/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/CompositingVisualLoop.cpp b/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/CompositingVisualLoop.cpp index 7f112805a17..aedc22e007a 100644 --- a/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/CompositingVisualLoop.cpp +++ b/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/CompositingVisualLoop.cpp @@ -29,9 +29,11 @@ namespace sofa::gl::component::shader { -int CompositingVisualLoopClass = core::RegisterObject("Visual loop enabling multipass rendering. Needs multiple fbo data and a compositing shader") - .add< CompositingVisualLoop >() - ; +void registerCompositingVisualLoop(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Visual loop enabling multipass rendering. Needs multiple fbo data and a compositing shader.") + .add< CompositingVisualLoop >()); +} CompositingVisualLoop::CompositingVisualLoop() : simulation::DefaultVisualManagerLoop(), diff --git a/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/Light.cpp b/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/Light.cpp index f9d837f0536..1d6fe6eb38a 100644 --- a/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/Light.cpp +++ b/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/Light.cpp @@ -30,23 +30,26 @@ namespace sofa::gl::component::shader { -//Register DirectionalLight in the Object Factory -int DirectionalLightClass = core::RegisterObject("A directional light illuminating the scene with parallel rays of light (can cast shadows).") - .add< DirectionalLight >() - ; - -//Register PositionalLight in the Object Factory -int PositionalLightClass = core::RegisterObject("A positional light illuminating the scene." - "The light has a location from which the ray are starting in all direction (cannot cast shadows for now)") - .add< PositionalLight >() - ; - -//Register SpotLight in the Object Factory -int SpotLightClass = core::RegisterObject("A spot light illuminating the scene." - "The light has a location and a illumination cone restricting the directions" - "taken by the rays of light (can cast shadows).") - .add< SpotLight >() - ; +void registerDirectionalLight(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("A directional light illuminating the scene with parallel rays of light (can cast shadows).") + .add< DirectionalLight >()); +} + +void registerPositionalLight(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("A positional light illuminating the scene." + "The light has a location from which the ray are starting in all direction (cannot cast shadows for now)") + .add< PositionalLight >()); +} + +void registerSpotlLight(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("A spot light illuminating the scene." + "The light has a location and a illumination cone restricting the directions" + "taken by the rays of light (can cast shadows).") + .add< SpotLight >()); +} using sofa::type::Vec3; diff --git a/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/LightManager.cpp b/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/LightManager.cpp index 6221add5f0c..9de7c2ccef6 100644 --- a/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/LightManager.cpp +++ b/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/LightManager.cpp @@ -34,7 +34,6 @@ using sofa::core::visual::VisualParams ; using sofa::gl::component::shader::OglTexture ; using sofa::core::objectmodel::BaseContext ; -using sofa::core::RegisterObject ; using sofa::type::Mat ; @@ -43,12 +42,12 @@ using sofa::type::RGBAColor ; namespace sofa::gl::component::shader { -//Register LightManager in the Object Factory -int LightManagerClass = RegisterObject - ("Manage a set of lights that can cast hard and soft shadows.Soft Shadows is done using Variance Shadow Mapping " - "(http://developer.download.nvidia.com/SDK/10.5/direct3d/Source/VarianceShadowMapping/Doc/VarianceShadowMapping.pdf)") - .add< LightManager >() - ; +void registerLightManager(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Manage a set of lights that can cast hard and soft shadows.Soft Shadows is done using Variance Shadow Mapping " + "(http://developer.download.nvidia.com/SDK/10.5/direct3d/Source/VarianceShadowMapping/Doc/VarianceShadowMapping.pdf)") + .add< LightManager >()); +} LightManager::LightManager() : d_shadowsEnabled(initData(&d_shadowsEnabled, (bool) false, "shadows", "Enable Shadow in the scene. (default=0)")) diff --git a/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/OglAttribute.cpp b/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/OglAttribute.cpp index b8a0d07c892..6f366fb4422 100644 --- a/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/OglAttribute.cpp +++ b/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/OglAttribute.cpp @@ -27,20 +27,22 @@ namespace sofa::gl::component::shader using namespace sofa::defaulttype; +void registerOglAttribute(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("OglFloatAttribute").add< OglFloatAttribute >()); + factory->registerObjects(core::ObjectRegistrationData("OglFloat2Attribute").add< OglFloat2Attribute >()); + factory->registerObjects(core::ObjectRegistrationData("OglFloat3Attribute").add< OglFloat3Attribute >()); + factory->registerObjects(core::ObjectRegistrationData("OglFloat4Attribute").add< OglFloat4Attribute >()); -int OglFloatAttributeClass = core::RegisterObject ( "OglFloatAttribute" ).add< OglFloatAttribute >(); -int OglFloat2AttributeClass = core::RegisterObject ( "OglFloat2Attribute" ).add< OglFloat2Attribute >(); -int OglFloat3AttributeClass = core::RegisterObject ( "OglFloat3Attribute" ).add< OglFloat3Attribute >(); -int OglFloat4AttributeClass = core::RegisterObject ( "OglFloat4Attribute" ).add< OglFloat4Attribute >(); - -int OglIntAttributeClass = core::RegisterObject ( "OglIntAttribute" ).add< OglIntAttribute >(); -int OglInt2AttributeClass = core::RegisterObject ( "OglInt2Attribute" ).add< OglInt2Attribute >(); -int OglInt3AttributeClass = core::RegisterObject ( "OglInt3Attribute" ).add< OglInt3Attribute >(); -int OglInt4AttributeClass = core::RegisterObject ( "OglInt4Attribute" ).add< OglInt4Attribute >(); + factory->registerObjects(core::ObjectRegistrationData("OglIntAttribute").add< OglIntAttribute >()); + factory->registerObjects(core::ObjectRegistrationData("OglInt2Attribute").add< OglInt2Attribute >()); + factory->registerObjects(core::ObjectRegistrationData("OglInt3Attribute").add< OglInt3Attribute >()); + factory->registerObjects(core::ObjectRegistrationData("OglInt4Attribute").add< OglInt4Attribute >()); -int OglUIntAttributeClass = core::RegisterObject ( "OglUIntAttribute" ).add< OglUIntAttribute >(); -int OglUInt2AttributeClass = core::RegisterObject ( "OglUInt2Attribute" ).add< OglUInt2Attribute >(); -int OglUInt3AttributeClass = core::RegisterObject ( "OglUInt3Attribute" ).add< OglUInt3Attribute >(); -int OglUInt4AttributeClass = core::RegisterObject ( "OglUInt4Attribute" ).add< OglUInt4Attribute >(); + factory->registerObjects(core::ObjectRegistrationData("OglUIntAttribute").add< OglUIntAttribute >()); + factory->registerObjects(core::ObjectRegistrationData("OglUInt2Attribute").add< OglUInt2Attribute >()); + factory->registerObjects(core::ObjectRegistrationData("OglUInt3Attribute").add< OglUInt3Attribute >()); + factory->registerObjects(core::ObjectRegistrationData("OglUInt4Attribute").add< OglUInt4Attribute >()); +} } // namespace sofa::gl::component::shader diff --git a/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/OglOITShader.cpp b/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/OglOITShader.cpp index a91cae1ca1e..d8e2a253c24 100644 --- a/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/OglOITShader.cpp +++ b/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/OglOITShader.cpp @@ -29,10 +29,11 @@ namespace sofa::gl::component::shader { -//Register OglShader in the Object Factory -int OglOITShaderClass = core::RegisterObject("OglOITShader") - .add< OglOITShader >() - ; +void registerOglOITShader(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Shader implementating Order Independent Transparency.") + .add< OglOITShader >()); +} const std::string OglOITShader::PATH_TO_OIT_ACCUMULATION_VERTEX_SHADERS = "shaders/orderIndependentTransparency/accumulation.vert"; const std::string OglOITShader::PATH_TO_OIT_ACCUMULATION_FRAGMENT_SHADERS = "shaders/orderIndependentTransparency/accumulation.frag"; diff --git a/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/OglRenderingSRGB.cpp b/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/OglRenderingSRGB.cpp index 8855735c746..3b0a72de51d 100644 --- a/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/OglRenderingSRGB.cpp +++ b/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/OglRenderingSRGB.cpp @@ -28,10 +28,11 @@ namespace sofa::gl::component::shader using namespace simulation; -//Register RenderingSRGB in the Object Factory -int OglRenderingSRGBClass = core::RegisterObject("OglRenderingSRGB") - .add< OglRenderingSRGB >() - ; +void registerOglRenderingSRGB(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Set the current visual context framebuffer with SRGB.") + .add< OglRenderingSRGB >()); +} void OglRenderingSRGB::fwdDraw(core::visual::VisualParams* /*vp*/) { diff --git a/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/OglShader.cpp b/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/OglShader.cpp index 5ea9c1266a2..940a204f73b 100644 --- a/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/OglShader.cpp +++ b/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/OglShader.cpp @@ -29,10 +29,11 @@ namespace sofa::gl::component::shader { -//Register OglShader in the Object Factory -int OglShaderClass = core::RegisterObject("OglShader") - .add< OglShader >() - ; +void registerOglShader(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Set custom shader for the current visual context.") + .add< OglShader >()); +} OglShader::OglShader(): turnOn(initData(&turnOn, (bool) true, "turnOn", "Turn On the shader?")), diff --git a/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/OglShaderMacro.cpp b/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/OglShaderMacro.cpp index be91ef41a46..ec570417549 100644 --- a/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/OglShaderMacro.cpp +++ b/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/OglShaderMacro.cpp @@ -25,9 +25,11 @@ namespace sofa::gl::component::shader { -//Register OglIntVariable in the Object Factory -int OglShaderDefineMacroClass = core::RegisterObject("OglShaderDefineMacro") - .add< OglShaderDefineMacro >(); +void registerOglShaderDefineMacro(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Add a custom preprocessor instruction to the shader in the current visual context.") + .add< OglShaderDefineMacro >()); +} OglShaderMacro::OglShaderMacro() { diff --git a/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/OglShaderVisualModel.cpp b/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/OglShaderVisualModel.cpp index d724d01c1b8..d92e1cfe973 100644 --- a/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/OglShaderVisualModel.cpp +++ b/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/OglShaderVisualModel.cpp @@ -34,9 +34,11 @@ namespace sofa::gl::component::shader using namespace sofa::core::topology; using namespace sofa::core::behavior; -int OglShaderVisualModelClass = core::RegisterObject("Visual model for OpenGL display using Glew extensions") - .add< OglShaderVisualModel >() - ; +void registerOglShaderVisualModel(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Visual model for OpenGL display using a custom shader.") + .add< OglShaderVisualModel >()); +} OglShaderVisualModel::OglShaderVisualModel() : shader(nullptr) diff --git a/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/OglShadowShader.cpp b/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/OglShadowShader.cpp index 70df33f52ac..1cf3016742e 100644 --- a/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/OglShadowShader.cpp +++ b/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/OglShadowShader.cpp @@ -29,10 +29,11 @@ namespace sofa::gl::component::shader { -//Register OglShader in the Object Factory -int OglShadowShaderClass = core::RegisterObject("This component sets the shader system responsible of the shadowing.") - .add< OglShadowShader >() - ; +void registerOglShadowShader(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("This component sets the shader system responsible of the shadowing.") + .add< OglShadowShader >()); +} const std::string OglShadowShader::PATH_TO_SHADOW_VERTEX_SHADERS = "shaders/hardShadows/shadowMapping.vert"; const std::string OglShadowShader::PATH_TO_SHADOW_FRAGMENT_SHADERS = "shaders/hardShadows/shadowMapping.frag"; diff --git a/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/OglTexture.cpp b/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/OglTexture.cpp index 6bb47b2d8dc..319e2cae1ae 100644 --- a/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/OglTexture.cpp +++ b/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/OglTexture.cpp @@ -27,9 +27,11 @@ namespace sofa::gl::component::shader { -// Register the OglTexture* objects in the Object Factory -int OglTextureClass = core::RegisterObject("OglTexture").add< OglTexture >(); -int OglTexture2DClass = core::RegisterObject("OglTexture2D").add< OglTexture2D >(); +void registerOglTexture(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Load a texture to be used in a shader.").add< OglTexture >()); + factory->registerObjects(core::ObjectRegistrationData("Load a 2d texture to be used in a shader.").add< OglTexture2D >()); +} GLint OglTexture::MAX_NUMBER_OF_TEXTURE_UNIT = 1; diff --git a/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/OglTexturePointer.cpp b/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/OglTexturePointer.cpp index a0ffed44c6c..e22f7cc98a1 100644 --- a/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/OglTexturePointer.cpp +++ b/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/OglTexturePointer.cpp @@ -27,8 +27,11 @@ namespace sofa::gl::component::shader { -// Register the OglTexturePointer class in the Factory -int OglTexturePointerClass = core::RegisterObject("OglTexturePointer").add< OglTexturePointer >(); +void registerOglTexturePointer(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Pointer to a OglTexture, useful for sharing a texture between multiple shaders.") + .add< OglTexturePointer >()); +} OglTexturePointer::OglTexturePointer() :l_oglTexture( initLink( "oglTexture", "OglTexture" ) ) diff --git a/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/OglVariable.cpp b/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/OglVariable.cpp index 02c3a0f13ab..b196cc42c85 100644 --- a/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/OglVariable.cpp +++ b/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/OglVariable.cpp @@ -25,138 +25,44 @@ namespace sofa::gl::component::shader { -/** SINGLE INT VARIABLE **/ -//Register OglIntVariable in the Object Factory -int OglIntVariableClass = core::RegisterObject("OglIntVariable") - .add< OglIntVariable >() - ; -//Register OglInt2Variable in the Object Factory -int OglInt2VariableClass = core::RegisterObject("OglInt2Variable") - .add< OglInt2Variable >() - ; -//Register OglInt3Variable in the Object Factory -int OglInt3VariableClass = core::RegisterObject("OglInt3Variable") - .add< OglInt3Variable >() - ; -//Register OglInt4Variable in the Object Factory -int OglInt4VariableClass = core::RegisterObject("OglInt4Variable") - .add< OglInt4Variable >() - ; - -/** SINGLE FLOAT VARIABLE **/ - -//Register OglFloatVariable in the Object Factory -int OglFloatVariableClass = core::RegisterObject("OglFloatVariable") - .add< OglFloatVariable >() - ; -//Register OglFloat2Variable in the Object Factory -int OglFloat2VariableClass = core::RegisterObject("OglFloat2Variable") - .add< OglFloat2Variable >() - ; -//Register OglFloat3Variable in the Object Factory -int OglFloat3VariableClass = core::RegisterObject("OglFloat3Variable") - .add< OglFloat3Variable >() - ; -//Register OglFloat4Variable in the Object Factory -int OglFloat4VariableClass = core::RegisterObject("OglFloat4Variable") - .add< OglFloat4Variable >() - ; - -/** INT VECTOR VARIABLE **/ -//Register OglIntVectorVariable in the Object Factory -int OglIntVectorVariableClass = core::RegisterObject("OglIntVectorVariable") - .add< OglIntVectorVariable >() - ; - -//Register OglIntVector2Variable in the Object Factory -int OglIntVector2VariableClass = core::RegisterObject("OglIntVector2Variable") - .add< OglIntVector2Variable >() - ; - -//Register OglIntVector3Variable in the Object Factory -int OglIntVector3VariableClass = core::RegisterObject("OglIntVector3Variable") - .add< OglIntVector3Variable >() - ; - -//Register OglIntVector4Variable in the Object Factory -int OglIntVector4VariableClass = core::RegisterObject("OglIntVector4Variable") - .add< OglIntVector4Variable >() - ; - - -/** FLOAT VECTOR VARIABLE **/ -//Register OglFloatVectorVariable in the Object Factory -int OglFloatVectorVariableClass = core::RegisterObject("OglFloatVectorVariable") - .add< OglFloatVectorVariable >() - ; - -//Register OglFloatVector2Variable in the Object Factory -int OglFloatVector2VariableClass = core::RegisterObject("OglFloatVector2Variable") - .add< OglFloatVector2Variable >() - ; - -//Register OglFloatVector3Variable in the Object Factory -int OglFloatVector3VariableClass = core::RegisterObject("OglFloatVector3Variable") - .add< OglFloatVector3Variable >() - ; -//Register OglFloatVector4Variable in the Object Factory -int OglFloatVector4VariableClass = core::RegisterObject("OglFloatVector4Variable") - .add< OglFloatVector4Variable >() - ; - -/** Matrix VARIABLE **/ -//Register OglMatrix2Variable in the Object Factory -int OglMatrix2VariableClass = core::RegisterObject("OglMatrix2Variable") - .add< OglMatrix2Variable >() - ; - -//Register OglMatrix3Variable in the Object Factory -int OglMatrix3VariableClass = core::RegisterObject("OglMatrix3Variable") - .add< OglMatrix3Variable >() - ; - -//Register OglMatrix4Variable in the Object Factory -int OglMatrix4VariableClass = core::RegisterObject("OglMatrix4Variable") - .add< OglMatrix4Variable >() - ; - -//Register OglMatrix2x3Variable in the Object Factory -int OglMatrix2x3VariableClass = core::RegisterObject("OglMatrix2x3Variable") - .add< OglMatrix2x3Variable >() - ; - -//Register OglMatrix3x2Variable in the Object Factory -int OglMatrix3x2VariableClass = core::RegisterObject("OglMatrix3x2Variable") - .add< OglMatrix3x2Variable >() - ; - -//Register OglMatrix2x4Variable in the Object Factory -int OglMatrix2x4VariableClass = core::RegisterObject("OglMatrix2x4Variable") - .add< OglMatrix2x4Variable >() - ; - -//Register OglMatrix4x2Variable in the Object Factory -int OglMatrix4x2VariableClass = core::RegisterObject("OglMatrix4x2Variable") - .add< OglMatrix4x2Variable >() - ; - -//Register OglMatrix2x4Variable in the Object Factory -int OglMatrix3x4VariableClass = core::RegisterObject("OglMatrix3x4Variable") - .add< OglMatrix3x4Variable >() - ; - -//Register OglMatrix4x3Variable in the Object Factory -int OglMatrix4x3VariableClass = core::RegisterObject("OglMatrix4x3Variable") - .add< OglMatrix4x3Variable >() - ; - -/** Matrix vector VARIABLE **/ -//Register OglMatrix4VectorVariable in the Object Factory -int OglMatrix4VectorVariableClass = core::RegisterObject("OglMatrix4VectorVariable") - .add< OglMatrix4VectorVariable >() - ; +void registerOglVariable(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("OglIntVariable").add< OglIntVariable >()); + factory->registerObjects(core::ObjectRegistrationData("OglInt2Variable").add< OglInt2Variable >()); + factory->registerObjects(core::ObjectRegistrationData("OglInt3Variable").add< OglInt3Variable >()); + factory->registerObjects(core::ObjectRegistrationData("OglInt4Variable").add< OglInt4Variable >()); + + factory->registerObjects(core::ObjectRegistrationData("OglFloatVariable").add< OglFloatVariable >()); + factory->registerObjects(core::ObjectRegistrationData("OglFloat2Variable").add< OglFloat2Variable >()); + factory->registerObjects(core::ObjectRegistrationData("OglFloat3Variable").add< OglFloat3Variable >()); + factory->registerObjects(core::ObjectRegistrationData("OglFloat4Variable").add< OglFloat4Variable >()); + + factory->registerObjects(core::ObjectRegistrationData("OglIntVectorVariable").add< OglIntVectorVariable >()); + factory->registerObjects(core::ObjectRegistrationData("OglIntVector2Variable").add< OglIntVector2Variable >()); + factory->registerObjects(core::ObjectRegistrationData("OglIntVector3Variable").add< OglIntVector3Variable >()); + factory->registerObjects(core::ObjectRegistrationData("OglIntVector4Variable").add< OglIntVector4Variable >()); + + + factory->registerObjects(core::ObjectRegistrationData("OglFloatVectorVariable").add< OglFloatVectorVariable >()); + factory->registerObjects(core::ObjectRegistrationData("OglFloatVector2Variable").add< OglFloatVector2Variable >()); + factory->registerObjects(core::ObjectRegistrationData("OglFloatVector3Variable").add< OglFloatVector3Variable >()); + factory->registerObjects(core::ObjectRegistrationData("OglFloatVector4Variable").add< OglFloatVector4Variable >()); + factory->registerObjects(core::ObjectRegistrationData("OglMatrix2Variable").add< OglMatrix2Variable >()); + factory->registerObjects(core::ObjectRegistrationData("OglMatrix3Variable").add< OglMatrix3Variable >()); + factory->registerObjects(core::ObjectRegistrationData("OglMatrix4Variable").add< OglMatrix4Variable >()); + factory->registerObjects(core::ObjectRegistrationData("OglMatrix2x3Variable").add< OglMatrix2x3Variable >()); + factory->registerObjects(core::ObjectRegistrationData("OglMatrix3x2Variable").add< OglMatrix3x2Variable >()); + factory->registerObjects(core::ObjectRegistrationData("OglMatrix2x4Variable").add< OglMatrix2x4Variable >()); + factory->registerObjects(core::ObjectRegistrationData("OglMatrix4x2Variable").add< OglMatrix4x2Variable >()); + factory->registerObjects(core::ObjectRegistrationData("OglMatrix3x4Variable").add< OglMatrix3x4Variable >()); + factory->registerObjects(core::ObjectRegistrationData("OglMatrix4x3Variable").add< OglMatrix4x3Variable >()); + + factory->registerObjects(core::ObjectRegistrationData("OglMatrix4VectorVariable").add< OglMatrix4VectorVariable >()); + +} + OglIntVariable::OglIntVariable() { diff --git a/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/OrderIndependentTransparencyManager.cpp b/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/OrderIndependentTransparencyManager.cpp index 366af540a37..c75c0a8519c 100644 --- a/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/OrderIndependentTransparencyManager.cpp +++ b/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/OrderIndependentTransparencyManager.cpp @@ -34,10 +34,11 @@ using namespace sofa::gl; using namespace simulation; using namespace core::visual; -//Register OrderIndependentTransparencyManager in the Object Factory -int OrderIndependentTransparencyManagerClass = core::RegisterObject("OrderIndependentTransparencyManager") - .add< OrderIndependentTransparencyManager >() - ; +void registerOrderIndependentTransparencyManager(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Order Independent Transparency Manager (to be used with OglOITShader).") + .add< OrderIndependentTransparencyManager >()); +} class VisualOITDrawVisitor : public VisualDrawVisitor { diff --git a/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/PostProcessManager.cpp b/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/PostProcessManager.cpp index 0021075359f..1874f2fed1d 100644 --- a/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/PostProcessManager.cpp +++ b/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/PostProcessManager.cpp @@ -27,10 +27,11 @@ namespace sofa::gl::component::shader { -//Register PostProcessManager in the Object Factory -int PostProcessManagerClass = core::RegisterObject("PostProcessManager") - .add< PostProcessManager >() - ; +void registerPostProcessManager(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Add a post process pass to the actual rendering.") + .add< PostProcessManager >()); +} using namespace core::visual; diff --git a/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/VisualManagerPass.cpp b/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/VisualManagerPass.cpp index 25e1607d724..98b18467be8 100644 --- a/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/VisualManagerPass.cpp +++ b/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/VisualManagerPass.cpp @@ -31,10 +31,11 @@ using namespace sofa::gl; using namespace simulation; using namespace core::visual; -//Register LightManager in the Object Factory -int VisualManagerPassClass = core::RegisterObject("VisualManagerPass") - .add< VisualManagerPass >() - ; +void registerVisualManagerPass(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Render pass element: render the relevant tagged objects in a FBO.") + .add< VisualManagerPass >()); +} VisualManagerPass::VisualManagerPass() : factor(initData(&factor, 1.0f, "factor","set the resolution factor for the output pass. default value:1.0")), diff --git a/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/VisualManagerSecondaryPass.cpp b/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/VisualManagerSecondaryPass.cpp index 569e0277991..00a0659e8e0 100644 --- a/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/VisualManagerSecondaryPass.cpp +++ b/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/VisualManagerSecondaryPass.cpp @@ -30,10 +30,11 @@ using namespace sofa::gl; using namespace simulation; using namespace core::visual; -//Register LightManager in the Object Factory -int VisualManagerSecondaryPassClass = core::RegisterObject("VisualManagerSecondaryPass") - .add< VisualManagerSecondaryPass >() - ; +void registerVisualManagerSecondaryPass(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Chain different rendering pass, for compositing.") + .add< VisualManagerSecondaryPass >()); +} VisualManagerSecondaryPass::VisualManagerSecondaryPass() : input_tags(initData( &input_tags, "input_tags", "list of input passes used as source textures")) diff --git a/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/init.cpp b/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/init.cpp index eeb782dcd3b..d9349701cd4 100644 --- a/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/init.cpp +++ b/Sofa/GL/Component/Shader/src/sofa/gl/component/shader/init.cpp @@ -21,22 +21,41 @@ ******************************************************************************/ #include #include +#include + namespace sofa::gl::component::shader { - + +extern void registerCompositingVisualLoop(sofa::core::ObjectFactory* factory); +extern void registerDirectionalLight(sofa::core::ObjectFactory* factory); +extern void registerPositionalLight(sofa::core::ObjectFactory* factory); +extern void registerSpotlLight(sofa::core::ObjectFactory* factory); +extern void registerLightManager(sofa::core::ObjectFactory* factory); +extern void registerOglAttribute(sofa::core::ObjectFactory* factory); +extern void registerOglOITShader(sofa::core::ObjectFactory* factory); +extern void registerOglRenderingSRGB(sofa::core::ObjectFactory* factory); +extern void registerOglShader(sofa::core::ObjectFactory* factory); +extern void registerOglShaderDefineMacro(sofa::core::ObjectFactory* factory); +extern void registerOglShaderVisualModel(sofa::core::ObjectFactory* factory); +extern void registerOglShadowShader(sofa::core::ObjectFactory* factory); +extern void registerOglTexture(sofa::core::ObjectFactory* factory); +extern void registerOglTexturePointer(sofa::core::ObjectFactory* factory); +extern void registerOglVariable(sofa::core::ObjectFactory* factory); +extern void registerOrderIndependentTransparencyManager(sofa::core::ObjectFactory* factory); +extern void registerPostProcessManager(sofa::core::ObjectFactory* factory); +extern void registerVisualManagerPass(sofa::core::ObjectFactory* factory); +extern void registerVisualManagerSecondaryPass(sofa::core::ObjectFactory* factory); + extern "C" { SOFA_EXPORT_DYNAMIC_LIBRARY void initExternalModule(); SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleName(); SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleVersion(); + SOFA_EXPORT_DYNAMIC_LIBRARY void registerObjects(sofa::core::ObjectFactory* factory); } void initExternalModule() { - static bool first = true; - if (first) - { - first = false; - } + init(); } const char* getModuleName() @@ -49,9 +68,39 @@ const char* getModuleVersion() return MODULE_VERSION; } +void registerObjects(sofa::core::ObjectFactory* factory) +{ + registerCompositingVisualLoop(factory); + registerDirectionalLight(factory); + registerPositionalLight(factory); + registerSpotlLight(factory); + registerLightManager(factory); + registerOglAttribute(factory); + registerOglOITShader(factory); + registerOglRenderingSRGB(factory); + registerOglShader(factory); + registerOglShaderDefineMacro(factory); + registerOglShaderVisualModel(factory); + registerOglShadowShader(factory); + registerOglTexture(factory); + registerOglTexturePointer(factory); + registerOglVariable(factory); + registerOrderIndependentTransparencyManager(factory); + registerPostProcessManager(factory); + registerVisualManagerPass(factory); + registerVisualManagerSecondaryPass(factory); +} + void init() { - initExternalModule(); + static bool first = true; + if (first) + { + // make sure that this plugin is registered into the PluginManager + sofa::helper::system::PluginManager::getInstance().registerPlugin(MODULE_NAME); + + first = false; + } } } // namespace sofa::gl::component::shader diff --git a/Sofa/GL/Component/src/sofa/gl/component/init.cpp b/Sofa/GL/Component/src/sofa/gl/component/init.cpp index 761a2932d08..177568ef080 100644 --- a/Sofa/GL/Component/src/sofa/gl/component/init.cpp +++ b/Sofa/GL/Component/src/sofa/gl/component/init.cpp @@ -21,10 +21,14 @@ ******************************************************************************/ #include +#include #include #include #include +#include +#include + namespace sofa::gl::component { @@ -32,19 +36,12 @@ extern "C" { SOFA_EXPORT_DYNAMIC_LIBRARY void initExternalModule(); SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleName(); SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleVersion(); + SOFA_EXPORT_DYNAMIC_LIBRARY void registerObjects(sofa::core::ObjectFactory* factory); } void initExternalModule() { - static bool first = true; - if (first) - { - sofa::gl::component::rendering2d::init(); - sofa::gl::component::rendering3d::init(); - sofa::gl::component::shader::init(); - - first = false; - } + init(); } const char* getModuleName() @@ -57,9 +54,30 @@ const char* getModuleVersion() return MODULE_VERSION; } +void registerObjects(sofa::core::ObjectFactory* factory) +{ + factory->registerObjectsFromPlugin("Sofa.GL.Component.Engine"); + factory->registerObjectsFromPlugin("Sofa.GL.Component.Rendering2D"); + factory->registerObjectsFromPlugin("Sofa.GL.Component.Rendering3D"); + factory->registerObjectsFromPlugin("Sofa.GL.Component.Shader"); +} + void init() { - initExternalModule(); + static bool first = true; + if (first) + { + // force dependencies at compile-time + sofa::gl::component::engine::init(); + sofa::gl::component::rendering2d::init(); + sofa::gl::component::rendering3d::init(); + sofa::gl::component::shader::init(); + + // make sure that this plugin is registered into the PluginManager + sofa::helper::system::PluginManager::getInstance().registerPlugin(MODULE_NAME); + + first = false; + } } } // namespace sofa::gl::component diff --git a/Sofa/GUI/Component/src/sofa/gui/component/AddFrameButtonSetting.cpp b/Sofa/GUI/Component/src/sofa/gui/component/AddFrameButtonSetting.cpp index e0e4b65546e..284c1596062 100644 --- a/Sofa/GUI/Component/src/sofa/gui/component/AddFrameButtonSetting.cpp +++ b/Sofa/GUI/Component/src/sofa/gui/component/AddFrameButtonSetting.cpp @@ -27,13 +27,10 @@ namespace sofa::gui::component { -int AddFrameButtonSettingClass = core::RegisterObject("Add a frame to a skinned model") - .add< AddFrameButtonSetting >() - .addAlias("AddFrameButton") - ; - -AddFrameButtonSetting::AddFrameButtonSetting() +void registerAddFrameButtonSetting(sofa::core::ObjectFactory* factory) { + factory->registerObjects(core::ObjectRegistrationData("Button setting adding a frame to a skinned model.") + .add< AddFrameButtonSetting >()); } } // namespace sofa::gui::component \ No newline at end of file diff --git a/Sofa/GUI/Component/src/sofa/gui/component/AddFrameButtonSetting.h b/Sofa/GUI/Component/src/sofa/gui/component/AddFrameButtonSetting.h index 054a07eb117..3206ffe6d81 100644 --- a/Sofa/GUI/Component/src/sofa/gui/component/AddFrameButtonSetting.h +++ b/Sofa/GUI/Component/src/sofa/gui/component/AddFrameButtonSetting.h @@ -34,7 +34,7 @@ class SOFA_GUI_COMPONENT_API AddFrameButtonSetting: public sofa::component::sett public: SOFA_CLASS(AddFrameButtonSetting, sofa::component::setting::MouseButtonSetting); protected: - AddFrameButtonSetting(); + AddFrameButtonSetting() = default; public: std::string getOperationType() override {return "AddFrame";} }; diff --git a/Sofa/GUI/Component/src/sofa/gui/component/AddRecordedCameraButtonSetting.cpp b/Sofa/GUI/Component/src/sofa/gui/component/AddRecordedCameraButtonSetting.cpp index 0e54d43de1e..b4bb9c67ff2 100644 --- a/Sofa/GUI/Component/src/sofa/gui/component/AddRecordedCameraButtonSetting.cpp +++ b/Sofa/GUI/Component/src/sofa/gui/component/AddRecordedCameraButtonSetting.cpp @@ -27,15 +27,16 @@ namespace sofa::gui::component { -int AddRecordedCameraButtonSettingClass = core::RegisterObject("Save Camera's View Point Button configuration") - .add< AddRecordedCameraButtonSetting >() - .addAlias("AddRecordedCameraButton") - ; - +void registerAddRecordedCameraButtonSetting(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Save Camera's View Point Button configuration.") + .add< AddRecordedCameraButtonSetting >()); +} -int StartNavigationButtonSettingClass = core::RegisterObject("Start Navigation Button configuration") - .add< StartNavigationButtonSetting >() - .addAlias("StartNavigationButton") - ; +void registerStartNavigationButtonSetting(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Start Navigation Button configuration.") + .add< StartNavigationButtonSetting >()); +} } // namespace sofa::gui::component diff --git a/Sofa/GUI/Component/src/sofa/gui/component/AttachBodyButtonSetting.cpp b/Sofa/GUI/Component/src/sofa/gui/component/AttachBodyButtonSetting.cpp index 0158b6864b3..5e3439aee0a 100644 --- a/Sofa/GUI/Component/src/sofa/gui/component/AttachBodyButtonSetting.cpp +++ b/Sofa/GUI/Component/src/sofa/gui/component/AttachBodyButtonSetting.cpp @@ -27,10 +27,12 @@ namespace sofa::gui::component { -int AttachBodyButtonSettingClass = core::RegisterObject("Attach Body Button configuration") - .add< AttachBodyButtonSetting >() - .addAlias("AttachBodyButton") - ; + +void registerAttachBodyButtonSetting(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Attach Body Button configuration.") + .add< AttachBodyButtonSetting >()); +} AttachBodyButtonSetting::AttachBodyButtonSetting(): d_stiffness(initData(&d_stiffness, 1000.0_sreal, "stiffness", "Stiffness of the spring to attach a particule")) diff --git a/Sofa/GUI/Component/src/sofa/gui/component/ConstraintAttachButtonSetting.cpp b/Sofa/GUI/Component/src/sofa/gui/component/ConstraintAttachButtonSetting.cpp index afafeb021ee..ebf84b4bbc7 100644 --- a/Sofa/GUI/Component/src/sofa/gui/component/ConstraintAttachButtonSetting.cpp +++ b/Sofa/GUI/Component/src/sofa/gui/component/ConstraintAttachButtonSetting.cpp @@ -27,9 +27,10 @@ namespace sofa::gui::component { -int ConstraintAttachButtonSettingClass = core::RegisterObject("Attach an object to the mouse using lagrangian multiplier") - .add< ConstraintAttachButtonSetting >(); - - +void registerConstraintAttachButtonSetting(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Attach an object to the mouse using lagrangian multiplier.") + .add< ConstraintAttachButtonSetting >()); +} } // namespace sofa::gui::component diff --git a/Sofa/GUI/Component/src/sofa/gui/component/FixPickedParticleButtonSetting.cpp b/Sofa/GUI/Component/src/sofa/gui/component/FixPickedParticleButtonSetting.cpp index 290b34c9905..9286ac9c680 100644 --- a/Sofa/GUI/Component/src/sofa/gui/component/FixPickedParticleButtonSetting.cpp +++ b/Sofa/GUI/Component/src/sofa/gui/component/FixPickedParticleButtonSetting.cpp @@ -27,10 +27,11 @@ namespace sofa::gui::component { -int FixPickedParticleButtonSettingClass = core::RegisterObject("Fix a picked particle in space") - .add< FixPickedParticleButtonSetting >() - .addAlias("FixPickedParticleButton") - ; +void registerFixPickedParticleButtonSetting(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Fix a picked particle in space.") + .add< FixPickedParticleButtonSetting >()); +} FixPickedParticleButtonSetting::FixPickedParticleButtonSetting(): stiffness(initData(&stiffness, 10000.0_sreal, "stiffness", "Stiffness of the spring to fix a particule")) diff --git a/Sofa/GUI/Component/src/sofa/gui/component/init.cpp b/Sofa/GUI/Component/src/sofa/gui/component/init.cpp index d0b96ee577f..8d1d2c0e687 100644 --- a/Sofa/GUI/Component/src/sofa/gui/component/init.cpp +++ b/Sofa/GUI/Component/src/sofa/gui/component/init.cpp @@ -21,22 +21,34 @@ ******************************************************************************/ #include +#include +#include + namespace sofa::gui::component { - + +extern void registerAddFrameButtonSetting(sofa::core::ObjectFactory* factory); +extern void registerAddRecordedCameraButtonSetting(sofa::core::ObjectFactory* factory); +extern void registerStartNavigationButtonSetting(sofa::core::ObjectFactory* factory); +extern void registerAttachBodyButtonSetting(sofa::core::ObjectFactory* factory); +extern void registerConstraintAttachButtonSetting(sofa::core::ObjectFactory* factory); +extern void registerFixPickedParticleButtonSetting(sofa::core::ObjectFactory* factory); + +namespace performer +{ + extern void registerMouseInteractor(sofa::core::ObjectFactory* factory); +} + extern "C" { SOFA_EXPORT_DYNAMIC_LIBRARY void initExternalModule(); SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleName(); SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleVersion(); + SOFA_EXPORT_DYNAMIC_LIBRARY void registerObjects(sofa::core::ObjectFactory* factory); } void initExternalModule() { - static bool first = true; - if (first) - { - first = false; - } + init(); } const char* getModuleName() @@ -49,9 +61,27 @@ const char* getModuleVersion() return MODULE_VERSION; } +void registerObjects(sofa::core::ObjectFactory* factory) +{ + registerAddFrameButtonSetting(factory); + registerAddRecordedCameraButtonSetting(factory); + registerStartNavigationButtonSetting(factory); + registerAttachBodyButtonSetting(factory); + registerConstraintAttachButtonSetting(factory); + registerFixPickedParticleButtonSetting(factory); + performer::registerMouseInteractor(factory); +} + void init() { - initExternalModule(); + static bool first = true; + if (first) + { + // make sure that this plugin is registered into the PluginManager + sofa::helper::system::PluginManager::getInstance().registerPlugin(MODULE_NAME); + + first = false; + } } } // namespace sofa::gui::component diff --git a/Sofa/GUI/Component/src/sofa/gui/component/performer/MouseInteractor.cpp b/Sofa/GUI/Component/src/sofa/gui/component/performer/MouseInteractor.cpp index ba515933229..02c9c71c3b5 100644 --- a/Sofa/GUI/Component/src/sofa/gui/component/performer/MouseInteractor.cpp +++ b/Sofa/GUI/Component/src/sofa/gui/component/performer/MouseInteractor.cpp @@ -28,15 +28,15 @@ namespace sofa::gui::component::performer { -int MouseInteractorClass = core::RegisterObject("Perform tasks related to the interaction with the mouse") +void registerMouseInteractor(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Perform tasks related to the interaction with the mouse.") .add< MouseInteractor >() - .add< MouseInteractor >() - - ; -int MouseInteractorRigidClass = core::RegisterObject("Perform tasks related to the interaction with the mouse and rigid objects") - .add< MouseInteractor >() + .add< MouseInteractor >()); - ; + factory->registerObjects(core::ObjectRegistrationData("Perform tasks related to the interaction with the mouse and rigid objects") + .add< MouseInteractor >()); +} template class SOFA_GUI_COMPONENT_API MouseInteractor; template class SOFA_GUI_COMPONENT_API MouseInteractor; diff --git a/Sofa/framework/Helper/src/sofa/helper/ComponentChange.cpp b/Sofa/framework/Helper/src/sofa/helper/ComponentChange.cpp index 5bb28b0964e..fa6c8375885 100644 --- a/Sofa/framework/Helper/src/sofa/helper/ComponentChange.cpp +++ b/Sofa/framework/Helper/src/sofa/helper/ComponentChange.cpp @@ -812,6 +812,13 @@ const std::map< std::string, Dealiased, std::less<> > dealiasedComponents = { {"DefaultContactManager", Dealiased("v24.12","CollisionResponse")}, {"RuleBasedCollisionResponse", Dealiased("v24.12","RuleBasedContactManager")}, {"SurfaceIdentityMapping", Dealiased("v24.12","SubsetMapping")}, + {"AddFrameButtonSetting", Dealiased("v24.12","AddFrameButton")}, + {"StartNavigationButtonSetting", Dealiased("v24.12","AddRecordedCameraButton")}, + {"AddRecordedCameraButtonSetting", Dealiased("v24.12","StartNavigationButton")}, + {"AttachBodyButtonSetting", Dealiased("v24.12","AttachBodyButton")}, + {"FixPickedParticleButtonSetting", Dealiased("v24.12","FixPickedParticleButton")}, + {"OglColorMap", Dealiased("v24.12","ColorMap")}, + {"PointSplatModel", Dealiased("v24.12","PointSplat")}, }; } // namespace sofa::helper::lifecycle