File: cs_225.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 (134 lines) | stat: -rw-r--r-- 5,685 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
<!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: Moving On</TITLE>

<META NAME="description" CONTENT="Crystal Space: Moving On">
<META NAME="keywords" CONTENT="Crystal Space: Moving On">
<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="SEC557"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_224.html#SEC551"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_226.html#SEC559"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_220.html#SEC543"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_221.html#SEC544"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_226.html#SEC559"> &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.10.4 Moving On </H3>
<!--docid::SEC557::-->
<P>

<EM>Written by Michael Voase,
<A HREF="mailto:mvoase@midcoast.com.au">mvoase@midcoast.com.au</A>.</EM>
</P><P>

<EM>Please note this document is not complete as yet. The examples given
are not 100% checked and verified.</EM>
</P><P>

In this section we will be exploring the second method of sprite animation,
skeletal animation.  The Crystal Space sprite contains a number of interfaces
and data structures that allow you to control your sprite on a limb by limb
basis.  Additionally, the `<SAMP>skel3d</SAMP>' module also transparently updates and
applies the animation transforms on the skeleton of the sprite for you.  To
accomplish this feat of wizardry, the skeleton employs a number of embedded
interfaces that permit the rapid updating of skeletal intformation.  However,
before we can beging, first we must define a skeleton for our sprite.
</P><P>

<A NAME="SEC558"></A>
<H4> Sprite Skeleton </H4>
<!--docid::SEC558::-->
<P>

The sprite skeleton is a farily simple structure. The most notable difference
from a frame is the addition of connections with embedded transforms that
permit the attached bones to be translated and transformed about the
connection point. Each limb of the skeleton has a number of attached vertices
which are transformed under the influence of the connection transform. The
declaration for an articulated sprite is very simmilar to a frame animated
sprite, with the notable exception that an articulated sprite usually
conatins one frame. You can use multiple frames if you want, I dont belive
there is a restriction at all, however, generally, a single frame is
sufficient. We will start with an identical sprite to our previous example,
then add an appendage to it. The appendage will be the same in shape, but
intverted and touching the lower appendage by a single point. We will then
add an animation to make the top pyramid wobble backward and forward.
</P><P>

<TABLE><tr><td>&nbsp;</td><td class=example><pre>MESHFACT(
  PLUGIN(crystalspace.mesh.loader.factory.sprite.3d)
  PARAMS(
    MATERIAL(white)
    FRAME 'the_frame' (
      V(0,0,0:0,0) ; 0
      V(0,1,0:0,0) ; 1
      V(1,0,0:0,0) ; 2
      V(0,0,1:0,0) ; 3
      V(0,2,0:0,0) ; 4
      V(0,2,1:0,0) ; 5
      V(1,2,0:0,0) ; 6
    )

    TRIANGLE(0,2,3)
    TRIANGLE(0,3,1)
    TRIANGLE(0,1,2)
    TRIANGLE(2,1,3)
    TRIANGLE(4,6,1)
    TRIANGLE(4,5,6)
    TRIANGLE(5,4,1)
    TRIANGLE(6,5,1)

    ACTION( F('the_frame',1000))

    SKELETON 'skel' (
      LIMB 'top' (
        VERTICES(1,4,5,6)
      )
    )
  )
)
</pre></td></tr></table><A NAME="Model Conversion"></A>
<HR SIZE=1>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_224.html#SEC551"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_226.html#SEC559"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_220.html#SEC543"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_221.html#SEC544"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_226.html#SEC559"> &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>