示例#1
0
bool LWEnvelope::Load( const LWLoadState *ls)
{
	long lB[1];
	float dB[7];

	LWLOAD_I4( ls, lB, 1 ) ;
	NumKeys=lB[0];

	Keys.clear();

	for (int i=0; i<NumKeys;i++)
	{
		LWKey locKey;

		LWLOAD_FP( ls, dB, 2 );
		locKey.Time=dB[0];
		locKey.value=dB[1];

		LWLOAD_I4(ls,lB,1);
		locKey.shape=lB[0];

		switch (locKey.shape)
		{
			 case 0:        // TCB
				LWLOAD_FP( ls, dB, 3 );
				locKey.tension=dB[0];
				locKey.continuity=dB[1];
				locKey.bias=dB[2];
			 break;

			 case 1:        // Hermite
			 case 2:        // Bezier
				LWLOAD_FP( ls, dB, 4 );
				locKey.par0=dB[0];
				locKey.par1=dB[1];
				locKey.par2=dB[2];
				locKey.par3=dB[3];
			 break;
			 case 3:        // Linear
			   break;

			 case 4:        // Stepped
			   break;

			 case 5:
				 break;     // 2DBezier   FIX IT!!
		}
		Keys.push_back(locKey);
	}

	return true;
}
示例#2
0
Load( AtmosphereData *dat, const LWLoadState *lState )
{
   int version, txtr = 0;
   float fp[ 3 ];

   LWLOAD_I4( lState, &version, 1 );

   LWLOAD_FP( lState, fp, 1);   dat->hi  = fp[ 0 ];
   LWLOAD_FP( lState, fp, 1);   dat->lo  = fp[ 0 ];
   LWLOAD_FP( lState, fp, 1);   dat->fa  = fp[ 0 ];
   LWLOAD_FP( lState, fp, 1);   dat->lum = fp[ 0 ];
   LWLOAD_FP( lState, fp, 1);   dat->opa = fp[ 0 ];
   LWLOAD_FP( lState, fp, 1);   dat->den = fp[ 0 ];
   LWLOAD_FP( lState, fp, 3);   VCPY( dat->col, fp );

   LWLOAD_I4( lState, &dat->res, 1 );
   LWLOAD_I4( lState, &dat->useTxtr, 1 );
   LWLOAD_I4( lState, &dat->march, 1 );
   if ( version > 1 )
      LWLOAD_I4( lState, &dat->bck, 1 );

   if ( version > 2 )
      LWLOAD_I4( lState, &txtr, 1 );
   else
      return NULL;

   if ( !txtr ) return NULL;

   if ( LWLOAD_FIND( lState, headerBlks )) {
      if ( !dat->txtr )
         dat->txtr = txtrf->create( TRT_COLOR, "FogTexture", NULL, NULL );
      txtrf->load( dat->txtr, lState );

      LWLOAD_END( lState );
   }

   return NULL;
}