Panda3D
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:
CopyOnWriteObject GeomEnums CachedTypedWritableReferenceCount TypedWritableReferenceCount TypedWritable ReferenceCount TypedObject MemoryBase MemoryBase

Classes

class  CacheEntry
 
class  CacheKey
 

Public Types

typedef pmap< const CacheKey *, PT(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 std::string &name, const GeomVertexFormat *format, UsageHint usage_hint)
 
 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. More...
 
void clear_animated_vertices ()
 
void clear_cache ()
 
void clear_cache_stage ()
 Removes all of the previously-cached results of convert_to(), at the current pipeline stage and upstream. More...
 
void clear_rows ()
 Removes all of the rows from the arrays; functionally equivalent to set_num_rows(0) (but faster). More...
 
void clear_slider_table ()
 Sets the SliderTable pointer to NULL, removing the table from the vertex data. More...
 
void clear_transform_blend_table ()
 
void clear_transform_table ()
 Sets the TransformTable pointer to NULL, removing the table from the vertex data. More...
 
int compare_to (const GeomVertexData &other) const
 Returns 0 if the two objects are equivalent, even if they are not the same pointer. More...
 
virtual int complete_pointers (TypedWritable **plist, BamReader *manager)
 Receives an array of pointers, one for each time manager->read_pointer() was called in fillin(). More...
 
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. More...
 
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. More...
 
 CPT (GeomVertexArrayData) get_array(size_t i) const
 
 CPT (GeomVertexArrayDataHandle) get_array_handle(size_t i) const
 
 CPT (TransformBlendTable) get_transform_blend_table() const
 
 CPT (GeomVertexData) convert_to(const GeomVertexFormat *new_format) const
 
 CPT (GeomVertexData) scale_color(const LVecBase4 &color_scale) const
 
 CPT (GeomVertexData) scale_color(const LVecBase4 &color_scale
 
 CPT (GeomVertexData) set_color(const LColor &color) const
 
 CPT (GeomVertexData) set_color(const LColor &color
 
 CPT (GeomVertexData) reverse_normals() const
 
 CPT (GeomVertexData) animate_vertices(bool force
 
void describe_vertex (std::ostream &out, int row) const
 
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. More...
 
virtual TypeHandle force_init_type ()
 
const GeomVertexFormatget_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. More...
 
const SliderTableget_slider_table () const
 
const TransformTableget_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. More...
 
void operator= (const GeomVertexData &copy)
 The copy assignment operator is not pipeline-safe. More...
 
void output (std::ostream &out) const
 
 PT (GeomVertexArrayData) modify_array(size_t i)
 
 PT (GeomVertexArrayDataHandle) modify_array_handle(size_t i)
 
 PT (TransformBlendTable) modify_transform_blend_table()
 
 PT (GeomVertexData) replace_column(InternalName *name
 
bool request_resident () const
 Returns true if the vertex data is currently resident in memory. More...
 
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. More...
 
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. More...
 
void set_array (size_t i, const GeomVertexArrayData *array)
 
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). More...
 
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. More...
 
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. More...
 
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. More...
 
void transform_vertices (const LMatrix4 &mat, const SparseArray &rows)
 Applies the indicated transform matrix to all of the vertices mentioned in the sparse array. More...
 
void unclean_set_format (const GeomVertexFormat *format)
 Changes the format of the vertex data, without reformatting the data to match. More...
 
bool unclean_set_num_rows (int n)
 This method behaves like set_num_rows(), except the new data is not initialized. More...
 
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. More...
 
- 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. More...
 
void cache_ref_only () const
 Decrements the cache reference count without affecting the normal reference count. More...
 
bool cache_unref () const
 Explicitly decrements the cache reference count and the normal reference count simultaneously. More...
 
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. More...
 
- Public Member Functions inherited from TypedWritableReferenceCount
 TypedWritableReferenceCount (const TypedWritableReferenceCount &copy)
 
virtual ReferenceCountas_reference_count ()
 Returns the pointer cast to a ReferenceCount pointer, if it is in fact of that type. More...
 
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. More...
 
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. More...
 
UpdateSeq get_bam_modified () const
 Returns the current bam_modified counter. More...
 
void mark_bam_modified ()
 Increments the bam_modified counter, so that this object will be invalidated and retransmitted on any open bam streams. More...
 
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. More...
 
- Public Member Functions inherited from TypedObject
 TypedObject (const TypedObject &copy)=default
 
TypedObjectas_typed_object ()
 Returns the object, upcast (if necessary) to a TypedObject pointer. More...
 
const TypedObjectas_typed_object () const
 Returns the object, upcast (if necessary) to a TypedObject pointer. More...
 
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. More...
 
bool is_exact_type (TypeHandle handle) const
 Returns true if the current object is the indicated type exactly. More...
 
bool is_of_type (TypeHandle handle) const
 Returns true if the current object is or derives from the indicated type. More...
 
TypedObjectoperator= (const TypedObject &copy)=default
 
- Public Member Functions inherited from ReferenceCount
int get_ref_count () const
 
WeakReferenceListget_weak_list () const
 Returns the WeakReferenceList associated with this ReferenceCount object. More...
 
bool has_weak_list () const
 Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise. More...
 
void local_object ()
 This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack. More...
 
void ref () const
 Explicitly increments the reference count. More...
 
bool ref_if_nonzero () const
 Atomically increases the reference count of this object if it is not zero. More...
 
bool test_ref_count_integrity () const
 Does some easy checks to make sure that the reference count isn't completely bogus. More...
 
bool test_ref_count_nonzero () const
 Does some easy checks to make sure that the reference count isn't zero, or completely bogus. More...
 
virtual bool unref () const
 Explicitly decrements the reference count. More...
 
WeakReferenceListweak_ref ()
 Adds the indicated PointerToVoid as a weak reference to this object. More...
 
void weak_unref ()
 Removes the indicated PointerToVoid as a weak reference to this object. More...
 

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. More...
 
static uint32_t pack_ufloat (float a, float b, float c)
 Packs three float values in an unsigned 32-bit int. More...
 
static void register_with_read_factory ()
 Tells the BamReader how to create objects of type GeomVertexData. More...
 
static unsigned int unpack_abcd_a (uint32_t data)
 Returns the first packed value from a DirectX-style NT_packed_abcd. More...
 
static unsigned int unpack_abcd_b (uint32_t data)
 Returns the second packed value from a DirectX-style NT_packed_abcd. More...
 
static unsigned int unpack_abcd_c (uint32_t data)
 Returns the third packed value from a DirectX-style NT_packed_abcd. More...
 
static unsigned int unpack_abcd_d (uint32_t data)
 Returns the fourth packed value from a DirectX-style NT_packed_abcd. More...
 
static float unpack_ufloat_a (uint32_t data)
 Unpacks an unsigned float11 value from an uint32. More...
 
static float unpack_ufloat_b (uint32_t data)
 Unpacks an unsigned float11 value from an uint32. More...
 
static float unpack_ufloat_c (uint32_t data)
 Unpacks an unsigned float10 value from an uint32. More...
 
- 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. More...
 
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. More...
 
- Static Public Member Functions inherited from ReferenceCount
static TypeHandle get_class_type ()
 
static void init_type ()
 

Public Attributes

int NumericType Contents contents const
 
Thread *current_thread const
 
 get_array
 
 get_format
 Returns a pointer to the GeomVertexFormat structure that defines this data. More...
 
 get_modified
 Returns a sequence number which is guaranteed to change at least every time the vertex data is modified. More...
 
 get_name
 Returns the name passed to the constructor, if any. More...
 
 get_num_arrays
 Returns the number of individual arrays stored within the data. More...
 
 get_num_bytes
 Returns the total number of bytes consumed by the different arrays of the vertex data. More...
 
 get_slider_table
 Returns a const pointer to the SliderTable assigned to this data. More...
 
 get_transform_table
 Returns a const pointer to the TransformTable assigned to this data. More...
 
 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. More...
 
int num_components
 
int NumericType numeric_type
 
 set_array
 Replaces the indicated vertex data array with a completely new array. More...
 
 set_format
 Changes the format of the vertex data. More...
 
 set_name
 Changes the name of the vertex data. More...
 
 set_slider_table
 Replaces the SliderTable on this vertex data with the indicated table. More...
 
 set_transform_table
 Replaces the TransformTable on this vertex data with the indicated table. More...
 
 set_usage_hint
 Changes the UsageHint hint for this vertex data, and for all of the arrays that share this data. More...
 
- Public Attributes inherited from CachedTypedWritableReferenceCount
 get_cache_ref_count
 Returns the current reference count. More...
 
- Public Attributes inherited from TypedWritableReferenceCount
static BamReaderreader = nullptr)
 
- Public Attributes inherited from TypedObject
 get_type
 
- Public Attributes inherited from ReferenceCount
 get_ref_count
 Returns the current reference count. More...
 

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.

Constructor & Destructor Documentation

◆ GeomVertexData()

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 106 of file geomVertexData.cxx.

Member Function Documentation

◆ 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 1386 of file geomVertexData.cxx.

Referenced by PT(), and set_transform_blend_table().

◆ 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 344 of file geomVertexData.cxx.

◆ 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 281 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 233 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 179 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 2019 of file geomVertexData.cxx.

◆ 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 477 of file geomVertexData.cxx.

References CPT(), GeomVertexFormat::get_array, GeomVertexWriter::get_array(), GeomVertexFormat::get_array_with(), GeomVertexArrayFormat::get_column, get_format, GeomVertexColumn::get_name(), GeomVertexFormat::get_num_arrays, GeomVertexArrayFormat::get_num_columns, get_num_rows(), GeomVertexArrayFormat::is_data_subset_of(), and set_array.

◆ 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 687 of file geomVertexData.cxx.

References GeomVertexDataPipelineWriter::copy_row_from().

◆ 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 2041 of file geomVertexData.cxx.

◆ 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 62 of file geomVertexData.I.

Referenced by copy_from(), GeomPrimitive::pack_vertices(), and PT().

◆ 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 52 of file geomVertexData.I.

◆ 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 145 of file geomVertexData.cxx.

◆ pack_abcd()

uint32_t GeomVertexData::pack_abcd ( unsigned int  a,
unsigned int  b,
unsigned int  c,
unsigned int  d 
)
inlinestatic

Packs four values in a DirectX-style NT_packed_abcd value.

Definition at line 309 of file geomVertexData.I.

◆ pack_ufloat()

uint32_t GeomVertexData::pack_ufloat ( float  a,
float  b,
float  c 
)
inlinestatic

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

Definition at line 353 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 1980 of file geomVertexData.cxx.

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

◆ 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 445 of file geomVertexData.cxx.

◆ 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 2031 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 133 of file geomVertexData.I.

◆ 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 97 of file geomVertexData.I.

◆ 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 409 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 1024 of file geomVertexData.cxx.

◆ transform_vertices() [2/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 1034 of file geomVertexData.cxx.

◆ transform_vertices() [3/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 1060 of file geomVertexData.cxx.

◆ 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 302 of file geomVertexData.cxx.

◆ 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 116 of file geomVertexData.I.

◆ unpack_abcd_a()

unsigned int GeomVertexData::unpack_abcd_a ( uint32_t  data)
inlinestatic

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

Definition at line 321 of file geomVertexData.I.

◆ unpack_abcd_b()

unsigned int GeomVertexData::unpack_abcd_b ( uint32_t  data)
inlinestatic

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

Definition at line 329 of file geomVertexData.I.

◆ unpack_abcd_c()

unsigned int GeomVertexData::unpack_abcd_c ( uint32_t  data)
inlinestatic

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

Definition at line 337 of file geomVertexData.I.

◆ unpack_abcd_d()

unsigned int GeomVertexData::unpack_abcd_d ( uint32_t  data)
inlinestatic

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

Definition at line 345 of file geomVertexData.I.

◆ unpack_ufloat_a()

float GeomVertexData::unpack_ufloat_a ( uint32_t  data)
inlinestatic

Unpacks an unsigned float11 value from an uint32.

Definition at line 409 of file geomVertexData.I.

◆ unpack_ufloat_b()

float GeomVertexData::unpack_ufloat_b ( uint32_t  data)
inlinestatic

Unpacks an unsigned float11 value from an uint32.

Definition at line 435 of file geomVertexData.I.

◆ unpack_ufloat_c()

float GeomVertexData::unpack_ufloat_c ( uint32_t  data)
inlinestatic

Unpacks an unsigned float10 value from an uint32.

Definition at line 461 of file geomVertexData.I.

◆ 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 1989 of file geomVertexData.cxx.

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

Member Data Documentation

◆ 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 copy_from(), and PT().

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

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

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

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

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

◆ 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: