Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 28, 2005, 10:33:14 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: more loading procedures, fixed small bugs in loadparam

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/particles/particle_system.cc

    r4725 r4726  
    127127
    128128  LoadParam<ParticleSystem>(root, "type", this, &ParticleSystem::setType)
    129       .describe("sets the type of the Particles, (DOT, SPARK, SPRITE or MODEL)");
    130 
    131   LoadParam<ParticleSystem>(root, "model", this, &ParticleSystem::setModel)
    132       .describe("sets a model to be loaded on top of this System (also sets type to Model)");
     129      .describe("sets the type of the Particles, (dot, spark, sprite or model)");
    133130
    134131  // PER-PARTICLE-ATTRIBUTES:
     
    149146void ParticleSystem::setType(const char* particleType)
    150147{
    151   if (strcmp(particleType, "DOTS"))
     148  if (!strcmp(particleType, "dot"))
    152149    this->setType(PARTICLE_DOT);
    153   else if (strcmp(particleType, "SPARKS"))
     150  else if(!strcmp(particleType, "spark"))
    154151    this->setType(PARTICLE_SPARK);
    155   else if (strcmp(particleType, "MODELS"))
     152  else if(!strcmp(particleType, "model"))
    156153    this->setType(PARTICLE_MODEL);
    157154  else // if (strcmp(particleType, "SPRITE"))
     
    187184      //  material->setTransparency(.5);
    188185        break;
    189       case PARTICLE_MODEL:
    190         if (!this->model)
    191         {
    192           PRINTF(2)("Model not loaded yet, please do this through ParticleSystem::loadModel()");
    193           this->setType(PARTICLE_SPRITE);
    194         }
    195         break;
    196     }
     186  }
    197187}
    198188
     
    207197{
    208198  this->material = material;
    209 }
    210 
    211 /**
    212  * sets a Model to the Particles
    213  * @param modelName the Name of the Model to load
    214  */
    215 void ParticleSystem::setModel(const char* modelName)
    216 {
    217   if (this->model)
    218     ResourceManager::getInstance()->unload(this->model);
    219   if (modelName)
    220   {
    221     this->model = (Model*)ResourceManager::getInstance()->load(modelName, OBJ, RP_LEVEL);
    222     this->setType(PARTICLE_MODEL);
    223   }
    224   else
    225   {
    226     this->model = NULL;
    227     this->setType(PARTICLE_SPRITE);
    228   }
    229199}
    230200
     
    505475          drawPart = drawPart->next;
    506476        }
     477        else
     478          printf("no model loaded onto ParticleSystem-%s\n", this->getName());
    507479      }
    508480      break;
     
    595567void ParticleSystem::debug(void) const
    596568{
    597   PRINT(0)("  ParticleSystem %s\n", this->getName());
     569  PRINT(0)("  ParticleSystem %s, type: ", this->getName());
     570  {
     571      if (this->particleType == PARTICLE_MODEL)
     572        PRINT(0)("model");
     573      else if (this->particleType == PARTICLE_SPRITE)
     574        PRINT(0)("sprite");
     575      else if (this->particleType == PARTICLE_DOT)
     576        PRINT(0)("dot");
     577      else if (this->particleType == PARTICLE_SPARK)
     578        PRINT(0)("spark");
     579
     580      PRINT(0)("\n");
     581  }
     582
    598583  PRINT(0)("  ParticleCount: %d, maximumCount: %d :: filled %d%%\n", this->count, this->maxCount, 100*this->count/this->maxCount);
    599584  if (deadList)
Note: See TracChangeset for help on using the changeset viewer.