///////////////////////////////////////////////////////////////////////////////
// ObjectSet3D
// - Container for multiple Object3D objects
// - Defines position or orientation, uses shape and appearance in Object3D
// - Methods for scaling, positioning, orienting, management, and drawing
///////////////////////////////////////////////////////////////////////////////
class ObjectSet3D
{
public:
// Attributes
fVector3D position; // Position, orientation in 3-space
fVector3D direction;
// Shared points
int nPoints; // Number of points
refptr<fVector3D> points,normals; // Points
refptr<CallList> nCompileID; // Compiled object ID
float fRadius; // Radius of bounding sphere
// Objects
std::vector<Object3D> objects; // Collection of objects
// Constructors
ObjectSet3D(); // Create empty ObjectSet3D
~ObjectSet3D();
// Add an object to the collection of objects in this set
void add(const Object3D &o);
// Manipulation
void copyOrientationTo(ObjectSet3D ©) const; // Copy settings to another object
void rescale(float fScale); // Rescale evenly
void rescale(float x,float y,float z); // Rescale
void scale(float fNewScale); // Scale to fixed size
// Compute radius of bounding sphere - see Frustum3D
void computeRadius();
// Drawing
void execute() opengl_const; // Execute drawing of object
void compile(); // Compile object into a CallList
void call() opengl_const; // Execute a compiled object
protected:
// Drawing, internal
void executePosition() opengl_const; // Setup position and orientation
void executeObjects() opengl_const; // Draw all objects in ObjectSet3D
};
// Very nice shortcut for iterating through objectset
#define FOROBJSET(objset,objvar) \
{ \
for (int __i=0; __i<objset.objects.size(); __i++) }