GeomVertexRewriter

class GeomVertexRewriter

Bases: GeomVertexWriter, GeomVertexReader

This object provides the functionality of both a GeomVertexReader and a GeomVertexWriter, combined together into one convenient package. It is designed for making a single pass over a GeomVertexData object, modifying rows as it goes.

Although it doesn’t provide any real performance benefit over using a separate reader and writer on the same data, it should probably be used in preference to a separate reader and writer, because it makes an effort to manage the reference counts properly between the reader and the writer to avoid accidentally dereferencing either array while recopying.

Inheritance diagram

Inheritance diagram of GeomVertexRewriter

GeomVertexRewriter(Thread *current_thread = Thread::get_current_thread())
GeomVertexRewriter(GeomVertexData *vertex_data, Thread *current_thread = Thread::get_current_thread())
GeomVertexRewriter(GeomVertexData *vertex_data, CPT_InternalName name, Thread *current_thread = Thread::get_current_thread())
GeomVertexRewriter(GeomVertexArrayData *array_data, Thread *current_thread = Thread::get_current_thread())
GeomVertexRewriter(GeomVertexArrayData *array_data, int column, Thread *current_thread = Thread::get_current_thread())
GeomVertexRewriter(GeomVertexRewriter const &copy)

Constructs an invalid GeomVertexRewriter. You must use the assignment operator to assign a valid GeomVertexRewriter to this object before you can use it.

Constructs a new rewriter to process the vertices of the indicated data object.

Constructs a new rewriter to process the vertices of the indicated data object. This flavor creates the rewriter specifically to process the named data type.

Constructs a new rewriter to process the vertices of the indicated array only.

Constructs a new rewriter to process the vertices of the indicated array only.

void clear(void)

Resets the GeomVertexRewriter to the initial state.

int get_array(void) const

Returns the array index containing the data type that the rewriter is working on.

GeomVertexArrayData *get_array_data(void) const

Returns the particular array object that the rewriter is currently processing.

GeomVertexArrayDataHandle *get_array_handle(void) const

Returns the write handle to the array object that the rewriter is currently processing. This low-level call should be used with caution; be careful with modifying the data in the handle out from under the GeomVertexRewriter.

GeomVertexColumn const *get_column(void) const

Returns the description of the data type that the rewriter is working on.

Thread *get_current_thread(void) const

Returns the Thread pointer of the currently-executing thread, as passed to the constructor of this object.

int get_start_row(void) const

Returns the row index at which the rewriter started. It will return to this row if you reset the current column.

std::size_t get_stride(void) const

Returns the per-row stride (bytes between consecutive rows) of the underlying vertex array. This low-level information is normally not needed to use the GeomVertexRewriter directly.

GeomVertexData *get_vertex_data(void) const

Returns the vertex data object that the rewriter is processing.

bool has_column(void) const

Returns true if a valid data type has been successfully set, or false if the data type does not exist.

bool is_at_end(void) const

Returns true if the reader or writer is currently at the end of the list of vertices, false otherwise.

void output(std::ostream &out) const
bool set_column(int column)
bool set_column(CPT_InternalName name)
bool set_column(int array, GeomVertexColumn const *column)

Sets up the rewriter to use the nth data type of the GeomVertexFormat, numbering from 0.

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, false otherwise.

Sets up the rewriter to use the data type with the indicated name.

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, false otherwise.

Sets up the rewriter to use the indicated column description on the given array.

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, false otherwise.

void set_row(int row)

Sets the start, write, and write index to the indicated value. The rewriter will begin traversing from the given row.

void set_row_unsafe(int row)

Sets the start row to the indicated value, without internal checks. This is the same as set_row(), but it does not check for the possibility that the array has been reallocated internally for some reason; use only when you are confident that the array is unchanged and you really need every bit of available performance.