File: cs_79.html

package info (click to toggle)
crystalspace 0.94-20020412-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 62,276 kB
  • ctags: 52,843
  • sloc: cpp: 274,783; ansic: 6,608; perl: 6,276; objc: 3,952; asm: 2,942; python: 2,354; php: 542; pascal: 530; sh: 430; makefile: 370; awk: 193
file content (110 lines) | stat: -rw-r--r-- 6,057 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- Created by texi2html 1.64 -->
<!-- 
Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
            Karl Berry  <karl@freefriends.org>
            Olaf Bachmann <obachman@mathematik.uni-kl.de>
            and many others.
Maintained by: Olaf Bachmann <obachman@mathematik.uni-kl.de>
Send bugs and suggestions to <texi2html@mathematik.uni-kl.de>
 
-->
<HTML>
<HEAD>
<TITLE>Crystal Space: Tutorial Simple 2</TITLE>

<META NAME="description" CONTENT="Crystal Space: Tutorial Simple 2">
<META NAME="keywords" CONTENT="Crystal Space: Tutorial Simple 2">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<META NAME="Generator" CONTENT="texi2html 1.64">

</HEAD>

<BODY LANG="" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080" ALINK="#FF0000">

<A NAME="SEC177"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_78.html#SEC176"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_80.html#SEC178"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_73.html#SEC171"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_69.html#SEC157"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_83.html#SEC181"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="index.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_toc.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_285.html#SEC711">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_abt.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<HR SIZE=1>
<H2> 5.3 Simple Tutorial 2: Sprites </H2>
<!--docid::SEC177::-->
<P>

This tutorial continues on the Simple Tutorial (see section <A HREF="cs_73.html#SEC171">5.2 Simple Tutorial 1</A>).
In this tutorial we explain a bit about VFS, texture management and
how you can add a simple sprite to the simple application.
</P><P>

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 thing 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 <A HREF="cs_201.html#SEC452">7.8 Mesh Object Plug-In System</A>.
</P><P>

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
`<TT>CS/data/standard.zip</TT>'.  In that archive file there is a file called
`<SAMP>sprite1</SAMP>' which contains the definition of our mesh factory.  Extract
it (by using, for instance, the command `<SAMP>unzip -x standard.zip sprite1</SAMP>')
and examine it to see how mesh factories for 3D sprites are defined (mesh
factories for other types of meshes can look different).
</P><P>

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 <A HREF="cs_161.html#SEC340">7.2 Virtual File System (VFS)</A>) to learn how it works.  Suffice it to say that
`<TT>standard.zip</TT>' is an archive that is, by default, mounted onto the
VFS path `<TT>/lib/std</TT>'.  You can see all the mounted VFS paths in
the `<TT>CS/vfs.cfg</TT>' file (and you can add more).  So, this means that our
sprite file can be found at the path `<TT>/lib/std/sprite1</TT>'.
</P><P>

If you look at the `<TT>sprite1</TT>' file you can see that it refers to a material
named `<SAMP>spark</SAMP>'.  So we'll have to load that material as well.  This can
also be found in `<TT>standard.zip</TT>' at the path `<TT>/lib/std/spark.png</TT>'.
</P><P>

<BLOCKQUOTE><TABLE BORDER=0 CELLSPACING=0> 
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="cs_80.html#SEC178">5.3.1 Loading a Material in Memory</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP"></TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="cs_81.html#SEC179">5.3.2 Loading a Mesh Factory in Memory</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP"></TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="cs_82.html#SEC180">5.3.3 Creating a Mesh from a Factory</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP"></TD></TR>
</TABLE></BLOCKQUOTE>
<P>

<A NAME="Simple Loading Material"></A>
<HR SIZE=1>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_78.html#SEC176"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_80.html#SEC178"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_73.html#SEC171"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_69.html#SEC157"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_83.html#SEC181"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="index.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_toc.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_285.html#SEC711">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_abt.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<BR>  
<FONT SIZE="-1">
This document was generated

using <A HREF="http://www.mathematik.uni-kl.de/~obachman/Texi2html
"><I>texi2html</I></A>

</BODY>
</HTML>