///////////////////////////////////////////////////////////////////////////////
// Object3D
// - A simple object in 3D space created from a single triangle mesh
// - Defines shape and appearance (but not position or orientation)
// - Methods for management and drawing
///////////////////////////////////////////////////////////////////////////////
class Object3D
{
public:
// Appearance
GLenum nTextureID; // Texture ID number
int nTextureType; // GL_TEXTURE_2D or GL_TEXTURE_1D
bool bTransparency; // Transparency flag
fRGBA color;
fRGBA ambient, diffuse, // Material settings
specular, emission;
int shininess; // Material specular exponent
bool bDrawSmooth; // Shade smoothly (side normals -vs- vertex normals)
bool bDrawNormals; // Draw normal lines
bool bSpecularBlend; // Make specular light look good on textured objs
// Shape
int nPoints, nSides; // Number of points, sides
refptr<fVector3D> points, normals; // Points and normals
refptr<Side3> sides; // Sides
// Constructors
Object3D();
~Object3D();
// Manipulation
void copyAppearanceTo(Object3D ©) const; // Copy settings to another object
void setLight(float fAmbient, float fDiffuse, // Shortcut to set light values
float fEmission,
float fSpecular,int nShininess);
void calcVertexNormals(); // Calculate vertex normals from side normals
// Drawing
void execute() opengl_const; // Execute opengl to draw object
protected:
// Drawing, internal
void executeAll() opengl_const; // Execute polygons, normals, whatever...
void executePolys() opengl_const; // Draw polygons
void executePolys1D() opengl_const; // Draw polygons with 1D textures
void executeNormals() opengl_const; // Draw normals
void executeColor() opengl_const; // Set color & material
};