summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/glu3.h25
-rw-r--r--src/cube.cpp10
-rw-r--r--src/sphere.cpp27
-rw-r--r--test/sphere.cpp4
4 files changed, 34 insertions, 32 deletions
diff --git a/include/glu3.h b/include/glu3.h
index f634a57..0039565 100644
--- a/include/glu3.h
+++ b/include/glu3.h
@@ -270,16 +270,16 @@ struct GLUarcball {
#ifdef __cplusplus
/**
- * Consumer for shape data generated by a GLUshape object
+ * Consumer for shape data generated by a GLUshapeProducer object
*
* Objects of this class and its descenents are used to consume data generated
- * by \c GLUshape. The \c GLUshape object is responsible for the format of
- * the data generate, and the \c GLUshapeConsumer object is repsonsible for
- * storing that data.
+ * by \c GLUshapeProducer. The \c GLUshapeProducer object is responsible for
+ * the format of the data generate, and the \c GLUshapeConsumer object is
+ * repsonsible for storing that data.
*
* This splits the functionality of the classic GLU's \c GLUquadric structure.
*
- * \sa GLUshape
+ * \sa GLUshapeProducer
*/
class GLUshapeConsumer {
public:
@@ -327,9 +327,9 @@ public:
*
* \sa GLUshapeConsumer
*/
-class GLUshape {
+class GLUshapeProducer {
public:
- virtual ~GLUshape()
+ virtual ~GLUshapeProducer()
{
}
@@ -383,7 +383,8 @@ public:
virtual void generate(GLUshapeConsumer *consumer) const = 0;
protected:
- GLUshape(void) : normals_point_out(true), normals_per_vertex(true)
+ GLUshapeProducer(void) :
+ normals_point_out(true), normals_per_vertex(true)
{
}
@@ -395,7 +396,7 @@ protected:
/**
* Shape generator that generates a sphere.
*/
-class GLUsphere : public GLUshape {
+class GLUsphereProducer : public GLUshapeProducer {
public:
/**
* Construct a new sphere shape generator
@@ -408,7 +409,7 @@ public:
* \param stacks Specifies the number of subdivisions along the
* z-axis. These match the latitude lines on the globe.
*/
- GLUsphere(GLdouble radius, GLint slices, GLint stacks);
+ GLUsphereProducer(GLdouble radius, GLint slices, GLint stacks);
virtual unsigned vertex_count(void) const;
virtual unsigned element_count(void) const;
virtual unsigned primitive_count(void) const;
@@ -424,7 +425,7 @@ private:
/**
* Shape generator that generates a cube.
*/
-class GLUcube : public GLUshape {
+class GLUcubeProducer : public GLUshapeProducer {
public:
/**
* Construct a new cube shape generator
@@ -432,7 +433,7 @@ public:
* \param radius Distance from the center of the cube to the center
* of one of the axis-aligned faces.
*/
- GLUcube(GLdouble radius);
+ GLUcubeProducer(GLdouble radius);
virtual unsigned vertex_count(void) const;
virtual unsigned element_count(void) const;
virtual unsigned primitive_count(void) const;
diff --git a/src/cube.cpp b/src/cube.cpp
index c1f13ed..88d4fe3 100644
--- a/src/cube.cpp
+++ b/src/cube.cpp
@@ -22,13 +22,13 @@
*/
#include "glu3.h"
-GLUcube::GLUcube(double radius) :
+GLUcubeProducer::GLUcubeProducer(double radius) :
radius(radius)
{
}
unsigned
-GLUcube::vertex_count(void) const
+GLUcubeProducer::vertex_count(void) const
{
/* Due to differeing normals and texture coordinates, each face of the
* cube has four unique vertices. This means that each unique vertex
@@ -38,7 +38,7 @@ GLUcube::vertex_count(void) const
}
unsigned
-GLUcube::element_count(void) const
+GLUcubeProducer::element_count(void) const
{
/* Each face is made up of two triangles. All data is sent in a single
* triangle list.
@@ -47,7 +47,7 @@ GLUcube::element_count(void) const
}
unsigned
-GLUcube::primitive_count(void) const
+GLUcubeProducer::primitive_count(void) const
{
/* Each face is made up of two triangles. All data is sent in a single
* triangle list.
@@ -58,7 +58,7 @@ GLUcube::primitive_count(void) const
#define Elements(a) (sizeof(a) / sizeof(a[0]))
void
-GLUcube::generate(GLUshapeConsumer *consumer) const
+GLUcubeProducer::generate(GLUshapeConsumer *consumer) const
{
static const float p[] = {
+1.0, 1.0, 1.0, 1.0,
diff --git a/src/sphere.cpp b/src/sphere.cpp
index ecd7db8..4aa1a79 100644
--- a/src/sphere.cpp
+++ b/src/sphere.cpp
@@ -42,20 +42,20 @@ static void sphere_end_cb(void *data);
/*@}*/
/**
- * GLUsphere decorator to implement call-backs
+ * GLUsphereProducer decorator to implement call-backs
*
- * To generate the sphere data, the \c GLUsphere class interfaces with various
- * C functions that use a call-back mechanism. These call-backs are analogous
- * the \c emit_vertex, \c emit_begin, \c emit_index, and \c emit_end methods
- * that \c GLUsphere subclasses will provide.
+ * To generate the sphere data, the \c GLUsphereProducer class interfaces with
+ * various C functions that use a call-back mechanism. These call-backs are
+ * analogous the \c emit_vertex, \c emit_begin, \c emit_index, and \c emit_end
+ * methods that \c GLUsphereProducer subclasses will provide.
*
* However, these methods are all \c protected. As a result the non-class
* call-back functions cannot call these methods unless they are \c friend
* functions. It is undesireable to expose the implementation detail in the
* application-facing header file. This can be worked around by creating a
- * dummy subclass of \c GLUsphere that only contains the \c friend function
- * declarations. Pointers to \c GLUsphere objects can be cast to pointers to
- * \c GLUsphereFriend objects without side-effect.
+ * dummy subclass of \c GLUsphereProducer that only contains the \c friend
+ * function declarations. Pointers to \c GLUsphereProducer objects can be
+ * cast to pointers to \c GLUsphereFriend objects without side-effect.
*
* This is arguably a mis-use of the "decorator" pattern, but it is the most
* efficient way to do this.
@@ -75,7 +75,8 @@ class GLUconsumerFriend : public GLUshapeConsumer {
};
-GLUsphere::GLUsphere(GLdouble radius, GLint slices, GLint stacks)
+GLUsphereProducer::GLUsphereProducer(GLdouble radius, GLint slices,
+ GLint stacks)
{
this->radius = radius;
this->slices = (slices < 4) ? 4 : (unsigned) slices;
@@ -84,7 +85,7 @@ GLUsphere::GLUsphere(GLdouble radius, GLint slices, GLint stacks)
unsigned
-GLUsphere::vertex_count(void) const
+GLUsphereProducer::vertex_count(void) const
{
/* Each line of vertices from the north pole to the south pole consists
* of (stacks+1) vertices. There are a total of (slices+1) of these
@@ -95,7 +96,7 @@ GLUsphere::vertex_count(void) const
unsigned
-GLUsphere::primitive_count(void) const
+GLUsphereProducer::primitive_count(void) const
{
/* For each slice there is a triangle strip from the north pole to the
* south pole.
@@ -105,7 +106,7 @@ GLUsphere::primitive_count(void) const
unsigned
-GLUsphere::element_count(void) const
+GLUsphereProducer::element_count(void) const
{
/* Each slice is a triangle strip represented by 2 elements plus
* 2 elements for each stack;
@@ -152,7 +153,7 @@ sphere_end_cb(void *data)
void
-GLUsphere::generate(GLUshapeConsumer *consumer) const
+GLUsphereProducer::generate(GLUshapeConsumer *consumer) const
{
generate_sphere(radius, slices, stacks,
normals_point_out,
diff --git a/test/sphere.cpp b/test/sphere.cpp
index adcce4e..ae2c5cf 100644
--- a/test/sphere.cpp
+++ b/test/sphere.cpp
@@ -4,7 +4,7 @@
class check_sphere : public GLUshapeConsumer {
public:
- check_sphere(const GLUshape &shape, double r) :
+ check_sphere(const GLUshapeProducer &shape, double r) :
pass(true), vert(0), prim(0), elts(0), r(r), mode(0)
{
primitive_count = shape.primitive_count();
@@ -164,7 +164,7 @@ public:
int
main(int argc, char **argv)
{
- GLUsphere s(4.0, 5, 5);
+ GLUsphereProducer s(4.0, 5, 5);
check_sphere c(s, 4.0);
s.generate(& c);