|[ < ]||[ > ]||[ << ]||[ Up ]||[ >> ]||[Top]||[Contents]||[Index]||[ ? ]||[ Search: ]|
Written by Jorrit Tyberghein, firstname.lastname@example.org.
In this section a general overview is given of the mesh object plug-in system and several of the concepts are explained.
A Mesh Object is what this plug-in system is all about. It is basically a 3D object that the engine can render. Every mesh object knows how to render and light itself. Mesh Objects don't control their own position in the engine though. The engine is responsible for doing that. Mesh Object implementations must implement the SCF interface ‘iMeshObject’. Every visible mesh object in the world will implement this interface. Note that from the perspective of the engine you will always communicate with ‘iMeshWrapper’ instead of ‘iMeshObject’.
Mesh Objects often also implement one or more additional type specific interfaces to access the characteristics of that Mesh Object. The engine itself does not know about these interfaces. It is the responsibility of the application writer to correctly set up the characteristics of all Mesh Objects that it uses. These type specific interfaces are usually called ‘iSomethingState’ (replace Something with the appropriate name).
A Mesh Object Factory is an object from which you can generate Mesh Object instances. The Mesh Objects generated from a Mesh Object Factory will inherit some of the characteristics from this factory. Exactly which characteristics depend upon the Mesh Object Type (see below). Roughly speaking, there are three possibilities:
Which of the possibilities is selected by some Mesh Object type depends on the type. You'll have to look it up in the respective documentation for that type. Mesh Object Factories implement the SCF interface ‘iMeshObjectFactory’. Note that from the perspective of the engine you will always communicate with ‘iMeshFactoryWrapper’ instead of ‘iMeshObjectFactory’.
Mesh Object Factories often implement one or more additional type specific interfaces to access the characteristics of that Mesh Object Factory. The engine itself does not know about these interfaces. It is the responsibility of the application writer to correctly set up the characteristics of all Mesh Objects Factories that it uses. These type specific interfaces are usually called ‘iSomethingFactoryState’ (replace Something with the appropriate name).
The Mesh Object Type describes a specific kind of Mesh Object plug-in. For example, Crystal Space supports several types of Mesh Objects: particle system, ball, terrain, genmesh, etc. The Mesh Object Type corresponds directly to the plug-in itself. It is the class' responsible for creating all Mesh Object Factories. Mesh Object Types implement the SCF interface ‘iMeshObjectType’.
Some Mesh Object Types implement the SCF interface ‘iConfig’. In this case, you can use this interface to query all run-time options that are valid for that type.
In addition to the functionality for the Mesh Objects themselves, many Mesh Object Types support two implementations of the SCF interface ‘iLoaderPlugin’. By implementing this, these plug-ins can be used directly by the standard Crystal Space map file loader. There is a loader for the Mesh Object Factory and a loader for the Mesh Object itself. The Mesh Object plug-in itself doesn't know about these loader plug-ins. In fact, you can even write different loader plug-ins for the same Mesh Object Type if you so desire.
As mentioned above Mesh Objects only know how to render themselves and how to update lighting information. The engine is responsible for deciding when to draw and when to update. So basically, the Mesh Objects control the how while the engine controls the when. This is not completely true, though. The Mesh Object implementation itself must do some parts of the visibility testing on its own. For example, far plane clipping, and testing if the bounding box of the object is visible on screen are all the responsibility of the Mesh Object (but it can use the engine for help on calculating these things).
|[ < ]||[ > ]||[ << ]||[ Up ]||[ >> ]||[Top]||[Contents]||[Index]||[ ? ]|
This document was generated using texi2html 1.76.