summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Romanick <idr@freedesktop.org>2010-10-03 10:33:58 -0700
committerIan Romanick <idr@freedesktop.org>2010-10-03 10:33:58 -0700
commit2117740f5ac63ed63a1f23682db912b98171a9cb (patch)
tree05be3f78ee87292899e653e4badf7edfff281fe4
parenta983be5d98e95a052505a9f5d05f781ee7f0b5f3 (diff)
GLUshape: Provide default implementations of some methods
-rw-r--r--include/glu3.h14
-rw-r--r--src/Makefile.am2
-rw-r--r--src/shape.cpp57
3 files changed, 67 insertions, 6 deletions
diff --git a/include/glu3.h b/include/glu3.h
index 4262d6e..7613682 100644
--- a/include/glu3.h
+++ b/include/glu3.h
@@ -303,6 +303,10 @@ public:
/**
* Emit a batch of vertices
*
+ * The default implementation is a no-op. The assumption is that the
+ * object's \c position, \c normal, \c tangent, and \c uv are properly
+ * filled in to receive data from the producer.
+ *
* \param position Object-space position of the vertex.
* \param normal Object-space normal of the vertex.
* \param tangent Object-space tangent of the vertex.
@@ -315,7 +319,7 @@ public:
const GLUvec4 *normal,
const GLUvec4 *tangent,
const GLUvec4 *uv,
- unsigned count) = 0;
+ unsigned count);
/**
* Start a new indexed primitive.
@@ -336,8 +340,10 @@ public:
/**
* End an index primitive previously started with begin_primitive
+ *
+ * The default implementation is a no-op.
*/
- virtual void end_primitive(void) = 0;
+ virtual void end_primitive(void);
/**
* Buffer storage for vertex data
@@ -378,9 +384,7 @@ public:
*/
class GLUshapeProducer {
public:
- virtual ~GLUshapeProducer()
- {
- }
+ virtual ~GLUshapeProducer();
/**
* Select the orientation of generated normals
diff --git a/src/Makefile.am b/src/Makefile.am
index 84a4fae..1a0257e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -26,7 +26,7 @@ AM_CFLAGS=-I../include
lib_LIBRARIES = libGLU3.a
libGLU3_a_SOURCES = matrix.c load_text.c arcball.c revolve.c mesh.c \
sphere.cpp cube.cpp shader.c mesh.h revolve.h system.h \
- buffer.c buffer.h
+ buffer.c buffer.h shape.cpp
libGLU3includedir = ${includedir}
libGLU3include_HEADERS = ../include/glu3.h ../include/glu3_scalar.h
diff --git a/src/shape.cpp b/src/shape.cpp
new file mode 100644
index 0000000..4a594c7
--- /dev/null
+++ b/src/shape.cpp
@@ -0,0 +1,57 @@
+/*
+ * Copyright © 2010 Ian D. Romanick
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file shape.cpp
+ * Default implementations of methods for shape consumer and producer classes
+ *
+ * \author Ian Romanick <idr@freedesktop.org>
+ */
+
+#include "glu3.h"
+
+void
+GLUshapeConsumer::vertex_batch(const GLUvec4 *position,
+ const GLUvec4 *normal,
+ const GLUvec4 *tangent,
+ const GLUvec4 *uv,
+ unsigned count)
+{
+ (void) position;
+ (void) normal;
+ (void) tangent;
+ (void) uv;
+ (void) count;
+}
+
+void
+GLUshapeConsumer::end_primitive(void)
+{
+ /* empty */
+}
+
+
+GLUshapeProducer::~GLUshapeProducer()
+{
+ /* empty */
+}