Panda3D

Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Friends | List of all members
GeomVertexData Class Reference

This defines the actual numeric vertex data stored in a Geom, in the structure defined by a particular GeomVertexFormat object. More...

`#include "geomVertexData.h"`

Inheritance diagram for GeomVertexData:

## Classes
class | CacheEntry
class | CacheKey

## Public Types
typedef pmap< const CacheKey *, PointerTo< CacheEntry >, IndirectLess< CacheKey > > | Cache
Public Types inherited from GeomEnums
enum | AnimationType { AT_none , AT_panda , AT_hardware }
enum | Contents { C_other , C_point , C_clip_point , C_vector , C_texcoord , C_color , C_index , C_morph_delta , C_matrix , C_normal }
enum | GeomRendering { GR_indexed_point = 0x00001 , GR_indexed_other = 0x10000 , GR_indexed_bits = 0x10001 , GR_point = 0x00002 , GR_point_uniform_size = 0x00004 , GR_per_point_size = 0x00008 , GR_point_perspective = 0x00010 , GR_point_aspect_ratio = 0x00020 , GR_point_scale = 0x00040 , GR_point_rotate = 0x00080 , GR_point_sprite = 0x00100 , GR_point_sprite_tex_matrix = 0x00200 , GR_point_bits = 0x003fe , GR_triangle_strip = 0x00400 , GR_triangle_fan = 0x00800 , GR_line_strip = 0x01000 , GR_composite_bits = 0x01c00 , GR_strip_cut_index = 0x20000 , GR_flat_first_vertex = 0x02000 , GR_flat_last_vertex = 0x04000 , GR_shade_model_bits = 0x06000 , GR_render_mode_wireframe = 0x40000 , GR_render_mode_point = 0x80000 , GR_adjacency = 0x100000 }
enum | NumericType { NT_uint8 , NT_uint16 , NT_uint32 , NT_packed_dcba , NT_packed_dabc , NT_float32 , NT_float64 , NT_stdfloat , NT_int8 , NT_int16 , NT_int32 , NT_packed_ufloat }
enum | PrimitiveType { PT_none , PT_polygons , PT_lines , PT_points , PT_patches }
enum | ShadeModel { SM_uniform , SM_smooth , SM_flat_first_vertex , SM_flat_last_vertex }
enum | UsageHint { UH_client , UH_stream , UH_dynamic , UH_static , UH_unspecified }

