diff options
author | Ian Romanick <idr@freedesktop.org> | 2010-10-03 18:47:01 -0700 |
---|---|---|
committer | Ian Romanick <idr@freedesktop.org> | 2010-10-03 18:47:01 -0700 |
commit | 5159190725da6d6aa390a881d3d868d643bc36a7 (patch) | |
tree | 4adbe707f4fcad756845250586ab1ba8776dfdae | |
parent | bf55af4beb9a86bf7556bc3a114a6e3fe7de37b4 (diff) |
GLUshape: Add the ability to generate meshes with a non-zero base vertex
-rw-r--r-- | include/glu3.h | 4 | ||||
-rw-r--r-- | src/mesh.cpp | 11 |
2 files changed, 12 insertions, 3 deletions
diff --git a/include/glu3.h b/include/glu3.h index 100cf4a..2edeb5b 100644 --- a/include/glu3.h +++ b/include/glu3.h @@ -454,7 +454,7 @@ public: /** * Construct a new mesh shape generator * - * \param rows Number of rows in the mesh + * \param rows Number of polygon (not vertex) rows in the mesh * \param columns Number of columns in the mesh * \param width Total width of the underlying mesh */ @@ -469,6 +469,8 @@ public: virtual unsigned primitive_count(void) const; virtual void generate(GLUshapeConsumer *consumer) const; + void generate(GLUshapeConsumer *consumer, unsigned base_vertex) const; + protected: unsigned rows; unsigned columns; diff --git a/src/mesh.cpp b/src/mesh.cpp index 76ea46a..6b0d667 100644 --- a/src/mesh.cpp +++ b/src/mesh.cpp @@ -45,7 +45,7 @@ GLUmeshProducer::primitive_count(void) const #define EMIT_ELT(e) \ do { \ - elts[count] = (e); \ + elts[count] = (e) + base_vertex; \ count++; \ if (count >= Elements(elts)) { \ consumer->index_batch(elts, count); \ @@ -54,7 +54,8 @@ GLUmeshProducer::primitive_count(void) const } while (0) void -GLUmeshProducer::generate(GLUshapeConsumer *consumer) const +GLUmeshProducer::generate(GLUshapeConsumer *consumer, + unsigned base_vertex) const { unsigned elts[64]; unsigned count = 0; @@ -91,3 +92,9 @@ GLUmeshProducer::generate(GLUshapeConsumer *consumer) const consumer->end_primitive(); } + +void +GLUmeshProducer::generate(GLUshapeConsumer *consumer) const +{ + this->generate(consumer, 0); +} |