Panda3D
Public Member Functions | Static Public Member Functions | Public Attributes | 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...

Inheritance diagram for GeomVertexData:
CopyOnWriteObject GeomEnums CachedTypedWritableReferenceCount TypedWritableReferenceCount TypedWritable ReferenceCount TypedObject

Public Member Functions

 __init__ (const GeomVertexData copy)
 
 __init__ (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...
 
 __init__ (str name, const GeomVertexFormat format, GeomEnums::UsageHint usage_hint)
 
const GeomVertexData animateVertices (bool force, Thread current_thread)
 Returns a GeomVertexData that represents the results of computing the vertex animation on the CPU for this GeomVertexData. More...
 
 clearAnimatedVertices ()
 Removes the cache of animated vertices computed by a previous call to animate_vertices() within the same frame. More...
 
 clearCache ()
 Removes all of the previously-cached results of convert_to(). More...
 
 clearCacheStage ()
 Removes all of the previously-cached results of convert_to(), at the current pipeline stage and upstream. More...
 
 clearRows ()
 Removes all of the rows from the arrays; functionally equivalent to set_num_rows(0) (but faster). More...
 
 clearSliderTable ()
 Sets the SliderTable pointer to NULL, removing the table from the vertex data. More...
 
 clearTransformBlendTable ()
 Sets the TransformBlendTable pointer to NULL, removing the table from the vertex data. More...
 
 clearTransformTable ()
 Sets the TransformTable pointer to NULL, removing the table from the vertex data. More...
 
int compareTo (const GeomVertexData other)
 Returns 0 if the two objects are equivalent, even if they are not the same pointer. More...
 
const GeomVertexData convertTo (const GeomVertexFormat new_format)
 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. More...
 
 copyFrom (const GeomVertexData source, bool keep_data_objects, Thread 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...
 
 copyRowFrom (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...
 
 describeVertex (Ostream out, int row)
 Writes a verbose, human-friendly description of the indicated vertex number. More...
 
const GeomVertexArrayData getArray (int i)
 Returns a const pointer to the vertex data for the indicated array, for application code to directly examine (but not modify) the underlying vertex data. More...
 
const GeomVertexArrayDataHandle getArrayHandle (int i)
 Equivalent to get_array(i).get_handle(). More...
 
list getArrays ()
 
const GeomVertexFormat getFormat ()
 Returns a pointer to the GeomVertexFormat structure that defines this data. More...
 
UpdateSeq getModified (Thread current_thread)
 Returns a sequence number which is guaranteed to change at least every time the vertex data is modified. More...
 
str getName ()
 Returns the name passed to the constructor, if any. More...
 
int getNumArrays ()
 Returns the number of individual arrays stored within the data. More...
 
int getNumBytes ()
 Returns the total number of bytes consumed by the different arrays of the vertex data. More...
 
int getNumRows ()
 Returns the number of rows stored within all the arrays. More...
 
const SliderTable getSliderTable ()
 Returns a const pointer to the SliderTable assigned to this data. More...
 
const TransformBlendTable getTransformBlendTable ()
 Returns a const pointer to the TransformBlendTable assigned to this data. More...
 
const TransformTable getTransformTable ()
 Returns a const pointer to the TransformTable assigned to this data. More...
 
GeomEnums::UsageHint getUsageHint ()
 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...
 
bool hasColumn (const InternalName name)
 Returns true if the data has the named column, false otherwise. More...
 
GeomVertexArrayData modifyArray (int i)
 Returns a modifiable pointer to the indicated vertex array, so that application code may directly manipulate the data. More...
 
GeomVertexArrayDataHandle modifyArrayHandle (int i)
 Equivalent to modify_array(i).modify_handle(). More...
 
TransformBlendTable modifyTransformBlendTable ()
 Returns a modifiable pointer to the current TransformBlendTable on this vertex data, if any, or NULL if there is not a TransformBlendTable. More...
 
 operator new (int size)
 
GeomVertexData operator= (const GeomVertexData copy)
 
 output (Ostream out)
 
GeomVertexData replaceColumn (InternalName name, int num_components, GeomEnums::NumericType numeric_type, GeomEnums::Contents contents)
 Returns a new GeomVertexData object, suitable for modification, with the indicated data type replaced with a new table filled with undefined values. More...
 
bool requestResident ()
 Returns true if the vertex data is currently resident in memory. More...
 
bool reserveNumRows (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...
 
const GeomVertexData reverseNormals ()
 Returns a new GeomVertexData object with the normal data modified in-place, so that each lighting normal is now facing in the opposite direction. More...
 
const GeomVertexData scaleColor (const LVecBase4 color_scale)
 Returns a new GeomVertexData object with the color table modified in-place to apply the indicated scale. More...
 
const GeomVertexData scaleColor (const LVecBase4 color_scale, int num_components, GeomEnums::NumericType numeric_type, GeomEnums::Contents contents)
 Returns a new GeomVertexData object with the color table replaced with a new color table that has been scaled by the indicated value. More...
 
 setArray (int i, const GeomVertexArrayData array)
 Replaces the indicated vertex data array with a completely new array. More...
 
const GeomVertexData setColor (const LColor color)
 Returns a new GeomVertexData object with the color data modified in-place with the new value. More...
 
const GeomVertexData setColor (const LColor color, int num_components, GeomEnums::NumericType numeric_type, GeomEnums::Contents contents)
 Returns a new GeomVertexData object with the color table replaced with a new color table for which each vertex has the indicated value. More...
 
 setFormat (const GeomVertexFormat format)
 Changes the format of the vertex data. More...
 
 setName (str name)
 Changes the name of the vertex data. More...
 
bool setNumRows (int n)
 Sets the length of the array to n rows in all of the various arrays (presumably by adding rows). More...
 
 setSliderTable (const SliderTable table)
 Replaces the SliderTable on this vertex data with the indicated table. More...
 
 setTransformBlendTable (const TransformBlendTable table)
 Replaces the TransformBlendTable on this vertex data with the indicated table. More...
 
 setTransformTable (const TransformTable table)
 Replaces the TransformTable on this vertex data with the indicated table. More...
 
 setUsageHint (GeomEnums::UsageHint usage_hint)
 Changes the UsageHint hint for this vertex data, and for all of the arrays that share this data. More...
 
 transformVertices (const LMatrix4 mat)
 Applies the indicated transform matrix to all of the vertices in the GeomVertexData. More...
 
 transformVertices (const LMatrix4 mat, const SparseArray rows)
 Applies the indicated transform matrix to all of the vertices mentioned in the sparse array. More...
 
 transformVertices (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...
 
 uncleanSetFormat (const GeomVertexFormat format)
 Changes the format of the vertex data, without reformatting the data to match. More...
 
bool uncleanSetNumRows (int n)
 This method behaves like set_num_rows(), except the new data is not initialized. More...
 
 write (Ostream out, int indent_level)
 
- Public Member Functions inherited from CopyOnWriteObject
 cacheRef ()
 
bool cacheUnref ()
 
- Public Member Functions inherited from CachedTypedWritableReferenceCount
 cacheRef ()
 Explicitly increments the cache reference count and the normal reference count simultaneously. More...
 
bool cacheUnref ()
 Explicitly decrements the cache reference count and the normal reference count simultaneously. More...
 
int getCacheRefCount ()
 Returns the current reference count. More...
 
bool testRefCountIntegrity ()
 Does some easy checks to make sure that the reference count isn't completely bogus. More...
 
- Public Member Functions inherited from TypedWritable
object __reduce__ ()
 
object __reduce_persist__ (object pickler)
 
VectorUchar encodeToBamStream ()
 Converts the TypedWritable object into a single stream of data using a BamWriter, and returns that data as a bytes object. More...
 
bool encodeToBamStream (VectorUchar data, BamWriter writer)
 Converts the TypedWritable object into a single stream of data using a BamWriter, and stores that data in the indicated string. More...
 
 fillin (DatagramIterator scan, BamReader manager)
 This internal function is intended to be called by each class's make_from_bam() method to read in all of the relevant data from the BamFile for the new object. More...
 
UpdateSeq getBamModified ()
 Returns the current bam_modified counter. More...
 
 markBamModified ()
 Increments the bam_modified counter, so that this object will be invalidated and retransmitted on any open bam streams. More...
 
- Public Member Functions inherited from TypedObject
TypeHandle getType ()
 
int getTypeIndex ()
 Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. More...
 
bool isExactType (TypeHandle handle)
 Returns true if the current object is the indicated type exactly. More...
 
bool isOfType (TypeHandle handle)
 Returns true if the current object is or derives from the indicated type. More...
 
- Public Member Functions inherited from ReferenceCount
int getRefCount ()
 Returns the current reference count. More...
 
 ref ()
 Explicitly increments the reference count. More...
 
bool testRefCountIntegrity ()
 Does some easy checks to make sure that the reference count isn't completely bogus. More...
 
bool testRefCountNonzero ()
 Does some easy checks to make sure that the reference count isn't zero, or completely bogus. More...
 
bool unref ()
 Explicitly decrements the reference count. More...
 
- Public Member Functions inherited from GeomEnums
 __init__ ()
 
 __init__ (const GeomEnums)
 

Static Public Member Functions

static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from CopyOnWriteObject
static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from CachedTypedWritableReferenceCount
static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from TypedWritableReferenceCount
static TypedWritableReferenceCount decodeFromBamStream (VectorUchar data, BamReader reader)
 Reads the bytes created by a previous call to encode_to_bam_stream(), and extracts and returns the single object on those bytes. More...
 
static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from TypedWritable
static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from TypedObject
static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from ReferenceCount
static TypeHandle getClassType ()
 

Public Attributes

ConstPointerToGeomVertexArrayData arrays []
 
const GeomVertexFormat format
 Returns a pointer to the GeomVertexFormat structure that defines this data. More...
 
UpdateSeq modified
 Returns a sequence number which is guaranteed to change at least every time the vertex data is modified. More...
 
const String name
 Returns the name passed to the constructor, if any. More...
 
int num_bytes
 Returns the total number of bytes consumed by the different arrays of the vertex data. More...
 
const SliderTable slider_table
 Returns a const pointer to the SliderTable assigned to this data. More...
 
const TransformTable transform_table
 Returns a const pointer to the TransformTable assigned to this data. More...
 
GeomEnums::UsageHint 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...
 
- Public Attributes inherited from CachedTypedWritableReferenceCount
int cache_ref_count
 Returns the current reference count. More...
 
- Public Attributes inherited from TypedObject
TypeHandle type
 Returns the TypeHandle representing this object's type. More...
 
- Public Attributes inherited from ReferenceCount
int ref_count
 The current reference count. More...
 

Additional Inherited Members

- Public Types inherited from GeomEnums
enum  AnimationType { AT_none = 0, AT_panda = 1, AT_hardware = 2 }
 
enum  Contents {
  C_other = 0, C_point = 1, C_clip_point = 2, C_vector = 3,
  C_texcoord = 4, C_color = 5, C_index = 6, C_morph_delta = 7,
  C_matrix = 8, C_normal = 9
}
 
enum  GeomRendering {
  GR_indexed_point = 1, GR_indexed_other = 65536, GR_indexed_bits = 65537, GR_point = 2,
  GR_point_uniform_size = 4, GR_per_point_size = 8, GR_point_perspective = 16, GR_point_aspect_ratio = 32,
  GR_point_scale = 64, GR_point_rotate = 128, GR_point_sprite = 256, GR_point_sprite_tex_matrix = 512,
  GR_point_bits = 1022, GR_triangle_strip = 1024, GR_triangle_fan = 2048, GR_line_strip = 4096,
  GR_composite_bits = 7168, GR_strip_cut_index = 131072, GR_flat_first_vertex = 8192, GR_flat_last_vertex = 16384,
  GR_shade_model_bits = 24576, GR_render_mode_wireframe = 262144, GR_render_mode_point = 524288, GR_adjacency = 1048576
}
 
enum  NumericType {
  NT_uint8 = 0, NT_uint16 = 1, NT_uint32 = 2, NT_packed_dcba = 3,
  NT_packed_dabc = 4, NT_float32 = 5, NT_float64 = 6, NT_stdfloat = 7,
  NT_int8 = 8, NT_int16 = 9, NT_int32 = 10, NT_packed_ufloat = 11
}
 
enum  PrimitiveType {
  PT_none = 0, PT_polygons = 1, PT_lines = 2, PT_points = 3,
  PT_patches = 4
}
 
enum  ShadeModel { SM_uniform = 0, SM_smooth = 1, SM_flat_first_vertex = 2, SM_flat_last_vertex = 3 }
 
enum  UsageHint {
  UH_client = 0, UH_stream = 1, UH_dynamic = 2, UH_static = 3,
  UH_unspecified = 4
}
 

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.

Member Function Documentation

◆ __init__() [1/3]

__init__ ( const GeomVertexData  copy)

◆ __init__() [2/3]

__init__ ( 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.

◆ __init__() [3/3]

__init__ ( str  name,
const GeomVertexFormat  format,
GeomEnums::UsageHint  usage_hint 
)

◆ animateVertices()

const GeomVertexData animateVertices ( bool  force,
Thread  current_thread 
)

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.

◆ clearAnimatedVertices()

clearAnimatedVertices ( )

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.

◆ clearCache()

clearCache ( )

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.

◆ clearCacheStage()

clearCacheStage ( )

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.

◆ clearRows()

clearRows ( )

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.

◆ clearSliderTable()

clearSliderTable ( )

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

This disables morph (blend shape) animation.

◆ clearTransformBlendTable()

clearTransformBlendTable ( )

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

This disables CPU-driven vertex animation.

◆ clearTransformTable()

clearTransformTable ( )

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

This disables hardware-driven vertex animation.

◆ compareTo()

int compareTo ( const GeomVertexData  other)

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

◆ convertTo()

const GeomVertexData convertTo ( const GeomVertexFormat  new_format)

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.

◆ copyFrom()

copyFrom ( const GeomVertexData  source,
bool  keep_data_objects,
Thread  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.

◆ copyRowFrom()

copyRowFrom ( 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.

◆ describeVertex()

describeVertex ( Ostream  out,
int  row 
)

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

◆ getArray()

const GeomVertexArrayData getArray ( int  i)

Returns a const pointer to the vertex data for the indicated array, for application code to directly examine (but not modify) the underlying vertex data.

◆ getArrayHandle()

const GeomVertexArrayDataHandle getArrayHandle ( int  i)

Equivalent to get_array(i).get_handle().

◆ getArrays()

list getArrays ( )

◆ getClassType()

static TypeHandle getClassType ( )
static

◆ getFormat()

const GeomVertexFormat getFormat ( )

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

◆ getModified()

UpdateSeq getModified ( Thread  current_thread)

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

◆ getName()

str getName ( )

Returns the name passed to the constructor, if any.

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

◆ getNumArrays()

int getNumArrays ( )

Returns the number of individual arrays stored within the data.

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

◆ getNumBytes()

int getNumBytes ( )

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

◆ getNumRows()

int getNumRows ( )

Returns the number of rows stored within all the arrays.

All arrays store data for the same n rows.

◆ getSliderTable()

const SliderTable getSliderTable ( )

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.

◆ getTransformBlendTable()

const TransformBlendTable getTransformBlendTable ( )

Returns a const pointer to the TransformBlendTable 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 CPU (but also see get_transform_table()).

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

◆ getTransformTable()

const TransformTable getTransformTable ( )

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

◆ getUsageHint()

GeomEnums::UsageHint getUsageHint ( )

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.

◆ hasColumn()

bool hasColumn ( const InternalName  name)

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.

◆ modifyArray()

GeomVertexArrayData modifyArray ( int  i)

Returns a modifiable pointer to the indicated vertex array, so that application code may directly manipulate the data.

You should avoid changing the length of this array, since all of the arrays should be kept in sync–use set_num_rows() instead.

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.

◆ modifyArrayHandle()

GeomVertexArrayDataHandle modifyArrayHandle ( int  i)

Equivalent to modify_array(i).modify_handle().

◆ modifyTransformBlendTable()

TransformBlendTable modifyTransformBlendTable ( )

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.

◆ operator new()

operator new ( int  size)

◆ operator=()

GeomVertexData operator= ( const GeomVertexData  copy)

◆ output()

output ( Ostream  out)

◆ replaceColumn()

GeomVertexData replaceColumn ( InternalName  name,
int  num_components,
GeomEnums::NumericType  numeric_type,
GeomEnums::Contents  contents 
)

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.

◆ requestResident()

bool requestResident ( )

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.

◆ reserveNumRows()

bool reserveNumRows ( 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.

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.

◆ reverseNormals()

const GeomVertexData reverseNormals ( )

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.

◆ scaleColor() [1/2]

const GeomVertexData scaleColor ( const LVecBase4  color_scale)

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.

◆ scaleColor() [2/2]

const GeomVertexData scaleColor ( const LVecBase4  color_scale,
int  num_components,
GeomEnums::NumericType  numeric_type,
GeomEnums::Contents  contents 
)

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.

◆ setArray()

setArray ( int  i,
const GeomVertexArrayData  array 
)

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.

◆ setColor() [1/2]

const GeomVertexData setColor ( const LColor  color)

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.

◆ setColor() [2/2]

const GeomVertexData setColor ( const LColor  color,
int  num_components,
GeomEnums::NumericType  numeric_type,
GeomEnums::Contents  contents 
)

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.

◆ setFormat()

setFormat ( const GeomVertexFormat  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.

◆ setName()

setName ( str  name)

Changes the name of the vertex data.

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

◆ setNumRows()

bool setNumRows ( int  n)

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.

◆ setSliderTable()

setSliderTable ( const SliderTable  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.

◆ setTransformBlendTable()

setTransformBlendTable ( 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.

◆ setTransformTable()

setTransformTable ( const TransformTable  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.

◆ setUsageHint()

setUsageHint ( GeomEnums::UsageHint  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.

◆ transformVertices() [1/3]

transformVertices ( 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.

◆ transformVertices() [2/3]

transformVertices ( 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.

◆ transformVertices() [3/3]

transformVertices ( 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.

◆ uncleanSetFormat()

uncleanSetFormat ( 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.

◆ uncleanSetNumRows()

bool uncleanSetNumRows ( int  n)

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

◆ write()

write ( Ostream  out,
int  indent_level 
)

Member Data Documentation

◆ arrays

ConstPointerToGeomVertexArrayData arrays[]

◆ format

const GeomVertexFormat format

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

◆ modified

UpdateSeq modified

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

◆ name

const String name

Returns the name passed to the constructor, if any.

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

◆ num_bytes

int num_bytes

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

◆ slider_table

const SliderTable slider_table

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.

◆ transform_table

const TransformTable transform_table

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

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

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.