21 _vertex_data(nullptr),
22 _current_thread(current_thread)
34 _vertex_data(vertex_data),
35 _current_thread(current_thread)
49 _vertex_data(vertex_data),
50 _current_thread(current_thread)
63 _array_data(array_data),
64 _current_thread(current_thread)
76 _array_data(array_data),
77 _current_thread(current_thread)
91 _vertex_data(data_reader->get_object()),
92 _current_thread(data_reader->get_current_thread())
107 _vertex_data(copy._vertex_data),
109 _array_data(copy._array_data),
110 _current_thread(copy._current_thread),
111 _packer(copy._packer),
112 _stride(copy._stride),
113 _handle(copy._handle),
114 _pointer_begin(copy._pointer_begin),
115 _pointer_end(copy._pointer_end),
116 _pointer(copy._pointer),
117 _start_row(copy._start_row),
125 INLINE
void GeomVertexReader::
127 _vertex_data = copy._vertex_data;
128 _array = copy._array;
129 _array_data = copy._array_data;
130 _current_thread = copy._current_thread;
131 _packer = copy._packer;
132 _stride = copy._stride;
133 _handle = copy._handle;
134 _pointer_begin = copy._pointer_begin;
135 _pointer_end = copy._pointer_end;
136 _pointer = copy._pointer;
137 _start_row = copy._start_row;
138 _force = copy._force;
144 INLINE GeomVertexReader::
145 ~GeomVertexReader() {
191 return _current_thread;
230 if (_vertex_data !=
nullptr) {
232 reader.check_array_readers();
238 if (_array_data !=
nullptr) {
239 return set_array_column(_array_data->get_array_format()->get_column(column));
255 if (_vertex_data !=
nullptr) {
257 reader.check_array_readers();
263 if (_array_data !=
nullptr) {
264 return set_array_column(_array_data->get_array_format()->get_column(name));
285 return (_packer !=
nullptr);
302 if (_packer !=
nullptr) {
303 return _packer->_column;
319 quick_set_pointer(_start_row);
333 bool result = set_pointer(_start_row);
353 return (
int)(_pointer - _pointer_begin) / _stride;
363 return _pointer >= _pointer_end;
373 return _packer->get_data1f(inc_pointer());
383 return _packer->get_data2f(inc_pointer());
393 return _packer->get_data3f(inc_pointer());
403 return _packer->get_data4f(inc_pointer());
414 _packer->_column->get_contents() == C_matrix &&
415 _packer->_column->get_num_elements() >= 3,
416 LMatrix3f::ident_mat());
418 size_t col_stride = _packer->_column->get_element_stride();
419 const unsigned char *pointer = inc_pointer();
422 mat.set_row(0, _packer->get_data3f(pointer));
423 pointer += col_stride;
424 mat.set_row(1, _packer->get_data3f(pointer));
425 pointer += col_stride;
426 mat.set_row(2, _packer->get_data3f(pointer));
438 _packer->_column->get_contents() == C_matrix &&
439 _packer->_column->get_num_elements() >= 4,
440 LMatrix4f::ident_mat());
442 size_t col_stride = _packer->_column->get_element_stride();
443 const unsigned char *pointer = inc_pointer();
446 mat.set_row(0, _packer->get_data4f(pointer));
447 pointer += col_stride;
448 mat.set_row(1, _packer->get_data4f(pointer));
449 pointer += col_stride;
450 mat.set_row(2, _packer->get_data4f(pointer));
451 pointer += col_stride;
452 mat.set_row(3, _packer->get_data4f(pointer));
463 return _packer->get_data1d(inc_pointer());
473 return _packer->get_data2d(inc_pointer());
483 return _packer->get_data3d(inc_pointer());
493 return _packer->get_data4d(inc_pointer());
504 _packer->_column->get_contents() == C_matrix &&
505 _packer->_column->get_num_elements() >= 3,
506 LMatrix3d::ident_mat());
508 size_t col_stride = _packer->_column->get_element_stride();
509 const unsigned char *pointer = inc_pointer();
512 mat.set_row(0, _packer->get_data3d(pointer));
513 pointer += col_stride;
514 mat.set_row(1, _packer->get_data3d(pointer));
515 pointer += col_stride;
516 mat.set_row(2, _packer->get_data3d(pointer));
528 _packer->_column->get_contents() == C_matrix &&
529 _packer->_column->get_num_elements() >= 4,
530 LMatrix4d::ident_mat());
532 size_t col_stride = _packer->_column->get_element_stride();
533 const unsigned char *pointer = inc_pointer();
536 mat.set_row(0, _packer->get_data4d(pointer));
537 pointer += col_stride;
538 mat.set_row(1, _packer->get_data4d(pointer));
539 pointer += col_stride;
540 mat.set_row(2, _packer->get_data4d(pointer));
541 pointer += col_stride;
542 mat.set_row(3, _packer->get_data4d(pointer));
552 #ifndef STDFLOAT_DOUBLE 565 #ifndef STDFLOAT_DOUBLE 578 #ifndef STDFLOAT_DOUBLE 591 #ifndef STDFLOAT_DOUBLE 605 #ifndef STDFLOAT_DOUBLE 619 #ifndef STDFLOAT_DOUBLE 633 return _packer->get_data1i(inc_pointer());
643 return _packer->get_data2i(inc_pointer());
653 return _packer->get_data3i(inc_pointer());
663 return _packer->get_data4i(inc_pointer());
669 INLINE GeomVertexColumn::Packer *GeomVertexReader::
683 INLINE
bool GeomVertexReader::
684 set_pointer(
int row) {
685 _pointer_begin = _handle->get_read_pointer(_force);
686 if (_pointer_begin ==
nullptr && _handle->get_data_size_bytes() != 0) {
693 _pointer_end = _pointer_begin + _handle->get_data_size_bytes();
694 quick_set_pointer(row);
702 INLINE
void GeomVertexReader::
703 quick_set_pointer(
int row) {
704 nassertv(
has_column() && (_pointer_begin !=
nullptr || row == 0));
708 nassertv(_pointer_begin == _handle->get_read_pointer(
true));
711 _pointer = _pointer_begin + _packer->_column->get_start() + _stride * row;
717 nassertv(_pointer_begin == _pointer_end || (_pointer - _packer->_column->get_start()) <= _pointer_end);
725 INLINE
const unsigned char *GeomVertexReader::
728 nassertr(_pointer < _pointer_end, empty_buffer);
730 nassertr(_pointer_begin == _handle->get_read_pointer(
true), empty_buffer);
731 nassertr(_pointer < _pointer_begin + _handle->get_data_size_bytes(), empty_buffer);
734 const unsigned char *orig_pointer = _pointer;
This is a const pointer to an InternalName, and should be used in lieu of a CPT(InternalName) in func...
const GeomVertexArrayData * get_array_data() const
Returns the particular array object that the reader is currently processing.
bool set_column(int column)
Sets up the reader to use the nth data type of the GeomVertexFormat, numbering from 0.
LMatrix3 get_matrix3()
Returns the 3-by-3 matrix associated with the read row and advances the read row.
double get_data1d()
Returns the data associated with the read row, expressed as a 1-component value, and advances the rea...
const LVecBase2 & get_data2()
Returns the data associated with the read row, expressed as a 2-component value, and advances the rea...
const GeomVertexColumn * get_column() const
Returns the description of the data type that the reader is working on.
const LVecBase3i & get_data3i()
Returns the data associated with the read row, expressed as a 3-component value, and advances the rea...
bool get_force() const
Returns the value of the force flag.
const LVecBase2d & get_data2d()
Returns the data associated with the read row, expressed as a 2-component value, and advances the rea...
const LVecBase4 & get_data4()
Returns the data associated with the read row, expressed as a 4-component value, and advances the rea...
const LVecBase3f & get_data3f()
Returns the data associated with the read row, expressed as a 3-component value, and advances the rea...
This data object is returned by GeomVertexArrayData::get_handle() or modify_handle().
LMatrix4d get_matrix4d()
Returns the 4-by-4 matrix associated with the read row and advances the read row.
size_t get_stride() const
Returns the per-row stride (bytes between consecutive rows) of the underlying vertex array.
const GeomVertexData * get_vertex_data() const
Returns the vertex data object that the reader is processing.
void set_force(bool force)
Sets the value of the force flag.
This defines how a single column is interleaved within a vertex array stored within a Geom.
const LVecBase4f & get_data4f()
Returns the data associated with the read row, expressed as a 4-component value, and advances the rea...
int get_read_row() const
Returns the row index from which the data will be retrieved by the next call to get_data*().
LMatrix3d get_matrix3d()
Returns the 3-by-3 matrix associated with the read row and advances the read row.
const LVecBase2i & get_data2i()
Returns the data associated with the read row, expressed as a 2-component value, and advances the rea...
bool has_column() const
Returns true if a valid data type has been successfully set, or false if the data type does not exist...
This defines the actual numeric vertex data stored in a Geom, in the structure defined by a particula...
Thread * get_current_thread() const
Returns the Thread pointer of the currently-executing thread, as passed to the constructor of this ob...
const GeomVertexArrayDataHandle * get_array_handle() const
Returns the read handle to the array object that the read is currently processing.
const LVecBase3 & get_data3()
Returns the data associated with the read row, expressed as a 3-component value, and advances the rea...
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 reader is working on.
int get_data1i()
Returns the data associated with the read row, expressed as a 1-component value, and advances the rea...
Encodes a string name in a hash table, mapping it to a pointer.
const LVecBase2f & get_data2f()
Returns the data associated with the read row, expressed as a 2-component value, and advances the rea...
A thread; that is, a lightweight process.
This object provides a high-level interface for quickly reading a sequence of numeric values from a v...
float get_data1f()
Returns the data associated with the read row, expressed as a 1-component value, and advances the rea...
bool is_at_end() const
Returns true if the reader is currently at the end of the list of vertices, false otherwise.
Encapsulates the data from a GeomVertexData, pre-fetched for one stage of the pipeline.
void set_row_unsafe(int row)
Sets the start row to the indicated value, without internal checks.
void clear()
Resets the GeomVertexReader to the initial state.
const LVecBase3d & get_data3d()
Returns the data associated with the read row, expressed as a 3-component value, and advances the rea...
int get_start_row() const
Returns the row index at which the reader started.
LMatrix4f get_matrix4f()
Returns the 4-by-4 matrix associated with the read row and advances the read row.
LMatrix4 get_matrix4()
Returns the 4-by-4 matrix associated with the read row and advances the read row.
const LVecBase4d & get_data4d()
Returns the data associated with the read row, expressed as a 4-component value, and advances the rea...
const LVecBase4i & get_data4i()
Returns the data associated with the read row, expressed as a 4-component value, and advances the rea...
This is the data for one array of a GeomVertexData structure.
PN_stdfloat get_data1()
Returns the data associated with the read row, expressed as a 1-component value, and advances the rea...
LMatrix3f get_matrix3f()
Returns the 3-by-3 matrix associated with the read row and advances the read row.
GeomVertexReader(Thread *current_thread=Thread::get_current_thread())
Constructs an invalid GeomVertexReader.