|[ < ]||[ > ]||[ << ]||[ Up ]||[ >> ]||[Top]||[Contents]||[Index]||[ ? ]||[ Search: ]|
This tutorial continues on the Simple Tutorial (see section Simple Tutorial 1: Basic Setup, World Creation). In this tutorial we explain a bit about VFS, texture management, and how you can add a simple mesh to the room.
This tutorial features (in addition to what is explained in simple1 tutorial):
Basic setup of a Crystal Space application using
Crystal Space has the concept of mesh factories and meshes. A mesh is basically
some kind of 3D object. Crystal Space supports several kinds of meshes. In
the previous tutorial we used the genmesh mesh to create the geometry of
our room. In this tutorial we will use the 3D sprite mesh. A mesh
factory is like a blue-print for a mesh (or sprite). It defines how the mesh
looks and how it animates. Before you can use a mesh you need to have a
mesh factory. Once you have a mesh factory you can create multiple
meshes from this. See section Mesh Object Plug-In System.
In this example we are going to load a mesh factory from disk. If you have the standard Crystal Space distribution then you have the file ‘CS/data/standard.zip’. In that archive file there is a file called ‘sprite1’ which contains the definition of our mesh factory. If you would like to examine the raw sprite data, extract it (by using, for instance, the command ‘unzip -x standard.zip sprite1’) and look at how mesh factories for 3D sprites are defined (mesh factories for other types of meshes may appear different).
But, how are we actually going to get that file out of that ZIP archive from within the Simple application? This is in fact very easy because Crystal Space supports the concept of VFS. Take a look at the VFS documentation (see section Virtual File System (VFS)) to learn how it works. Suffice it to say that ‘standard.zip’ is an archive that is, by default, mounted onto the VFS path ‘/lib/std’. You can see all the mounted VFS paths in the ‘CS/vfs.cfg’ file (and you can add more). So, this means that our sprite file can be found at the path ‘/lib/std/sprite1’.
If you look at the ‘sprite1’ file you can see that it refers to a material named ‘spark’. So, we'll have to load that material as well. This can also be found in ‘standard.zip’ at the path ‘/lib/std/spark.png’.
|22.214.171.124 Loading a Material in Memory|
|126.96.36.199 Loading a Mesh Factory in Memory|
|188.8.131.52 Creating a Mesh from a Factory|
|[ < ]||[ > ]||[ << ]||[ Up ]||[ >> ]||[Top]||[Contents]||[Index]||[ ? ]|
This document was generated using texi2html 1.76.