From 749e91d879b491bbcaa13a58b418d256c946e587 Mon Sep 17 00:00:00 2001 From: David Rose Date: Fri, 15 Apr 2005 23:48:43 +0000 Subject: [PATCH] rename vertex -> row in GeomVertexData etc. --- panda/src/dxgsg8/dxGraphicsStateGuardian8.cxx | 15 +- .../glstuff/glGraphicsStateGuardian_src.cxx | 10 +- panda/src/gobj/qpgeom.cxx | 2 +- panda/src/gobj/qpgeomLines.cxx | 6 +- panda/src/gobj/qpgeomLinestrips.cxx | 4 +- panda/src/gobj/qpgeomPrimitive.I | 2 +- panda/src/gobj/qpgeomPrimitive.cxx | 40 +-- panda/src/gobj/qpgeomTriangles.cxx | 10 +- panda/src/gobj/qpgeomTrifans.cxx | 2 +- panda/src/gobj/qpgeomTristrips.cxx | 14 +- panda/src/gobj/qpgeomVertexArrayData.I | 14 +- panda/src/gobj/qpgeomVertexArrayData.cxx | 18 +- panda/src/gobj/qpgeomVertexArrayData.h | 6 +- panda/src/gobj/qpgeomVertexArrayFormat.cxx | 6 +- panda/src/gobj/qpgeomVertexData.I | 18 +- panda/src/gobj/qpgeomVertexData.cxx | 88 +++--- panda/src/gobj/qpgeomVertexData.h | 8 +- panda/src/gobj/qpgeomVertexFormat.cxx | 2 +- panda/src/gobj/qpgeomVertexReader.I | 90 +++--- panda/src/gobj/qpgeomVertexReader.cxx | 11 +- panda/src/gobj/qpgeomVertexReader.h | 8 +- panda/src/gobj/qpgeomVertexRewriter.I | 54 ++-- panda/src/gobj/qpgeomVertexRewriter.h | 6 +- panda/src/gobj/qpgeomVertexWriter.I | 264 +++++++++--------- panda/src/gobj/qpgeomVertexWriter.cxx | 13 +- panda/src/gobj/qpgeomVertexWriter.h | 12 +- panda/src/pgraph/config_pgraph.cxx | 18 +- panda/src/pgraph/config_pgraph.h | 1 + panda/src/pgraph/cullableObject.cxx | 14 +- panda/src/pgraph/geomTransformer.cxx | 10 +- 30 files changed, 392 insertions(+), 374 deletions(-) diff --git a/panda/src/dxgsg8/dxGraphicsStateGuardian8.cxx b/panda/src/dxgsg8/dxGraphicsStateGuardian8.cxx index 0e6349018a..dd5b353206 100644 --- a/panda/src/dxgsg8/dxGraphicsStateGuardian8.cxx +++ b/panda/src/dxgsg8/dxGraphicsStateGuardian8.cxx @@ -2805,8 +2805,8 @@ draw_tristrips(const qpGeomTristrips *primitive) { qpGeomVertexReader mins(primitive->get_mins(), 0); qpGeomVertexReader maxs(primitive->get_maxs(), 0); - nassertv(primitive->get_mins()->get_num_vertices() == (int)ends.size() && - primitive->get_maxs()->get_num_vertices() == (int)ends.size()); + nassertv(primitive->get_mins()->get_num_rows() == (int)ends.size() && + primitive->get_maxs()->get_num_rows() == (int)ends.size()); if (_vbuffer_active) { IndexBufferContext *ibc = ((qpGeomPrimitive *)primitive)->prepare_now(get_prepared_objects(), this); @@ -2867,8 +2867,8 @@ draw_trifans(const qpGeomTrifans *primitive) { qpGeomVertexReader mins(primitive->get_mins(), 0); qpGeomVertexReader maxs(primitive->get_maxs(), 0); - nassertv(primitive->get_mins()->get_num_vertices() == (int)ends.size() && - primitive->get_maxs()->get_num_vertices() == (int)ends.size()); + nassertv(primitive->get_mins()->get_num_rows() == (int)ends.size() && + primitive->get_maxs()->get_num_rows() == (int)ends.size()); if (_vbuffer_active) { IndexBufferContext *ibc = ((qpGeomPrimitive *)primitive)->prepare_now(get_prepared_objects(), this); @@ -3203,7 +3203,7 @@ prepare_vertex_buffer(qpGeomVertexArrayData *data) { if (dxgsg8_cat.is_debug()) { dxgsg8_cat.debug() << "creating vertex buffer " << dvbc->_vbuffer << ": " - << data->get_num_vertices() << " vertices " + << data->get_num_rows() << " vertices " << *data->get_array_format() << "\n"; } } @@ -3285,7 +3285,10 @@ prepare_index_buffer(qpGeomPrimitive *data) { if (dxgsg8_cat.is_debug()) { dxgsg8_cat.debug() - << "creating index buffer " << dibc->_ibuffer << "\n"; + << "creating index buffer " << dibc->_ibuffer << ": " + << data->get_num_vertices() << " indices (" + << data->get_vertices()->get_array_format()->get_column(0)->get_numeric_type() + << ")\n"; } return dibc; diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx index b34afa022b..b9fa125ee9 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx @@ -2520,8 +2520,8 @@ draw_tristrips(const qpGeomTristrips *primitive) { qpGeomVertexReader mins(primitive->get_mins(), 0); qpGeomVertexReader maxs(primitive->get_maxs(), 0); - nassertv(primitive->get_mins()->get_num_vertices() == (int)ends.size() && - primitive->get_maxs()->get_num_vertices() == (int)ends.size()); + nassertv(primitive->get_mins()->get_num_rows() == (int)ends.size() && + primitive->get_maxs()->get_num_rows() == (int)ends.size()); unsigned int start = 0; for (size_t i = 0; i < ends.size(); i++) { @@ -2554,8 +2554,8 @@ draw_trifans(const qpGeomTrifans *primitive) { qpGeomVertexReader mins(primitive->get_mins(), 0); qpGeomVertexReader maxs(primitive->get_maxs(), 0); - nassertv(primitive->get_mins()->get_num_vertices() == (int)ends.size() && - primitive->get_maxs()->get_num_vertices() == (int)ends.size()); + nassertv(primitive->get_mins()->get_num_rows() == (int)ends.size() && + primitive->get_maxs()->get_num_rows() == (int)ends.size()); unsigned int start = 0; for (size_t i = 0; i < ends.size(); i++) { @@ -2881,7 +2881,7 @@ prepare_vertex_buffer(qpGeomVertexArrayData *data) { if (GLCAT.is_debug()) { GLCAT.debug() << "creating vertex buffer " << gvbc->_index << ": " - << data->get_num_vertices() << " vertices " + << data->get_num_rows() << " vertices " << *data->get_array_format() << "\n"; } diff --git a/panda/src/gobj/qpgeom.cxx b/panda/src/gobj/qpgeom.cxx index e34bd22dbd..268eb9f6f7 100644 --- a/panda/src/gobj/qpgeom.cxx +++ b/panda/src/gobj/qpgeom.cxx @@ -575,7 +575,7 @@ output(ostream &out) const { for (ti = types.begin(); ti != types.end(); ++ti) { out << " " << (*ti); } - out << " ], " << cdata->_data->get_num_vertices() << " vertices"; + out << " ], " << cdata->_data->get_num_rows() << " vertices"; } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/gobj/qpgeomLines.cxx b/panda/src/gobj/qpgeomLines.cxx index 0612659725..0fbe41ab07 100644 --- a/panda/src/gobj/qpgeomLines.cxx +++ b/panda/src/gobj/qpgeomLines.cxx @@ -131,12 +131,12 @@ rotate_impl() const { qpGeomVertexReader from(vertices, 0); qpGeomVertexWriter to(new_vertices, 0); - int num_vertices = vertices->get_num_vertices(); + int num_vertices = vertices->get_num_rows(); for (int begin = 0; begin < num_vertices; begin += 2) { - from.set_vertex(begin + 1); + from.set_row(begin + 1); to.set_data1i(from.get_data1i()); - from.set_vertex(begin); + from.set_row(begin); to.set_data1i(from.get_data1i()); } diff --git a/panda/src/gobj/qpgeomLinestrips.cxx b/panda/src/gobj/qpgeomLinestrips.cxx index a38ce42351..f3a9726391 100644 --- a/panda/src/gobj/qpgeomLinestrips.cxx +++ b/panda/src/gobj/qpgeomLinestrips.cxx @@ -153,7 +153,7 @@ decompose_impl() const { } ++li; } - nassertr(vi == vertices->get_num_vertices() && index.is_at_end(), NULL); + nassertr(vi == vertices->get_num_rows() && index.is_at_end(), NULL); return lines.p(); } @@ -178,7 +178,7 @@ rotate_impl() const { for (ei = ends.begin(); ei != ends.end(); ++ei) { int end = (*ei); for (int vi = end - 1; vi >= begin; --vi) { - from.set_vertex(vi); + from.set_row(vi); to.set_data1i(from.get_data1i()); } begin = end; diff --git a/panda/src/gobj/qpgeomPrimitive.I b/panda/src/gobj/qpgeomPrimitive.I index 9965d3f66b..0556ec6c1b 100644 --- a/panda/src/gobj/qpgeomPrimitive.I +++ b/panda/src/gobj/qpgeomPrimitive.I @@ -100,7 +100,7 @@ get_index_type() const { INLINE int qpGeomPrimitive:: get_num_vertices() const { CDReader cdata(_cycler); - return cdata->_vertices->get_num_vertices(); + return cdata->_vertices->get_num_rows(); } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/gobj/qpgeomPrimitive.cxx b/panda/src/gobj/qpgeomPrimitive.cxx index b682aabe65..b903f2c7e4 100644 --- a/panda/src/gobj/qpgeomPrimitive.cxx +++ b/panda/src/gobj/qpgeomPrimitive.cxx @@ -136,10 +136,10 @@ set_index_type(qpGeomPrimitive::NumericType index_type) { int qpGeomPrimitive:: get_vertex(int i) const { CDReader cdata(_cycler); - nassertr(i >= 0 && i < (int)cdata->_vertices->get_num_vertices(), -1); + nassertr(i >= 0 && i < (int)cdata->_vertices->get_num_rows(), -1); qpGeomVertexReader index(cdata->_vertices, 0); - index.set_vertex(i); + index.set_row(i); return index.get_data1i(); } @@ -159,14 +159,14 @@ add_vertex(int vertex) { int num_primitives = get_num_primitives(); if (num_primitives > 0 && - (int)cdata->_vertices->get_num_vertices() == get_primitive_end(num_primitives - 1)) { + (int)cdata->_vertices->get_num_rows() == get_primitive_end(num_primitives - 1)) { // If we are beginning a new primitive, give the derived class a // chance to insert some degenerate vertices. append_unused_vertices(cdata->_vertices, vertex); } qpGeomVertexWriter index(cdata->_vertices, 0); - index.set_vertex(cdata->_vertices->get_num_vertices()); + index.set_row(cdata->_vertices->get_num_rows()); index.add_data1i(vertex); @@ -191,14 +191,14 @@ add_consecutive_vertices(int start, int num_vertices) { int num_primitives = get_num_primitives(); if (num_primitives > 0 && - (int)cdata->_vertices->get_num_vertices() == get_primitive_end(num_primitives - 1)) { + (int)cdata->_vertices->get_num_rows() == get_primitive_end(num_primitives - 1)) { // If we are beginning a new primitive, give the derived class a // chance to insert some degenerate vertices. append_unused_vertices(cdata->_vertices, start); } qpGeomVertexWriter index(cdata->_vertices, 0); - index.set_vertex(cdata->_vertices->get_num_vertices()); + index.set_row(cdata->_vertices->get_num_rows()); for (int v = start; v <= end; ++v) { index.add_data1i(v); @@ -247,14 +247,14 @@ close_primitive() { #ifndef NDEBUG int num_added; if (cdata->_ends.empty()) { - num_added = (int)cdata->_vertices->get_num_vertices(); + num_added = (int)cdata->_vertices->get_num_rows(); } else { - num_added = (int)cdata->_vertices->get_num_vertices() - cdata->_ends.back(); + num_added = (int)cdata->_vertices->get_num_rows() - cdata->_ends.back(); num_added -= get_num_unused_vertices_per_primitive(); } nassertr(num_added >= get_min_num_vertices_per_primitive(), false); #endif - cdata->_ends.push_back((int)cdata->_vertices->get_num_vertices()); + cdata->_ends.push_back((int)cdata->_vertices->get_num_rows()); } else { #ifndef NDEBUG @@ -264,7 +264,7 @@ close_primitive() { int num_vertices_per_primitive = get_num_vertices_per_primitive(); int num_unused_vertices_per_primitive = get_num_unused_vertices_per_primitive(); - int num_vertices = cdata->_vertices->get_num_vertices(); + int num_vertices = cdata->_vertices->get_num_rows(); nassertr((num_vertices + num_unused_vertices_per_primitive) % (num_vertices_per_primitive + num_unused_vertices_per_primitive) == 0, false) #endif } @@ -331,7 +331,7 @@ get_num_primitives() const { } else { // This is a simple primitive type like a triangle: each primitive // uses the same number of vertices. - return ((int)cdata->_vertices->get_num_vertices() / num_vertices_per_primitive); + return ((int)cdata->_vertices->get_num_rows() / num_vertices_per_primitive); } } @@ -437,10 +437,10 @@ get_primitive_num_vertices(int n) const { int qpGeomPrimitive:: get_primitive_min_vertex(int n) const { CDReader cdata(_cycler); - nassertr(n >= 0 && n < (int)cdata->_mins->get_num_vertices(), -1); + nassertr(n >= 0 && n < (int)cdata->_mins->get_num_rows(), -1); qpGeomVertexReader index(cdata->_mins, 0); - index.set_vertex(n); + index.set_row(n); return index.get_data1i(); } @@ -453,10 +453,10 @@ get_primitive_min_vertex(int n) const { int qpGeomPrimitive:: get_primitive_max_vertex(int n) const { CDReader cdata(_cycler); - nassertr(n >= 0 && n < (int)cdata->_maxs->get_num_vertices(), -1); + nassertr(n >= 0 && n < (int)cdata->_maxs->get_num_rows(), -1); qpGeomVertexReader index(cdata->_maxs, 0); - index.set_vertex(n); + index.set_row(n); return index.get_data1i(); } @@ -540,7 +540,7 @@ get_num_bytes() const { bool qpGeomPrimitive:: check_valid(const qpGeomVertexData *vertex_data) const { return get_num_vertices() == 0 || - get_max_vertex() < vertex_data->get_num_vertices(); + get_max_vertex() < vertex_data->get_num_rows(); } //////////////////////////////////////////////////////////////////// @@ -856,7 +856,7 @@ calc_tight_bounds(LPoint3f &min_point, LPoint3f &max_point, if (got_mat) { while (!index.is_at_end()) { - reader.set_vertex(index.get_data1i()); + reader.set_row(index.get_data1i()); const LVecBase3f &vertex = reader.get_data3f(); if (found_any) { @@ -874,7 +874,7 @@ calc_tight_bounds(LPoint3f &min_point, LPoint3f &max_point, } } else { while (!index.is_at_end()) { - reader.set_vertex(index.get_data1i()); + reader.set_row(index.get_data1i()); LPoint3f vertex = mat.xform_point(reader.get_data3f()); if (found_any) { @@ -945,7 +945,7 @@ append_unused_vertices(qpGeomVertexArrayData *, int) { //////////////////////////////////////////////////////////////////// void qpGeomPrimitive:: recompute_minmax(qpGeomPrimitive::CDWriter &cdata) { - if (cdata->_vertices->get_num_vertices() == 0) { + if (cdata->_vertices->get_num_rows() == 0) { cdata->_min_vertex = 0; cdata->_max_vertex = 0; cdata->_mins.clear(); @@ -995,7 +995,7 @@ recompute_minmax(qpGeomPrimitive::CDWriter &cdata) { } mins.add_data1i(min_prim); maxs.add_data1i(max_prim); - nassertv(cdata->_mins->get_num_vertices() == (int)cdata->_ends.size()); + nassertv(cdata->_mins->get_num_rows() == (int)cdata->_ends.size()); } else { // This is a simple primitive type like a triangle; just compute diff --git a/panda/src/gobj/qpgeomTriangles.cxx b/panda/src/gobj/qpgeomTriangles.cxx index 9eb91f6966..3282eef71f 100644 --- a/panda/src/gobj/qpgeomTriangles.cxx +++ b/panda/src/gobj/qpgeomTriangles.cxx @@ -124,17 +124,17 @@ rotate_impl() const { qpGeomVertexReader from(vertices, 0); qpGeomVertexWriter to(new_vertices, 0); - int num_vertices = vertices->get_num_vertices(); + int num_vertices = vertices->get_num_rows(); switch (shade_model) { case SM_flat_first_vertex: // Move the first vertex to the end. { for (int begin = 0; begin < num_vertices; begin += 3) { - from.set_vertex(begin + 1); + from.set_row(begin + 1); to.set_data1i(from.get_data1i()); to.set_data1i(from.get_data1i()); - from.set_vertex(begin); + from.set_row(begin); to.set_data1i(from.get_data1i()); } } @@ -144,9 +144,9 @@ rotate_impl() const { // Move the last vertex to the front. { for (int begin = 0; begin < num_vertices; begin += 3) { - from.set_vertex(begin + 2); + from.set_row(begin + 2); to.set_data1i(from.get_data1i()); - from.set_vertex(begin); + from.set_row(begin); to.set_data1i(from.get_data1i()); to.set_data1i(from.get_data1i()); } diff --git a/panda/src/gobj/qpgeomTrifans.cxx b/panda/src/gobj/qpgeomTrifans.cxx index 9af598eafb..aea17bc1ab 100644 --- a/panda/src/gobj/qpgeomTrifans.cxx +++ b/panda/src/gobj/qpgeomTrifans.cxx @@ -124,7 +124,7 @@ decompose_impl() const { qpGeomVertexReader index(vertices, 0); CPTA_int ends = get_ends(); - int num_vertices = vertices->get_num_vertices(); + int num_vertices = vertices->get_num_rows(); int vi = 0; int li = 0; diff --git a/panda/src/gobj/qpgeomTristrips.cxx b/panda/src/gobj/qpgeomTristrips.cxx index 697f3f73fd..7394db9a1a 100644 --- a/panda/src/gobj/qpgeomTristrips.cxx +++ b/panda/src/gobj/qpgeomTristrips.cxx @@ -139,7 +139,7 @@ decompose_impl() const { qpGeomVertexReader index(vertices, 0); CPTA_int ends = get_ends(); - int num_vertices = vertices->get_num_vertices(); + int num_vertices = vertices->get_num_rows(); // We need a slightly different algorithm for SM_flat_first_vertex // than for SM_flat_last_vertex, to preserve the key vertex in the @@ -153,7 +153,7 @@ decompose_impl() const { while (li < (int)ends.size()) { // Skip unused vertices between tristrips. vi += 2; - index.set_vertex(vi); + index.set_row(vi); int end = ends[li]; nassertr(vi + 2 <= end, NULL); int v0 = index.get_data1i(); @@ -190,7 +190,7 @@ decompose_impl() const { while (li < (int)ends.size()) { // Skip unused vertices between tristrips. vi += 2; - index.set_vertex(vi); + index.set_row(vi); int end = ends[li]; nassertr(vi + 2 <= end, NULL); int v0 = index.get_data1i(); @@ -252,7 +252,7 @@ rotate_impl() const { if (begin != 0) { // Copy in the unused vertices between tristrips. to.set_data1i(last_added); - from.set_vertex(end - 1); + from.set_row(end - 1); to.set_data1i(from.get_data1i()); begin += 2; } @@ -261,7 +261,7 @@ rotate_impl() const { // an odd number of vertices, which is not allowed. nassertr((num_vertices & 1) == 0, NULL); for (int vi = end - 1; vi >= begin; --vi) { - from.set_vertex(vi); + from.set_row(vi); last_added = from.get_data1i(); to.set_data1i(last_added); } @@ -285,11 +285,11 @@ rotate_impl() const { void qpGeomTristrips:: append_unused_vertices(qpGeomVertexArrayData *vertices, int vertex) { qpGeomVertexReader from(vertices, 0); - from.set_vertex(vertices->get_num_vertices() - 1); + from.set_row(vertices->get_num_rows() - 1); int prev = from.get_data1i(); qpGeomVertexWriter to(vertices, 0); - to.set_vertex(vertices->get_num_vertices()); + to.set_row(vertices->get_num_rows()); to.add_data1i(prev); to.add_data1i(vertex); diff --git a/panda/src/gobj/qpgeomVertexArrayData.I b/panda/src/gobj/qpgeomVertexArrayData.I index 7c929f825c..ac88c892f2 100644 --- a/panda/src/gobj/qpgeomVertexArrayData.I +++ b/panda/src/gobj/qpgeomVertexArrayData.I @@ -53,26 +53,26 @@ has_column(const InternalName *name) const { } //////////////////////////////////////////////////////////////////// -// Function: qpGeomVertexArrayData::get_num_vertices +// Function: qpGeomVertexArrayData::get_num_rows // Access: Published -// Description: Returns the number of vertices stored in the array, +// Description: Returns the number of rows stored in the array, // based on the number of bytes and the stride. This // should be the same for all arrays within a given // GeomVertexData object. //////////////////////////////////////////////////////////////////// INLINE int qpGeomVertexArrayData:: -get_num_vertices() const { +get_num_rows() const { return get_data_size_bytes() / _array_format->get_stride(); } //////////////////////////////////////////////////////////////////// -// Function: qpGeomVertexArrayData::clear_vertices +// Function: qpGeomVertexArrayData::clear_rows // Access: Published -// Description: Removes all of the vertices in the array. -// Functionally equivalent to set_num_vertices(0). +// Description: Removes all of the rows in the array. +// Functionally equivalent to set_num_rows(0). //////////////////////////////////////////////////////////////////// INLINE void qpGeomVertexArrayData:: -clear_vertices() { +clear_rows() { set_data(PTA_uchar()); } diff --git a/panda/src/gobj/qpgeomVertexArrayData.cxx b/panda/src/gobj/qpgeomVertexArrayData.cxx index 584994ca1f..678a2122f3 100644 --- a/panda/src/gobj/qpgeomVertexArrayData.cxx +++ b/panda/src/gobj/qpgeomVertexArrayData.cxx @@ -92,24 +92,24 @@ qpGeomVertexArrayData:: //////////////////////////////////////////////////////////////////// -// Function: qpGeomVertexArrayData::set_num_vertices +// Function: qpGeomVertexArrayData::set_num_rows // Access: Published -// Description: Sets the length of the array to n vertices. +// Description: Sets the length of the array to n rows. // Normally, you would not call this directly, since all // of the arrays in a particular GeomVertexData must -// have the same number of vertices; instead, call -// GeomVertexData::set_num_vertices(). +// have the same number of rows; instead, call +// GeomVertexData::set_num_rows(). // -// The return value is true if the number of vertices +// The return value is true if the number of rows // was changed, false if the object already contained n -// vertices (or if there was some error). +// rows (or if there was some error). // // The new vertex data is initialized to 0, including // the "color" column (but see -// GeomVertexData::set_num_vertices()). +// GeomVertexData::set_num_rows()). //////////////////////////////////////////////////////////////////// bool qpGeomVertexArrayData:: -set_num_vertices(int n) { +set_num_rows(int n) { CDWriter cdata(_cycler); int stride = _array_format->get_stride(); @@ -164,7 +164,7 @@ set_usage_hint(qpGeomVertexArrayData::UsageHint usage_hint) { // Access: Public // Description: Returns a modifiable pointer to the actual vertex // array, so that application code may directly -// manipulate the vertices. +// manipulate it. Use with caution. //////////////////////////////////////////////////////////////////// PTA_uchar qpGeomVertexArrayData:: modify_data() { diff --git a/panda/src/gobj/qpgeomVertexArrayData.h b/panda/src/gobj/qpgeomVertexArrayData.h index 9be7dd949d..0d692169b7 100644 --- a/panda/src/gobj/qpgeomVertexArrayData.h +++ b/panda/src/gobj/qpgeomVertexArrayData.h @@ -74,9 +74,9 @@ PUBLISHED: INLINE bool has_column(const InternalName *name) const; - INLINE int get_num_vertices() const; - bool set_num_vertices(int n); - INLINE void clear_vertices(); + INLINE int get_num_rows() const; + bool set_num_rows(int n); + INLINE void clear_rows(); INLINE int get_data_size_bytes() const; INLINE UpdateSeq get_modified() const; diff --git a/panda/src/gobj/qpgeomVertexArrayFormat.cxx b/panda/src/gobj/qpgeomVertexArrayFormat.cxx index 216ecf2a2e..327fe64da1 100644 --- a/panda/src/gobj/qpgeomVertexArrayFormat.cxx +++ b/panda/src/gobj/qpgeomVertexArrayFormat.cxx @@ -437,14 +437,14 @@ void qpGeomVertexArrayFormat:: write_with_data(ostream &out, int indent_level, const qpGeomVertexData *data, int array_index) const { consider_sort_columns(); - int num_vertices = data->get_num_vertices(); + int num_vertices = data->get_num_rows(); qpGeomVertexReader reader(data); for (int i = 0; i < num_vertices; i++) { indent(out, indent_level) - << "vertex index " << i << ":\n"; - reader.set_vertex(i); + << "row " << i << ":\n"; + reader.set_row(i); Columns::const_iterator ci; for (ci = _columns.begin(); ci != _columns.end(); ++ci) { const qpGeomVertexColumn *column = (*ci); diff --git a/panda/src/gobj/qpgeomVertexData.I b/panda/src/gobj/qpgeomVertexData.I index f07bf483e3..ccfaf724a8 100644 --- a/panda/src/gobj/qpgeomVertexData.I +++ b/panda/src/gobj/qpgeomVertexData.I @@ -88,30 +88,30 @@ has_column(const InternalName *name) const { } //////////////////////////////////////////////////////////////////// -// Function: qpGeomVertexData::set_num_vertices +// Function: qpGeomVertexData::set_num_rows // Access: Published -// Description: Sets the length of the array to n vertices in all of -// the various arrays (presumably by adding vertices). +// Description: Sets the length of the array to n rows in all of +// the various arrays (presumably by adding rows). // // The new vertex data is initialized to 0, except for // the "color" column, which is initialized to (1, 1, 1, // 1). // -// The return value is true if the number of vertices +// The return value is true if the number of rows // was changed, false if the object already contained n -// vertices (or if there was some error). +// rows (or if there was some error). // // Although this method is Published, application code // only very rarely has any need to call it. Instead, // you should use the GeomVertexWriter to build up the -// vertices in a GeomVertexData object automatically, +// rows in a GeomVertexData object automatically, // without need to explicitly set the number of -// vertices. +// rows. //////////////////////////////////////////////////////////////////// INLINE bool qpGeomVertexData:: -set_num_vertices(int n) { +set_num_rows(int n) { CDWriter cdata(_cycler); - return do_set_num_vertices(n, cdata); + return do_set_num_rows(n, cdata); } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/gobj/qpgeomVertexData.cxx b/panda/src/gobj/qpgeomVertexData.cxx index d92333fd7e..dc574176ea 100644 --- a/panda/src/gobj/qpgeomVertexData.cxx +++ b/panda/src/gobj/qpgeomVertexData.cxx @@ -146,18 +146,18 @@ set_usage_hint(qpGeomVertexData::UsageHint usage_hint) { } //////////////////////////////////////////////////////////////////// -// Function: qpGeomVertexData::get_num_vertices +// Function: qpGeomVertexData::get_num_rows // Access: Published -// Description: Returns the number of vertices stored within all the +// Description: Returns the number of rows stored within all the // arrays. All arrays store data for the same n -// vertices. +// rows. //////////////////////////////////////////////////////////////////// int qpGeomVertexData:: -get_num_vertices() const { +get_num_rows() const { CDReader cdata(_cycler); nassertr(_format->get_num_arrays() == (int)cdata->_arrays.size(), 0); if (_format->get_num_arrays() == 0) { - // No arrays means no vertices. Weird but legal. + // No arrays means no rows. Weird but legal. return 0; } @@ -167,14 +167,14 @@ get_num_vertices() const { } //////////////////////////////////////////////////////////////////// -// Function: qpGeomVertexData::clear_vertices +// Function: qpGeomVertexData::clear_rows // Access: Published -// Description: Removes all of the vertices from the arrays; -// functionally equivalent to set_num_vertices(0) (but +// Description: Removes all of the rows from the arrays; +// functionally equivalent to set_num_rows(0) (but // faster). //////////////////////////////////////////////////////////////////// void qpGeomVertexData:: -clear_vertices() { +clear_rows() { CDWriter cdata(_cycler); nassertv(_format->get_num_arrays() == (int)cdata->_arrays.size()); @@ -185,7 +185,7 @@ clear_vertices() { if ((*ai)->get_ref_count() > 1) { (*ai) = new qpGeomVertexArrayData(*(*ai)); } - (*ai)->clear_vertices(); + (*ai)->clear_rows(); } cdata->_modified = qpGeom::get_next_modified(); cdata->_animated_vertices.clear(); @@ -196,9 +196,9 @@ clear_vertices() { // Access: Published // Description: Returns a modifiable pointer to the indicated vertex // array, so that application code may directly -// manipulate the vertices. You should avoid changing +// manipulate the data. You should avoid changing // the length of this array, since all of the arrays -// should be kept in sync--use set_num_vertices() +// should be kept in sync--use set_num_rows() // instead. //////////////////////////////////////////////////////////////////// qpGeomVertexArrayData *qpGeomVertexData:: @@ -357,7 +357,7 @@ copy_from(const qpGeomVertexData &source, bool keep_data_objects) { const qpGeomVertexFormat *source_format = source.get_format(); const qpGeomVertexFormat *dest_format = get_format(); - int num_vertices = source.get_num_vertices(); + int num_rows = source.get_num_rows(); int num_arrays = source_format->get_num_arrays(); int source_i; @@ -402,7 +402,7 @@ copy_from(const qpGeomVertexData &source, bool keep_data_objects) { } // Now make sure the arrays we didn't share are all filled in. - set_num_vertices(num_vertices); + set_num_rows(num_rows); // Now go back through and copy any data that's left over. for (source_i = 0; source_i < num_arrays; ++source_i) { @@ -427,7 +427,7 @@ copy_from(const qpGeomVertexData &source, bool keep_data_objects) { bytewise_copy(dest_array_data + dest_column->get_start(), dest_array_format->get_stride(), array_data + source_column->get_start(), source_array_format->get_stride(), - source_column, num_vertices); + source_column, num_rows); } else if (dest_column->is_packed_argb() && source_column->is_uint8_rgba()) { @@ -438,7 +438,7 @@ copy_from(const qpGeomVertexData &source, bool keep_data_objects) { (dest_array_data + dest_column->get_start(), dest_array_format->get_stride(), array_data + source_column->get_start(), source_array_format->get_stride(), - num_vertices); + num_rows); } else if (dest_column->is_uint8_rgba() && source_column->is_packed_argb()) { @@ -450,7 +450,7 @@ copy_from(const qpGeomVertexData &source, bool keep_data_objects) { (dest_array_data + dest_column->get_start(), dest_array_format->get_stride(), array_data + source_column->get_start(), source_array_format->get_stride(), - num_vertices); + num_rows); } else { // A generic copy. @@ -553,7 +553,7 @@ convert_to(const qpGeomVertexFormat *new_format) const { // Okay, convert the data to the new format. if (gobj_cat.is_debug()) { gobj_cat.debug() - << "Converting " << get_num_vertices() << " vertices.\n"; + << "Converting " << get_num_rows() << " rows.\n"; } PStatTimer timer(_convert_pcollector); @@ -617,11 +617,11 @@ scale_color(const LVecBase4f &color_scale, int num_components, return set_color(color_scale, num_components, numeric_type, contents); } - int num_vertices = get_num_vertices(); + int num_rows = get_num_rows(); if (gobj_cat.is_debug()) { gobj_cat.debug() - << "Scaling color for " << num_vertices << " vertices by " + << "Scaling color for " << num_rows << " vertices by " << color_scale << ".\n"; } PStatTimer timer(_scale_color_pcollector); @@ -634,7 +634,7 @@ scale_color(const LVecBase4f &color_scale, int num_components, qpGeomVertexWriter to(new_data, InternalName::get_color()); qpGeomVertexReader from(this, InternalName::get_color()); - for (int i = 0; i < num_vertices; i++) { + for (int i = 0; i < num_rows; i++) { Colorf color = from.get_data4f(); to.set_data4f(color[0] * color_scale[0], color[1] * color_scale[1], @@ -687,7 +687,7 @@ set_color(const Colorf &color, int num_components, qpGeomVertexData::Contents contents) const { if (gobj_cat.is_debug()) { gobj_cat.debug() - << "Setting color for " << get_num_vertices() << " vertices to " + << "Setting color for " << get_num_rows() << " vertices to " << color << ".\n"; } PStatTimer timer(_set_color_pcollector); @@ -759,7 +759,7 @@ replace_column(const InternalName *name, int num_components, if (gobj_cat.is_debug()) { gobj_cat.debug() << "Replacing data type " << *name << "; converting " - << get_num_vertices() << " vertices from " + << get_num_rows() << " rows from " << *_format << " to " << *format << "\n"; } @@ -792,10 +792,10 @@ replace_column(const InternalName *name, int num_components, nassertr(j == new_type_array, new_data); // For the new type array, we set up a temporary array that has - // room for the right number of vertices. + // room for the right number of rows. PT(qpGeomVertexArrayData) new_array = new qpGeomVertexArrayData (format->get_array(j), get_usage_hint()); - new_array->set_num_vertices(get_num_vertices()); + new_array->set_num_rows(get_num_rows()); new_data->set_array(j, new_array); } @@ -812,7 +812,7 @@ output(ostream &out) const { if (!get_name().empty()) { out << get_name() << " "; } - out << get_num_vertices() << " vertices: " << *get_format(); + out << get_num_rows() << " rows: " << *get_format(); } //////////////////////////////////////////////////////////////////// @@ -1080,36 +1080,36 @@ uint8_rgba_to_packed_argb(unsigned char *to, int to_stride, } //////////////////////////////////////////////////////////////////// -// Function: qpGeomVertexData::do_set_num_vertices +// Function: qpGeomVertexData::do_set_num_rows // Access: Private -// Description: The private implementation of set_num_vertices(). +// Description: The private implementation of set_num_rows(). //////////////////////////////////////////////////////////////////// bool qpGeomVertexData:: -do_set_num_vertices(int n, qpGeomVertexData::CDWriter &cdata) { +do_set_num_rows(int n, qpGeomVertexData::CDWriter &cdata) { nassertr(_format->get_num_arrays() == (int)cdata->_arrays.size(), false); bool any_changed = false; int color_array = -1; - int orig_color_vertices = -1; + int orig_color_rows = -1; for (size_t i = 0; i < cdata->_arrays.size(); i++) { - if (cdata->_arrays[i]->get_num_vertices() != n) { + if (cdata->_arrays[i]->get_num_rows() != n) { // Copy-on-write. if (cdata->_arrays[i]->get_ref_count() > 1) { cdata->_arrays[i] = new qpGeomVertexArrayData(*cdata->_arrays[i]); } if (cdata->_arrays[i]->has_column(InternalName::get_color())) { color_array = i; - orig_color_vertices = cdata->_arrays[i]->get_num_vertices(); + orig_color_rows = cdata->_arrays[i]->get_num_rows(); } - cdata->_arrays[i]->set_num_vertices(n); + cdata->_arrays[i]->set_num_rows(n); any_changed = true; } } - if (color_array >= 0 && orig_color_vertices < n) { - // We have just added some vertices, fill the "color" column with + if (color_array >= 0 && orig_color_rows < n) { + // We have just added some rows, fill the "color" column with // (1, 1, 1, 1), for the programmer's convenience. qpGeomVertexArrayData *array_data = cdata->_arrays[color_array]; const qpGeomVertexColumn *column = @@ -1118,7 +1118,7 @@ do_set_num_vertices(int n, qpGeomVertexData::CDWriter &cdata) { unsigned char *start = array_data->modify_data() + column->get_start(); unsigned char *stop = start + array_data->get_data_size_bytes(); - unsigned char *pointer = start + stride * orig_color_vertices; + unsigned char *pointer = start + stride * orig_color_rows; int num_values = column->get_num_values(); switch (column->get_numeric_type()) { @@ -1162,11 +1162,11 @@ do_set_num_vertices(int n, qpGeomVertexData::CDWriter &cdata) { //////////////////////////////////////////////////////////////////// void qpGeomVertexData:: update_animated_vertices(qpGeomVertexData::CDWriter &cdata, bool from_app) { - int num_vertices = get_num_vertices(); + int num_rows = get_num_rows(); if (gobj_cat.is_debug()) { gobj_cat.debug() - << "Animating " << num_vertices << " vertices for " << get_name() + << "Animating " << num_rows << " vertices for " << get_name() << "\n"; } @@ -1208,7 +1208,7 @@ update_animated_vertices(qpGeomVertexData::CDWriter &cdata, bool from_app) { if (data.get_column()->get_num_values() == 4) { if (data.get_column()->has_homogeneous_coord()) { - for (int i = 0; i < num_vertices; i++) { + for (int i = 0; i < num_rows; i++) { // Scale the delta by the homogeneous coordinate. LPoint4f vertex = data.get_data4f(); LPoint3f d = delta.get_data3f(); @@ -1220,7 +1220,7 @@ update_animated_vertices(qpGeomVertexData::CDWriter &cdata, bool from_app) { } } else { // Just apply the four-component delta. - for (int i = 0; i < num_vertices; i++) { + for (int i = 0; i < num_rows; i++) { const LPoint4f &vertex = data.get_data4f(); LPoint4f d = delta.get_data4f(); data.set_data4f(vertex + d * slider_value); @@ -1229,7 +1229,7 @@ update_animated_vertices(qpGeomVertexData::CDWriter &cdata, bool from_app) { } else { // 3-component or smaller values; don't worry about a // homogeneous coordinate. - for (int i = 0; i < num_vertices; i++) { + for (int i = 0; i < num_rows; i++) { const LPoint3f &vertex = data.get_data3f(); LPoint3f d = delta.get_data3f(); data.set_data3f(vertex + d * slider_value); @@ -1266,14 +1266,14 @@ update_animated_vertices(qpGeomVertexData::CDWriter &cdata, bool from_app) { } if (data.get_column()->get_num_values() == 4) { - for (int i = 0; i < num_vertices; i++) { + for (int i = 0; i < num_rows; i++) { LPoint4f vertex = data.get_data4f(); int bi = blendi.get_data1i(); palette->get_blend(bi).transform_point(vertex); data.set_data4f(vertex); } } else { - for (int i = 0; i < num_vertices; i++) { + for (int i = 0; i < num_rows; i++) { LPoint3f vertex = data.get_data3f(); int bi = blendi.get_data1i(); palette->get_blend(bi).transform_point(vertex); @@ -1292,7 +1292,7 @@ update_animated_vertices(qpGeomVertexData::CDWriter &cdata, bool from_app) { return; } - for (int i = 0; i < num_vertices; i++) { + for (int i = 0; i < num_rows; i++) { LVector3f vertex = data.get_data3f(); int bi = blendi.get_data1i(); palette->get_blend(bi).transform_vector(vertex); diff --git a/panda/src/gobj/qpgeomVertexData.h b/panda/src/gobj/qpgeomVertexData.h index f8afbf9f5a..dd7a081478 100644 --- a/panda/src/gobj/qpgeomVertexData.h +++ b/panda/src/gobj/qpgeomVertexData.h @@ -92,9 +92,9 @@ PUBLISHED: INLINE bool has_column(const InternalName *name) const; - int get_num_vertices() const; - INLINE bool set_num_vertices(int n); - void clear_vertices(); + int get_num_rows() const; + INLINE bool set_num_rows(int n); + void clear_rows(); INLINE int get_num_arrays() const; INLINE const qpGeomVertexArrayData *get_array(int i) const; @@ -223,7 +223,7 @@ private: typedef CycleDataWriter CDWriter; private: - bool do_set_num_vertices(int n, CDWriter &cdata); + bool do_set_num_rows(int n, CDWriter &cdata); void update_animated_vertices(CDWriter &cdata, bool from_app); CPT(qpGeomVertexFormat) get_post_animated_format() const; diff --git a/panda/src/gobj/qpgeomVertexFormat.cxx b/panda/src/gobj/qpgeomVertexFormat.cxx index b085ef0b88..ecac9edc36 100644 --- a/panda/src/gobj/qpgeomVertexFormat.cxx +++ b/panda/src/gobj/qpgeomVertexFormat.cxx @@ -413,7 +413,7 @@ void qpGeomVertexFormat:: write_with_data(ostream &out, int indent_level, const qpGeomVertexData *data) const { indent(out, indent_level) - << data->get_num_vertices() << " vertices.\n"; + << data->get_num_rows() << " rows.\n"; for (size_t i = 0; i < _arrays.size(); i++) { CPTA_uchar array_data = data->get_array(i)->get_data(); indent(out, indent_level) diff --git a/panda/src/gobj/qpgeomVertexReader.I b/panda/src/gobj/qpgeomVertexReader.I index 3fc3b09a94..70e99887a3 100644 --- a/panda/src/gobj/qpgeomVertexReader.I +++ b/panda/src/gobj/qpgeomVertexReader.I @@ -126,9 +126,9 @@ get_array_data() const { // Description: Sets up the reader to use the nth data type of the // GeomVertexFormat, numbering from 0. // -// This also resets the read vertex number to the start -// vertex (the same value passed to a previous call to -// set_vertex(), or 0 if set_vertex() was never called.) +// This also resets the read row number to the start row +// (the same value passed to a previous call to +// set_row(), or 0 if set_row() was never called.) // // The return value is true if the data type is valid, // false otherwise. @@ -151,9 +151,9 @@ set_column(int column) { // Description: Sets up the reader to use the data type with the // indicated name. // -// This also resets the read vertex number to the start -// vertex (the same value passed to a previous call to -// set_vertex(), or 0 if set_vertex() was never called.) +// This also resets the read row number to the start row +// (the same value passed to a previous call to +// set_row(), or 0 if set_row() was never called.) // // The return value is true if the data type is valid, // false otherwise. @@ -169,9 +169,9 @@ set_column(const string &name) { // Description: Sets up the reader to use the data type with the // indicated name. // -// This also resets the read vertex number to the start -// vertex (the same value passed to a previous call to -// set_vertex(), or 0 if set_vertex() was never called.) +// This also resets the read row number to the start row +// (the same value passed to a previous call to +// set_row(), or 0 if set_row() was never called.) // // The return value is true if the data type is valid, // false otherwise. @@ -227,30 +227,32 @@ get_column() const { } //////////////////////////////////////////////////////////////////// -// Function: qpGeomVertexReader::set_vertex +// Function: qpGeomVertexReader::set_row // Access: Published -// Description: Sets the start, read, and write index to the -// indicated value. The reader will begin traversing -// from the given vertex. +// Description: Sets the start row to the indicated value. The +// reader will begin reading from the indicated row; +// each subsequent get_data*() call will return the data +// from the subsequent row. If set_column() is called, +// the reader will return to this row. //////////////////////////////////////////////////////////////////// INLINE void qpGeomVertexReader:: -set_vertex(int vertex) { - _start_vertex = vertex; +set_row(int row) { + _start_row = row; if (has_column()) { - set_pointer(_start_vertex); + set_pointer(_start_row); } } //////////////////////////////////////////////////////////////////// -// Function: qpGeomVertexReader::get_start_vertex +// Function: qpGeomVertexReader::get_start_row // Access: Published -// Description: Returns the vertex index at which the reader -// started. It will return to this vertex if you reset -// the current column. +// Description: Returns the row index at which the reader started. +// It will return to this row if you reset the current +// column. //////////////////////////////////////////////////////////////////// INLINE int qpGeomVertexReader:: -get_start_vertex() const { - return _start_vertex; +get_start_row() const { + return _start_row; } //////////////////////////////////////////////////////////////////// @@ -269,9 +271,9 @@ is_at_end() const { //////////////////////////////////////////////////////////////////// // Function: qpGeomVertexReader::get_data1f // Access: Published -// Description: Returns the data associated with the read vertex, +// Description: Returns the data associated with the read row, // expressed as a 1-component value, and advances the -// read vertex. +// read row. //////////////////////////////////////////////////////////////////// INLINE float qpGeomVertexReader:: get_data1f() { @@ -282,9 +284,9 @@ get_data1f() { //////////////////////////////////////////////////////////////////// // Function: qpGeomVertexReader::get_data2f // Access: Published -// Description: Returns the data associated with the read vertex, +// Description: Returns the data associated with the read row, // expressed as a 2-component value, and advances the -// read vertex. +// read row. //////////////////////////////////////////////////////////////////// INLINE const LVecBase2f &qpGeomVertexReader:: get_data2f() { @@ -295,9 +297,9 @@ get_data2f() { //////////////////////////////////////////////////////////////////// // Function: qpGeomVertexReader::get_data3f // Access: Published -// Description: Returns the data associated with the read vertex, +// Description: Returns the data associated with the read row, // expressed as a 3-component value, and advances the -// read vertex. +// read row. //////////////////////////////////////////////////////////////////// INLINE const LVecBase3f &qpGeomVertexReader:: get_data3f() { @@ -308,9 +310,9 @@ get_data3f() { //////////////////////////////////////////////////////////////////// // Function: qpGeomVertexReader::get_data4f // Access: Published -// Description: Returns the data associated with the read vertex, +// Description: Returns the data associated with the read row, // expressed as a 4-component value, and advances the -// read vertex. +// read row. //////////////////////////////////////////////////////////////////// INLINE const LVecBase4f &qpGeomVertexReader:: get_data4f() { @@ -321,9 +323,9 @@ get_data4f() { //////////////////////////////////////////////////////////////////// // Function: qpGeomVertexReader::get_data1i // Access: Published -// Description: Returns the data associated with the read vertex, +// Description: Returns the data associated with the read row, // expressed as a 1-component value, and advances the -// read vertex. +// read row. //////////////////////////////////////////////////////////////////// INLINE int qpGeomVertexReader:: get_data1i() { @@ -334,9 +336,9 @@ get_data1i() { //////////////////////////////////////////////////////////////////// // Function: qpGeomVertexReader::get_data2i // Access: Published -// Description: Returns the data associated with the read vertex, +// Description: Returns the data associated with the read row, // expressed as a 2-component value, and advances the -// read vertex. +// read row. //////////////////////////////////////////////////////////////////// INLINE const int *qpGeomVertexReader:: get_data2i() { @@ -347,9 +349,9 @@ get_data2i() { //////////////////////////////////////////////////////////////////// // Function: qpGeomVertexReader::get_data3i // Access: Published -// Description: Returns the data associated with the read vertex, +// Description: Returns the data associated with the read row, // expressed as a 3-component value, and advances the -// read vertex. +// read row. //////////////////////////////////////////////////////////////////// INLINE const int *qpGeomVertexReader:: get_data3i() { @@ -360,9 +362,9 @@ get_data3i() { //////////////////////////////////////////////////////////////////// // Function: qpGeomVertexReader::get_data4i // Access: Published -// Description: Returns the data associated with the read vertex, +// Description: Returns the data associated with the read row, // expressed as a 4-component value, and advances the -// read vertex. +// read row. //////////////////////////////////////////////////////////////////// INLINE const int *qpGeomVertexReader:: get_data4i() { @@ -373,29 +375,29 @@ get_data4i() { //////////////////////////////////////////////////////////////////// // Function: qpGeomVertexReader::set_pointer // Access: Private -// Description: Sets up the internal write pointer, etc. to use the -// indicated vertex. +// Description: Sets up the internal read pointer, etc. to read from +// the indicated row. //////////////////////////////////////////////////////////////////// INLINE void qpGeomVertexReader:: -set_pointer(int vertex) { +set_pointer(int row) { nassertv(has_column()); if (_vertex_data != (const qpGeomVertexData *)NULL) { const qpGeomVertexArrayData *array_data = _vertex_data->get_array(_array); _pointer = array_data->get_data(); _pointer_end = _pointer + array_data->get_data_size_bytes(); - _pointer += _packer->_column->get_start() + _stride * vertex; + _pointer += _packer->_column->get_start() + _stride * row; } else { _pointer = _array_data->get_data(); _pointer_end = _pointer + _array_data->get_data_size_bytes(); - _pointer += _packer->_column->get_start() + _stride * vertex; + _pointer += _packer->_column->get_start() + _stride * row; } } //////////////////////////////////////////////////////////////////// // Function: qpGeomVertexReader::inc_pointer // Access: Private -// Description: Increments to the next vertex, and returns the data +// Description: Increments to the next row, and returns the data // pointer as it was before incrementing. //////////////////////////////////////////////////////////////////// INLINE const unsigned char *qpGeomVertexReader:: diff --git a/panda/src/gobj/qpgeomVertexReader.cxx b/panda/src/gobj/qpgeomVertexReader.cxx index 7726c1d65a..dca81b5b67 100644 --- a/panda/src/gobj/qpgeomVertexReader.cxx +++ b/panda/src/gobj/qpgeomVertexReader.cxx @@ -31,10 +31,9 @@ const unsigned char qpGeomVertexReader::empty_buffer[100] = { 0 }; // Description: Sets up the reader to use the indicated column // description on the given array. // -// This also resets the current read vertex numbers to -// the start vertex (the same value passed to a previous -// call to set_vertex(), or 0 if set_vertex() was never -// called.) +// This also resets the current read row number to the +// start row (the same value passed to a previous call +// to set_row(), or 0 if set_row() was never called.) // // The return value is true if the data type is valid, // false otherwise. @@ -73,7 +72,7 @@ set_column(int array, const qpGeomVertexColumn *column) { _packer = column->_packer; - set_pointer(_start_vertex); + set_pointer(_start_row); return true; } @@ -89,5 +88,5 @@ initialize() { _packer = NULL; _pointer = NULL; _pointer_end = NULL; - _start_vertex = 0; + _start_row = 0; } diff --git a/panda/src/gobj/qpgeomVertexReader.h b/panda/src/gobj/qpgeomVertexReader.h index 4647b71889..5ab113fb1e 100644 --- a/panda/src/gobj/qpgeomVertexReader.h +++ b/panda/src/gobj/qpgeomVertexReader.h @@ -83,9 +83,9 @@ PUBLISHED: INLINE int get_array() const; INLINE const qpGeomVertexColumn *get_column() const; - INLINE void set_vertex(int vertex); + INLINE void set_row(int row); - INLINE int get_start_vertex() const; + INLINE int get_start_row() const; INLINE bool is_at_end() const; INLINE float get_data1f(); @@ -101,7 +101,7 @@ PUBLISHED: private: void initialize(); - INLINE void set_pointer(int vertex); + INLINE void set_pointer(int row); INLINE const unsigned char *inc_pointer(); // It is important that we only store *one* of the following two @@ -119,7 +119,7 @@ private: const unsigned char *_pointer; const unsigned char *_pointer_end; - int _start_vertex; + int _start_row; #ifndef NDEBUG // This is defined just for the benefit of having something non-NULL diff --git a/panda/src/gobj/qpgeomVertexRewriter.I b/panda/src/gobj/qpgeomVertexRewriter.I index 47e0a93494..f3dd806a95 100644 --- a/panda/src/gobj/qpgeomVertexRewriter.I +++ b/panda/src/gobj/qpgeomVertexRewriter.I @@ -128,9 +128,9 @@ get_array_data() const { // Description: Sets up the rewriter to use the nth data type of the // GeomVertexFormat, numbering from 0. // -// This also resets both the read and write vertex -// numbers to the start vertex (the same value passed to -// a previous call to set_vertex(), or 0 if set_vertex() +// This also resets both the read and write row +// numbers to the start row (the same value passed to +// a previous call to set_row(), or 0 if set_row() // was never called.) // // The return value is true if the data type is valid, @@ -139,7 +139,7 @@ get_array_data() const { INLINE bool qpGeomVertexRewriter:: set_column(int column) { // It's important to invoke the writer first, then the reader. See - // set_vertex(). + // set_row(). qpGeomVertexWriter::set_column(column); return qpGeomVertexReader::set_column(column); } @@ -150,9 +150,9 @@ set_column(int column) { // Description: Sets up the rewriter to use the data type with the // indicated name. // -// This also resets both the read and write vertex -// numbers to the start vertex (the same value passed to -// a previous call to set_vertex(), or 0 if set_vertex() +// This also resets both the read and write row +// numbers to the start row (the same value passed to +// a previous call to set_row(), or 0 if set_row() // was never called.) // // The return value is true if the data type is valid, @@ -169,9 +169,9 @@ set_column(const string &name) { // Description: Sets up the rewriter to use the data type with the // indicated name. // -// This also resets both the read and write vertex -// numbers to the start vertex (the same value passed to -// a previous call to set_vertex(), or 0 if set_vertex() +// This also resets both the read and write row +// numbers to the start row (the same value passed to +// a previous call to set_row(), or 0 if set_row() // was never called.) // // The return value is true if the data type is valid, @@ -180,7 +180,7 @@ set_column(const string &name) { INLINE bool qpGeomVertexRewriter:: set_column(const InternalName *name) { // It's important to invoke the writer first, then the reader. See - // set_vertex(). + // set_row(). qpGeomVertexWriter::set_column(name); return qpGeomVertexReader::set_column(name); } @@ -191,9 +191,9 @@ set_column(const InternalName *name) { // Description: Sets up the rewriter to use the indicated column // description on the given array. // -// This also resets both the read and write vertex -// numbers to the start vertex (the same value passed to -// a previous call to set_vertex(), or 0 if set_vertex() +// This also resets both the read and write row +// numbers to the start row (the same value passed to +// a previous call to set_row(), or 0 if set_row() // was never called.) // // The return value is true if the data type is valid, @@ -202,7 +202,7 @@ set_column(const InternalName *name) { INLINE bool qpGeomVertexRewriter:: set_column(int array, const qpGeomVertexColumn *column) { // It's important to invoke the writer first, then the reader. See - // set_vertex(). + // set_row(). qpGeomVertexWriter::set_column(array, column); return qpGeomVertexReader::set_column(array, column); } @@ -248,33 +248,33 @@ get_column() const { } //////////////////////////////////////////////////////////////////// -// Function: qpGeomVertexRewriter::set_vertex +// Function: qpGeomVertexRewriter::set_row // Access: Published // Description: Sets the start, write, and write index to the // indicated value. The rewriter will begin traversing -// from the given vertex. +// from the given row. //////////////////////////////////////////////////////////////////// INLINE void qpGeomVertexRewriter:: -set_vertex(int vertex) { +set_row(int row) { // It's important to invoke the Writer first, since that might force // a recopy of the array, which might invalidate the pointer already // stored by the Reader if we invoked the Reader first. - qpGeomVertexWriter::set_vertex(vertex); - qpGeomVertexReader::set_vertex(vertex); + qpGeomVertexWriter::set_row(row); + qpGeomVertexReader::set_row(row); } //////////////////////////////////////////////////////////////////// -// Function: qpGeomVertexRewriter::get_start_vertex +// Function: qpGeomVertexRewriter::get_start_row // Access: Published -// Description: Returns the vertex index at which the rewriter -// started. It will return to this vertex if you reset +// Description: Returns the row index at which the rewriter +// started. It will return to this row if you reset // the current column. //////////////////////////////////////////////////////////////////// INLINE int qpGeomVertexRewriter:: -get_start_vertex() const { - nassertr(qpGeomVertexWriter::get_start_vertex() == - qpGeomVertexReader::get_start_vertex(), 0); - return qpGeomVertexWriter::get_start_vertex(); +get_start_row() const { + nassertr(qpGeomVertexWriter::get_start_row() == + qpGeomVertexReader::get_start_row(), 0); + return qpGeomVertexWriter::get_start_row(); } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/gobj/qpgeomVertexRewriter.h b/panda/src/gobj/qpgeomVertexRewriter.h index eeb8076e6d..dc00a07126 100644 --- a/panda/src/gobj/qpgeomVertexRewriter.h +++ b/panda/src/gobj/qpgeomVertexRewriter.h @@ -29,7 +29,7 @@ // GeomVertexReader and a GeomVertexWriter, combined // together into one convenient package. It is designed // for making a single pass over a GeomVertexData -// object, modifying vertices as it goes. +// object, modifying rows as it goes. // // Although it doesn't provide any real performance // benefit over using a separate reader and writer on @@ -66,9 +66,9 @@ PUBLISHED: INLINE int get_array() const; INLINE const qpGeomVertexColumn *get_column() const; - INLINE void set_vertex(int vertex); + INLINE void set_row(int row); - INLINE int get_start_vertex() const; + INLINE int get_start_row() const; INLINE bool is_at_end() const; }; diff --git a/panda/src/gobj/qpgeomVertexWriter.I b/panda/src/gobj/qpgeomVertexWriter.I index 06b55366ad..34bc52b568 100644 --- a/panda/src/gobj/qpgeomVertexWriter.I +++ b/panda/src/gobj/qpgeomVertexWriter.I @@ -125,9 +125,9 @@ get_array_data() const { // Description: Sets up the writer to use the nth data type of the // GeomVertexFormat, numbering from 0. // -// This also resets the write vertex number to the start -// vertex (the same value passed to a previous call to -// set_vertex(), or 0 if set_vertex() was never called.) +// This also resets the write row number to the start +// row (the same value passed to a previous call to +// set_row(), or 0 if set_row() was never called.) // // The return value is true if the data type is valid, // false otherwise. @@ -150,9 +150,9 @@ set_column(int column) { // Description: Sets up the writer to use the data type with the // indicated name. // -// This also resets the write vertex number to the start -// vertex (the same value passed to a previous call to -// set_vertex(), or 0 if set_vertex() was never called.) +// This also resets the write row number to the start +// row (the same value passed to a previous call to +// set_row(), or 0 if set_row() was never called.) // // The return value is true if the data type is valid, // false otherwise. @@ -168,9 +168,9 @@ set_column(const string &name) { // Description: Sets up the writer to use the data type with the // indicated name. // -// This also resets the write number to the start vertex +// This also resets the write number to the start row // (the same value passed to a previous call to -// set_vertex(), or 0 if set_vertex() was never called.) +// set_row(), or 0 if set_row() was never called.) // // The return value is true if the data type is valid, // false otherwise. @@ -226,30 +226,32 @@ get_column() const { } //////////////////////////////////////////////////////////////////// -// Function: qpGeomVertexWriter::set_vertex +// Function: qpGeomVertexWriter::set_row // Access: Published -// Description: Sets the start, write, and write index to the -// indicated value. The writer will begin traversing -// from the given vertex. +// Description: Sets the start row to the indicated value. The +// writer will begin writing to the indicated row; +// each subsequent set_data*() call will store the data +// into the subsequent row. If set_column() is called, +// the writer will return to this row. //////////////////////////////////////////////////////////////////// INLINE void qpGeomVertexWriter:: -set_vertex(int vertex) { - _start_vertex = vertex; +set_row(int row) { + _start_row = row; if (has_column()) { - set_pointer(_start_vertex); + set_pointer(_start_row); } } //////////////////////////////////////////////////////////////////// -// Function: qpGeomVertexWriter::get_start_vertex +// Function: qpGeomVertexWriter::get_start_row // Access: Published -// Description: Returns the vertex index at which the writer -// started. It will return to this vertex if you reset +// Description: Returns the row index at which the writer +// started. It will return to this row if you reset // the current column. //////////////////////////////////////////////////////////////////// INLINE int qpGeomVertexWriter:: -get_start_vertex() const { - return _start_vertex; +get_start_row() const { + return _start_row; } //////////////////////////////////////////////////////////////////// @@ -259,7 +261,7 @@ get_start_vertex() const { // the list of vertices, false otherwise. If this is // true, another call to set_data*() will result in a // crash, but another call to add_data*() will add a new -// vertex. +// row. //////////////////////////////////////////////////////////////////// INLINE bool qpGeomVertexWriter:: is_at_end() const { @@ -269,10 +271,10 @@ is_at_end() const { //////////////////////////////////////////////////////////////////// // Function: qpGeomVertexWriter::set_data1f // Access: Published -// Description: Sets the write vertex to a particular 1-component -// value, and advances the write vertex. +// Description: Sets the write row to a particular 1-component +// value, and advances the write row. // -// It is an error for the write vertex to advance past +// It is an error for the write row to advance past // the end of data. //////////////////////////////////////////////////////////////////// INLINE void qpGeomVertexWriter:: @@ -284,10 +286,10 @@ set_data1f(float data) { //////////////////////////////////////////////////////////////////// // Function: qpGeomVertexWriter::set_data2f // Access: Published -// Description: Sets the write vertex to a particular 2-component -// value, and advances the write vertex. +// Description: Sets the write row to a particular 2-component +// value, and advances the write row. // -// It is an error for the write vertex to advance past +// It is an error for the write row to advance past // the end of data. //////////////////////////////////////////////////////////////////// INLINE void qpGeomVertexWriter:: @@ -298,10 +300,10 @@ set_data2f(float x, float y) { //////////////////////////////////////////////////////////////////// // Function: qpGeomVertexWriter::set_data2f // Access: Published -// Description: Sets the write vertex to a particular 2-component -// value, and advances the write vertex. +// Description: Sets the write row to a particular 2-component +// value, and advances the write row. // -// It is an error for the write vertex to advance past +// It is an error for the write row to advance past // the end of data. //////////////////////////////////////////////////////////////////// INLINE void qpGeomVertexWriter:: @@ -313,10 +315,10 @@ set_data2f(const LVecBase2f &data) { //////////////////////////////////////////////////////////////////// // Function: qpGeomVertexWriter::set_data3f // Access: Published -// Description: Sets the write vertex to a particular 3-component -// value, and advances the write vertex. +// Description: Sets the write row to a particular 3-component +// value, and advances the write row. // -// It is an error for the write vertex to advance past +// It is an error for the write row to advance past // the end of data. //////////////////////////////////////////////////////////////////// INLINE void qpGeomVertexWriter:: @@ -327,10 +329,10 @@ set_data3f(float x, float y, float z) { //////////////////////////////////////////////////////////////////// // Function: qpGeomVertexWriter::set_data3f // Access: Published -// Description: Sets the write vertex to a particular 3-component -// value, and advances the write vertex. +// Description: Sets the write row to a particular 3-component +// value, and advances the write row. // -// It is an error for the write vertex to advance past +// It is an error for the write row to advance past // the end of data. //////////////////////////////////////////////////////////////////// INLINE void qpGeomVertexWriter:: @@ -342,10 +344,10 @@ set_data3f(const LVecBase3f &data) { //////////////////////////////////////////////////////////////////// // Function: qpGeomVertexWriter::set_data4f // Access: Published -// Description: Sets the write vertex to a particular 4-component -// value, and advances the write vertex. +// Description: Sets the write row to a particular 4-component +// value, and advances the write row. // -// It is an error for the write vertex to advance past +// It is an error for the write row to advance past // the end of data. //////////////////////////////////////////////////////////////////// INLINE void qpGeomVertexWriter:: @@ -356,10 +358,10 @@ set_data4f(float x, float y, float z, float w) { //////////////////////////////////////////////////////////////////// // Function: qpGeomVertexWriter::set_data4f // Access: Published -// Description: Sets the write vertex to a particular 4-component -// value, and advances the write vertex. +// Description: Sets the write row to a particular 4-component +// value, and advances the write row. // -// It is an error for the write vertex to advance past +// It is an error for the write row to advance past // the end of data. //////////////////////////////////////////////////////////////////// INLINE void qpGeomVertexWriter:: @@ -371,10 +373,10 @@ set_data4f(const LVecBase4f &data) { //////////////////////////////////////////////////////////////////// // Function: qpGeomVertexWriter::set_data1i // Access: Published -// Description: Sets the write vertex to a particular 1-component -// value, and advances the write vertex. +// Description: Sets the write row to a particular 1-component +// value, and advances the write row. // -// It is an error for the write vertex to advance past +// It is an error for the write row to advance past // the end of data. //////////////////////////////////////////////////////////////////// INLINE void qpGeomVertexWriter:: @@ -386,10 +388,10 @@ set_data1i(int data) { //////////////////////////////////////////////////////////////////// // Function: qpGeomVertexWriter::set_data2i // Access: Published -// Description: Sets the write vertex to a particular 2-component -// value, and advances the write vertex. +// Description: Sets the write row to a particular 2-component +// value, and advances the write row. // -// It is an error for the write vertex to advance past +// It is an error for the write row to advance past // the end of data. //////////////////////////////////////////////////////////////////// INLINE void qpGeomVertexWriter:: @@ -401,10 +403,10 @@ set_data2i(int a, int b) { //////////////////////////////////////////////////////////////////// // Function: qpGeomVertexWriter::set_data2i // Access: Published -// Description: Sets the write vertex to a particular 2-component -// value, and advances the write vertex. +// Description: Sets the write row to a particular 2-component +// value, and advances the write row. // -// It is an error for the write vertex to advance past +// It is an error for the write row to advance past // the end of data. //////////////////////////////////////////////////////////////////// INLINE void qpGeomVertexWriter:: @@ -415,10 +417,10 @@ set_data2i(const int data[2]) { //////////////////////////////////////////////////////////////////// // Function: qpGeomVertexWriter::set_data3i // Access: Published -// Description: Sets the write vertex to a particular 3-component -// value, and advances the write vertex. +// Description: Sets the write row to a particular 3-component +// value, and advances the write row. // -// It is an error for the write vertex to advance past +// It is an error for the write row to advance past // the end of data. //////////////////////////////////////////////////////////////////// INLINE void qpGeomVertexWriter:: @@ -430,10 +432,10 @@ set_data3i(int a, int b, int c) { //////////////////////////////////////////////////////////////////// // Function: qpGeomVertexWriter::set_data3i // Access: Published -// Description: Sets the write vertex to a particular 3-component -// value, and advances the write vertex. +// Description: Sets the write row to a particular 3-component +// value, and advances the write row. // -// It is an error for the write vertex to advance past +// It is an error for the write row to advance past // the end of data. //////////////////////////////////////////////////////////////////// INLINE void qpGeomVertexWriter:: @@ -444,10 +446,10 @@ set_data3i(const int data[3]) { //////////////////////////////////////////////////////////////////// // Function: qpGeomVertexWriter::set_data4i // Access: Published -// Description: Sets the write vertex to a particular 4-component -// value, and advances the write vertex. +// Description: Sets the write row to a particular 4-component +// value, and advances the write row. // -// It is an error for the write vertex to advance past +// It is an error for the write row to advance past // the end of data. //////////////////////////////////////////////////////////////////// INLINE void qpGeomVertexWriter:: @@ -459,10 +461,10 @@ set_data4i(int a, int b, int c, int d) { //////////////////////////////////////////////////////////////////// // Function: qpGeomVertexWriter::set_data4i // Access: Published -// Description: Sets the write vertex to a particular 4-component -// value, and advances the write vertex. +// Description: Sets the write row to a particular 4-component +// value, and advances the write row. // -// It is an error for the write vertex to advance past +// It is an error for the write row to advance past // the end of data. //////////////////////////////////////////////////////////////////// INLINE void qpGeomVertexWriter:: @@ -473,11 +475,11 @@ set_data4i(const int data[4]) { //////////////////////////////////////////////////////////////////// // Function: qpGeomVertexWriter::add_data1f // Access: Published -// Description: Sets the write vertex to a particular 1-component -// value, and advances the write vertex. +// Description: Sets the write row to a particular 1-component +// value, and advances the write row. // -// If the write vertex advances past the end of data, -// implicitly adds a new vertex to the data. +// If the write row advances past the end of data, +// implicitly adds a new row to the data. //////////////////////////////////////////////////////////////////// INLINE void qpGeomVertexWriter:: add_data1f(float data) { @@ -488,11 +490,11 @@ add_data1f(float data) { //////////////////////////////////////////////////////////////////// // Function: qpGeomVertexWriter::add_data2f // Access: Published -// Description: Sets the write vertex to a particular 2-component -// value, and advances the write vertex. +// Description: Sets the write row to a particular 2-component +// value, and advances the write row. // -// If the write vertex advances past the end of data, -// implicitly adds a new vertex to the data. +// If the write row advances past the end of data, +// implicitly adds a new row to the data. //////////////////////////////////////////////////////////////////// INLINE void qpGeomVertexWriter:: add_data2f(float x, float y) { @@ -502,11 +504,11 @@ add_data2f(float x, float y) { //////////////////////////////////////////////////////////////////// // Function: qpGeomVertexWriter::add_data2f // Access: Published -// Description: Sets the write vertex to a particular 2-component -// value, and advances the write vertex. +// Description: Sets the write row to a particular 2-component +// value, and advances the write row. // -// If the write vertex advances past the end of data, -// implicitly adds a new vertex to the data. +// If the write row advances past the end of data, +// implicitly adds a new row to the data. //////////////////////////////////////////////////////////////////// INLINE void qpGeomVertexWriter:: add_data2f(const LVecBase2f &data) { @@ -517,11 +519,11 @@ add_data2f(const LVecBase2f &data) { //////////////////////////////////////////////////////////////////// // Function: qpGeomVertexWriter::add_data3f // Access: Published -// Description: Sets the write vertex to a particular 3-component -// value, and advances the write vertex. +// Description: Sets the write row to a particular 3-component +// value, and advances the write row. // -// If the write vertex advances past the end of data, -// implicitly adds a new vertex to the data. +// If the write row advances past the end of data, +// implicitly adds a new row to the data. //////////////////////////////////////////////////////////////////// INLINE void qpGeomVertexWriter:: add_data3f(float x, float y, float z) { @@ -531,11 +533,11 @@ add_data3f(float x, float y, float z) { //////////////////////////////////////////////////////////////////// // Function: qpGeomVertexWriter::add_data3f // Access: Published -// Description: Sets the write vertex to a particular 3-component -// value, and advances the write vertex. +// Description: Sets the write row to a particular 3-component +// value, and advances the write row. // -// If the write vertex advances past the end of data, -// implicitly adds a new vertex to the data. +// If the write row advances past the end of data, +// implicitly adds a new row to the data. //////////////////////////////////////////////////////////////////// INLINE void qpGeomVertexWriter:: add_data3f(const LVecBase3f &data) { @@ -546,11 +548,11 @@ add_data3f(const LVecBase3f &data) { //////////////////////////////////////////////////////////////////// // Function: qpGeomVertexWriter::add_data4f // Access: Published -// Description: Sets the write vertex to a particular 4-component -// value, and advances the write vertex. +// Description: Sets the write row to a particular 4-component +// value, and advances the write row. // -// If the write vertex advances past the end of data, -// implicitly adds a new vertex to the data. +// If the write row advances past the end of data, +// implicitly adds a new row to the data. //////////////////////////////////////////////////////////////////// INLINE void qpGeomVertexWriter:: add_data4f(float x, float y, float z, float w) { @@ -560,11 +562,11 @@ add_data4f(float x, float y, float z, float w) { //////////////////////////////////////////////////////////////////// // Function: qpGeomVertexWriter::add_data4f // Access: Published -// Description: Sets the write vertex to a particular 4-component -// value, and advances the write vertex. +// Description: Sets the write row to a particular 4-component +// value, and advances the write row. // -// If the write vertex advances past the end of data, -// implicitly adds a new vertex to the data. +// If the write row advances past the end of data, +// implicitly adds a new row to the data. //////////////////////////////////////////////////////////////////// INLINE void qpGeomVertexWriter:: add_data4f(const LVecBase4f &data) { @@ -575,11 +577,11 @@ add_data4f(const LVecBase4f &data) { //////////////////////////////////////////////////////////////////// // Function: qpGeomVertexWriter::add_data1i // Access: Published -// Description: Sets the write vertex to a particular 1-component -// value, and advances the write vertex. +// Description: Sets the write row to a particular 1-component +// value, and advances the write row. // -// If the write vertex advances past the end of data, -// implicitly adds a new vertex to the data. +// If the write row advances past the end of data, +// implicitly adds a new row to the data. //////////////////////////////////////////////////////////////////// INLINE void qpGeomVertexWriter:: add_data1i(int data) { @@ -590,11 +592,11 @@ add_data1i(int data) { //////////////////////////////////////////////////////////////////// // Function: qpGeomVertexWriter::add_data2i // Access: Published -// Description: Sets the write vertex to a particular 2-component -// value, and advances the write vertex. +// Description: Sets the write row to a particular 2-component +// value, and advances the write row. // -// If the write vertex advances past the end of data, -// implicitly adds a new vertex to the data. +// If the write row advances past the end of data, +// implicitly adds a new row to the data. //////////////////////////////////////////////////////////////////// INLINE void qpGeomVertexWriter:: add_data2i(int a, int b) { @@ -605,11 +607,11 @@ add_data2i(int a, int b) { //////////////////////////////////////////////////////////////////// // Function: qpGeomVertexWriter::add_data2i // Access: Published -// Description: Sets the write vertex to a particular 2-component -// value, and advances the write vertex. +// Description: Sets the write row to a particular 2-component +// value, and advances the write row. // -// If the write vertex advances past the end of data, -// implicitly adds a new vertex to the data. +// If the write row advances past the end of data, +// implicitly adds a new row to the data. //////////////////////////////////////////////////////////////////// INLINE void qpGeomVertexWriter:: add_data2i(const int data[2]) { @@ -619,11 +621,11 @@ add_data2i(const int data[2]) { //////////////////////////////////////////////////////////////////// // Function: qpGeomVertexWriter::add_data3i // Access: Published -// Description: Sets the write vertex to a particular 3-component -// value, and advances the write vertex. +// Description: Sets the write row to a particular 3-component +// value, and advances the write row. // -// If the write vertex advances past the end of data, -// implicitly adds a new vertex to the data. +// If the write row advances past the end of data, +// implicitly adds a new row to the data. //////////////////////////////////////////////////////////////////// INLINE void qpGeomVertexWriter:: add_data3i(int a, int b, int c) { @@ -634,11 +636,11 @@ add_data3i(int a, int b, int c) { //////////////////////////////////////////////////////////////////// // Function: qpGeomVertexWriter::add_data3i // Access: Published -// Description: Sets the write vertex to a particular 3-component -// value, and advances the write vertex. +// Description: Sets the write row to a particular 3-component +// value, and advances the write row. // -// If the write vertex advances past the end of data, -// implicitly adds a new vertex to the data. +// If the write row advances past the end of data, +// implicitly adds a new row to the data. //////////////////////////////////////////////////////////////////// INLINE void qpGeomVertexWriter:: add_data3i(const int data[3]) { @@ -648,11 +650,11 @@ add_data3i(const int data[3]) { //////////////////////////////////////////////////////////////////// // Function: qpGeomVertexWriter::add_data4i // Access: Published -// Description: Sets the write vertex to a particular 4-component -// value, and advances the write vertex. +// Description: Sets the write row to a particular 4-component +// value, and advances the write row. // -// If the write vertex advances past the end of data, -// implicitly adds a new vertex to the data. +// If the write row advances past the end of data, +// implicitly adds a new row to the data. //////////////////////////////////////////////////////////////////// INLINE void qpGeomVertexWriter:: add_data4i(int a, int b, int c, int d) { @@ -663,11 +665,11 @@ add_data4i(int a, int b, int c, int d) { //////////////////////////////////////////////////////////////////// // Function: qpGeomVertexWriter::add_data4i // Access: Published -// Description: Sets the write vertex to a particular 4-component -// value, and advances the write vertex. +// Description: Sets the write row to a particular 4-component +// value, and advances the write row. // -// If the write vertex advances past the end of data, -// implicitly adds a new vertex to the data. +// If the write row advances past the end of data, +// implicitly adds a new row to the data. //////////////////////////////////////////////////////////////////// INLINE void qpGeomVertexWriter:: add_data4i(const int data[4]) { @@ -678,29 +680,29 @@ add_data4i(const int data[4]) { // Function: qpGeomVertexWriter::set_pointer // Access: Private // Description: Sets up the internal write pointer, etc. to use the -// indicated vertex. +// indicated row. //////////////////////////////////////////////////////////////////// INLINE void qpGeomVertexWriter:: -set_pointer(int vertex) { +set_pointer(int row) { nassertv(has_column()); if (_vertex_data != (qpGeomVertexData *)NULL) { qpGeomVertexArrayData *array_data = _vertex_data->modify_array(_array); _pointer = array_data->modify_data(); _pointer_end = _pointer + array_data->get_data_size_bytes(); - _pointer += _packer->_column->get_start() + _stride * vertex; + _pointer += _packer->_column->get_start() + _stride * row; } else { _pointer = _array_data->modify_data(); _pointer_end = _pointer + _array_data->get_data_size_bytes(); - _pointer += _packer->_column->get_start() + _stride * vertex; + _pointer += _packer->_column->get_start() + _stride * row; } - _write_vertex = vertex; + _write_row = row; } //////////////////////////////////////////////////////////////////// // Function: qpGeomVertexWriter::inc_pointer // Access: Private -// Description: Increments to the next vertex, and returns the data +// Description: Increments to the next row, and returns the data // pointer as it was before incrementing. //////////////////////////////////////////////////////////////////// INLINE unsigned char *qpGeomVertexWriter:: @@ -717,28 +719,28 @@ inc_pointer() { unsigned char *orig_pointer = _pointer; _pointer += _stride; - ++_write_vertex; + ++_write_row; return orig_pointer; } //////////////////////////////////////////////////////////////////// // Function: qpGeomVertexWriter::inc_add_pointer // Access: Private -// Description: Increments to the next vertex, and returns the data +// Description: Increments to the next row, and returns the data // pointer as it was before incrementing. If we are at // or past the end of data, implicitly adds more -// vertices first. +// rows first. //////////////////////////////////////////////////////////////////// INLINE unsigned char *qpGeomVertexWriter:: inc_add_pointer() { if (_pointer >= _pointer_end) { // Reset the data pointer. if (_vertex_data != (qpGeomVertexData *)NULL) { - _vertex_data->set_num_vertices(max(_write_vertex + 1, _vertex_data->get_num_vertices())); + _vertex_data->set_num_rows(max(_write_row + 1, _vertex_data->get_num_rows())); } else { - _array_data->set_num_vertices(max(_write_vertex + 1, _array_data->get_num_vertices())); + _array_data->set_num_rows(max(_write_row + 1, _array_data->get_num_rows())); } - set_pointer(_write_vertex); + set_pointer(_write_row); } return inc_pointer(); } diff --git a/panda/src/gobj/qpgeomVertexWriter.cxx b/panda/src/gobj/qpgeomVertexWriter.cxx index b0f3a89691..db7a79bb64 100644 --- a/panda/src/gobj/qpgeomVertexWriter.cxx +++ b/panda/src/gobj/qpgeomVertexWriter.cxx @@ -31,10 +31,9 @@ unsigned char qpGeomVertexWriter::empty_buffer[100] = { 0 }; // Description: Sets up the writer to use the indicated column // description on the given array. // -// This also resets the current write vertex numbers to -// the start vertex (the same value passed to a previous -// call to set_vertex(), or 0 if set_vertex() was never -// called.) +// This also resets the current write row number to the +// start row (the same value passed to a previous call +// to set_row(), or 0 if set_row() was never called.) // // The return value is true if the data type is valid, // false otherwise. @@ -73,7 +72,7 @@ set_column(int array, const qpGeomVertexColumn *column) { _packer = column->_packer; - set_pointer(_start_vertex); + set_pointer(_start_row); return true; } @@ -89,6 +88,6 @@ initialize() { _packer = NULL; _pointer = NULL; _pointer_end = NULL; - _start_vertex = 0; - _write_vertex = 0; + _start_row = 0; + _write_row = 0; } diff --git a/panda/src/gobj/qpgeomVertexWriter.h b/panda/src/gobj/qpgeomVertexWriter.h index 4d04abc3b1..f29a0778d3 100644 --- a/panda/src/gobj/qpgeomVertexWriter.h +++ b/panda/src/gobj/qpgeomVertexWriter.h @@ -39,7 +39,7 @@ // to allow these to run past the end of the data. The // add_data*() family of methods, on the other hand, can // be used to replace existing data or add new data; if -// you call set_vertex() into the middle of existing +// you call set_row() into the middle of existing // data the add_data*() methods will behave like the // corresponding set_data*(), but if they run past the // end of existing data they will quietly add new @@ -96,9 +96,9 @@ PUBLISHED: INLINE int get_array() const; INLINE const qpGeomVertexColumn *get_column() const; - INLINE void set_vertex(int vertex); + INLINE void set_row(int row); - INLINE int get_start_vertex() const; + INLINE int get_start_row() const; INLINE bool is_at_end() const; INLINE void set_data1f(float data); @@ -138,7 +138,7 @@ private: void initialize(); - INLINE void set_pointer(int vertex); + INLINE void set_pointer(int row); INLINE unsigned char *inc_pointer(); INLINE unsigned char *inc_add_pointer(); @@ -157,8 +157,8 @@ private: unsigned char *_pointer; unsigned char *_pointer_end; - int _start_vertex; - int _write_vertex; + int _start_row; + int _write_row; #ifndef NDEBUG // This is defined just for the benefit of having something non-NULL diff --git a/panda/src/pgraph/config_pgraph.cxx b/panda/src/pgraph/config_pgraph.cxx index ac14bd759d..68c3b33e29 100644 --- a/panda/src/pgraph/config_pgraph.cxx +++ b/panda/src/pgraph/config_pgraph.cxx @@ -155,13 +155,25 @@ ConfigVariableBool auto_break_cycles "from time to time to prevent gradual memory bloat.")); ConfigVariableInt max_collect_vertices -("max-collect-vertices", 4096, +("max-collect-vertices", 1024, PRC_DESC("Specifies the maximum number of vertices that are allowed to be " "accumulated into any one GeomVertexData structure as a result " - "of collecting objects together during a flatten operation. This " - "does not impose a limit on the original size of any one " + "of collecting objects together during a flatten operation. " + "This prevents the accidental generation of large vertex buffers " + "from lots of smaller vertex buffers, while not " + "imposing a limit on the original size of any one " "GeomVertexData structure.")); +ConfigVariableInt max_collect_indices +("max-collect-indices", 1024, + PRC_DESC("Specifies the maximum number of vertex indices that are allowed " + "to be accumulated into any one GeomPrimitive as a result " + "of collecting objects together during a flatten operation. " + "This prevents the accidental generation of large index buffers " + "from lots of smaller index buffers, while not " + "imposing a limit on the original size of any one " + "GeomPrimitive.")); + ConfigVariableBool polylight_info ("polylight-info", false, PRC_DESC("Set this true to view some info statements regarding the polylight. " diff --git a/panda/src/pgraph/config_pgraph.h b/panda/src/pgraph/config_pgraph.h index 6c4328635e..00c1e90636 100644 --- a/panda/src/pgraph/config_pgraph.h +++ b/panda/src/pgraph/config_pgraph.h @@ -42,6 +42,7 @@ extern ConfigVariableBool compose_componentwise; extern ConfigVariableBool paranoid_const; extern ConfigVariableBool auto_break_cycles; extern ConfigVariableInt max_collect_vertices; +extern ConfigVariableInt max_collect_indices; extern ConfigVariableBool polylight_info; extern ConfigVariableDouble lod_fade_time; diff --git a/panda/src/pgraph/cullableObject.cxx b/panda/src/pgraph/cullableObject.cxx index 7dc6b15889..58d54c99f2 100644 --- a/panda/src/pgraph/cullableObject.cxx +++ b/panda/src/pgraph/cullableObject.cxx @@ -273,7 +273,7 @@ munge_points_to_quads(const CullTraverser *traverser) { // Get the point in eye-space coordinates. unsigned int v = index.get_data1i(); (*vi) = v; - vertex.set_vertex(v); + vertex.set_row(v); points[v]._eye = modelview.xform_point(vertex.get_data3f()); points[v]._dist = gsg->compute_distance_to(points[v]._eye); } @@ -298,7 +298,7 @@ munge_points_to_quads(const CullTraverser *traverser) { LPoint4f p4 = LPoint4f(eye[0], eye[1], eye[2], 1.0f) * projection; if (has_size) { - size.set_vertex(*vi); + size.set_row(*vi); point_size = size.get_data1f(); } @@ -323,7 +323,7 @@ munge_points_to_quads(const CullTraverser *traverser) { float scale_x = scale_y; if (has_aspect_ratio) { - aspect_ratio.set_vertex(*vi); + aspect_ratio.set_row(*vi); scale_x *= aspect_ratio.get_data1f(); } @@ -333,7 +333,7 @@ munge_points_to_quads(const CullTraverser *traverser) { if (has_rotate) { // If we have a rotate factor, apply it to those two corners. - rotate.set_vertex(*vi); + rotate.set_row(*vi); float r = rotate.get_data1f(); LMatrix3f mat = LMatrix3f::rotate_mat(r); c0 = c0 * mat; @@ -353,7 +353,7 @@ munge_points_to_quads(const CullTraverser *traverser) { new_vertex.add_data4f(p4[0] - c0[0], p4[1] - c0[1], p4[2], p4[3]); if (has_normal) { - normal.set_vertex(*vi); + normal.set_row(*vi); Normalf c = render_transform.xform_vec(normal.get_data3f()); new_normal.add_data3f(c); new_normal.add_data3f(c); @@ -361,7 +361,7 @@ munge_points_to_quads(const CullTraverser *traverser) { new_normal.add_data3f(c); } if (has_color) { - color.set_vertex(*vi); + color.set_row(*vi); const Colorf &c = color.get_data4f(); new_color.add_data4f(c); new_color.add_data4f(c); @@ -374,7 +374,7 @@ munge_points_to_quads(const CullTraverser *traverser) { new_texcoord.add_data2f(1.0f, 1.0f); new_texcoord.add_data2f(0.0f, 1.0f); } else if (has_texcoord) { - texcoord.set_vertex(*vi); + texcoord.set_row(*vi); const LVecBase4f &c = texcoord.get_data4f(); new_texcoord.add_data4f(c); new_texcoord.add_data4f(c); diff --git a/panda/src/pgraph/geomTransformer.cxx b/panda/src/pgraph/geomTransformer.cxx index c96c2e2b1e..6d06dde94a 100644 --- a/panda/src/pgraph/geomTransformer.cxx +++ b/panda/src/pgraph/geomTransformer.cxx @@ -538,7 +538,7 @@ int GeomTransformer:: collect_vertex_data(qpGeom *geom, int collect_bits) { const qpGeomVertexData *vdata = geom->get_vertex_data(); - if (vdata->get_num_vertices() > _max_collect_vertices) { + if (vdata->get_num_rows() > _max_collect_vertices) { // Don't even bother. return 0; } @@ -576,8 +576,8 @@ collect_vertex_data(qpGeom *geom, int collect_bits) { ++num_created; } - int offset = new_data->get_num_vertices(); - int new_num_vertices = offset + vdata->get_num_vertices(); + int offset = new_data->get_num_rows(); + int new_num_vertices = offset + vdata->get_num_rows(); if (new_num_vertices > _max_collect_vertices) { // Whoa, hold the phone! Too many vertices going into this one // GeomVertexData object; we'd better start over. @@ -585,11 +585,11 @@ collect_vertex_data(qpGeom *geom, int collect_bits) { vdata->get_usage_hint()); _new_collected_data[key] = new_data; offset = 0; - new_num_vertices = vdata->get_num_vertices(); + new_num_vertices = vdata->get_num_rows(); ++num_created; } - new_data->set_num_vertices(new_num_vertices); + new_data->set_num_rows(new_num_vertices); for (int i = 0; i < vdata->get_num_arrays(); ++i) { qpGeomVertexArrayData *new_array = new_data->modify_array(i);