panda3d.core.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

__init__(array_data: GeomVertexArrayData, current_thread: Thread) → None

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

__init__(array_data: GeomVertexArrayData, column: int, current_thread: Thread) → None

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

__init__(vertex_data: GeomVertexData, name: InternalName, current_thread: Thread) → None

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.

__init__(vertex_data: GeomVertexData, current_thread: Thread) → None

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

__init__(copy: GeomVertexRewriter) → None
__init__(current_thread: Thread) → None

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

assign(copy: GeomVertexRewriter) → GeomVertexRewriter
Return type

GeomVertexRewriter

clear() → None

Resets the GeomVertexRewriter to the initial state.

getArray() → int

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

getArrayData() → GeomVertexArrayData

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

Return type

GeomVertexArrayData

getArrayHandle() → GeomVertexArrayDataHandle

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.

Return type

GeomVertexArrayDataHandle

getColumn() → GeomVertexColumn

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

Return type

GeomVertexColumn

getCurrentThread() → Thread

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

Return type

Thread

getStartRow() → int

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

getStride() → size_t

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.

Return type

size_t

getVertexData() → GeomVertexData

Returns the vertex data object that the rewriter is processing.

Return type

GeomVertexData

hasColumn() → bool

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

isAtEnd() → bool

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

output(out: ostream) → None
setColumn(name: InternalName) → bool

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 setRow(), or 0 if setRow() was never called.)

The return value is true if the data type is valid, false otherwise.

setColumn(column: int) → bool

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 setRow(), or 0 if setRow() was never called.)

The return value is true if the data type is valid, false otherwise.

setColumn(array: int, column: GeomVertexColumn) → bool

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 setRow(), or 0 if setRow() was never called.)

The return value is true if the data type is valid, false otherwise.

setRow(row: int) → None

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

setRowUnsafe(row: int) → None

Sets the start row to the indicated value, without internal checks. This is the same as setRow(), 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.