|
1 | | -#include <string> |
2 | | -#include <stdio.h> |
| 1 | +#include <sofa/core/ObjectFactory.h> |
3 | 2 | #include <sofa/helper/system/FileRepository.h> |
| 3 | +#include <sofa/helper/system/PluginManager.h> |
4 | 4 | #include <sofa/helper/system/SetDirectory.h> |
5 | | -#include <sofa/core/ObjectFactory.h> |
6 | 5 | #include <stdio.h> |
7 | 6 | #include <string.h> |
8 | 7 |
|
| 8 | +#include <string> |
| 9 | + |
9 | 10 | #define Q(x) #x |
10 | 11 | #define QUOTE(x) Q(x) |
11 | 12 |
|
12 | | -namespace sofa { |
13 | | - |
14 | | -namespace collisionAlgorithm { |
15 | | - |
16 | | - //Here are just several convenient functions to help user to know what contains the plugin |
17 | | - |
18 | | - extern "C" { |
19 | | - void initExternalModule(); |
20 | | - const char* getModuleName(); |
21 | | - const char* getModuleVersion(); |
22 | | - const char* getModuleLicense(); |
23 | | - const char* getModuleDescription(); |
24 | | - const char* getModuleComponentList(); |
25 | | - } |
26 | | - |
27 | | - void initExternalModule() |
28 | | - { |
29 | | - static bool first = true; |
30 | | - if (first) |
31 | | - { |
32 | | - first = false; |
| 13 | +namespace sofa::collisionAlgorithm |
| 14 | +{ |
| 15 | + |
| 16 | +// CollisionPipeline |
| 17 | +extern void registerCollisionLoop(sofa::core::ObjectFactory* factory); |
| 18 | + |
| 19 | +// Algorithms |
| 20 | +extern void registerFind2DClosestProximityAlgorithm(sofa::core::ObjectFactory* factory); |
| 21 | +extern void registerFindClosestProximityAlgorithm(sofa::core::ObjectFactory* factory); |
| 22 | +extern void registerInsertionAlgorithm(sofa::core::ObjectFactory* factory); |
| 23 | + |
| 24 | +// BroadPhase |
| 25 | +extern void registerAABBBroadPhase(sofa::core::ObjectFactory* factory); |
| 26 | +extern void registerFullAABBBroadPhase(sofa::core::ObjectFactory* factory); |
| 27 | + |
| 28 | +// Distance Filters |
| 29 | +extern void registerDistanceFilter(sofa::core::ObjectFactory* factory); |
| 30 | + |
| 31 | +// Geometry |
| 32 | +extern void registerSubsetGeometry(sofa::core::ObjectFactory* factory); |
| 33 | +extern void registerPointGeometry(sofa::core::ObjectFactory* factory); |
| 34 | +extern void registerEdgeGeometry(sofa::core::ObjectFactory* factory); |
| 35 | +extern void registerTriangleGeometry(sofa::core::ObjectFactory* factory); |
| 36 | +extern void registerTetrahedronGeometry(sofa::core::ObjectFactory* factory); |
| 37 | +} // namespace sofa::collisionAlgorithm |
| 38 | + |
| 39 | +namespace sofa::component |
| 40 | +{ |
| 41 | + |
| 42 | +// Here are just several convenient functions to help user to know what contains the plugin |
| 43 | + |
| 44 | +extern "C" |
| 45 | +{ |
| 46 | + void initExternalModule(); |
| 47 | + const char* getModuleName(); |
| 48 | + const char* getModuleVersion(); |
| 49 | + const char* getModuleLicense(); |
| 50 | + const char* getModuleDescription(); |
| 51 | + void registerObjects(sofa::core::ObjectFactory* factory); |
| 52 | +} |
| 53 | + |
| 54 | +void initCollisionAlgorithm() |
| 55 | +{ |
| 56 | + static bool first = true; |
| 57 | + if (first) |
| 58 | + { |
| 59 | + first = false; |
33 | 60 | #ifdef PLUGIN_DATA_DIR |
34 | | - sofa::helper::system::DataRepository.addLastPath(std::string(QUOTE(PLUGIN_DATA_DIR))); |
| 61 | + sofa::helper::system::DataRepository.addLastPath(std::string(QUOTE(PLUGIN_DATA_DIR))); |
35 | 62 | #endif |
36 | | - sofa::helper::system::DataRepository.addLastPath(sofa::helper::system::SetDirectory::GetCurrentDir()); |
37 | | - } |
38 | | - } |
| 63 | + sofa::helper::system::DataRepository.addLastPath( |
| 64 | + sofa::helper::system::SetDirectory::GetCurrentDir()); |
| 65 | + } |
| 66 | +} |
| 67 | + |
| 68 | +void initExternalModule() |
| 69 | +{ |
| 70 | + initCollisionAlgorithm(); |
| 71 | +} |
39 | 72 |
|
40 | | - const char* getModuleName() |
41 | | - { |
42 | | - return "CollisionAlgorithm"; |
43 | | - } |
| 73 | +const char* getModuleName() { return "CollisionAlgorithm"; } |
44 | 74 |
|
45 | | - const char* getModuleVersion() |
46 | | - { |
| 75 | +const char* getModuleVersion() |
| 76 | +{ |
47 | 77 | #ifdef PLUGIN_GIT_INFO |
48 | | - return QUOTE(PLUGIN_GIT_INFO); |
| 78 | + return QUOTE(PLUGIN_GIT_INFO); |
49 | 79 | #else |
50 | | - return "??? to get the last git hash you must active the setupGit macro in CMakeLists"; |
| 80 | + return "??? to get the last git hash you must active the setupGit macro in CMakeLists"; |
51 | 81 | #endif |
52 | | - } |
| 82 | +} |
53 | 83 |
|
54 | | - const char* getModuleLicense() |
55 | | - { |
56 | | - return "LGPL"; |
57 | | - } |
58 | | - |
59 | | - const char* getModuleDescription() { |
60 | | - return "Plugin for collision detection"; |
61 | | - } |
| 84 | +const char* getModuleLicense() { return "LGPL"; } |
62 | 85 |
|
63 | | - const char* getModuleComponentList() |
64 | | - { |
65 | | - return ""; |
66 | | - } |
| 86 | +const char* getModuleDescription() { return "Plugin for collision detection"; } |
67 | 87 |
|
68 | | -} |
| 88 | +void registerObjects(sofa::core::ObjectFactory* factory) |
| 89 | +{ |
| 90 | + using namespace sofa::collisionAlgorithm; |
| 91 | + // Register CollisionPipeline |
| 92 | + registerCollisionLoop(factory); |
| 93 | + // Register Algorithms |
| 94 | + registerFind2DClosestProximityAlgorithm(factory); |
| 95 | + registerFindClosestProximityAlgorithm(factory); |
| 96 | + registerInsertionAlgorithm(factory); |
| 97 | + // Register BroadPhase |
| 98 | + registerAABBBroadPhase(factory); |
| 99 | + registerFullAABBBroadPhase(factory); |
| 100 | + // Register Distance Filters |
| 101 | + registerDistanceFilter(factory); |
| 102 | + // Register Geometry |
| 103 | + registerSubsetGeometry(factory); |
| 104 | + registerPointGeometry(factory); |
| 105 | + registerEdgeGeometry(factory); |
| 106 | + registerTriangleGeometry(factory); |
| 107 | + registerTetrahedronGeometry(factory); |
| 108 | +} |
69 | 109 |
|
70 | | -} |
| 110 | +} // namespace sofa::component |
0 commit comments