## Public Member Functions
| GeomVertexData (const GeomVertexData &copy)
| GeomVertexData (const GeomVertexData &copy, const GeomVertexFormat *format)
| This constructor copies all of the basic properties of the source VertexData, like usage_hint and animation tables, but does not copy the actual data, and it allows you to specify a different format.
| GeomVertexData (const std::string &name, const GeomVertexFormat *format, UsageHint usage_hint)
ConstPointerTo< GeomVertexData > | animate_vertices (bool force, Thread *current_thread) const
| Returns a GeomVertexData that represents the results of computing the vertex animation on the CPU for this GeomVertexData.
void | clear_animated_vertices ()
| Removes the cache of animated vertices computed by a previous call to animate_vertices() within the same frame.
void | clear_cache ()
| Removes all of the previously-cached results of convert_to().
void | clear_cache_stage ()
| Removes all of the previously-cached results of convert_to(), at the current pipeline stage and upstream.
void | clear_rows ()
| Removes all of the rows from the arrays; functionally equivalent to set_num_rows(0) (but faster).
void | clear_slider_table ()
| Sets the SliderTable pointer to NULL, removing the table from the vertex data.
void | clear_transform_blend_table ()
void | clear_transform_table ()
| Sets the TransformTable pointer to NULL, removing the table from the vertex data.
int | compare_to (const GeomVertexData &other) const
| Returns 0 if the two objects are equivalent, even if they are not the same pointer.
virtual int | complete_pointers (TypedWritable **plist, BamReader *manager)
| Receives an array of pointers, one for each time manager->read_pointer() was called in fillin().
ConstPointerTo< GeomVertexData > | convert_to (const GeomVertexFormat *new_format) const
| Returns a new GeomVertexData that represents the same contents as this one, with all data types matched up name-by-name to the indicated new format.
void | copy_from (const GeomVertexData *source, bool keep_data_objects, Thread *current_thread=Thread::get_current_thread())
| Copies all the data from the other array into the corresponding data types in this array, by matching data types name-by-name.
void | copy_row_from (int dest_row, const GeomVertexData *source, int source_row, Thread *current_thread)
| Copies a single row of the data from the other array into the indicated row of this array.
void | describe_vertex (std::ostream &out, int row) const
| Writes a verbose, human-friendly description of the indicated vertex number.
virtual void | finalize (BamReader *manager)
| Called by the BamReader to perform any final actions needed for setting up the object after all objects have been read and all pointers have been completed.
virtual TypeHandle | force_init_type ()
ConstPointerTo< GeomVertexArrayData > | get_array (size_t i) const
ConstPointerTo< GeomVertexArrayDataHandle > | get_array_handle (size_t i) const
const GeomVertexFormat * | get_format () const
UpdateSeq | get_modified (Thread *current_thread=Thread::get_current_thread()) const
const std::string & | get_name () const
size_t | get_num_arrays () const
int | get_num_bytes () const
int | get_num_rows () const
| Returns the number of rows stored within all the arrays.
const SliderTable * | get_slider_table () const
ConstPointerTo< TransformBlendTable > | get_transform_blend_table () const
const TransformTable * | get_transform_table () const
virtual TypeHandle | get_type () const
UsageHint | get_usage_hint () const
bool | has_column (const InternalName *name) const
| Returns true if the data has the named column, false otherwise.
PointerTo< GeomVertexArrayData > | modify_array (size_t i)
PointerTo< GeomVertexArrayDataHandle > | modify_array_handle (size_t i)
PointerTo< TransformBlendTable > | modify_transform_blend_table ()
| Returns a modifiable pointer to the current TransformBlendTable on this vertex data, if any, or NULL if there is not a TransformBlendTable.
void | operator= (const GeomVertexData &copy)
| The copy assignment operator is not pipeline-safe.
void | output (std::ostream &out) const
PointerTo< GeomVertexData > | replace_column (InternalName *name, int num_components, NumericType numeric_type, Contents contents) const
| Returns a new GeomVertexData object, suitable for modification, with the indicated data type replaced with a new table filled with undefined values.
bool | request_resident () const
| Returns true if the vertex data is currently resident in memory.
virtual bool | require_fully_complete () const
| Some objects require all of their nested pointers to have been completed before the objects themselves can be completed.
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 rows to n without causing a new memory allocation.
ConstPointerTo< GeomVertexData > | reverse_normals () const
| Returns a new GeomVertexData object with the normal data modified in-place, so that each lighting normal is now facing in the opposite direction.
ConstPointerTo< GeomVertexData > | scale_color (const LVecBase4 &color_scale) const
| Returns a new GeomVertexData object with the color table modified in-place to apply the indicated scale.
ConstPointerTo< GeomVertexData > | scale_color (const LVecBase4 &color_scale, int num_components, NumericType numeric_type, Contents contents) const
| Returns a new GeomVertexData object with the color table replaced with a new color table that has been scaled by the indicated value.
void | set_array (size_t i, const GeomVertexArrayData *array)
ConstPointerTo< GeomVertexData > | set_color (const LColor &color) const
| Returns a new GeomVertexData object with the color data modified in-place with the new value.
ConstPointerTo< GeomVertexData > | set_color (const LColor &color, int num_components, NumericType numeric_type, Contents contents) const
| Returns a new GeomVertexData object with the color table replaced with a new color table for which each vertex has the indicated value.
void | set_format (const GeomVertexFormat *format)
void | set_name (const std::string &name)
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).
void | set_slider_table (const SliderTable *table)
void | set_transform_blend_table (const TransformBlendTable *table)
| Replaces the TransformBlendTable on this vertex data with the indicated table.
void | set_transform_table (const TransformTable *table)
void | set_usage_hint (UsageHint usage_hint)
void | transform_vertices (const LMatrix4 &mat)
| Applies the indicated transform matrix to all of the vertices in the GeomVertexData.
void | transform_vertices (const LMatrix4 &mat, const SparseArray &rows)
| Applies the indicated transform matrix to all of the vertices mentioned in the sparse array.
void | transform_vertices (const LMatrix4 &mat, int begin_row, int end_row)
| Applies the indicated transform matrix to all of the vertices from begin_row up to but not including end_row.
void | unclean_set_format (const GeomVertexFormat *format)
| Changes the format of the vertex data, without reformatting the data to match.
bool | unclean_set_num_rows (int n)
| This method behaves like set_num_rows(), except the new data is not initialized.
void | write (std::ostream &out, int indent_level=0) const
virtual void | write_datagram (BamWriter *manager, Datagram &dg)
| Writes the contents of this object to the datagram for shipping out to a Bam file.
Public Member Functions inherited from CopyOnWriteObject
| CopyOnWriteObject (const CopyOnWriteObject &copy)
void | operator= (const CopyOnWriteObject &copy)
Public Member Functions inherited from CachedTypedWritableReferenceCount
void | cache_ref () const
| Explicitly increments the cache reference count and the normal reference count simultaneously.
void | cache_ref_only () const
| Decrements the cache reference count without affecting the normal reference count.
bool | cache_unref () const
| Explicitly decrements the cache reference count and the normal reference count simultaneously.
int | get_cache_ref_count () const
bool | test_ref_count_integrity () const
| Does some easy checks to make sure that the reference count isn't completely bogus.
Public Member Functions inherited from TypedWritableReferenceCount
| TypedWritableReferenceCount (const TypedWritableReferenceCount &copy)
virtual ReferenceCount * | as_reference_count ()
| Returns the pointer cast to a ReferenceCount pointer, if it is in fact of that type.
void | operator= (const TypedWritableReferenceCount &copy)
Public Member Functions inherited from TypedWritable
| TypedWritable (const TypedWritable &copy)
vector_uchar | encode_to_bam_stream () const
| Converts the TypedWritable object into a single stream of data using a BamWriter, and returns that data as a bytes object.
bool | encode_to_bam_stream (vector_uchar &data, BamWriter *writer=nullptr) const
| Converts the TypedWritable object into a single stream of data using a BamWriter, and stores that data in the indicated string.
UpdateSeq | get_bam_modified () const
| Returns the current bam_modified counter.
void | mark_bam_modified ()
| Increments the bam_modified counter, so that this object will be invalidated and retransmitted on any open bam streams.
void | operator= (const TypedWritable &copy)
virtual void | update_bam_nested (BamWriter *manager)
| Called by the BamWriter when this object has not itself been modified recently, but it should check its nested objects for updates.
Public Member Functions inherited from TypedObject
| TypedObject (const TypedObject &copy)=default
TypedObject * | as_typed_object ()
| Returns the object, upcast (if necessary) to a TypedObject pointer.
const TypedObject * | as_typed_object () const
| Returns the object, upcast (if necessary) to a TypedObject pointer.
int | get_best_parent_from_Set (const std::set< int > &) const
int | get_type_index () const
| Returns the internal index number associated with this object's TypeHandle, a unique number for each different type.
bool | is_exact_type (TypeHandle handle) const
| Returns true if the current object is the indicated type exactly.
bool | is_of_type (TypeHandle handle) const
| Returns true if the current object is or derives from the indicated type.
TypedObject & | operator= (const TypedObject &copy)=default
Public Member Functions inherited from MemoryBase
void | operator delete (void *, void *)
void | operator delete (void *ptr)
void | operator delete[] (void *, void *)
void | operator delete[] (void *ptr)
void * | operator new (size_t size)
void * | operator new (size_t size, void *ptr)
void * | operator new[] (size_t size)
void * | operator new[] (size_t size, void *ptr)
Public Member Functions inherited from ReferenceCount
int | get_ref_count () const
WeakReferenceList * | get_weak_list () const
| Returns the WeakReferenceList associated with this ReferenceCount object.
bool | has_weak_list () const
| Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise.
void | local_object ()
| This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack.
void | ref () const
| Explicitly increments the reference count.
bool | ref_if_nonzero () const
| Atomically increases the reference count of this object if it is not zero.
bool | test_ref_count_integrity () const
| Does some easy checks to make sure that the reference count isn't completely bogus.
bool | test_ref_count_nonzero () const
| Does some easy checks to make sure that the reference count isn't zero, or completely bogus.
virtual bool | unref () const
| Explicitly decrements the reference count.
bool | unref_if_one () const
| Atomically decreases the reference count of this object if it is one.
WeakReferenceList * | weak_ref ()
| Adds the indicated PointerToVoid as a weak reference to this object.
void | weak_unref ()
| Removes the indicated PointerToVoid as a weak reference to this object.

