# GeomVertexData

from pandac.PandaModules import GeomVertexData

Class : GeomVertexData
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.

## Inheritance:

GeomVertexData: TypedWritableReferenceCount GeomEnums
TypedWritableReferenceCount: TypedWritable ReferenceCount
TypedWritable: TypedObject
TypedObject:
ReferenceCount:
GeomEnums:

## Methods of GeomVertexData:

animateVertices
clearCache
clearCacheStage
clearRows
clearSliderTable
clearTransformBlendTable
clearTransformTable
convertTo
copyFrom
copyRowFrom
getArray
getClassType
getFormat
getModified
getName
getNumArrays
getNumBytes
getNumRows
getSliderTable
getTransformBlendTable
getTransformTable
getUsageHint
hasColumn
modifyArray
modifyTransformBlendTable
operator =
operator delete
operator new
output
replaceColumn
scaleColor
setArray
setColor
setFormat
setName
setNumRows
setSliderTable
setTransformBlendTable
setTransformTable
setUsageHint
write

## Methods of TypedWritableReferenceCount:

getClassType

## Methods of TypedWritable:

getClassType

## Methods of TypedObject:

getClassType
getType
getTypeIndex
isExactType
isOfType

## Methods of ReferenceCount:

getClassType
getRefCount
ref
testRefCountIntegrity
testRefCountNonzero
unref

## Constants in GeomEnums:

UHClient | (UsageHint)
UHStream | (UsageHint)
UHDynamic | (UsageHint)
UHStatic | (UsageHint)
UHUnspecified | (UsageHint)
GRIndexedPoint | (GeomRendering)
GRIndexedOther | (GeomRendering)
GRIndexedBits | (GeomRendering)
GRPoint | (GeomRendering)
GRPointUniformSize | (GeomRendering)
GRPerPointSize | (GeomRendering)
GRPointPerspective | (GeomRendering)
GRPointAspectRatio | (GeomRendering)
GRPointScale | (GeomRendering)
GRPointRotate | (GeomRendering)
GRPointSprite | (GeomRendering)
GRPointSpriteTexMatrix | (GeomRendering)
GRPointBits | (GeomRendering)
GRTriangleStrip | (GeomRendering)
GRTriangleFan | (GeomRendering)
GRLineStrip | (GeomRendering)
GRCompositeBits | (GeomRendering)
GRFlatFirstVertex | (GeomRendering)
GRFlatLastVertex | (GeomRendering)
GRShadeModelBits | (GeomRendering)
GRTexcoordLightVector | (GeomRendering)
SMUniform | (ShadeModel)
SMSmooth | (ShadeModel)
SMFlatFirstVertex | (ShadeModel)
SMFlatLastVertex | (ShadeModel)
PTNone | (PrimitiveType)
PTPolygons | (PrimitiveType)
PTLines | (PrimitiveType)
PTPoints | (PrimitiveType)
NTUint8 | (NumericType)
NTUint16 | (NumericType)
NTUint32 | (NumericType)
NTPackedDcba | (NumericType)
NTPackedDabc | (NumericType)
NTFloat32 | (NumericType)
COther | (Contents)
CPoint | (Contents)
CClipPoint | (Contents)
CVector | (Contents)
CTexcoord | (Contents)
CColor | (Contents)
CIndex | (Contents)
CMorphDelta | (Contents)
ATNone | (AnimationType)
ATPanda | (AnimationType)
ATHardware | (AnimationType)

animateVertices ConstPointerTo< GeomVertexData > GeomVertexData::animate_vertices(Thread *current_thread) const; Description: 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).

clearCache void GeomVertexData::clear_cache(void); Description: 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 void GeomVertexData::clear_cache_stage(void); Description: 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 void GeomVertexData::clear_rows(void); Description: 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 void GeomVertexData::clear_slider_table(void); Description: Sets the SliderTable pointer to NULL, removing the table from the vertex data. This disables morph (blend shape) animation.

clearTransformBlendTable void GeomVertexData::clear_transform_blend_table(void); Description: Sets the TransformBlendTable pointer to NULL, removing the table from the vertex data. This disables CPU-driven vertex animation.

clearTransformTable void GeomVertexData::clear_transform_table(void); Description: Sets the TransformTable pointer to NULL, removing the table from the vertex data. This disables hardware-driven vertex animation.

convertTo ConstPointerTo< GeomVertexData > GeomVertexData::convert_to(GeomVertexFormat const *new_format) const; Description: 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 void GeomVertexData::copy_from(GeomVertexData const *source, bool keep_data_objects, Thread *current_thread = ((get_current_thread()))); Description: 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, but their data arrays are copied pointerwise from the source; if it is false, then the GeomVertexArrayData objects themselves 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 void GeomVertexData::copy_row_from(int dest_row, GeomVertexData const *source, int source_row, Thread *current_thread); Description: 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.

getArray GeomVertexArrayData const *GeomVertexData::get_array(int i) const; Description: 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.

getClassType static TypeHandle GeomVertexData::get_class_type(void); Undocumented function.

getFormat GeomVertexFormat const *GeomVertexData::get_format(void) const; Description: Returns a pointer to the GeomVertexFormat structure that defines this data.

getModified UpdateSeq GeomVertexData::get_modified(Thread *current_thread = ((get_current_thread()))) const; Description: Returns a sequence number which is guaranteed to change at least every time the vertex data is modified.

