Open Inventor Release 2024.2.0
 
Loading...
Searching...
No Matches
Overview

As described in The Inventor Mentor, all engines have at least one input and one output. The inputs are derived from SoField (either SoSF or SoMF fields). Outputs are of type SoEngineOutput. In addition, each engine has an evaluate() method, which uses the current input values and produces new output values. The file SoSubEngine.h contains the macros for defining new engine classes. The SO_ENGINE_HEADER() macro declares type identifier and naming variables and methods that all engine classes must support. The macro defines the static variables and methods declared in the SO_ENGINE_HEADER() macro. Other macros useful in creating new engine classes are mentioned in the following sections.

Creating a new engine requires these steps:

  1. Select a name for the new engine class and determine what class it is derived from.
  2. Define and name each input and output of the engine (see Defining Inputs and Outputs).
  3. Define an initClass() method to initialize the type information (see Initializing the Engine Class).
  4. Define an exitClass() method to clean up the type information. In the exitClass() routine of your class, use the macro SO_ENGINE_EXIT_CLASS.
  5. Define a constructor (see Defining the Constructor).
  6. Define a destructor.
  7. Implement an evaluate() method for the engine class (see Notification and Evaluation).
  8. If necessary, implement an inputChanged() method (see the section called “Creating a Fan-in Engine” and the section called “Creating a Second-Ticker Engine”).
  9. Implement a copy() method if the engine contains any nonfield instance data (see Creating a Node for more information on implementing a copy() method).