## Static Public Member Functions
static TypeHandle | get_class_type ()
static void | init_type ()
static uint32_t | 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.
static uint32_t | pack_ufloat (float a, float b, float c)
| Packs three float values in an unsigned 32-bit int.
static void | register_with_read_factory ()
| Tells the BamReader how to create objects of type GeomVertexData.
static unsigned int | unpack_abcd_a (uint32_t data)
| Returns the first packed value from a DirectX-style NT_packed_abcd.
static unsigned int | unpack_abcd_b (uint32_t data)
| Returns the second packed value from a DirectX-style NT_packed_abcd.
static unsigned int | unpack_abcd_c (uint32_t data)
| Returns the third packed value from a DirectX-style NT_packed_abcd.
static unsigned int | unpack_abcd_d (uint32_t data)
| Returns the fourth packed value from a DirectX-style NT_packed_abcd.
static float | unpack_ufloat_a (uint32_t data)
| Unpacks an unsigned float11 value from an uint32.
static float | unpack_ufloat_b (uint32_t data)
| Unpacks an unsigned float11 value from an uint32.
static float | unpack_ufloat_c (uint32_t data)
| Unpacks an unsigned float10 value from an uint32.
Static Public Member Functions inherited from CopyOnWriteObject
static TypeHandle | get_class_type ()
static void | init_type ()
Static Public Member Functions inherited from CachedTypedWritableReferenceCount
static TypeHandle | get_class_type ()
static void | init_type ()
Static Public Member Functions inherited from TypedWritableReferenceCount
static TypeHandle | get_class_type ()
static void | init_type ()
static | PT (TypedWritableReferenceCount) decode_from_bam_stream(vector_uchar data
Static Public Member Functions inherited from TypedWritable
static bool | decode_raw_from_bam_stream (TypedWritable *&ptr, ReferenceCount *&ref_ptr, vector_uchar data, BamReader *reader=nullptr)
| Reads the bytes created by a previous call to encode_to_bam_stream(), and extracts the single object on those bytes.
static TypeHandle | get_class_type ()
static void | init_type ()
Static Public Member Functions inherited from TypedObject
static TypeHandle | get_class_type ()
static void | init_type ()
| This function is declared non-inline to work around a compiler bug in g++ 2.96.
Static Public Member Functions inherited from ReferenceCount
static TypeHandle | get_class_type ()
static void | init_type ()

## Public Attributes
| get_array
| get_format
| Returns a pointer to the GeomVertexFormat structure that defines this data.
| get_modified
| Returns a sequence number which is guaranteed to change at least every time the vertex data is modified.
| get_name
| Returns the name passed to the constructor, if any.
| get_num_arrays
| Returns the number of individual arrays stored within the data.
| get_num_bytes
| Returns the total number of bytes consumed by the different arrays of the vertex data.
| get_slider_table
| Returns a const pointer to the SliderTable assigned to this data.
| get_transform_table
| Returns a const pointer to the TransformTable assigned to this data.
| get_usage_hint
| Returns the usage hint that was passed to the constructor, and which will be passed to each array data object created initially, and arrays created as the result of a convert_to() operation.
| set_array
| Replaces the indicated vertex data array with a completely new array.
| set_format
| Changes the format of the vertex data.
| set_name
| Changes the name of the vertex data.
| set_slider_table
| Replaces the SliderTable on this vertex data with the indicated table.
| set_transform_table
| Replaces the TransformTable on this vertex data with the indicated table.
| set_usage_hint
| Changes the UsageHint hint for this vertex data, and for all of the arrays that share this data.
Public Attributes inherited from CachedTypedWritableReferenceCount
| get_cache_ref_count
| Returns the current reference count.
Public Attributes inherited from TypedWritableReferenceCount
static BamReader * | reader = nullptr)
Public Attributes inherited from TypedObject
| get_type
Public Attributes inherited from ReferenceCount
| get_ref_count
| Returns the current reference count.

## Friends
class | CacheEntry
class | GeomVertexDataPipelineBase
class | GeomVertexDataPipelineReader
class | GeomVertexDataPipelineWriter

## Additional Inherited Members
Static Public Attributes inherited from TypedWritable
static TypedWritable *const | Null = nullptr

## Detailed Description

This defines the actual numeric vertex data stored in a Geom, in the structure defined by a particular GeomVertexFormat object.

The data consists of one or more arrays, each of which in turn consists of a series of rows, one per vertex. All arrays should have the same number of rows; each vertex is defined by the column data from a particular row across all arrays.

Often, there will be only one array per Geom, and the various columns defined in the GeomVertexFormat will be interleaved within that array. However, it is also possible to have multiple different arrays, with a certain subset of the total columns defined in each array.

However the data is distributed, the effect is of a single table of vertices, where each vertex is represented by one row of the table.

In general, application code should not attempt to directly manipulate the vertex data through this structure; instead, use the GeomVertexReader, GeomVertexWriter, and GeomVertexRewriter objects to read and write vertex data at a high level.

