Load( SurfaceInstance *inst, const LWLoadState *ls )
{
  float af[3];

  LWLOAD_I1( ls, inst->si_strShader, sizeof(inst->si_strShader));
  LWLOAD_I1( ls, (char*)&inst->si_astrTextures, sizeof(inst->si_astrTextures));

  for (int i=0; i<sizeof(inst->si_adColors)/sizeof(inst->si_adColors[0]); i++) {
    LWLOAD_FP( ls, af, 3);
    inst->si_adColors[i][0] = af[0];
    inst->si_adColors[i][1] = af[1];
    inst->si_adColors[i][2] = af[2];
  }

  return NULL;
}
示例#2
0
// Load():
void SelectOMatic_Item::Load( const LWLoadState *loader ) {
  int  keyword_id;
  char cvalue;
  char buffer[512];

  while( keyword_id = LWLOAD_FIND( loader, selectomatic_item_io_root ) ) {
    switch( keyword_id ) {
      // Item ID
      case SOMITEMIOPRE_ITID:
        LWLOAD_STR( loader, buffer, 512 );
        sscanf( buffer, "%x", &id );
        break;

      // Folded
      case SOMITEMIOPRE_FOLD:
        LWLOAD_I1( loader, &cvalue, 1 );
        is_folded = (cvalue != 0);
        break;

      // Group Name
      case SOMITEMIOPRE_NAME:
        LWLOAD_STR( loader, buffer, 512 );
        SetName( buffer );
        break;

      // Children
      case SOMITEMIOPRE_CHLD: {
        while( keyword_id = LWLOAD_FIND( loader, selectomatic_item_io_item ) ) {
          SelectOMatic_Item *item = new SelectOMatic_Item( NULL, this );
          item->Load( loader );
          children.Add( item );
        }
      }
    }

    LWLOAD_END( loader );            // End Keyword
  }

  LWLOAD_END( loader );              // End ITEM
}
示例#3
0
// Load():
const char * IllumiSurf_Instance::Load( const LWLoadState *loader ) {
  char cvalue;

  if( ISIOPRE_ISFV == LWLOAD_FIND( loader, illumisurf_io_isfv ) ) {
    LWLOAD_I1( loader, &cvalue, 1 );
    if( cvalue != 1 )
      return "IllumiSurf Error:  Unsupported version found, aborting load";

    while( int id = LWLOAD_FIND( loader, illumisurf_io_root ) ) {
      switch( id ) {
        case ISIOPRE_BLND:
          LWLOAD_I1( loader, &cvalue, 1 );
          SetBlendMode( (IllumiSurf_BlendModes)cvalue );
          break;

        case ISIOPRE_BINT:
          vparam_funcs->load( GetBaseIntensity(), loader );
          break;

        case ISIOPRE_AINT:
          vparam_funcs->load( GetAltIntensity(), loader );
          break;

        case ISIOPRE_COLR:
          LWLOAD_I1( loader, &cvalue, 1 );
          SetUseColor( cvalue != 0 );
          vparam_funcs->load( GetColor(), loader );
          break;

        case ISIOPRE_LUMI:
          LWLOAD_I1( loader, &cvalue, 1 );
          SetUseLuminosity( cvalue != 0 );
          vparam_funcs->load( GetLuminosity(), loader );
          break;

        case ISIOPRE_DIFF:
          LWLOAD_I1( loader, &cvalue, 1 );
          SetUseDiffusion( cvalue != 0 );
          vparam_funcs->load( GetDiffusion(), loader );
          break;

        case ISIOPRE_SPEC:
          LWLOAD_I1( loader, &cvalue, 1 );
          SetUseSpecular( cvalue != 0 );
          vparam_funcs->load( GetSpecular(), loader );
          break;

        case ISIOPRE_GLOS:
          LWLOAD_I1( loader, &cvalue, 1 );
          SetUseGlossiness( cvalue != 0 );
          vparam_funcs->load( GetGlossiness(), loader );
          break;

        case ISIOPRE_REFL:
          LWLOAD_I1( loader, &cvalue, 1 );
          SetUseReflection( cvalue != 0 );
          vparam_funcs->load( GetReflection(), loader );
          break;

        case ISIOPRE_TRNP:
          LWLOAD_I1( loader, &cvalue, 1 );
          SetUseTransparency( cvalue != 0 );
          vparam_funcs->load( GetTransparency(), loader );
          break;

        case ISIOPRE_REFR:
          LWLOAD_I1( loader, &cvalue, 1 );
          SetUseRefraction( cvalue != 0 );
          vparam_funcs->load( GetRefraction(), loader );
          break;

        case ISIOPRE_TRNC:
          LWLOAD_I1( loader, &cvalue, 1 );
          SetUseTranslucency( cvalue != 0 );
          vparam_funcs->load( GetTranslucency(), loader );
          break;
      }

      LWLOAD_END( loader );            // End Keyword
    }

    LWLOAD_END( loader );            // End Keyword
  }

  return NULL;
}