00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "Teddy/TeddyConfig.h"
00026 #if defined( TEDDY_INCLUDE_LW_SCENE )
00027
00028
00029 #include "Teddy/Imports/LWEnvelope.h"
00030 #include "Teddy/Imports/LWEnvelopeKey.h"
00031 #include "Teddy/Imports/LWFile.h"
00032 #include "Teddy/SysSupport/StdIO.h"
00033
00034
00035 namespace Teddy {
00036 namespace Imports {
00037
00038
00040 LWEnvelope::LWEnvelope( LWFile *f ){
00041 this->f = f;
00042 last_key = NULL;
00043 }
00044
00045
00046 void LWEnvelope::processEnvelope(){
00047 envelope_type = f->read_ID4();
00048 envelope_length = f->read_U2();
00049 f->pushDomain( envelope_length );
00050 switch( envelope_type ){
00051 case ID_PRE: readPreBehaviour_U2(); break;
00052 case ID_POST: readPostBehaviour_U2(); break;
00053 case ID_KEY: readKeyframe_F4_F4(); break;
00054 case ID_SPAN: readInterpolation_ID4_d(); break;
00055 case ID_CHAN: readChannel_S0_U2_d(); break;
00056 case ID_NAME: readName_S0(); break;
00057 default: break;
00058 }
00059 f->popDomain( true );
00060 }
00061
00062
00072 void LWEnvelope::readPreBehaviour_U2(){
00073 pre_behaviour = f->read_U2();
00074 }
00075
00076
00085 void LWEnvelope::readPostBehaviour_U2(){
00086 post_behaviour = f->read_U2();
00087 }
00088
00089
00090 void LWEnvelope::readKeyframe_F4_F4(){
00091 F4 keyframe_time = f->read_F4();
00092 F4 keyframe_value = f->read_F4();
00093 LWEnvelopeKey *key = last_key = new LWEnvelopeKey( keyframe_time, keyframe_value );
00094 keys.push_back( key );
00095 }
00096
00097
00109 void LWEnvelope::readInterpolation_ID4_d(){
00110 if( last_key == NULL ){
00111 printf( "Envelope key missing for interval interpolation\n" );
00112 return;
00113 }
00114
00115 }
00116
00117
00128 void LWEnvelope::readChannel_S0_U2_d(){
00129 std::string server_name = f->read_S0();
00130 U2 flags = f->read_U2();
00131
00132 if( (flags & 1) == 1 ){
00133
00134 return;
00135 }
00136
00137 while( f->domainLeft() > 0 ){
00138
00139 }
00140 }
00141
00142
00152 void LWEnvelope::readName_S0(){
00153 name = f->read_S0();
00154 }
00155
00156
00157 };
00158 };
00159
00160
00161 #endif // TEDDY_INCLUDE_LW_SCENE