27 _current_thread(current_thread)
40 _vertex_data(vertex_data),
41 _current_thread(current_thread)
56 _vertex_data(vertex_data),
57 _current_thread(current_thread)
72 _array_data(array_data),
73 _current_thread(current_thread)
87 _array_data(array_data),
88 _current_thread(current_thread)
103 const InternalName *name) :
104 _vertex_data(data_writer->get_object()),
105 _current_thread(data_writer->get_current_thread())
108 const GeomVertexFormat *format = data_writer->get_format();
109 set_vertex_column(format->get_array_with(name),
110 format->get_column(name),
121 _vertex_data(copy._vertex_data),
123 _array_data(copy._array_data),
124 _current_thread(copy._current_thread),
125 _packer(copy._packer),
126 _stride(copy._stride),
127 _handle(copy._handle),
128 _pointer_begin(copy._pointer_begin),
129 _pointer_end(copy._pointer_end),
130 _pointer(copy._pointer),
131 _start_row(copy._start_row)
140 INLINE
void GeomVertexWriter::
142 _vertex_data = copy._vertex_data;
143 _array = copy._array;
144 _array_data = copy._array_data;
145 _current_thread = copy._current_thread;
146 _packer = copy._packer;
147 _stride = copy._stride;
148 _handle = copy._handle;
149 _pointer_begin = copy._pointer_begin;
150 _pointer_end = copy._pointer_end;
151 _pointer = copy._pointer;
152 _start_row = copy._start_row;
160 INLINE GeomVertexWriter::
161 ~GeomVertexWriter() {
222 return _current_thread;
242 writer.check_array_writers();
243 const GeomVertexFormat *format = writer.get_format();
244 return set_vertex_column(format->get_array_with(column),
245 format->get_column(column),
249 return set_array_column(_array_data->get_array_format()->get_column(column));
271 writer.check_array_writers();
272 const GeomVertexFormat *format = writer.get_format();
273 return set_vertex_column(format->get_array_with(name),
274 format->get_column(name),
278 return set_array_column(_array_data->get_array_format()->get_column(name));
302 return (_packer != (GeomVertexColumn::Packer *)NULL);
324 if (_packer != (GeomVertexColumn::Packer *)NULL) {
325 return _packer->_column;
345 quick_set_pointer(_start_row);
362 set_pointer(_start_row);
387 return (
int)(_pointer - _pointer_begin) / _stride;
401 return _pointer >= _pointer_end;
416 _packer->set_data1f(inc_pointer(), data);
445 _packer->set_data2f(inc_pointer(), data);
474 _packer->set_data3f(inc_pointer(), data);
503 _packer->set_data4f(inc_pointer(), data);
519 _packer->_column->get_contents() == C_matrix &&
520 _packer->_column->get_num_elements() == 3);
522 size_t col_stride = _packer->_column->get_element_stride();
523 unsigned char *pointer = inc_pointer();
525 _packer->set_data3f(pointer, mat.
get_row(0));
526 pointer += col_stride;
527 _packer->set_data3f(pointer, mat.
get_row(1));
528 pointer += col_stride;
529 _packer->set_data3f(pointer, mat.
get_row(2));
545 _packer->_column->get_contents() == C_matrix &&
546 _packer->_column->get_num_elements() == 4);
548 size_t col_stride = _packer->_column->get_element_stride();
549 unsigned char *pointer = inc_pointer();
551 _packer->set_data4f(pointer, mat.
get_row(0));
552 pointer += col_stride;
553 _packer->set_data4f(pointer, mat.
get_row(1));
554 pointer += col_stride;
555 _packer->set_data4f(pointer, mat.
get_row(2));
556 pointer += col_stride;
557 _packer->set_data4f(pointer, mat.
get_row(3));
572 _packer->set_data1d(inc_pointer(), data);
601 _packer->set_data2d(inc_pointer(), data);
630 _packer->set_data3d(inc_pointer(), data);
659 _packer->set_data4d(inc_pointer(), data);
675 _packer->_column->get_contents() == C_matrix &&
676 _packer->_column->get_num_elements() == 3);
678 size_t col_stride = _packer->_column->get_element_stride();
679 unsigned char *pointer = inc_pointer();
681 _packer->set_data3d(pointer, mat.
get_row(0));
682 pointer += col_stride;
683 _packer->set_data3d(pointer, mat.
get_row(1));
684 pointer += col_stride;
685 _packer->set_data3d(pointer, mat.
get_row(2));
701 _packer->_column->get_contents() == C_matrix &&
702 _packer->_column->get_num_elements() == 4);
704 size_t col_stride = _packer->_column->get_element_stride();
705 unsigned char *pointer = inc_pointer();
707 _packer->set_data4d(pointer, mat.
get_row(0));
708 pointer += col_stride;
709 _packer->set_data4d(pointer, mat.
get_row(1));
710 pointer += col_stride;
711 _packer->set_data4d(pointer, mat.
get_row(2));
712 pointer += col_stride;
713 _packer->set_data4d(pointer, mat.
get_row(3));
727 #ifndef STDFLOAT_DOUBLE
745 #ifndef STDFLOAT_DOUBLE
763 #ifndef STDFLOAT_DOUBLE
780 set_data3(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z) {
781 #ifndef STDFLOAT_DOUBLE
799 #ifndef STDFLOAT_DOUBLE
816 set_data4(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z, PN_stdfloat w) {
817 #ifndef STDFLOAT_DOUBLE
835 #ifndef STDFLOAT_DOUBLE
854 #ifndef STDFLOAT_DOUBLE
873 #ifndef STDFLOAT_DOUBLE
892 _packer->set_data1i(inc_pointer(), data);
935 _packer->set_data2i(inc_pointer(), data);
978 _packer->set_data3i(inc_pointer(), data);
1021 _packer->set_data4i(inc_pointer(), data);
1036 _packer->set_data1f(inc_add_pointer(), data);
1065 _packer->set_data2f(inc_add_pointer(), data);
1094 _packer->set_data3f(inc_add_pointer(), data);
1123 _packer->set_data4f(inc_add_pointer(), data);
1139 _packer->_column->get_contents() == C_matrix &&
1140 _packer->_column->get_num_elements() == 3);
1142 size_t col_stride = _packer->_column->get_element_stride();
1143 unsigned char *pointer = inc_add_pointer();
1145 _packer->set_data3f(pointer, mat.
get_row(0));
1146 pointer += col_stride;
1147 _packer->set_data3f(pointer, mat.
get_row(1));
1148 pointer += col_stride;
1149 _packer->set_data3f(pointer, mat.
get_row(2));
1165 _packer->_column->get_contents() == C_matrix &&
1166 _packer->_column->get_num_elements() == 4);
1168 size_t col_stride = _packer->_column->get_element_stride();
1169 unsigned char *pointer = inc_add_pointer();
1171 _packer->set_data4f(pointer, mat.
get_row(0));
1172 pointer += col_stride;
1173 _packer->set_data4f(pointer, mat.
get_row(1));
1174 pointer += col_stride;
1175 _packer->set_data4f(pointer, mat.
get_row(2));
1176 pointer += col_stride;
1177 _packer->set_data4f(pointer, mat.
get_row(3));
1192 _packer->set_data1d(inc_add_pointer(), data);
1221 _packer->set_data2d(inc_add_pointer(), data);
1250 _packer->set_data3d(inc_add_pointer(), data);
1279 _packer->set_data4d(inc_add_pointer(), data);
1295 _packer->_column->get_contents() == C_matrix &&
1296 _packer->_column->get_num_elements() == 3);
1298 size_t col_stride = _packer->_column->get_element_stride();
1299 unsigned char *pointer = inc_add_pointer();
1301 _packer->set_data3d(pointer, mat.
get_row(0));
1302 pointer += col_stride;
1303 _packer->set_data3d(pointer, mat.
get_row(1));
1304 pointer += col_stride;
1305 _packer->set_data3d(pointer, mat.
get_row(2));
1321 _packer->_column->get_contents() == C_matrix &&
1322 _packer->_column->get_num_elements() == 4);
1324 size_t col_stride = _packer->_column->get_element_stride();
1325 unsigned char *pointer = inc_add_pointer();
1327 _packer->set_data4d(pointer, mat.
get_row(0));
1328 pointer += col_stride;
1329 _packer->set_data4d(pointer, mat.
get_row(1));
1330 pointer += col_stride;
1331 _packer->set_data4d(pointer, mat.
get_row(2));
1332 pointer += col_stride;
1333 _packer->set_data4d(pointer, mat.
get_row(3));
1347 #ifndef STDFLOAT_DOUBLE
1365 #ifndef STDFLOAT_DOUBLE
1383 #ifndef STDFLOAT_DOUBLE
1401 #ifndef STDFLOAT_DOUBLE
1419 #ifndef STDFLOAT_DOUBLE
1436 add_data4(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z, PN_stdfloat w) {
1437 #ifndef STDFLOAT_DOUBLE
1455 #ifndef STDFLOAT_DOUBLE
1474 #ifndef STDFLOAT_DOUBLE
1493 #ifndef STDFLOAT_DOUBLE
1512 _packer->set_data1i(inc_add_pointer(), data);
1555 _packer->set_data2i(inc_add_pointer(), data);
1598 _packer->set_data3i(inc_add_pointer(), data);
1641 _packer->set_data4i(inc_add_pointer(), data);
1649 INLINE GeomVertexColumn::Packer *GeomVertexWriter::
1650 get_packer()
const {
1661 INLINE
void GeomVertexWriter::
1662 set_pointer(
int row) {
1663 _pointer_begin = _handle->get_write_pointer();
1664 _pointer_end = _pointer_begin + _handle->get_data_size_bytes();
1665 quick_set_pointer(row);
1675 INLINE
void GeomVertexWriter::
1676 quick_set_pointer(
int row) {
1681 nassertv(_pointer_begin == _handle->get_write_pointer());
1684 _pointer = _pointer_begin + _packer->_column->get_start() + _stride * row;
1689 nassertv(_pointer_begin == _pointer_end || (_pointer - _packer->_column->get_start()) <= _pointer_end);
1699 INLINE
unsigned char *GeomVertexWriter::
1702 nassertr(_pointer < _pointer_end, empty_buffer);
1704 nassertr(_pointer_begin == _handle->get_write_pointer(), empty_buffer);
1705 nassertr(_pointer < _pointer_begin + _handle->get_data_size_bytes(), empty_buffer);
1708 unsigned char *orig_pointer = _pointer;
1709 _pointer += _stride;
1710 return orig_pointer;
1721 INLINE
unsigned char *GeomVertexWriter::
1723 if (_pointer >= _pointer_end) {
1732 writer.check_array_writers();
1733 writer.set_num_rows(max(write_row + 1, writer.get_num_rows()));
1734 _handle = writer.get_array_writer(_array);
1739 _handle->set_num_rows(max(write_row + 1, _handle->get_num_rows()));
1742 set_pointer(write_row);
1744 return inc_pointer();
void add_data4f(float x, float y, float z, float w)
Sets the write row to a particular 4-component value, and advances the write row. ...
void add_data1d(double data)
Sets the write row to a particular 1-component value, and advances the write row. ...
This object provides a high-level interface for quickly writing a sequence of numeric values from a v...
void set_matrix3f(const LMatrix3f &mat)
Sets the write row to a 3-by-3 matrix, and advances the write row.
void set_data2i(int a, int b)
Sets the write row to a particular 2-component value, and advances the write row. ...
This is the base class for all three-component vectors and points.
void set_matrix4f(const LMatrix4f &mat)
Sets the write row to a 4-by-4 matrix, and advances the write row.
This is a const pointer to an InternalName, and should be used in lieu of a CPT(InternalName) in func...
void add_data2i(int a, int b)
Sets the write row to a particular 2-component value, and advances the write row. ...
This is a 4-by-4 transform matrix.
LVecBase4f get_row(int row) const
Retrieves the indicated row of the matrix as a 4-component vector.
void set_data3i(int a, int b, int c)
Sets the write row to a particular 3-component value, and advances the write row. ...
GeomVertexArrayDataHandle * get_array_handle() const
Returns the write handle to the array object that the writer is currently processing.
void add_data1i(int data)
Sets the write row to a particular 1-component value, and advances the write row. ...
void set_data3(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z)
Sets the write row to a particular 3-component value, and advances the write row. ...
void add_data2f(float x, float y)
Sets the write row to a particular 2-component value, and advances the write row. ...
void set_data4i(int a, int b, int c, int d)
Sets the write row to a particular 4-component value, and advances the write row. ...
This is the base class for all two-component vectors and points.
void clear()
Resets the GeomVertexWriter to the initial state.
int get_write_row() const
Returns the row index to which the data will be written at the next call to set_data*() or add_data*(...
void add_data2(PN_stdfloat x, PN_stdfloat y)
Sets the write row to a particular 2-component value, and advances the write row. ...
This is the base class for all two-component vectors and points.
LVecBase4d get_row(int row) const
Retrieves the indicated row of the matrix as a 4-component vector.
This is the base class for all three-component vectors and points.
void set_data1i(int data)
Sets the write row to a particular 1-component value, and advances the write row. ...
void set_matrix3(const LMatrix3 &mat)
Sets the write row to a 3-by-3 matrix, and advances the write row.
void add_data3i(int a, int b, int c)
Sets the write row to a particular 3-component value, and advances the write row. ...
This data object is returned by GeomVertexArrayData::get_handle() or modify_handle().
void add_data4(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z, PN_stdfloat w)
Sets the write row to a particular 4-component value, and advances the write row. ...
This is the base class for all three-component vectors and points.
void set_data2d(double x, double y)
Sets the write row to a particular 2-component value, and advances the write row. ...
Encapsulates the data from a GeomVertexData, pre-fetched for one stage of the pipeline.
This defines how a single column is interleaved within a vertex array stored within a Geom...
void add_data2d(double x, double y)
Sets the write row to a particular 2-component value, and advances the write row. ...
void set_data2(PN_stdfloat x, PN_stdfloat y)
Sets the write row to a particular 2-component value, and advances the write row. ...
void add_data1f(float data)
Sets the write row to a particular 1-component value, and advances the write row. ...
void set_data3f(float x, float y, float z)
Sets the write row to a particular 3-component value, and advances the write row. ...
void set_data3d(double x, double y, double z)
Sets the write row to a particular 3-component value, and advances the write row. ...
This is a 3-by-3 transform matrix.
void set_data1f(float data)
Sets the write row to a particular 1-component value, and advances the write row. ...
void set_data4d(double x, double y, double z, double w)
Sets the write row to a particular 4-component value, and advances the write row. ...
void add_data4d(double x, double y, double z, double w)
Sets the write row to a particular 4-component value, and advances the write row. ...
void set_data4f(float x, float y, float z, float w)
Sets the write row to a particular 4-component value, and advances the write row. ...
This is a 4-by-4 transform matrix.
This defines the actual numeric vertex data stored in a Geom, in the structure defined by a particula...
GeomVertexArrayData * get_array_data() const
Returns the particular array object that the writer is currently processing.
void set_data1(PN_stdfloat data)
Sets the write row to a particular 1-component value, and advances the write row. ...
int get_start_row() const
Returns the row index at which the writer started.
bool has_column() const
Returns true if a valid data type has been successfully set, or false if the data type does not exist...
void add_data3(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z)
Sets the write row to a particular 3-component value, and advances the write row. ...
void set_data4(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z, PN_stdfloat w)
Sets the write row to a particular 4-component value, and advances the write row. ...
This is the base class for all two-component vectors and points.
This is the base class for all three-component vectors and points.
void add_matrix4(const LMatrix4 &mat)
Sets the write row to a 4-by-4 matrix, and advances the write row.
void add_data3d(double x, double y, double z)
Sets the write row to a particular 3-component value, and advances the write row. ...
void add_matrix4f(const LMatrix4f &mat)
Sets the write row to a 4-by-4 matrix, and advances the write row.
void add_data3f(float x, float y, float z)
Sets the write row to a particular 3-component value, and advances the write row. ...
const GeomVertexColumn * get_column() const
Returns the description of the data type that the writer is working on.
void add_matrix3(const LMatrix3 &mat)
Sets the write row to a 3-by-3 matrix, and advances the write row.
This is the base class for all three-component vectors and points.
LVecBase3d get_row(int row) const
Returns the indicated row of the matrix as a three-component vector.
This is the base class for all three-component vectors and points.
Thread * get_current_thread() const
Returns the Thread pointer of the currently-executing thread, as passed to the constructor of this ob...
void add_data1(PN_stdfloat data)
Sets the write row to a particular 1-component value, and advances the write row. ...
size_t get_stride() const
Returns the per-row stride (bytes between consecutive rows) of the underlying vertex array...
void add_matrix3d(const LMatrix3d &mat)
Sets the write row to a 3-by-3 matrix, and advances the write row.
void set_matrix3d(const LMatrix3d &mat)
Sets the write row to a 3-by-3 matrix, and advances the write row.
A thread; that is, a lightweight process.
void set_matrix4(const LMatrix4 &mat)
Sets the write row to a 4-by-4 matrix, and advances the write row.
void set_matrix4d(const LMatrix4d &mat)
Sets the write row to a 4-by-4 matrix, and advances the write row.
void set_data2f(float x, float y)
Sets the write row to a particular 2-component value, and advances the write row. ...
void add_matrix3f(const LMatrix3f &mat)
Sets the write row to a 3-by-3 matrix, and advances the write row.
bool set_column(int column)
Sets up the writer to use the nth data type of the GeomVertexFormat, numbering from 0...
void set_row(int row)
Sets the start row to the indicated value.
int get_array() const
Returns the array index containing the data type that the writer is working on.
LVecBase3f get_row(int row) const
Returns the indicated row of the matrix as a three-component vector.
GeomVertexData * get_vertex_data() const
Returns the vertex data object that the writer is processing.
This is a 3-by-3 transform matrix.
void add_matrix4d(const LMatrix4d &mat)
Sets the write row to a 4-by-4 matrix, and advances the write row.
void set_data1d(double data)
Sets the write row to a particular 1-component value, and advances the write row. ...
GeomVertexWriter(Thread *current_thread=Thread::get_current_thread())
Constructs an invalid GeomVertexWriter.
This is the data for one array of a GeomVertexData structure.
void set_row_unsafe(int row)
Sets the start row to the indicated value, without internal checks.
void add_data4i(int a, int b, int c, int d)
Sets the write row to a particular 4-component value, and advances the write row. ...
bool is_at_end() const
Returns true if the writer is currently at the end of the list of vertices, false otherwise...