GeomVertexWriter
from panda3d.core import GeomVertexWriter
- class GeomVertexWriter
Bases:
Bases:
GeomEnums
This object provides a high-level interface for quickly writing a sequence of numeric values from a vertex table.
This object can be used both to replace existing vertices in the table, or to extend the table with new vertices. The set_data*() family of methods can only be used to replace existing data; it is an error 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_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 vertices.Like
GeomVertexReader
, the writer is particularly optimized for writing a single column of data values for a series of vertices, without changing columns between each number. Although you can also use one GeomVertexWriter to write across the columns if it is convenient, by callingset_column()
repeatedly at each vertex, it is faster to write down the columns, and to use a different GeomVertexWriter for each column.Note that, like a
GeomVertexReader
, a GeomVertexWriter does not keep a reference count to the actual vertex data buffer. This means that it is important not to keep a GeomVertexWriter object around over a long period of time in which the data buffer is likely to be deallocated; it is intended for making a quick pass over the data in one session.It also means that you should create any GeomVertexWriters before creating
GeomVertexReaders
on the same data, since the writer itself might cause the vertex buffer to be deallocated. Better yet, use aGeomVertexRewriter
if you are going to create both of them anyway.Inheritance diagram
- __init__(copy: GeomVertexWriter)
- __init__(array_data: GeomVertexArrayData, current_thread: Thread)
Constructs a new writer to process the vertices of the indicated array only.
- __init__(array_data: GeomVertexArrayData, column: int, current_thread: Thread)
Constructs a new writer to process the vertices of the indicated array only.
- __init__(vertex_data: GeomVertexData, name: InternalName, current_thread: Thread)
Constructs a new writer to process the vertices of the indicated data object. This flavor creates the writer specifically to process the named data type.
- __init__(vertex_data: GeomVertexData, current_thread: Thread)
Constructs a new writer to process the vertices of the indicated data object.
- __init__(current_thread: Thread)
Constructs an invalid
GeomVertexWriter
. You must use the assignment operator to assign a validGeomVertexWriter
to this object before you can use it.
- add_data1(data: float)
Sets the write row to a particular 1-component value, and advances the write row.
If the write row advances past the end of data, implicitly adds a new row to the data.
- add_data1d(data: float)
Sets the write row to a particular 1-component value, and advances the write row.
If the write row advances past the end of data, implicitly adds a new row to the data.
- add_data1f(data: float)
Sets the write row to a particular 1-component value, and advances the write row.
If the write row advances past the end of data, implicitly adds a new row to the data.
- add_data1i(data: int)
Sets the write row to a particular 1-component value, and advances the write row.
If the write row advances past the end of data, implicitly adds a new row to the data.
- add_data2(data: LVecBase2)
Sets the write row to a particular 2-component value, and advances the write row.
If the write row advances past the end of data, implicitly adds a new row to the data.
- add_data2(x: float, y: float)
Sets the write row to a particular 2-component value, and advances the write row.
If the write row advances past the end of data, implicitly adds a new row to the data.
- add_data2d(data: LVecBase2d)
Sets the write row to a particular 2-component value, and advances the write row.
If the write row advances past the end of data, implicitly adds a new row to the data.
- add_data2d(x: float, y: float)
Sets the write row to a particular 2-component value, and advances the write row.
If the write row advances past the end of data, implicitly adds a new row to the data.
- add_data2f(data: LVecBase2f)
Sets the write row to a particular 2-component value, and advances the write row.
If the write row advances past the end of data, implicitly adds a new row to the data.
- add_data2f(x: float, y: float)
Sets the write row to a particular 2-component value, and advances the write row.
If the write row advances past the end of data, implicitly adds a new row to the data.
- add_data2i(data: LVecBase2i)
Sets the write row to a particular 2-component value, and advances the write row.
If the write row advances past the end of data, implicitly adds a new row to the data.
- add_data2i(a: int, b: int)
Sets the write row to a particular 2-component value, and advances the write row.
If the write row advances past the end of data, implicitly adds a new row to the data.
- add_data3(data: LVecBase3)
Sets the write row to a particular 3-component value, and advances the write row.
If the write row advances past the end of data, implicitly adds a new row to the data.
- add_data3(x: float, y: float, z: float)
Sets the write row to a particular 3-component value, and advances the write row.
If the write row advances past the end of data, implicitly adds a new row to the data.
- add_data3d(data: LVecBase3d)
Sets the write row to a particular 3-component value, and advances the write row.
If the write row advances past the end of data, implicitly adds a new row to the data.
- add_data3d(x: float, y: float, z: float)
Sets the write row to a particular 3-component value, and advances the write row.
If the write row advances past the end of data, implicitly adds a new row to the data.
- add_data3f(data: LVecBase3f)
Sets the write row to a particular 3-component value, and advances the write row.
If the write row advances past the end of data, implicitly adds a new row to the data.
- add_data3f(x: float, y: float, z: float)
Sets the write row to a particular 3-component value, and advances the write row.
If the write row advances past the end of data, implicitly adds a new row to the data.
- add_data3i(data: LVecBase3i)
Sets the write row to a particular 3-component value, and advances the write row.
If the write row advances past the end of data, implicitly adds a new row to the data.
- add_data3i(a: int, b: int, c: int)
Sets the write row to a particular 3-component value, and advances the write row.
If the write row advances past the end of data, implicitly adds a new row to the data.
- add_data4(data: LVecBase4)
Sets the write row to a particular 4-component value, and advances the write row.
If the write row advances past the end of data, implicitly adds a new row to the data.
- add_data4(x: float, y: float, z: float, w: float)
Sets the write row to a particular 4-component value, and advances the write row.
If the write row advances past the end of data, implicitly adds a new row to the data.
- add_data4d(data: LVecBase4d)
Sets the write row to a particular 4-component value, and advances the write row.
If the write row advances past the end of data, implicitly adds a new row to the data.
- add_data4d(x: float, y: float, z: float, w: float)
Sets the write row to a particular 4-component value, and advances the write row.
If the write row advances past the end of data, implicitly adds a new row to the data.
- add_data4f(data: LVecBase4f)
Sets the write row to a particular 4-component value, and advances the write row.
If the write row advances past the end of data, implicitly adds a new row to the data.
- add_data4f(x: float, y: float, z: float, w: float)
Sets the write row to a particular 4-component value, and advances the write row.
If the write row advances past the end of data, implicitly adds a new row to the data.
- add_data4i(data: LVecBase4i)
Sets the write row to a particular 4-component value, and advances the write row.
If the write row advances past the end of data, implicitly adds a new row to the data.
- add_data4i(a: int, b: int, c: int, d: int)
Sets the write row to a particular 4-component value, and advances the write row.
If the write row advances past the end of data, implicitly adds a new row to the data.
- add_matrix3(mat: LMatrix3)
Sets the write row to a 3-by-3 matrix, and advances the write row. This is a special method that can only be used on matrix columns.
If the write row advances past the end of data, implicitly adds a new row to the data.
- add_matrix3d(mat: LMatrix3d)
Sets the write row to a 3-by-3 matrix, and advances the write row. This is a special method that can only be used on matrix columns.
If the write row advances past the end of data, implicitly adds a new row to the data.
- add_matrix3f(mat: LMatrix3f)
Sets the write row to a 3-by-3 matrix, and advances the write row. This is a special method that can only be used on matrix columns.
If the write row advances past the end of data, implicitly adds a new row to the data.
- add_matrix4(mat: LMatrix4)
Sets the write row to a 4-by-4 matrix, and advances the write row. This is a special method that can only be used on matrix columns.
If the write row advances past the end of data, implicitly adds a new row to the data.
- add_matrix4d(mat: LMatrix4d)
Sets the write row to a 4-by-4 matrix, and advances the write row. This is a special method that can only be used on matrix columns.
If the write row advances past the end of data, implicitly adds a new row to the data.
- add_matrix4f(mat: LMatrix4f)
Sets the write row to a 4-by-4 matrix, and advances the write row. This is a special method that can only be used on matrix columns.
If the write row advances past the end of data, implicitly adds a new row to the data.
- assign(copy: GeomVertexWriter) GeomVertexWriter
- clear()
Resets the
GeomVertexWriter
to the initial state.
- get_array_data() GeomVertexArrayData
Returns the particular array object that the writer is currently processing.
- get_array_handle() GeomVertexArrayDataHandle
Returns the write handle to the array object that the writer 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
GeomVertexWriter
.
- get_column() GeomVertexColumn
Returns the description of the data type that the writer is working on.
- get_current_thread() Thread
Returns the Thread pointer of the currently-executing thread, as passed to the constructor of this object.
- get_start_row() int
Returns the row index at which the writer started. It will return to this row if you reset the current column.
- get_stride() 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
GeomVertexWriter
directly.
- get_vertex_data() GeomVertexData
Returns the vertex data object that the writer is processing. This may return NULL if the writer was constructed with just an array pointer.
- get_write_row() int
Returns the row index to which the data will be written at the next call to set_data*() or add_data*().
- has_column() bool
Returns true if a valid data type has been successfully set, or false if the data type does not exist.
- is_at_end() bool
Returns true if the writer is currently at the end of 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 row.
- reserve_num_rows(num_rows: int) bool
This ensures that enough memory space for num_rows is allocated, so that you may add up to num_rows rows without causing a new memory allocation. This is a performance optimization only; it is especially useful when you know the number of rows you will be adding ahead of time.
- set_column(name: InternalName) bool
Sets up the writer to use the data type with the indicated name.
This also resets the write number to the start row (the same value passed to a previous call to
set_row()
, or 0 ifset_row()
was never called.)The return value is true if the data type is valid, false otherwise.
- set_column(column: int) bool
Sets up the writer to use the nth data type of the
GeomVertexFormat
, numbering from 0.This also resets the write row number to the start row (the same value passed to a previous call to
set_row()
, or 0 ifset_row()
was never called.)The return value is true if the data type is valid, false otherwise.
- set_column(array: int, column: GeomVertexColumn) bool
Sets up the writer to use the indicated column description on the given array.
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 ifset_row()
was never called.)The return value is true if the data type is valid, false otherwise.
- set_data1(data: float)
Sets the write row to a particular 1-component value, and advances the write row.
It is an error for the write row to advance past the end of data.
- set_data1d(data: float)
Sets the write row to a particular 1-component value, and advances the write row.
It is an error for the write row to advance past the end of data.
- set_data1f(data: float)
Sets the write row to a particular 1-component value, and advances the write row.
It is an error for the write row to advance past the end of data.
- set_data1i(data: int)
Sets the write row to a particular 1-component value, and advances the write row.
It is an error for the write row to advance past the end of data.
- set_data2(data: LVecBase2)
Sets the write row to a particular 2-component value, and advances the write row.
It is an error for the write row to advance past the end of data.
- set_data2(x: float, y: float)
Sets the write row to a particular 2-component value, and advances the write row.
It is an error for the write row to advance past the end of data.
- set_data2d(data: LVecBase2d)
Sets the write row to a particular 2-component value, and advances the write row.
It is an error for the write row to advance past the end of data.
- set_data2d(x: float, y: float)
Sets the write row to a particular 2-component value, and advances the write row.
It is an error for the write row to advance past the end of data.
- set_data2f(data: LVecBase2f)
Sets the write row to a particular 2-component value, and advances the write row.
It is an error for the write row to advance past the end of data.
- set_data2f(x: float, y: float)
Sets the write row to a particular 2-component value, and advances the write row.
It is an error for the write row to advance past the end of data.
- set_data2i(data: LVecBase2i)
Sets the write row to a particular 2-component value, and advances the write row.
It is an error for the write row to advance past the end of data.
- set_data2i(a: int, b: int)
Sets the write row to a particular 2-component value, and advances the write row.
It is an error for the write row to advance past the end of data.
- set_data3(data: LVecBase3)
Sets the write row to a particular 3-component value, and advances the write row.
It is an error for the write row to advance past the end of data.
- set_data3(x: float, y: float, z: float)
Sets the write row to a particular 3-component value, and advances the write row.
It is an error for the write row to advance past the end of data.
- set_data3d(data: LVecBase3d)
Sets the write row to a particular 3-component value, and advances the write row.
It is an error for the write row to advance past the end of data.
- set_data3d(x: float, y: float, z: float)
Sets the write row to a particular 3-component value, and advances the write row.
It is an error for the write row to advance past the end of data.
- set_data3f(data: LVecBase3f)
Sets the write row to a particular 3-component value, and advances the write row.
It is an error for the write row to advance past the end of data.
- set_data3f(x: float, y: float, z: float)
Sets the write row to a particular 3-component value, and advances the write row.
It is an error for the write row to advance past the end of data.
- set_data3i(data: LVecBase3i)
Sets the write row to a particular 3-component value, and advances the write row.
It is an error for the write row to advance past the end of data.
- set_data3i(a: int, b: int, c: int)
Sets the write row to a particular 3-component value, and advances the write row.
It is an error for the write row to advance past the end of data.
- set_data4(data: LVecBase4)
Sets the write row to a particular 4-component value, and advances the write row.
It is an error for the write row to advance past the end of data.
- set_data4(x: float, y: float, z: float, w: float)
Sets the write row to a particular 4-component value, and advances the write row.
It is an error for the write row to advance past the end of data.
- set_data4d(data: LVecBase4d)
Sets the write row to a particular 4-component value, and advances the write row.
It is an error for the write row to advance past the end of data.
- set_data4d(x: float, y: float, z: float, w: float)
Sets the write row to a particular 4-component value, and advances the write row.
It is an error for the write row to advance past the end of data.
- set_data4f(data: LVecBase4f)
Sets the write row to a particular 4-component value, and advances the write row.
It is an error for the write row to advance past the end of data.
- set_data4f(x: float, y: float, z: float, w: float)
Sets the write row to a particular 4-component value, and advances the write row.
It is an error for the write row to advance past the end of data.
- set_data4i(data: LVecBase4i)
Sets the write row to a particular 4-component value, and advances the write row.
It is an error for the write row to advance past the end of data.
- set_data4i(a: int, b: int, c: int, d: int)
Sets the write row to a particular 4-component value, and advances the write row.
It is an error for the write row to advance past the end of data.
- set_matrix3(mat: LMatrix3)
Sets the write row to a 3-by-3 matrix, and advances the write row. This is a special method that can only be used on matrix columns.
It is an error for the write row to advance past the end of data.
- set_matrix3d(mat: LMatrix3d)
Sets the write row to a 3-by-3 matrix, and advances the write row. This is a special method that can only be used on matrix columns.
It is an error for the write row to advance past the end of data.
- set_matrix3f(mat: LMatrix3f)
Sets the write row to a 3-by-3 matrix, and advances the write row. This is a special method that can only be used on matrix columns.
It is an error for the write row to advance past the end of data.
- set_matrix4(mat: LMatrix4)
Sets the write row to a 4-by-4 matrix, and advances the write row. This is a special method that can only be used on matrix columns.
It is an error for the write row to advance past the end of data.
- set_matrix4d(mat: LMatrix4d)
Sets the write row to a 4-by-4 matrix, and advances the write row. This is a special method that can only be used on matrix columns.
It is an error for the write row to advance past the end of data.
- set_matrix4f(mat: LMatrix4f)
Sets the write row to a 4-by-4 matrix, and advances the write row. This is a special method that can only be used on matrix columns.
It is an error for the write row to advance past the end of data.
- set_row(row: int)
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.
- set_row_unsafe(row: int)
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.