File: cs_227.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 (145 lines) | stat: -rw-r--r-- 6,626 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
<!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: Model Data Structure</TITLE>

<META NAME="description" CONTENT="Crystal Space: Model Data Structure">
<META NAME="keywords" CONTENT="Crystal Space: Model Data Structure">
<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="SEC560"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_226.html#SEC559"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_228.html#SEC561"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_221.html#SEC544"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_226.html#SEC559"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_228.html#SEC561"> &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.11.1 Common Model Data Structure (<CODE>iModelData</CODE>) </H3>
<!--docid::SEC560::-->
<P>

The IDS is built by a simple concept. All components implement
<CODE>iObject</CODE>. Except a few cases, the structure is built using the
<CODE>iObject</CODE> hierarchy. The following components are currently used:
</P><P>

<DL COMPACT>
<DT><EM>Scene</EM>
<DD>This is the main object. It contains any number of <EM>objects</EM>,
<EM>light sources</EM>, <EM>cameras</EM>, <EM>materials</EM> and <EM>textures</EM>.
<P>

<DT><EM>Texture</EM>
<DD>An image, which can be stored as an <CODE>iImage</CODE>, an <CODE>iTextureWrapper</CODE>,
or a filename.
<P>

<DT><EM>Material</EM>
<DD>A material, which can be stored as an <CODE>iMaterial</CODE> or an
<CODE>iMaterialWrapper</CODE>.
<P>

<DT><EM>Camera</EM>
<DD>A camera that looks into the scene. It currently contains a position and
up, front and right vectors.
<P>

<DT><EM>Light Source</EM>
<DD>A light source, consisting of position, brightness and color.
<P>

<DT><EM>Vertex Frame</EM>
<DD>This is a collection of any number of vertex positions, any number of normal
vectors, of color values and of texture coordinates (also called
<EM>texels</EM>).
<P>

<DT><EM>Polygon</EM>
<DD>A list of quadruples of index values. Every entry in the list contains an
index for a vertex table, an index for a normal table, one for a color table
and one for a texel table. To produce meaningful output, a polygon has to be
used together with a vertex frame object.
<P>

<DT><EM>Object</EM>
<DD>This is what model importing is usually about. An object can be as much as
a complete level or as few as one polygon. It is simply something that you
can build a mesh object from. This means that it doesn't even have to use
polygons (it could use curves instead). This object itself is hardly more
than a node in the <CODE>iObject</CODE> hierarchy.
<P>

Sub-objects are currently organized in a way that is closely related to the
<EM>thing</EM> and <EM>sprite</EM> meshes used in CS: Every object contains a
<EM>Default Vertex Frame</EM>, which is (of course) a vertex frame object. Also,
an object contains any number of <EM>polygon</EM> objects. Take these together
and you have the static shape of an object (and also the shape that is used
when you build a thing mesh from it).
</P><P>

<DT><EM>Action</EM>
<DD>For sprites, it is more difficult as you also want animation. An IDS
object can also contain any number of <EM>action</EM> objects. An action is
a list of frames and time values. Frames are also handled as generic IDS
objects. However, they are special in the way that they are not contained in
the action as <CODE>iObject</CODE> children but rather directly though the
<CODE>iModelDataAction</CODE> interface. Currently the only types of frames that are
allowed are vertex frames.
<P>

Finally, the time value system has to be explained. Time values are stored in
a rather unusual way: The time that is stored with each frame is the point
in time when the frame ends. For example, if the first frame lasts 50 msec,
then the time value stored with it is 50 msec. If the second frame lasts 30
msec, its time value is 80 (50+30). The last time value is also the total
length of one animation cycle. Note that for interpolated animation this
produces another effect: At the point <EM>zero</EM> in time, the frame to show
is equal to the last stored frame. The animation then moves on to the first
time value, shifting the frame to show over to the first stored frame.
</DL>
<P>

<A NAME="AWS"></A>
<HR SIZE=1>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_226.html#SEC559"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_228.html#SEC561"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_221.html#SEC544"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_226.html#SEC559"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_228.html#SEC561"> &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>