File: cs_202.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 (204 lines) | stat: -rw-r--r-- 9,076 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
<!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: MeshObject Concepts</TITLE>

<META NAME="description" CONTENT="Crystal Space: MeshObject Concepts">
<META NAME="keywords" CONTENT="Crystal Space: MeshObject Concepts">
<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="SEC453"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_201.html#SEC452"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_203.html#SEC459"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_196.html#SEC414"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_201.html#SEC452"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_220.html#SEC543"> &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>
<H3> 7.8.1 MeshObject Concepts </H3>
<!--docid::SEC453::-->
<P>

<EM>Written by Jorrit Tyberghein,
<A HREF="mailto:jorrit.tyberghein@uz.kuleuven.ac.be">jorrit.tyberghein@uz.kuleuven.ac.be</A>.</EM>
</P><P>

In this section a general overview is given of the mesh object plug-in
system and several of the concepts are explained.
</P><P>

<A NAME="SEC454"></A>
<H4> Mesh Object </H4>
<!--docid::SEC454::-->
<P>

A <EM>Mesh Object</EM> 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 there own position in the engine
though.  The engine is responsible for doing that.  Mesh Object implementations
must implement the SCF interface `<SAMP>iMeshObject</SAMP>'.  Every visible mesh
object in the world will implement this interface.
</P><P>

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 responsability of the
application writer to correctly set up the characteristics of all Mesh Objects
that it uses.  These type specific interfaces are usually called
`<SAMP>iSomethingState</SAMP>' (replace <EM>Something</EM> with the appropriate name).
</P><P>

Some Mesh Objects also implement the SCF interface `<SAMP>iPolygonMesh</SAMP>'
which you can use for collision detection.  You can use
<CODE>SCF_QUERY_INTERFACE()</CODE> to find out if some Mesh Object implements this
interface.
</P><P>

In addition to the interfaces above, Mesh Objects also sometimes implement
`<SAMP>iParticle</SAMP>'.  When they do so, they can be used as particles for one of
the particle system Mesh Object plug-in modules.
</P><P>

<A NAME="SEC455"></A>
<H4> Mesh Object Factory </H4>
<!--docid::SEC455::-->
<P>

A <EM>Mesh Object Factory</EM> 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:
</P><P>

<OL>
<LI>
For some types the factory is really empty and only serves as a stub to create
Mesh Object instances.  In that case you would only have to use one factory to
generate all your Mesh Objects of that type.
<P>

<LI>
In other cases the factory contains default values for some characteristics
that are copied to all Mesh Objects created from that factory.  In that case
you can decide to use one factory and change the settings before creating new
instances.  Or (for conveniance) you can create several factories with default
values that you use often and create Mesh Objects from the factory of choice.
<P>

<LI>
In still other cases the factory actually contains the characteristics used by
all Mesh Objects created from it.  Changing the factory characteristics will
actually modify the characteristics for all Mesh Objects instantly.  In this
case you will have to use a seperate factory for all Mesh Objects sharing the
same characteristics.
</OL>
<P>

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
`<SAMP>iMeshObjectFactory</SAMP>'.
</P><P>

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 responsability
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 `<SAMP>iSomethingFactoryState</SAMP>' (replace <EM>Something</EM> with the
appropriate name).
</P><P>

<A NAME="SEC456"></A>
<H4> Mesh Object Type </H4>
<!--docid::SEC456::-->
<P>

The <EM>Mesh Object Type</EM> describes a specific kind of Mesh Object plug-in.
For example, Crystal Space supports several types of Mesh Objects: snow
particle system, fountain particle system, cube, ball, 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 `<SAMP>iMeshObjectType</SAMP>'.
</P><P>

Some Mesh Object Types implement the SCF interface `<SAMP>iConfig</SAMP>'.  In
this case, you can use this interface to query all run-time options that are
valid for that type.
</P><P>

<A NAME="SEC457"></A>
<H4> Loaders </H4>
<!--docid::SEC457::-->
<P>

In addition to the functionality for the Mesh Objects themselves, many Mesh
Object Types support two implementations of the SCF interface
`<SAMP>iLoaderPlugin</SAMP>'.  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.
</P><P>

<A NAME="SEC458"></A>
<H4> Responsabilities </H4>
<!--docid::SEC458::-->
<P>

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 <EM>how</EM>
while the engine controls the <EM>when</EM>.  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).
</P><P>

<A NAME="Using MeshObject"></A>
<HR SIZE=1>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_201.html#SEC452"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_203.html#SEC459"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_196.html#SEC414"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_201.html#SEC452"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_220.html#SEC543"> &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>