Definition at line 68 of file geomVertexData.h.

## Member Typedef Documentation

## ◆ Cache

typedef pmap<const CacheKey *, PointerTo< CacheEntry > , IndirectLess<CacheKey> > GeomVertexData::Cache

Definition at line 286 of file geomVertexData.h.

## Constructor & Destructor Documentation

## ◆ GeomVertexData() [1/3]

GeomVertexData::GeomVertexData | ( | const std::string & | name,
|  | const GeomVertexFormat * | format,
|  | GeomVertexData::UsageHint | usage_hint )
| explicit

Definition at line 64 of file geomVertexData.cxx.

## ◆ GeomVertexData() [2/3]

GeomVertexData::GeomVertexData | ( | const GeomVertexData & | copy | ) |

Definition at line 81 of file geomVertexData.cxx.

## ◆ GeomVertexData() [3/3]

GeomVertexData::GeomVertexData | ( | const GeomVertexData & | copy,
|  | const GeomVertexFormat * | format )
| explicit

This constructor copies all of the basic properties of the source VertexData, like usage_hint and animation tables, but does not copy the actual data, and it allows you to specify a different format.

Definition at line 105 of file geomVertexData.cxx.

References GeomVertexFormat::get_array, GeomVertexFormat::get_num_arrays, and GeomVertexFormat::is_registered.

## ◆ ~GeomVertexData()

GeomVertexData::~GeomVertexData | ( |  | ) |
| virtual

Definition at line 169 of file geomVertexData.cxx.

## Member Function Documentation

## ◆ animate_vertices()

ConstPointerTo< GeomVertexData > GeomVertexData::animate_vertices | ( | bool | force,
|  | Thread * | current_thread ) const

Returns a GeomVertexData that represents the results of computing the vertex animation on the CPU for this GeomVertexData.

If there is no CPU-defined vertex animation on this object, this just returns the original object.

If there is vertex animation, but the VertexTransform values have not changed since last time, this may return the same pointer it returned previously. Even if the VertexTransform values have changed, it may still return the same pointer, but with its contents modified (this is preferred, since it allows the graphics backend to update vertex buffers optimally).

If force is false, this method may return immediately with stale data, if the vertex data is not completely resident. If force is true, this method will never return stale data, but may block until the data is available.

Definition at line 939 of file geomVertexData.cxx.

References request_resident().

## ◆ clear_animated_vertices()

void GeomVertexData::clear_animated_vertices | ( |  | ) |

Removes the cache of animated vertices computed by a previous call to animate_vertices() within the same frame.

This will force the next call to animate_vertices() to recompute these values from scratch. Normally it is not necessary to call this.

Definition at line 1010 of file geomVertexData.cxx.

References PointerToBase< T >::clear(), and UpdateSeq::clear().

## ◆ clear_cache()

void GeomVertexData::clear_cache | ( |  | ) |

Removes all of the previously-cached results of convert_to().

This blows away the entire cache, upstream and downstream the pipeline. Use clear_cache_stage() instead if you only want to blow away the cache at the current stage and upstream.

Definition at line 1375 of file geomVertexData.cxx.

Referenced by operator=().

## ◆ clear_cache_stage()

void GeomVertexData::clear_cache_stage | ( |  | ) |

Removes all of the previously-cached results of convert_to(), at the current pipeline stage and upstream.

Does not affect the downstream cache.

Don't call this in a downstream thread unless you don't mind it blowing away other changes you might have recently made in an upstream thread.

Definition at line 1394 of file geomVertexData.cxx.

Referenced by clear_rows(), modify_transform_blend_table(), set_transform_blend_table(), and unclean_set_format().

## ◆ clear_rows()

void GeomVertexData::clear_rows | ( |  | ) |

Removes all of the rows from the arrays; functionally equivalent to set_num_rows(0) (but faster).

Don't call this in a downstream thread unless you don't mind it blowing away other changes you might have recently made in an upstream thread.

Definition at line 343 of file geomVertexData.cxx.

References PointerToBase< T >::clear(), clear_cache_stage(), Thread::get_current_thread, and Geom::get_next_modified().

## ◆ clear_slider_table()

void GeomVertexData::clear_slider_table | ( |  | ) |
| inline

Sets the SliderTable pointer to NULL, removing the table from the vertex data.

This disables morph (blend shape) animation.

Definition at line 280 of file geomVertexData.I.

References set_slider_table.

## ◆ clear_transform_table()

void GeomVertexData::clear_transform_table | ( |  | ) |
| inline

Sets the TransformTable pointer to NULL, removing the table from the vertex data.

This disables hardware-driven vertex animation.

Definition at line 232 of file geomVertexData.I.

References set_transform_table.

## ◆ compare_to()

int GeomVertexData::compare_to | ( | const GeomVertexData & | other | ) | const

Returns 0 if the two objects are equivalent, even if they are not the same pointer.

Definition at line 178 of file geomVertexData.cxx.

## ◆ complete_pointers()

int GeomVertexData::complete_pointers | ( | TypedWritable ** | p_list,
|  | BamReader * | manager )
| virtual

Receives an array of pointers, one for each time manager->read_pointer() was called in fillin().

Returns the number of pointers processed.

Reimplemented from TypedWritable.

Definition at line 2027 of file geomVertexData.cxx.

References TypedWritable::complete_pointers().

## ◆ convert_to()

ConstPointerTo< GeomVertexData > GeomVertexData::convert_to | ( | const GeomVertexFormat * | new_format | ) | const

Returns a new GeomVertexData that represents the same contents as this one, with all data types matched up name-by-name to the indicated new format.

Definition at line 702 of file geomVertexData.cxx.

References Thread::get_current_thread, get_format, get_name, get_num_rows(), get_slider_table, and get_usage_hint.

Referenced by PT().

## ◆ copy_from()

void GeomVertexData::copy_from | ( | const GeomVertexData * | source,
|  | bool | keep_data_objects,
|  | Thread * | current_thread = Thread::get_current_thread() )

