Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

LWChannelKey.cpp

Go to the documentation of this file.
00001 
00002 /*
00003     TEDDY - General graphics application library
00004     Copyright (C) 1999-2002  Timo Suoranta
00005     tksuoran@cc.helsinki.fi
00006 
00007     This library is free software; you can redistribute it and/or
00008     modify it under the terms of the GNU Lesser General Public
00009     License as published by the Free Software Foundation; either
00010     version 2.1 of the License, or (at your option) any later version.
00011 
00012     This library is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015     Lesser General Public License for more details.
00016 
00017     You should have received a copy of the GNU Lesser General Public
00018     License along with this library; if not, write to the Free Software
00019     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020 
00021     $Id: LWChannelKey.cpp,v 1.1 2002/02/16 12:41:39 tksuoran Exp $
00022 */
00023 
00024 
00025 #include "Teddy/TeddyConfig.h"
00026 #if defined( TEDDY_INCLUDE_LW_SCENE )
00027 
00028 
00029 #include "Teddy/Imports/LWChannelKey.h"
00030 
00031 
00032 namespace Teddy   {
00033 namespace Imports {
00034 
00035 
00036 LWChannelKey::LWChannelKey(
00037     float value,
00038     float time,
00039     int   shape,
00040     float p1,
00041     float p2,
00042     float p3,
00043     float p4,
00044     float p5,
00045     float p6
00046 )
00047 :
00048 value(value),
00049 time (time ),
00050 shape(shape),
00051 p1   (p1   ),
00052 p2   (p2   ),
00053 p3   (p3   ),
00054 p4   (p4   ),
00055 p5   (p5   ),
00056 p6   (p6   )
00057 {
00058 }
00059 
00060 
00061 /*
00062 
00063 In scene files, an envelope is stored in a block named Envelope that
00064 contains one or more nested Key blocks and one Behaviors block.
00065 
00066    { Envelope
00067      nkeys
00068      Key value time spantype p1 p2 p3 p4 p5 p6
00069      Key ...
00070      Behaviors pre post
00071    }
00072 
00073 The nkeys value is an integer, the number of Key blocks in the envelope.
00074 Envelopes must contain at least one Key block. The contents of a Key block
00075 are as follows. 
00076 
00077 value  The key value, a floating-point number. The units and limits of the
00078        value depend on what parameter the envelope represents. 
00079 
00080 time   The time in seconds, a float. This can be negative, zero or positive.
00081        Keys are listed in the envelope in increasing time order. 
00082 
00083 spantype  The curve type, an integer. This determines the kind of interpolation
00084           that will be performed on the span between this key and the previous
00085           key, and also indicates what interpolation parameters are stored for
00086           the key. 
00087 
00088 0 - TCB (Kochanek-Bartels) 
00089 1 - Hermite 
00090 2 - 1D Bezier (obsolete, equivalent to Hermite) 
00091 3 - Linear 
00092 4 - Stepped 
00093 5 - 2D Bezier 
00094 
00095 p1...p6   Curve parameters. The data depends on the span type. 
00096 
00097 TCB, Hermite, 1D Bezier
00098 
00099 The first three parameters are tension, continuity and bias. The fourth and fifth
00100 parameters are the incoming and outgoing tangents. The sixth parameter is ignored
00101 and should be 0. Use the first three to evaluate TCB spans, and the other two to
00102 evaluate Hermite spans. 
00103 
00104 2D Bezier 
00105 
00106 The first two parameters are the incoming time and value, and the second two are
00107 the outgoing time and value. The Behaviors block contains two integers.
00108 
00109 pre, post 
00110 
00111 Pre- and post-behaviors. These determine how the envelope is extrapolated at
00112 times before the first key and after the last one. 
00113 
00114 0 - Reset         Sets the value to 0.0. 
00115 1 - Constant      Sets the value to the value at the nearest key. 
00116 2 - Repeat        Repeats the interval between the first and last keys (the primary interval). 
00117 3 - Oscillate     Like Repeat, but alternating copies of the primary interval are time-reversed. 
00118 4 - Offset Repeat Like Repeat, but offset by the difference between the values of the first and last keys. 
00119 5 - Linear        Linearly extrapolates the value based on the tangent at the nearest key. */
00120 
00121 
00122 };  //  namespace Imports   
00123 };  //  namespace Teddy
00124 
00125 
00126 #endif  //  TEDDY_INCLUDE_LW_SCENE
00127 
00128