A design improvement would be to have a Shape hierarchy that could be used by ParticleEmitters (and by whatever other classes that would find it useful.
Code: Select all
// In ParticleEmitter:
Ogre::Shape* getShape();
void setShape(Shape* shape);
//// Shape class hierarchy
class Shape {...}
class BoxShape { ...
setSize(Ogre::Vector3& size);
...};
class Ellipsoid { ... }
// etc.
Code: Select all
char str[256];
sprintf(str, "%f", size.x);
emitter.setParameter("width", str);
sprintf(str, "%f", size.y);
emitter.setParameter("height", str);
sprintf(str, "%f", size.z);
emitter.setParameter("depth", str);
Code: Select all
static_cast<BoxShape*>(emitter.getShape())->setSize(size);