Copies all the data from the other array into the corresponding data types in this array, by matching data types name-by-name.

keep_data_objects specifies what to do when one or more of the arrays can be copied without the need to apply any conversion operation. If it is true, the original GeomVertexArrayData objects in this object are retained, and their data arrays are copied byte-by-byte from the source; if it is false, then the GeomVertexArrayData objects are copied pointerwise from the source.

Don't call this in a downstream thread unless you don't mind it blowing away other changes you might have recently made in an upstream thread.

Definition at line 476 of file geomVertexData.cxx.

References GeomVertexFormat::get_animation, GeomVertexAnimationSpec::get_animation_type, GeomVertexFormat::get_array, GeomVertexFormat::get_array_with(), TransformBlend::get_blend(), GeomVertexArrayFormat::get_column, Thread::get_current_thread, GeomVertexReader::get_data1i(), GeomVertexReader::get_data4(), get_format, GeomVertexAnimationSpec::get_indexed_transforms, GeomVertexColumn::get_name(), GeomVertexFormat::get_num_arrays, GeomVertexArrayFormat::get_num_columns, get_num_rows(), TransformBlend::get_num_transforms, GeomVertexColumn::get_start(), GeomVertexArrayFormat::get_stride, TransformBlend::get_transform, TransformBlend::get_weight, GeomVertexWriter::has_column(), GeomVertexReader::is_at_end(), GeomVertexColumn::is_bytewise_equivalent(), GeomVertexArrayFormat::is_data_subset_of(), GeomVertexColumn::is_packed_argb(), GeomVertexColumn::is_uint8_rgba(), TransformBlend::limit_transforms(), TransformBlend::normalize_weights(), set_array, GeomVertexReader::set_column(), GeomVertexWriter::set_column(), GeomVertexWriter::set_data4(), GeomVertexWriter::set_data4i(), and set_transform_table.

## ◆ copy_row_from()

void GeomVertexData::copy_row_from | ( | int | dest_row,
|  | const GeomVertexData * | source,
|  | int | source_row,
|  | Thread * | current_thread )

Copies a single row of the data from the other array into the indicated row of this array.

In this case, the source format must exactly match the destination format.

Don't call this in a downstream thread unless you don't mind it blowing away other changes you might have recently made in an upstream thread.

Definition at line 686 of file geomVertexData.cxx.

References GeomVertexDataPipelineWriter::copy_row_from().

Referenced by GeomPrimitive::pack_vertices().

## ◆ describe_vertex()

void GeomVertexData::describe_vertex | ( | std::ostream & | out,
|  | int | row ) const

Writes a verbose, human-friendly description of the indicated vertex number.

Definition at line 1304 of file geomVertexData.cxx.

References Datagram::dump_hex(), GeomVertexFormat::get_animation, GeomVertexFormat::get_array, GeomVertexFormat::get_array_with(), TransformBlendTable::get_blend, GeomVertexFormat::get_column, get_format, GeomVertexColumn::get_name(), GeomVertexFormat::get_num_arrays, GeomVertexFormat::get_num_columns, get_num_rows(), GeomVertexColumn::get_num_values(), and GeomVertexArrayFormat::get_stride.

## ◆ finalize()

void GeomVertexData::finalize | ( | BamReader * | manager | ) |
| virtual

Called by the BamReader to perform any final actions needed for setting up the object after all objects have been read and all pointers have been completed.

Reimplemented from TypedWritable.

Definition at line 2049 of file geomVertexData.cxx.

References BamReader::change_pointer().

## ◆ force_init_type()

virtual TypeHandle GeomVertexData::force_init_type | ( |  | ) |
| inline virtual

Reimplemented from CopyOnWriteObject.

Definition at line 388 of file geomVertexData.h.

## ◆ get_class_type()

static TypeHandle GeomVertexData::get_class_type | ( |  | ) |
| inline static

Definition at line 374 of file geomVertexData.h.

## ◆ get_num_rows()

int GeomVertexData::get_num_rows | ( |  | ) | const
| inline

Returns the number of rows stored within all the arrays.

All arrays store data for the same n rows.

Definition at line 61 of file geomVertexData.I.

Referenced by convert_to(), copy_from(), GeomVertexDataPipelineWriter::copy_row_from(), describe_vertex(), GeomPrimitive::pack_vertices(), replace_column(), scale_color(), set_color(), and transform_vertices().

## ◆ get_type()

virtual TypeHandle GeomVertexData::get_type | ( |  | ) | const
| inline virtual

Reimplemented from CopyOnWriteObject.

Definition at line 385 of file geomVertexData.h.

## ◆ has_column()

bool GeomVertexData::has_column | ( | const InternalName * | name | ) | const
| inline

Returns true if the data has the named column, false otherwise.

This is really just a shortcut for asking the same thing from the format.

Definition at line 51 of file geomVertexData.I.

## ◆ init_type()

static void GeomVertexData::init_type | ( |  | ) |
| inline static

Definition at line 377 of file geomVertexData.h.

## ◆ modify_transform_blend_table()

PointerTo< TransformBlendTable > GeomVertexData::modify_transform_blend_table | ( |  | ) |

Returns a modifiable pointer to the current TransformBlendTable on this vertex data, if any, or NULL if there is not a TransformBlendTable.

See get_transform_blend_table().

Don't call this in a downstream thread unless you don't mind it blowing away other changes you might have recently made in an upstream thread.

Definition at line 389 of file geomVertexData.cxx.

References clear_cache_stage(), and Geom::get_next_modified().

## ◆ operator=()

void GeomVertexData::operator= | ( | const GeomVertexData & | copy | ) |

The copy assignment operator is not pipeline-safe.

This will completely obliterate all stages of the pipeline, so don't do it for a GeomVertexData that is actively being used for rendering.

Definition at line 144 of file geomVertexData.cxx.

References clear_cache(), and Geom::get_next_modified().

## ◆ output()

void GeomVertexData::output | ( | std::ostream & | out | ) | const

Definition at line 1266 of file geomVertexData.cxx.

