Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
env_map_gent.h File Reference

Go to the source code of this file.

Functions

void EnvironmentMapGeneratorMain (const char *inpt, const char *outpt, float a=0, float m=1, float p=1, bool w=false)
 

Function Documentation

void EnvironmentMapGeneratorMain ( const char *  inpt,
const char *  outpt,
float  a = 0,
float  m = 1,
float  p = 1,
bool  w = false 
)

Definition at line 458 of file env_map_gent.cpp.

References a, affine, VSFileSystem::VSFile::Close(), f, GenerateSphereMap(), InputName, multiplicitive, VSFileSystem::Ok, VSFileSystem::VSFile::OpenReadOnly(), OutputName, power, pushdown, VSFileSystem::sharedtextures, size, VSFileSystem::TextureFile, and VSFileSystem::vs_fprintf().

Referenced by GameStarSystem::createBackground().

459 {
460  affine = a;
461  multiplicitive = m;
462  power = p;
463  pushdown = w;
464  int size = sizeof (char)*strlen( inpt )+40;
465  char *tmp = (char*) malloc( size );
466  strcpy( tmp, inpt );
467  VSFile f;
468  VSError err = f.OpenReadOnly( strcat( tmp, "_sphere.image" ), TextureFile );
469  if (err > Ok) {
470  err = f.OpenReadOnly( strcat( tmp, "_sphere.bmp" ), TextureFile );
471  if (err > Ok) {
472  memset( tmp, 0, size );
473  strcpy( tmp, inpt );
474  err = f.OpenReadOnly( strcat( tmp, "_up.image" ), TextureFile );
475  if (err > Ok)
476  err = f.OpenReadOnly( strcat( tmp, "_up.bmp" ), TextureFile );
477  }
478  }
479  //bool share = false;
480  std::string s;
481  if (err > Ok) {
482  //s = VSFileSystem::GetSharedTexturePath (std::string (inpt));
483  s = VSFileSystem::sharedtextures+"/"+string( inpt );
484  InputName = (char*) malloc( sizeof (char)*(s.length()+2) );
485  strcpy( InputName, s.c_str() );
486  } else {
487  f.Close();
488  InputName = (char*) malloc( sizeof (char)*(strlen( inpt )+2) );
489  strcpy( InputName, inpt );
490  }
491  OutputName = strdup( outpt );
492  free( tmp );
493  tmp = NULL;
494  VSFileSystem::vs_fprintf( stderr,
495  "input name %s, output name %s\nAffine %f Mult %f Pow %f\n",
496  InputName,
497  OutputName,
498  affine,
500  power );
502  free( InputName );
503  free( OutputName );
504 }