bool LWEnvelope::Save( const LWSaveState *ss) { LWEnvKeyframeID curKey; long lB[1]; float dB[7]; lB[0]=NumKeys; LWSAVE_I4( ss, lB, 1 ); curKey=Lightwave3D::envfunc->nextKey(Envelope, NULL); std::list<LWKey>::iterator KeyItor=Keys.begin(); for (int i=0; i<NumKeys;i++) { dB[0]=(float)KeyItor->Time; dB[1]=(float)KeyItor->value; LWSAVE_FP( ss, dB, 2 ); lB[0]=KeyItor->shape; LWSAVE_I4( ss, lB, 1 ); int counter=0; switch( KeyItor->shape ) { case 0: // TCB dB[counter++]=(float)KeyItor->tension; dB[counter++]=(float)KeyItor->continuity; dB[counter++]=(float)KeyItor->bias; break; case 1: // Hermite case 2: // Bezier dB[counter++]=(float)KeyItor->par0; dB[counter++]=(float)KeyItor->par1; dB[counter++]=(float)KeyItor->par2; dB[counter++]=(float)KeyItor->par3; break; case 3: // Linear break; case 4: // Stepped break; case 5: break; // 2DBezier FIX IT!! } LWSAVE_FP( ss, dB, counter ); KeyItor++; curKey=Lightwave3D::envfunc->nextKey(Envelope, curKey); } return true; }
Save( SurfaceInstance *inst, const LWSaveState *ss ) { float af[3]; LWSAVE_I1( ss, inst->si_strShader, sizeof(inst->si_strShader)); LWSAVE_I1( ss, (char*)&inst->si_astrTextures, sizeof(inst->si_astrTextures)); for (int i=0; i<sizeof(inst->si_adColors)/sizeof(inst->si_adColors[0]); i++) { af[0] = (float)inst->si_adColors[i][0]; af[1] = (float)inst->si_adColors[i][1]; af[2] = (float)inst->si_adColors[i][2]; LWSAVE_FP( ss, af, 3); } return NULL; }
Save( AtmosphereData *dat, const LWSaveState *sState ) { int version = VERSION_NB, txtr; float fp[ 3 ]; LWSAVE_I4( sState, &version, 1 ); fp[ 0 ] = ( float ) dat->hi; LWSAVE_FP( sState, fp, 1 ); fp[ 0 ] = ( float ) dat->lo; LWSAVE_FP( sState, fp, 1 ); fp[ 0 ] = ( float ) dat->fa; LWSAVE_FP( sState, fp, 1 ); fp[ 0 ] = ( float ) dat->lum; LWSAVE_FP( sState, fp, 1 ); fp[ 0 ] = ( float ) dat->opa; LWSAVE_FP( sState, fp, 1 ); fp[ 0 ] = ( float ) dat->den; LWSAVE_FP( sState, fp, 1 ); fp[ 0 ] = ( float ) dat->col[ 0 ]; fp[ 1 ] = ( float ) dat->col[ 1 ]; fp[ 2 ] = ( float ) dat->col[ 2 ]; LWSAVE_FP( sState, fp, 3 ); LWSAVE_I4( sState, &dat->res, 1 ); LWSAVE_I4( sState, &dat->useTxtr, 1 ); LWSAVE_I4( sState, &dat->march, 1 ); LWSAVE_I4( sState, &dat->bck, 1 ); if ( dat->txtr ) { txtr = 1; LWSAVE_I4( sState, &txtr, 1 ); LWSAVE_BEGIN( sState, &headerBlks[ 0 ], 0 ); txtrf->save( dat->txtr, sState ); LWSAVE_END( sState ); } else { txtr = 0; LWSAVE_I4( sState, &txtr, 1 ); } return NULL; }