## ◆ pack_abcd()

uint32_t GeomVertexData::pack_abcd | ( | unsigned int | a,
|  | unsigned int | b,
|  | unsigned int | c,
|  | unsigned int | d )
| inline static

Packs four values in a DirectX-style NT_packed_abcd value.

Definition at line 308 of file geomVertexData.I.

## ◆ pack_ufloat()

uint32_t GeomVertexData::pack_ufloat | ( | float | a,
|  | float | b,
|  | float | c )
| inline static

Packs three float values in an unsigned 32-bit int.

Definition at line 352 of file geomVertexData.I.

## ◆ register_with_read_factory()

void GeomVertexData::register_with_read_factory | ( |  | ) |
| static

Tells the BamReader how to create objects of type GeomVertexData.

Definition at line 1988 of file geomVertexData.cxx.

References BamReader::get_factory(), and Factory< Type >::register_factory().

## ◆ replace_column()

PointerTo< GeomVertexData > GeomVertexData::replace_column | ( | InternalName * | name,
|  | int | num_components,
|  | GeomVertexData::NumericType | numeric_type,
|  | GeomVertexData::Contents | contents ) const

Returns a new GeomVertexData object, suitable for modification, with the indicated data type replaced with a new table filled with undefined values.

The new table will be added as a new array; if the old table was interleaved with a previous array, the previous array will not be repacked.

If num_components is 0, the indicated name is simply removed from the type, without replacing it with anything else.

Definition at line 1186 of file geomVertexData.cxx.

References GeomVertexFormat::get_array, get_num_arrays, GeomVertexArrayFormat::get_num_columns, get_num_rows(), get_usage_hint, and GeomVertexArrayFormat::remove_column().

Referenced by scale_color(), and set_color().

## ◆ request_resident()

bool GeomVertexData::request_resident | ( |  | ) | const

Returns true if the vertex data is currently resident in memory.

If this returns false, the vertex data will be brought back into memory shortly; try again later.

Definition at line 444 of file geomVertexData.cxx.

Referenced by animate_vertices().

## ◆ require_fully_complete()

bool GeomVertexData::require_fully_complete | ( |  | ) | const
| virtual

Some objects require all of their nested pointers to have been completed before the objects themselves can be completed.

If this is the case, override this method to return true, and be careful with circular references (which would make the object unreadable from a bam file).

Reimplemented from TypedWritable.

Definition at line 2039 of file geomVertexData.cxx.

## ◆ reserve_num_rows()

bool GeomVertexData::reserve_num_rows | ( | int | n | ) |
| inline

This ensures that enough memory space for n rows is allocated, so that you may increase the number of rows to n without causing a new memory allocation.

This is a performance optimization only; it is especially useful when you know ahead of time that you will be adding n rows to the data.

If you know exactly how many rows you will be needing, it is significantly faster to use set_num_rows() or unclean_set_num_rows() instead.

Definition at line 132 of file geomVertexData.I.

References Thread::get_current_thread.

## ◆ reverse_normals()

ConstPointerTo< GeomVertexData > GeomVertexData::reverse_normals | ( |  | ) | const

Returns a new GeomVertexData object with the normal data modified in-place, so that each lighting normal is now facing in the opposite direction.

If the vertex data does not include a normal column, this returns the original GeomVertexData object, unchanged.

Definition at line 905 of file geomVertexData.cxx.

References GeomVertexReader::get_data3(), get_format, GeomVertexRewriter::is_at_end(), and GeomVertexWriter::set_data3().

## ◆ scale_color() [1/2]

ConstPointerTo< GeomVertexData > GeomVertexData::scale_color | ( | const LVecBase4 & | color_scale | ) | const

Returns a new GeomVertexData object with the color table modified in-place to apply the indicated scale.

If the vertex data does not include a color column, a new one will not be added.

Definition at line 790 of file geomVertexData.cxx.

References get_format.

## ◆ scale_color() [2/2]

ConstPointerTo< GeomVertexData > GeomVertexData::scale_color | ( | const LVecBase4 & | color_scale,
|  | int | num_components,
|  | GeomVertexData::NumericType | numeric_type,
|  | GeomVertexData::Contents | contents ) const

Returns a new GeomVertexData object with the color table replaced with a new color table that has been scaled by the indicated value.

The new color table will be added as a new array; if the old color table was interleaved with a previous array, the previous array will not be repacked.

Definition at line 817 of file geomVertexData.cxx.

References GeomVertexReader::get_data4(), get_format, get_num_rows(), replace_column(), set_color(), and GeomVertexWriter::set_data4().

## ◆ set_color() [1/2]

ConstPointerTo< GeomVertexData > GeomVertexData::set_color | ( | const LColor & | color | ) | const

Returns a new GeomVertexData object with the color data modified in-place with the new value.

If the vertex data does not include a color column, a new one will not be added.

Definition at line 861 of file geomVertexData.cxx.

References get_format.

Referenced by scale_color().

## ◆ set_color() [2/2]

ConstPointerTo< GeomVertexData > GeomVertexData::set_color | ( | const LColor & | color,
|  | int | num_components,
|  | GeomVertexData::NumericType | numeric_type,
|  | GeomVertexData::Contents | contents ) const

Returns a new GeomVertexData object with the color table replaced with a new color table for which each vertex has the indicated value.

The new color table will be added as a new array; if the old color table was interleaved with a previous array, the previous array will not be repacked.

Definition at line 880 of file geomVertexData.cxx.

References get_num_rows(), and replace_column().

## ◆ set_num_rows()

bool GeomVertexData::set_num_rows | ( | int | n | ) |
| inline

Sets the length of the array to n rows in all of the various arrays (presumably by adding rows).

The new vertex data is initialized to 0, except for the "color" column, which is initialized to (1, 1, 1, 1).

The return value is true if the number of rows was changed, false if the object already contained n rows (or if there was some error).

This can be used when you know exactly how many rows you will be needing. It is faster than reserve_num_rows(). Also see unclean_set_num_rows() if you are planning to fill in all the data yourself.

