Difference between revisions of "NaviTrack Tutorial:Creating module:Adding module"

From NAMIC Wiki
Jump to: navigation, search
 
Line 37: Line 37:
  
 
SPLModule is a special module to register all NaviTrack modules, whenever the NaviTracker is started.
 
SPLModule is a special module to register all NaviTrack modules, whenever the NaviTracker is started.
This registration enables NaviTrack to recognize names of modules described in XML file.
+
This registration enables the NaviTrack to recognize names of modules described in XML file.
  
 
In addSPLModules() function in src/misc/SPLModules.cxx (starts from L.50):
 
In addSPLModules() function in src/misc/SPLModules.cxx (starts from L.50):
Line 54: Line 54:
 
      
 
      
 
     ....
 
     ....
 
  
 
=Step 4: Configure and build it!=
 
=Step 4: Configure and build it!=

Revision as of 18:52, 14 May 2007

Home < NaviTrack Tutorial:Creating module:Adding module

Here, we will add "MyTutorialModule" to your NaviTrack.

Step 1: Deploy your source codes

Put your *.cxx files into "src/input/", and *.h into "include/OpenTracker/input".

In UNIX:

% cp *.cxx <your NaviTrack directory>/src/input/
% cp *.h   <your NaviTrack directory>/include/OpenTracker/input/


Step 2: Configure Cmake

Configure your "CMakeLists.txt" at the root of your NaviTrack source tree, so that NaviTrack is compiled with your own module.

In SET(SOURCES ...) section in CMakeLists.txt (starts from L.126), add paths to your *.cxx files as:

SET(SOURCES
src/core/Event.cxx
src/core/EventAttributeBase.cxx
src/core/Translator.cxx

...

src/input/CustomTransformation.cxx
src/input/SpaceTravellerModule.cxx
src/input/MyTutorialModule.cxx                       <----- Here !!!
src/tool/OT_ACE_Log.cxx
src/input/QuatToMatrix.cxx
src/types/Image.cxx
)

Step 3: Register your module in SPLModule

SPLModule is a special module to register all NaviTrack modules, whenever the NaviTracker is started. This registration enables the NaviTrack to recognize names of modules described in XML file.

In addSPLModules() function in src/misc/SPLModules.cxx (starts from L.50): add your own module using OT_REGISTER_MODULE() macro as:

 OPENTRACKER_API int addSPLModules()
 {
 
   OT_REGISTER_MODULE(NaviTrack, NULL);
   
   OT_REGISTER_MODULE(SpaceTravellerModule, NULL);
   
   OT_REGISTER_MODULE(NDIModule, NULL);
   
   OT_REGISTER_MODULE(MyTutorialModule, NULL);                      <---   Here !!!
   
   ....

Step 4: Configure and build it!