...
A extension must inherit from one of the types, implement some generic basic methods for the interface, and the specific methods of the extension type its writing.
Example of a basic extension implementing generic methods.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
class CubeExampleExtension : public CgeometryLoaderExtension { // Macro for burocracy, parameters: extension name, main class in the extension, and the version number DECLARE_EXTENSION_METHODS( "CubeExample", CubeExampleExtension, 1 ) public: //declare internal variables for calculation, it must include at least variables for storing extensionData values double cubeSize; CubeExampleExtension() { //create the editable values of the extensions, they can be modified when used, // getExtensionData returns the internal MxParamList to create new fields // check MxParamList for all possibilities of types creation getExtensionData()->createDouble( "Cube size", 1.0, 0, 1000 );//Create parameter with Default value } ~CubeExampleExtension() { } bool initialize() { //We must at least copy the extensionData values to internal variables, this will be called usually just one time, //before maxwell needs it getExtensionData()->getDouble( "Cube size", cubeSize );//Get the parameter value and store it before using it return true; } bool loadMesh( Cmaxwell::Cobject &cube ) { ... // <extension type method> CgeometryLoaderExtension method, will be explained in the corresponding chapter ... } bool getBoundingBox( Cvector &bmin, Cvector& bmax) { ... // <extension type method> CgeometryLoaderExtension method, will be explained in the corresponding chapter ... } |