Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Extensions in Maxwell are dynamic libraries, that are loaded on demand. They have extension .<platform>.mxx and are typically  stored in the extensions folder inside Maxwell applications folder. They must be compiled and linked with the maxwell SDK.

All the extensions actually distributed in Maxwell have been created with this same API, without tricks or shortcuts, so it shows what can be achieved with it.

There are several extensions types that group extensions with the same functionality, and that need to implement some specific methods depending on type. All extensions types inherit from class CbaseExtension that handle the general interface with Maxwell, and the methods all extension must implement in order to work correctly. There are currently 3 geometry extension types that can be created, there are plans in the future for more extension types for other different needs and not only geometry, but they are in the works and not fully supported yet.

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.

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:
 double cubeSize;
 
 CubeExampleExtension()
 {
 
   getExtensionData()->createDouble( "Cube size", 1.0, 0, 1000 );//Create parameter with Default value
 }
 
 ~CubeExampleExtension() 
 {
 }
 
 bool initialize()
 {
   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>
  ...
 } 
 
 bool getBoundingBox( Cvector &bmin, Cvector& bmax)
 { 
   ...
   // <extension type method>
   ... 
 }

 

 

 

  • No labels