Don't call this in a downstream thread unless you don't mind it blowing away other changes you might have recently made in an upstream thread.

Definition at line 96 of file geomVertexData.I.

References Thread::get_current_thread.

Referenced by GeomVertexDataPipelineWriter::copy_row_from().

## ◆ set_transform_blend_table()

void GeomVertexData::set_transform_blend_table | ( | const TransformBlendTable * | table | ) |

Replaces the TransformBlendTable on this vertex data with the indicated table.

The length of this table should be consistent with the maximum table index assigned to the vertices under the "transform_blend" name.

Don't call this in a downstream thread unless you don't mind it blowing away other changes you might have recently made in an upstream thread.

Definition at line 408 of file geomVertexData.cxx.

References clear_cache_stage(), and Geom::get_next_modified().

## ◆ transform_vertices() [1/3]

void GeomVertexData::transform_vertices | ( | const LMatrix4 & | mat | ) |

Applies the indicated transform matrix to all of the vertices in the GeomVertexData.

The transform is applied to all "point" and "vector" type columns described in the format.

Definition at line 1023 of file geomVertexData.cxx.

References get_num_rows(), and transform_vertices().

Referenced by transform_vertices().

## ◆ transform_vertices() [2/3]

void GeomVertexData::transform_vertices | ( | const LMatrix4 & | mat,
|  | const SparseArray & | rows )

Applies the indicated transform matrix to all of the vertices mentioned in the sparse array.

The transform is applied to all "point" and "vector" type columns described in the format.

Definition at line 1059 of file geomVertexData.cxx.

References get_format, GeomVertexFormat::get_num_points, SparseArray::get_num_subranges(), GeomVertexFormat::get_num_vectors, GeomVertexFormat::get_point, SparseArray::get_subrange_begin(), SparseArray::get_subrange_end(), GeomVertexFormat::get_vector, and SparseArray::is_zero().

## ◆ transform_vertices() [3/3]

void GeomVertexData::transform_vertices | ( | const LMatrix4 & | mat,
|  | int | begin_row,
|  | int | end_row )

Applies the indicated transform matrix to all of the vertices from begin_row up to but not including end_row.

The transform is applied to all "point" and "vector" type columns described in the format.

Definition at line 1033 of file geomVertexData.cxx.

References get_format, GeomVertexFormat::get_num_points, GeomVertexFormat::get_num_vectors, GeomVertexFormat::get_point, and GeomVertexFormat::get_vector.

## ◆ unclean_set_format()

void GeomVertexData::unclean_set_format | ( | const GeomVertexFormat * | format | ) |

Changes the format of the vertex data, without reformatting the data to match.

The data is exactly the same after this operation, but will be reinterpreted according to the new format. This assumes that the new format is fundamentally compatible with the old format; in particular, it must have the same number of arrays with the same stride in each one. No checking is performed that the data remains sensible.

Definition at line 301 of file geomVertexData.cxx.

References PointerToBase< T >::clear(), clear_cache_stage(), GeomVertexFormat::get_array, Thread::get_current_thread, Geom::get_next_modified(), GeomVertexFormat::get_num_arrays, and GeomVertexFormat::is_registered.

## ◆ unclean_set_num_rows()

bool GeomVertexData::unclean_set_num_rows | ( | int | n | ) |
| inline

This method behaves like set_num_rows(), except the new data is not initialized.

Furthermore, after this call, *any* of the data in the GeomVertexData may be uninitialized, including the earlier rows.

This is intended for applications that are about to completely fill the GeomVertexData with new data anyway; it provides a tiny performance boost over set_num_rows().

This can be used when you know exactly how many rows you will be needing. It is faster than reserve_num_rows().

Definition at line 115 of file geomVertexData.I.

References Thread::get_current_thread.

## ◆ unpack_abcd_a()

unsigned int GeomVertexData::unpack_abcd_a | ( | uint32_t | data | ) |
| inline static

Returns the first packed value from a DirectX-style NT_packed_abcd.

Definition at line 320 of file geomVertexData.I.

## ◆ unpack_abcd_b()

unsigned int GeomVertexData::unpack_abcd_b | ( | uint32_t | data | ) |
| inline static

Returns the second packed value from a DirectX-style NT_packed_abcd.

Definition at line 328 of file geomVertexData.I.

## ◆ unpack_abcd_c()

unsigned int GeomVertexData::unpack_abcd_c | ( | uint32_t | data | ) |
| inline static

Returns the third packed value from a DirectX-style NT_packed_abcd.

Definition at line 336 of file geomVertexData.I.

## ◆ unpack_abcd_d()

unsigned int GeomVertexData::unpack_abcd_d | ( | uint32_t | data | ) |
| inline static

Returns the fourth packed value from a DirectX-style NT_packed_abcd.

Definition at line 344 of file geomVertexData.I.

## ◆ unpack_ufloat_a()

float GeomVertexData::unpack_ufloat_a | ( | uint32_t | data | ) |
| inline static

Unpacks an unsigned float11 value from an uint32.

Definition at line 408 of file geomVertexData.I.

## ◆ unpack_ufloat_b()

float GeomVertexData::unpack_ufloat_b | ( | uint32_t | data | ) |
| inline static

Unpacks an unsigned float11 value from an uint32.

Definition at line 434 of file geomVertexData.I.

## ◆ unpack_ufloat_c()

float GeomVertexData::unpack_ufloat_c | ( | uint32_t | data | ) |
| inline static

Unpacks an unsigned float10 value from an uint32.

Definition at line 460 of file geomVertexData.I.

## ◆ write()

void GeomVertexData::write | ( | std::ostream & | out,
|  | int | indent_level = 0 ) const

Definition at line 1279 of file geomVertexData.cxx.

## ◆ write_datagram()

void GeomVertexData::write_datagram | ( | BamWriter * | manager,
|  | Datagram & | dg )
| virtual

Writes the contents of this object to the datagram for shipping out to a Bam file.

