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 setRow() 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 calling setColumn() 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 a GeomVertexRewriter if you are going to create both of them anyway.

Inheritance diagram

Inheritance diagram of 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__(copy: GeomVertexWriter)
__init__(current_thread: Thread)

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

addData1(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.

addData1d(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.

addData1f(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.

addData1i(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.

addData2(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.

addData2(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.

addData2d(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.

addData2d(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.

addData2f(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.

addData2f(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.

addData2i(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.

addData2i(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.

addData3(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.

addData3(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.

addData3d(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.

addData3d(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.

addData3f(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.

addData3f(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.

addData3i(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.

addData3i(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.

addData4(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.

addData4(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.

addData4d(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.

addData4d(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.

addData4f(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.

addData4f(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.

addData4i(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.

addData4i(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.

addMatrix3(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.

addMatrix3d(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.

addMatrix3f(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.

addMatrix4(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.

addMatrix4d(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.

addMatrix4f(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.

getArray() int

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

getArrayData() GeomVertexArrayData

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

getArrayHandle() 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.

getColumn() GeomVertexColumn

Returns the description of the data type that the writer 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 writer 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 GeomVertexWriter directly.

getVertexData() 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.

getWriteRow() int

Returns the row index to which the data will be written at the next call to set_data*() or add_data*().

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

output(out: ostream)
reserveNumRows(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.

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

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

setData1(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.

setData1d(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.

setData1f(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.

setData1i(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.

setData2(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.

setData2(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.

setData2d(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.

setData2d(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.

setData2f(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.

setData2f(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.

setData2i(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.

setData2i(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.

setData3(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.

setData3(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.

setData3d(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.

setData3d(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.

setData3f(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.

setData3f(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.

setData3i(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.

setData3i(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.

setData4(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.

setData4(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.

setData4d(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.

setData4d(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.

setData4f(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.

setData4f(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.

setData4i(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.

setData4i(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.

setMatrix3(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.

setMatrix3d(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.

setMatrix3f(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.

setMatrix4(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.

setMatrix4d(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.

setMatrix4f(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.

setRow(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 setColumn() is called, the writer will return to this 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.