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;
}
예제 #2
0
// Save():
void SelectOMatic_Item::Save( const LWSaveState *saver ) {
  char cvalue;
  char buffer[20];

  // Item Base
  LWSAVE_BEGIN( saver, &selectomatic_item_io_item[ SOMITEMIOID_ITEM ], 0 );

  // Item ID
  LWSAVE_BEGIN( saver, &selectomatic_item_io_root[ SOMITEMIOID_ITID ], 1 );
  sprintf( buffer, "%x", id );
  LWSAVE_STR( saver, buffer );
  LWSAVE_END( saver );

  if( id == SOM_GROUP ) {
    // Fold State
    LWSAVE_BEGIN( saver, &selectomatic_item_io_root[ SOMITEMIOID_FOLD ], 1 );
    cvalue = is_folded ? 1 : 0;
    LWSAVE_I1( saver, &cvalue, 1 );
    LWSAVE_END( saver );

    // Group Name
    LWSAVE_BEGIN( saver, &selectomatic_item_io_root[ SOMITEMIOID_NAME ], 1 );
    LWSAVE_STR( saver, ((name == NULL) ? "" : name) );
    LWSAVE_END( saver );

    // Children
    if( children.NumElements() > 0 ) {
      LWSAVE_BEGIN( saver, &selectomatic_item_io_root[ SOMITEMIOID_CHLD ], 0 );
      for( unsigned long i=0; i < children.NumElements(); i++ )
        children[i]->Save( saver );
      LWSAVE_END( saver );
    }
  }

  LWSAVE_END( saver );  // End item
}
예제 #3
0
// Save():
const char * IllumiSurf_Instance::Save( const LWSaveState *saver ) {
  char cvalue;

  // Version
  LWSAVE_BEGIN( saver, &illumisurf_io_isfv[0], 0 );
  cvalue = 1;
  LWSAVE_I1( saver, &cvalue, 1 );

  // Blending Mode
  LWSAVE_BEGIN( saver, &illumisurf_io_root[ ISIOID_BLND ], 1 );
  cvalue = GetBlendMode();
  LWSAVE_I1( saver, &cvalue, 1 );
  LWSAVE_END( saver );

  // Base Intensity
  LWSAVE_BEGIN( saver, &illumisurf_io_root[ ISIOID_BINT ], 1 );
  vparam_funcs->save( GetBaseIntensity(), saver );
  LWSAVE_END( saver );

  // Alternate Intensity
  LWSAVE_BEGIN( saver, &illumisurf_io_root[ ISIOID_AINT ], 1 );
  vparam_funcs->save( GetAltIntensity(), saver );
  LWSAVE_END( saver );

  // Color
  LWSAVE_BEGIN( saver, &illumisurf_io_root[ ISIOID_COLR ], 1 );
  cvalue = GetUseColor() ? 1 : 0;
  LWSAVE_I1( saver, &cvalue, 1 );
  vparam_funcs->save( GetColor(), saver );
  LWSAVE_END( saver );

  // Luminosity
  LWSAVE_BEGIN( saver, &illumisurf_io_root[ ISIOID_LUMI ], 1 );
  cvalue = GetUseLuminosity() ? 1 : 0;
  LWSAVE_I1( saver, &cvalue, 1 );
  vparam_funcs->save( GetLuminosity(), saver );
  LWSAVE_END( saver );

  // Diffusion
  LWSAVE_BEGIN( saver, &illumisurf_io_root[ ISIOID_DIFF ], 1 );
  cvalue = GetUseDiffusion() ? 1 : 0;
  LWSAVE_I1( saver, &cvalue, 1 );
  vparam_funcs->save( GetDiffusion(), saver );
  LWSAVE_END( saver );

  // Specular
  LWSAVE_BEGIN( saver, &illumisurf_io_root[ ISIOID_SPEC ], 1 );
  cvalue = GetUseSpecular() ? 1 : 0;
  LWSAVE_I1( saver, &cvalue, 1 );
  vparam_funcs->save( GetSpecular(), saver );
  LWSAVE_END( saver );

  // Glossiness
  LWSAVE_BEGIN( saver, &illumisurf_io_root[ ISIOID_GLOS ], 1 );
  cvalue = GetUseGlossiness() ? 1 : 0;
  LWSAVE_I1( saver, &cvalue, 1 );
  vparam_funcs->save( GetGlossiness(), saver );
  LWSAVE_END( saver );

  // Reflection
  LWSAVE_BEGIN( saver, &illumisurf_io_root[ ISIOID_REFL ], 1 );
  cvalue = GetUseReflection() ? 1 : 0;
  LWSAVE_I1( saver, &cvalue, 1 );
  vparam_funcs->save( GetReflection(), saver );
  LWSAVE_END( saver );

  // Transparency
  LWSAVE_BEGIN( saver, &illumisurf_io_root[ ISIOID_TRNP ], 1 );
  cvalue = GetUseTransparency() ? 1 : 0;
  LWSAVE_I1( saver, &cvalue, 1 );
  vparam_funcs->save( GetTransparency(), saver );
  LWSAVE_END( saver );

  // Refraction
  LWSAVE_BEGIN( saver, &illumisurf_io_root[ ISIOID_REFR ], 1 );
  cvalue = GetUseRefraction() ? 1 : 0;
  LWSAVE_I1( saver, &cvalue, 1 );
  vparam_funcs->save( GetRefraction(), saver );
  LWSAVE_END( saver );

  // Translucency
  LWSAVE_BEGIN( saver, &illumisurf_io_root[ ISIOID_TRNC ], 1 );
  cvalue = GetUseTranslucency() ? 1 : 0;
  LWSAVE_I1( saver, &cvalue, 1 );
  vparam_funcs->save( GetTranslucency(), saver );
  LWSAVE_END( saver );

  LWSAVE_END( saver );

  return NULL;
}