Reimplemented from TypedWritable.

Definition at line 1997 of file geomVertexData.cxx.

References Datagram::add_string(), BamWriter::write_cdata(), and TypedWritable::write_datagram().

## Friends And Related Symbol Documentation

## ◆ CacheEntry

friend class CacheEntry
| friend

Definition at line 393 of file geomVertexData.h.

## ◆ GeomVertexDataPipelineBase

friend class GeomVertexDataPipelineBase
| friend

Definition at line 394 of file geomVertexData.h.

## ◆ GeomVertexDataPipelineReader

friend class GeomVertexDataPipelineReader
| friend

Definition at line 395 of file geomVertexData.h.

## ◆ GeomVertexDataPipelineWriter

friend class GeomVertexDataPipelineWriter
| friend

Definition at line 396 of file geomVertexData.h.

## Member Data Documentation

## ◆ get_array

GeomVertexData::get_array

Definition at line 111 of file geomVertexData.h.

## ◆ get_format

const GeomVertexFormat * GeomVertexData::get_format
| inline

Returns a pointer to the GeomVertexFormat structure that defines this data.

Definition at line 98 of file geomVertexData.h.

Referenced by convert_to(), copy_from(), GeomVertexDataPipelineWriter::copy_row_from(), describe_vertex(), PT(), reverse_normals(), scale_color(), scale_color(), set_color(), transform_vertices(), and transform_vertices().

## ◆ get_modified

UpdateSeq GeomVertexData::get_modified
| inline

Returns a sequence number which is guaranteed to change at least every time the vertex data is modified.

Definition at line 135 of file geomVertexData.h.

## ◆ get_name

const std::string & GeomVertexData::get_name
| inline

Returns the name passed to the constructor, if any.

This name is reported on the PStats graph for vertex computations.

Definition at line 89 of file geomVertexData.h.

Referenced by convert_to().

## ◆ get_num_arrays

size_t GeomVertexData::get_num_arrays
| inline

Returns the number of individual arrays stored within the data.

This must match get_format()->get_num_arrays().

Definition at line 111 of file geomVertexData.h.

Referenced by replace_column().

## ◆ get_num_bytes

int GeomVertexData::get_num_bytes
| inline

Returns the total number of bytes consumed by the different arrays of the vertex data.

Definition at line 134 of file geomVertexData.h.

## ◆ get_slider_table

const SliderTable * GeomVertexData::get_slider_table
| inline

Returns a const pointer to the SliderTable assigned to this data.

Vertices within the vertex data will look up their morph offsets, if any, within this table.

This will return NULL if the vertex data does not have a SliderTable assigned.

Definition at line 130 of file geomVertexData.h.

Referenced by convert_to().

## ◆ get_transform_table

const TransformTable * GeomVertexData::get_transform_table
| inline

Returns a const pointer to the TransformTable assigned to this data.

Vertices within the table will index into this table to indicate their dynamic skinning information; this table is used when the vertex animation is to be performed by the graphics hardware (but also see get_transform_blend_table()).

This will return NULL if the vertex data does not have a TransformTable assigned (which implies the vertices will not be animated by the graphics hardware).

Definition at line 120 of file geomVertexData.h.

## ◆ get_usage_hint

GeomVertexData::UsageHint GeomVertexData::get_usage_hint
| inline

Returns the usage hint that was passed to the constructor, and which will be passed to each array data object created initially, and arrays created as the result of a convert_to() operation.

See geomEnums.h.

However, each individual array may be replaced with a different array object with an independent usage hint specified, so there is no guarantee that the individual arrays all have the same usage_hint.

Definition at line 93 of file geomVertexData.h.

Referenced by convert_to(), PT(), and replace_column().

## ◆ set_array

void GeomVertexData::set_array
| inline

Replaces the indicated vertex data array with a completely new array.

You should be careful that the new array has the same length and format as the old one, unless you know what you are doing.

Don't call this in a downstream thread unless you don't mind it blowing away other changes you might have recently made in an upstream thread.

Definition at line 115 of file geomVertexData.h.

Referenced by copy_from().

## ◆ set_format

void GeomVertexData::set_format

Changes the format of the vertex data.

If the data is not empty, this will implicitly change every row to match the new format.

Don't call this in a downstream thread unless you don't mind it blowing away other changes you might have recently made in an upstream thread.

Definition at line 98 of file geomVertexData.h.

## ◆ set_name

void GeomVertexData::set_name

Changes the name of the vertex data.

This name is reported on the PStats graph for vertex computations.

Definition at line 89 of file geomVertexData.h.

## ◆ set_slider_table

void GeomVertexData::set_slider_table

Replaces the SliderTable on this vertex data with the indicated table.

There should be an entry in this table for each kind of morph offset defined in the vertex data.

The SliderTable object must have been registered prior to setting it on the GeomVertexData.

Don't call this in a downstream thread unless you don't mind it blowing away other changes you might have recently made in an upstream thread.

Definition at line 130 of file geomVertexData.h.

Referenced by clear_slider_table().

## ◆ set_transform_table

void GeomVertexData::set_transform_table

Replaces the TransformTable on this vertex data with the indicated table.

The length of this table should be consistent with the maximum table index assigned to the vertices under the "transform_index" name.

Don't call this in a downstream thread unless you don't mind it blowing away other changes you might have recently made in an upstream thread.

Definition at line 120 of file geomVertexData.h.

Referenced by clear_transform_table(), and copy_from().

## ◆ set_usage_hint

void GeomVertexData::set_usage_hint

Changes the UsageHint hint for this vertex data, and for all of the arrays that share this data.

See get_usage_hint().

Don't call this in a downstream thread unless you don't mind it blowing away other changes you might have recently made in an upstream thread.

Definition at line 93 of file geomVertexData.h.

The documentation for this class was generated from the following files:

- panda/src/gobj/geomVertexData.h
- panda/src/gobj/geomVertexData.cxx
- panda/src/gobj/geomVertexData.I