getName string const &GeomVertexData::get_name(void) const; Filename: geomVertexData.I Created by: drose (06Mar05) PANDA 3D SOFTWARE Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved All use of this software is subject to the terms of the Panda 3d Software license. You should have received a copy of this license along with this source code; you will also find a current copy of the license at http://etc.cmu.edu/panda3d/docs/license/ . To contact the maintainers of this program write to panda3d-general@lists.sourceforge.net . Description: Returns the name passed to the constructor, if any. This name is reported on the PStats graph for vertex computations.

getNumArrays int GeomVertexData::get_num_arrays(void) const; Description: Returns the number of individual arrays stored within the data. This must match get_format()->get_num_arrays().

getNumBytes int GeomVertexData::get_num_bytes(void) const; Description: Returns the total number of bytes consumed by the different arrays of the vertex data.

getNumRows int GeomVertexData::get_num_rows(void) const; Description: Returns the number of rows stored within all the arrays. All arrays store data for the same n rows.

getSliderTable SliderTable const *GeomVertexData::get_slider_table(void) const; Description: 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 TransformBlendTable const *GeomVertexData::get_transform_blend_table(void) const; Description: 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 TransformTable const *GeomVertexData::get_transform_table(void) const; Description: 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 GeomVertexData::get_usage_hint(void) const; Description: 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 GeomVertexData::has_column(InternalName const *name) const; Description: 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 *GeomVertexData::modify_array(int i); Description: 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.

modifyTransformBlendTable TransformBlendTable *GeomVertexData::modify_transform_blend_table(void); Description: 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 = void GeomVertexData::operator =(GeomVertexData const &copy); Description: 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.

operator delete void GeomVertexData::operator delete(void *ptr); Undocumented function.

operator new void *GeomVertexData::operator new(unsigned int size); Undocumented function.

output void GeomVertexData::output(ostream &out) const; Description:

replaceColumn PointerTo< GeomVertexData > GeomVertexData::replace_column(InternalName *name, int num_components, GeomEnums::NumericType numeric_type, GeomEnums::Contents contents) const; Description: 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.

scaleColor ConstPointerTo< GeomVertexData > GeomVertexData::scale_color(LVecBase4f const &color_scale) const; Description: 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. Description: 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 void GeomVertexData::set_array(int i, GeomVertexArrayData const *array); Description: 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 ConstPointerTo< GeomVertexData > GeomVertexData::set_color(LVecBase4f const &color) const; Description: 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. Description: 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 void GeomVertexData::set_format(GeomVertexFormat const *format); Description: 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 void GeomVertexData::set_name(string const &name); Description: Changes the name of the vertex data. This name is reported on the PStats graph for vertex computations.

setNumRows bool GeomVertexData::set_num_rows(int n); Description: 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). Although this method is Published, application code only very rarely has any need to call it. Instead, you should use the GeomVertexWriter to build up the rows in a GeomVertexData object automatically, without need to explicitly set the number of rows. 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 void GeomVertexData::set_slider_table(SliderTable const *table); Description: 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 void GeomVertexData::set_transform_blend_table(TransformBlendTable const *table); Description: 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 void GeomVertexData::set_transform_table(TransformTable const *table); Description: 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 void GeomVertexData::set_usage_hint(GeomEnums::UsageHint usage_hint); Description: 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.

write void GeomVertexData::write(ostream &out, int indent_level = (0)) const; Description:

getClassType static TypeHandle TypedWritableReferenceCount::get_class_type(void); Undocumented function.

getClassType static TypeHandle TypedWritable::get_class_type(void); Undocumented function.

getClassType static TypeHandle TypedObject::get_class_type(void); Undocumented function.

getType virtual TypeHandle TypedObject::get_type(void) const = 0; Derived classes should override this function to return get_class_type().

getTypeIndex int TypedObject::get_type_index(void) const; Description: Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. This is equivalent to get_type().get_index().

isExactType bool TypedObject::is_exact_type(TypeHandle handle) const; Description: Returns true if the current object is the indicated type exactly.

isOfType bool TypedObject::is_of_type(TypeHandle handle) const; Description: Returns true if the current object is or derives from the indicated type.

getClassType static TypeHandle ReferenceCount::get_class_type(void); Undocumented function.

getRefCount int ReferenceCount::get_ref_count(void) const; Description: Returns the current reference count.

ref void ReferenceCount::ref(void) const; Description: Explicitly increments the reference count. User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically. This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it.

testRefCountIntegrity bool ReferenceCount::test_ref_count_integrity(void) const; Description: Does some easy checks to make sure that the reference count isn't completely bogus. Returns true if ok, false otherwise.

testRefCountNonzero bool ReferenceCount::test_ref_count_nonzero(void) const; Description: Does some easy checks to make sure that the reference count isn't zero, or completely bogus. Returns true if ok, false otherwise.

unref bool ReferenceCount::unref(void) const; Description: Explicitly decrements the reference count. Note that the object will not be implicitly deleted by unref() simply because the reference count drops to zero. (Having a member function delete itself is problematic; plus, we don't have a virtual destructor anyway.) However, see the helper function unref_delete(). User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically. This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it. The return value is true if the new reference count is nonzero, false if it is zero.