Concrete ParticleEmitter shape types

What it says on the tin: a place to discuss proposed new features.
Post Reply
User avatar
pianoman
Halfling
Posts: 47
Joined: Sun Feb 08, 2009 10:52 pm

Concrete ParticleEmitter shape types

Post 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

 static_cast<BoxShape*>(emitter.getShape())->setSize(size); 
Post Reply