Page 1 of 1

Concrete ParticleEmitter shape types

Posted: Sat Oct 31, 2009 7:23 pm
by pianoman
Currently, ParticleEmitters have a String type, and each type has properties that apparently are only accessible via String parameters. This works good for the scripting, but in code is unnatural to use and hard to discover in the API.

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.
Currently to set the size of an emitter's box, for example, you must do something quite unnatural like:

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);
Rather than:

Code: Select all