VR-Vantage 1.4.1 API Class Documentation
Creating a Plug-In

A typical VR-Vantage application (such as VR-Vantage Stealth) creates a DtDe, then immediately creates a DtPluginManager (DtPluginManager.h) - a class responsible for loading and initializing plug-ins.

The Plug-in Manager loads plug-ins before DtDe::initialize() is even called, because a plug-in developer often wants to affect the way a DtDe is initialized. The DtPluginManager loads each of the plug-ins in the ./plugins folder, and tries to call a global function called initDeModule(). The Plug-in Manager passes a pointer to the DtDe to initDeModule(), so that the plug-in has access to the DtDe. Therefore, the main responsibility of every plug-in developer is to implement and export (with C linkage) a global function called initDeModule().

What you actually do in your plug-in is up to you. A typical plug-in may subclass one of the key VR-Vantage classes and register the subclass with the display engine within initDeModule(). For example, the following plug-in code registers a new subclass of DtChannel (DtChannel.h) (the class that represents visual channels) with the display engine:

// This method is called by the DtPluginManager during startup.
void initDeModule(makVrv::DtDe* de)
{
   // Tell the display engine to use an instance of MyChannelCreator
   // instead of the base DtChannelCreator to create channels.
   // MyChannelCreator will create MyChannels instead of base
   // DtChannels.
   DtChannelCreator::registerInstance(de, new MyChannelCreator);
}

Once you build your plug-in, place it in the ./plugins folder, so that DtPluginManager can find it.



Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)