45 return cdata->_usage_hint;
57 return cdata->_format;
70 return cdata->_format->has_column(name);
83 reader.check_array_readers();
84 return reader.get_num_rows();
113 writer.check_array_writers();
114 return writer.set_num_rows(n);
137 writer.check_array_writers();
138 return writer.unclean_set_num_rows(n);
158 writer.check_array_writers();
159 return writer.reserve_num_rows(n);
172 return cdata->_arrays.size();
183 get_array(
int i)
const {
184 CDReader cdata(_cycler);
185 nassertr(i >= 0 && i < (
int)cdata->_arrays.size(), NULL);
186 return cdata->_arrays[i].get_read_pointer();
204 modify_array(
int i) {
206 return writer.modify_array(i);
224 writer.set_array(i, array);
246 return cdata->_transform_table;
276 get_transform_blend_table()
const {
277 CDReader cdata(_cycler);
278 return cdata->_transform_blend_table.get_read_pointer();
307 return cdata->_slider_table;
331 return reader.get_num_bytes();
343 CDReader cdata(_cycler, current_thread);
344 return cdata->_modified;
355 unsigned int c,
unsigned int d) {
356 return (((a & 0xff) << 24) |
370 return (data >> 24) & 0xff;
381 return (data >> 16) & 0xff;
392 return (data >> 8) & 0xff;
412 INLINE
int GeomVertexData::
414 TransformMap &already_added) {
415 pair<TransformMap::iterator, bool> result = already_added.insert(TransformMap::value_type(transform, table->
get_num_transforms()));
421 return (*(result.first)).second;
429 INLINE GeomVertexData::CDataCache::
438 INLINE GeomVertexData::CDataCache::
439 CDataCache(
const GeomVertexData::CDataCache ©) :
440 _result(copy._result)
449 INLINE GeomVertexData::CacheKey::
450 CacheKey(
const GeomVertexFormat *modifier) :
460 INLINE GeomVertexData::CacheKey::
461 CacheKey(
const CacheKey ©) :
462 _modifier(copy._modifier)
466 #ifdef USE_MOVE_SEMANTICS
472 INLINE GeomVertexData::CacheKey::
473 CacheKey(CacheKey &&from) NOEXCEPT :
474 _modifier(move(from._modifier))
477 #endif // USE_MOVE_SEMANTICS
486 return _modifier < other._modifier;
494 INLINE GeomVertexData::CacheEntry::
495 CacheEntry(
GeomVertexData *source,
const GeomVertexFormat *modifier) :
506 INLINE GeomVertexData::CacheEntry::
513 #ifdef USE_MOVE_SEMANTICS
519 INLINE GeomVertexData::CacheEntry::
525 #endif // USE_MOVE_SEMANTICS
532 INLINE GeomVertexData::CData::
534 _usage_hint(UH_unspecified)
543 INLINE GeomVertexData::CData::
544 CData(
const GeomVertexData::CData ©) :
545 _usage_hint(copy._usage_hint),
546 _format(copy._format),
547 _arrays(copy._arrays),
548 _transform_table(copy._transform_table),
549 _transform_blend_table(copy._transform_blend_table),
550 _slider_table(copy._slider_table),
551 _animated_vertices(copy._animated_vertices),
552 _animated_vertices_modified(copy._animated_vertices_modified),
553 _modified(copy._modified)
562 INLINE GeomVertexDataPipelineBase::
565 GeomVertexData::CData *cdata) :
567 _current_thread(current_thread),
571 nassertv(_object->test_ref_count_nonzero());
575 #endif // DO_PIPELINING
583 INLINE GeomVertexDataPipelineBase::
584 ~GeomVertexDataPipelineBase() {
586 nassertv(_object->test_ref_count_nonzero());
591 #endif // DO_PIPELINING
604 INLINE
Thread *GeomVertexDataPipelineBase::
605 get_current_thread()
const {
606 return _current_thread;
614 INLINE GeomVertexDataPipelineBase::UsageHint GeomVertexDataPipelineBase::
615 get_usage_hint()
const {
616 return _cdata->_usage_hint;
624 INLINE
const GeomVertexFormat *GeomVertexDataPipelineBase::
626 return _cdata->_format;
634 INLINE
bool GeomVertexDataPipelineBase::
635 has_column(
const InternalName *name)
const {
636 return _cdata->_format->has_column(name);
644 INLINE
int GeomVertexDataPipelineBase::
645 get_num_arrays()
const {
646 return _cdata->_arrays.size();
655 get_array(
int i)
const {
656 nassertr(i >= 0 && i < (
int)_cdata->_arrays.size(), NULL);
657 return _cdata->_arrays[i].get_read_pointer();
666 get_transform_table()
const {
667 return _cdata->_transform_table;
676 get_transform_blend_table()
const {
677 return _cdata->_transform_blend_table.get_read_pointer();
685 INLINE
const SliderTable *GeomVertexDataPipelineBase::
686 get_slider_table()
const {
687 return _cdata->_slider_table;
695 INLINE
UpdateSeq GeomVertexDataPipelineBase::
696 get_modified()
const {
697 return _cdata->_modified;
705 INLINE GeomVertexDataPipelineReader::
709 (
GeomVertexData::CData *)object->_cycler.read_unlocked(current_thread)),
710 _got_array_readers(false)
719 INLINE GeomVertexDataPipelineReader::
731 INLINE
void GeomVertexDataPipelineReader::
741 INLINE GeomVertexDataPipelineReader::
742 ~GeomVertexDataPipelineReader() {
743 if (_got_array_readers) {
744 delete_array_readers();
764 INLINE
void GeomVertexDataPipelineReader::
765 check_array_readers()
const {
766 if (!_got_array_readers) {
777 get_array_reader(
int i)
const {
778 nassertr(_got_array_readers, NULL);
779 nassertr(i >= 0 && i < (
int)_array_readers.size(), NULL);
780 return _array_readers[i];
788 INLINE
bool GeomVertexDataPipelineReader::
798 INLINE
bool GeomVertexDataPipelineReader::
799 is_vertex_transformed()
const {
813 INLINE
bool GeomVertexDataPipelineReader::
823 INLINE
bool GeomVertexDataPipelineReader::
833 INLINE GeomVertexDataPipelineWriter::
834 GeomVertexDataPipelineWriter(
GeomVertexData *
object,
bool force_to_0,
837 object->_cycler.write_upstream(force_to_0, current_thread)),
838 _force_to_0(force_to_0),
839 _got_array_writers(false)
842 nassertv(_object->test_ref_count_nonzero());
844 nassertv(_cdata->test_ref_count_nonzero());
845 #endif // DO_PIPELINING
854 INLINE GeomVertexDataPipelineWriter::
866 INLINE
void GeomVertexDataPipelineWriter::
876 INLINE GeomVertexDataPipelineWriter::
877 ~GeomVertexDataPipelineWriter() {
878 if (_got_array_writers) {
879 delete_array_writers();
881 _object->_cycler.release_write(_cdata);
899 INLINE
void GeomVertexDataPipelineWriter::
900 check_array_writers()
const {
901 if (!_got_array_writers) {
912 get_array_writer(
int i)
const {
913 nassertr(_got_array_writers, NULL);
914 nassertr(i >= 0 && i < (
int)_array_writers.size(), NULL);
915 return _array_writers[i];
The common code from GeomVertexDataPipelineReader and GeomVertexDataPipelineWriter.
bool has_column(const InternalName *name) const
Returns true if the data has the named column, false otherwise.
bool unclean_set_num_rows(int n)
This method behaves like set_num_rows(), except the new data is not initialized.
void set_transform_table(const TransformTable *table)
Replaces the TransformTable on this vertex data with the indicated table.
static PN_uint32 pack_abcd(unsigned int a, unsigned int b, unsigned int c, unsigned int d)
Packs four values in a DirectX-style NT_packed_abcd value.
const TransformTable * get_transform_table() const
Returns a const pointer to the TransformTable assigned to this data.
UsageHint get_usage_hint() const
Returns the usage hint that was passed to the constructor, and which will be passed to each array dat...
A single page of data maintained by a PipelineCycler.
void set_array(int i, const GeomVertexArrayData *array)
Replaces the indicated vertex data array with a completely new array.
void set_slider_table(const SliderTable *table)
Replaces the SliderTable on this vertex data with the indicated table.
This data object is returned by GeomVertexArrayData::get_handle() or modify_handle().
const SliderTable * get_slider_table() const
Returns a const pointer to the SliderTable assigned to this data.
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...
static Thread * get_current_thread()
Returns a pointer to the currently-executing Thread object.
This template class calls PipelineCycler::read_unlocked(), and then provides a transparent read-only ...
const string & get_name() const
Returns the name passed to the constructor, if any.
void set_transform_blend_table(const TransformBlendTable *table)
Replaces the TransformBlendTable on this vertex data with the indicated table.
Stores the total set of VertexSliders that the vertices in a particular GeomVertexData object might d...
bool reserve_num_rows(int n)
This ensures that enough memory space for n rows is allocated, so that you may increase the number of...
void clear_transform_table()
Sets the TransformTable pointer to NULL, removing the table from the vertex data. ...
static unsigned int unpack_abcd_c(PN_uint32 data)
Returns the third packed value from a DirectX-style NT_packed_abcd.
This defines the actual numeric vertex data stored in a Geom, in the structure defined by a particula...
const GeomVertexFormat * get_format() const
Returns a pointer to the GeomVertexFormat structure that defines this data.
bool operator<(const CacheKey &other) const
Provides a unique ordering within the set.
UpdateSeq get_modified(Thread *current_thread=Thread::get_current_thread()) const
Returns a sequence number which is guaranteed to change at least every time the vertex data is modifi...
bool set_num_rows(int n)
Sets the length of the array to n rows in all of the various arrays (presumably by adding rows)...
int get_num_arrays() const
Returns the number of individual arrays stored within the data.
void clear_slider_table()
Sets the SliderTable pointer to NULL, removing the table from the vertex data.
int get_num_bytes() const
Returns the total number of bytes consumed by the different arrays of the vertex data.
A thread; that is, a lightweight process.
static unsigned int unpack_abcd_d(PN_uint32 data)
Returns the fourth packed value from a DirectX-style NT_packed_abcd.
Contents get_contents() const
Returns the token representing the semantic meaning of the stored value.
static unsigned int unpack_abcd_b(PN_uint32 data)
Returns the second packed value from a DirectX-style NT_packed_abcd.
Encapsulates the data from a GeomVertexData, pre-fetched for one stage of the pipeline.
static unsigned int unpack_abcd_a(PN_uint32 data)
Returns the first packed value from a DirectX-style NT_packed_abcd.
This is a sequence number that increments monotonically.
void clear_transform_blend_table()
Sets the TransformBlendTable pointer to NULL, removing the table from the vertex data.
This is the data for one array of a GeomVertexData structure.
int get_num_rows() const
Returns the number of rows stored within all the arrays.