GeomVertexRewriter
from panda3d.core import GeomVertexRewriter
- class GeomVertexRewriter
Bases:
Bases:
GeomVertexWriter
,GeomVertexReader
This object provides the functionality of both a
GeomVertexReader
and aGeomVertexWriter
, combined together into one convenient package. It is designed for making a single pass over aGeomVertexData
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
- __init__(array_data: GeomVertexArrayData, current_thread: Thread)
Constructs a new rewriter to process the vertices of the indicated array only.
- __init__(array_data: GeomVertexArrayData, column: int, current_thread: Thread)
Constructs a new rewriter to process the vertices of the indicated array only.
- __init__(vertex_data: GeomVertexData, name: InternalName, current_thread: Thread)
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)
Constructs a new rewriter to process the vertices of the indicated data object.
- __init__(copy: GeomVertexRewriter)
- __init__(current_thread: Thread)
Constructs an invalid
GeomVertexRewriter
. You must use the assignment operator to assign a validGeomVertexRewriter
to this object before you can use it.
- assign(copy: GeomVertexRewriter) GeomVertexRewriter
- clear()
Resets the
GeomVertexRewriter
to the initial state.
- getArrayData() GeomVertexArrayData
Returns the particular array object that the rewriter is currently processing.
- 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
.
- getColumn() GeomVertexColumn
Returns the description of the data type that the rewriter is working on.
- getCurrentThread() Thread
Returns the Thread pointer of the currently-executing thread, as passed to the constructor of this object.
- getStartRow() int
Returns the row index at which the rewriter started. It will return to this row if you reset the current column.
- getStride() int
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.
- getVertexData() GeomVertexData
Returns the vertex data object that the rewriter is processing.
- 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.
- 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 ifsetRow()
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 ifsetRow()
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 ifsetRow()
was never called.)The return value is true if the data type is valid, false otherwise.
- setRow(row: int)
Sets the start, write, and write index to the indicated value. The rewriter will begin traversing from the given row.
- setRowUnsafe(row: int)
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.