Crystal Space 2.0.0: 4.2.2.2 Loading a Mesh Factory in Memory

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

#### 4.2.2.2 Loading a Mesh Factory in Memory

Now that we have our material we can use it to load the mesh factory. Edit `‘simple.cpp’` and add the following code in `Simple::CreateSprites()` (before the end and after the code we just added to load the material):

    void Simple::CreateSprites ()
    {
      ...
      // Load a sprite template from disk.
      csRef<iMeshFactoryWrapper> imeshfact (loader->LoadMeshObjectFactory (
            "/lib/std/sprite1"));
      if (imeshfact == 0)
        ReportError("Error loading mesh object factory!");
    }

This example uses `iLoader::LoadMeshObjectFactory()` to load the mesh factory from the given location. The name of the mesh factory will be “box” as that is the name given in the file `‘sprite1’` itself.

This is all there is to it. After this call the mesh factory is loaded in the engine and can be used to create meshes. This is what we'll do in the next section.

This document was generated using texi2html 1.76.