Collaboration diagram for cugl::Revolute:
Public Member Functions
|Revolute (int numSteps, GLfloat profile)|
|void||setSlices (int slices)|
|void||setEccentricity (double ecc)|
|void||draw (bool showNormals=false)|
Private Member Functions
|Revolute::Revolute (const Revolute &)|
|const Revolute &||Revolute::operator= (const Revolute &)|
The shape of the surface is determined by a 'profile'.
The profile is defined by an array. Each component of the array is a pair (h,r) in which h is measured along the axis of revolution and r is the distance from the axis. (If the axis is assumed to be vertical, then h suggests 'height' and r suggests 'radius'.) The surface is generated by rotating the profile about the Z-axis.
Revolute::draw() generates vertex coordinates, normals, and texture coordinates for the surface.
It is up to the caller to set the OpenGL state for rendering: this includes setting material properties and defining rules for polygon shading, or binding an appropriate texture.
The normals generated by
Revolute::process() are obtained by averaging the normals of the polygons that meet at each vertex. Consequently, if
GL_SMOOTH shading is used and sufficient points and slices are specified, the object should look fairly smooth.
Definition at line 2059 of file cugl.h.
Construct a surface of revolution.
|numSteps||is the number of coordinates in the profile.|
|profile||is the address of a 2D array giving the points of the profile.|
Delete a surface of revolution.
Set the number of "slices". The value determines the visual quality of the object. The number of slices should be an odd number greater than 2. If it is not, Revolute::process() will change it. By default, the number of slices is 45, corresponding to 8 degrees per slice.
Set the eccentricity of the surface. By default, the eccentricity is 0, giving a surface with a circular cross-section. Setting the eccentricity to a non-zero value gives a surface with an elliptical cross-section. As the eccentricity approaches 1, the major axis of the ellipse increases without limit as the cross-section approaches a parabola.
|ecc||must be greater than or equal to zero and less than 1.|
Compute vertexes, normals, and texture coordinates for the surface of revolution. This function must be called before calling
|void cugl::Revolute::draw||(||bool|| showNormals =
Draw the surface of revolution.
|showNormals||determines whether surface normals will be drawn. Note that surface normals are computed for lighting purposes anyway: |
|cugl::Revolute::Revolute::Revolute||(||const Revolute &||)||
The copy constructor is private and not implemented: instances cannot be copied implicitly.
The assignment operator is private and not implemented: instances cannot be assigned.