# GeomVertexFormat

from pandac.PandaModules import GeomVertexFormat

Class : GeomVertexFormat
Description : This class defines the physical layout of the vertex data stored within a Geom. The layout consists of a list of named columns, each of which has a numeric type and a size.
The columns are typically interleaved within a single array, but they may also be distributed among multiple different arrays; at the extreme, each column may be alone within its own array (which amounts to a parallel-array definition).
Thus, a GeomVertexFormat is really a list of GeomVertexArrayFormats, each of which contains a list of columns. However, a particular column name should not appear more than once in the format, even between different arrays.
There are a handful of standard pre-defined GeomVertexFormat objects, or you may define your own as needed. You may record any combination of standard and/or user-defined columns in your custom GeomVertexFormat constructions.

## Inheritance:

GeomVertexFormat: TypedWritableReferenceCount GeomEnums
TypedWritableReferenceCount: TypedWritable ReferenceCount
TypedWritable: TypedObject
TypedObject: MemoryBase
MemoryBase:
ReferenceCount: MemoryBase
GeomEnums:

## Methods of GeomVertexFormat:

addArray
clearArrays
getAnimation
getArray
getArrayWith
getClassType
getColumn
getMorphBase
getMorphDelta
getMorphSlider
getNumArrays
getNumColumns
getNumMorphs
getNumPoints
getNumTexcoords
getNumVectors
getPoint
getPostAnimatedFormat
getTexcoord
getUnionFormat
getV3
getV3c4
getV3c4t2
getV3cp
getV3cpt2
getV3n3
getV3n3c4
getV3n3c4t2
getV3n3cp
getV3n3cpt2
getV3n3t2
getV3t2
getVector
hasColumn
insertArray
isRegistered
modifyArray
operator =
output
packColumns
registerFormat
removeArray
removeColumn
setAnimation
setArray
unref
write
writeWithData

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

addArray int GeomVertexFormat::add_array(GeomVertexArrayFormat const *array_format); Description: Adds the indicated array definition to the list of arrays included within this vertex format definition. The return value is the index number of the new array. This may not be called once the format has been registered.

clearArrays void GeomVertexFormat::clear_arrays(void); Description: Removes all of the array definitions from the format and starts over. This may not be called once the format has been registered.

getAnimation GeomVertexAnimationSpec const &GeomVertexFormat::get_animation(void) const; Description: Returns the GeomVertexAnimationSpec that indicates how this format's vertices are set up for animation.

getArray GeomVertexArrayFormat const *GeomVertexFormat::get_array(int array) const; Description: Returns the description of the nth array used by the format.

getArrayWith int GeomVertexFormat::get_array_with(int i) const; Description: Returns the index number of the array with the ith column. The return value can be passed to get_array_format() to get the format of the array. It may also be passed to GeomVertexData::get_array_data() or get_data() or set_data() to manipulate the actual array data. Description: Returns the index number of the array with the indicated column, or -1 if no arrays contained that name. This may only be called after the format has been registered.

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

getColumn GeomVertexColumn const *GeomVertexFormat::get_column(int i) const; Description: Returns the ith column of the specification, across all arrays. Description: Returns the specification with the indicated name, or NULL if the name is not used. Use get_array_with() to determine which array this column is associated with.

getMorphBase InternalName const *GeomVertexFormat::get_morph_base(int n) const; Description: Returns the name of the base column that the nth morph modifies. This column will also be defined within the format, and can be retrieved via get_array_with() and/or get_column(). This may only be called after the format has been registered.

getMorphDelta InternalName const *GeomVertexFormat::get_morph_delta(int n) const; Description: Returns the name of the column that defines the nth morph. This contains the delta offsets that are to be applied to the column defined by get_morph_base(). This column will be defined within the format, and can be retrieved via get_array_with() and/or get_column(). This may only be called after the format has been registered.

getMorphSlider InternalName const *GeomVertexFormat::get_morph_slider(int n) const; Description: Returns the slider name associated with the nth morph column. This is the name of the slider that will control the morph, and should be defined within the SliderTable associated with the GeomVertexData. This may only be called after the format has been registered.

getNumArrays int GeomVertexFormat::get_num_arrays(void) const; Description: Returns the number of individual arrays required by the format. If the array data is completely interleaved, this will be 1; if it is completely parallel, this will be the same as the number of data types.

getNumColumns int GeomVertexFormat::get_num_columns(void) const; Description: Returns the total number of different columns in the specification, across all arrays.

getNumMorphs int GeomVertexFormat::get_num_morphs(void) const; Description: Returns the number of columns within the format that represent morph deltas. This may only be called after the format has been registered.

getNumPoints int GeomVertexFormat::get_num_points(void) const; Description: Returns the number of columns within the format that represent points in space. This may only be called after the format has been registered.

getNumTexcoords int GeomVertexFormat::get_num_texcoords(void) const; Description: Returns the number of columns within the format that represent texture coordinates. This may only be called after the format has been registered.

getNumVectors int GeomVertexFormat::get_num_vectors(void) const; Description: Returns the number of columns within the format that represent directional vectors. This may only be called after the format has been registered.

getPoint InternalName const *GeomVertexFormat::get_point(int n) const; Description: Returns the name of the nth point column. This represents a point in space, which should be transformed by any spatial transform matrix. This may only be called after the format has been registered.

getPostAnimatedFormat ConstPointerTo< GeomVertexFormat > GeomVertexFormat::get_post_animated_format(void) const; Description: Returns a suitable vertex format for sending the animated vertices to the graphics backend. This is the same format as the source format, with the CPU-animation data elements removed. This may only be called after the format has been registered. The return value will have been already registered.

getTexcoord InternalName const *GeomVertexFormat::get_texcoord(int n) const; Description: Returns the name of the nth texcoord column. This represents a texture coordinate. This may only be called after the format has been registered.

getUnionFormat ConstPointerTo< GeomVertexFormat > GeomVertexFormat::get_union_format(GeomVertexFormat const *other) const; Description: Returns a new GeomVertexFormat that includes all of the columns defined in either this GeomVertexFormat or the other one. If any column is defined in both formats with different sizes (for instance, texcoord2 vs. texcoord3), the new format will include the larger of the two definitions. This may only be called after both source formats have been registered. The return value will also have been already registered.

getV3 static GeomVertexFormat const *GeomVertexFormat::get_v3(void); Some standard vertex formats. No particular requirement to use one of these, but the DirectX renderers can use these formats directly, whereas any other format will have to be converted first. Description: Returns a standard vertex format with just a 3-component vertex position.

getV3c4 static GeomVertexFormat const *GeomVertexFormat::get_v3c4(void); These formats, with an OpenGL-style four-byte color, are not supported directly by DirectX. If you use them, the DXGraphicsStateGuardian will automatically convert to DirectX form (with a larger runtime overhead, since DirectX8, and old DirectX9 drivers, require everything to be interleaved together). Description: Returns a standard vertex format with a 4-component color and a 3-component vertex position.

getV3c4t2 static GeomVertexFormat const *GeomVertexFormat::get_v3c4t2(void); These formats, with an OpenGL-style four-byte color, are not supported directly by DirectX. If you use them, the DXGraphicsStateGuardian will automatically convert to DirectX form (with a larger runtime overhead, since DirectX8, and old DirectX9 drivers, require everything to be interleaved together). Description: Returns a standard vertex format with a 2-component texture coordinate pair, a 4-component color, and a 3-component vertex position.

getV3cp static GeomVertexFormat const *GeomVertexFormat::get_v3cp(void); These formats, with the DirectX-style packed color, are not supported directly by OpenGL. If you use them, the GLGraphicsStateGuardian will automatically convert to OpenGL form (with a small runtime overhead). Description: Returns a standard vertex format with a packed color and a 3-component vertex position.

getV3cpt2 static GeomVertexFormat const *GeomVertexFormat::get_v3cpt2(void); These formats, with the DirectX-style packed color, are not supported directly by OpenGL. If you use them, the GLGraphicsStateGuardian will automatically convert to OpenGL form (with a small runtime overhead). Description: Returns a standard vertex format with a 2-component texture coordinate pair, a packed color, and a 3-component vertex position.

getV3n3 static GeomVertexFormat const *GeomVertexFormat::get_v3n3(void); Some standard vertex formats. No particular requirement to use one of these, but the DirectX renderers can use these formats directly, whereas any other format will have to be converted first. Description: Returns a standard vertex format with a 3-component normal and a 3-component vertex position.

getV3n3c4 static GeomVertexFormat const *GeomVertexFormat::get_v3n3c4(void); Description: Returns a standard vertex format with a 4-component color, a 3-component normal, and a 3-component vertex position.

getV3n3c4t2 static GeomVertexFormat const *GeomVertexFormat::get_v3n3c4t2(void); Description: Returns a standard vertex format with a 2-component texture coordinate pair, a 4-component color, a 3-component normal, and a 3-component vertex position.

getV3n3cp static GeomVertexFormat const *GeomVertexFormat::get_v3n3cp(void); Description: Returns a standard vertex format with a packed color, a 3-component normal, and a 3-component vertex position.

getV3n3cpt2 static GeomVertexFormat const *GeomVertexFormat::get_v3n3cpt2(void); Description: Returns a standard vertex format with a 2-component texture coordinate pair, a packed color, a 3-component normal, and a 3-component vertex position.

getV3n3t2 static GeomVertexFormat const *GeomVertexFormat::get_v3n3t2(void); Description: Returns a standard vertex format with a 2-component texture coordinate pair, a 3-component normal, and a 3-component vertex position.

getV3t2 static GeomVertexFormat const *GeomVertexFormat::get_v3t2(void); Description: Returns a standard vertex format with a 2-component texture coordinate pair and a 3-component vertex position.

getVector InternalName const *GeomVertexFormat::get_vector(int n) const; Description: Returns the name of the nth vector column. This represents a directional vector, which should be transformed by any spatial transform matrix as a vector. This may only be called after the format has been registered.

hasColumn bool GeomVertexFormat::has_column(InternalName const *name) const; Description: Returns true if the format has the named column, false otherwise.

insertArray void GeomVertexFormat::insert_array(int array, GeomVertexArrayFormat const *array_format); Description: Adds the indicated array definition to the list of arrays at the indicated position. This works just like add_array(), except that you can specify which array index the new array should have. This may not be called once the format has been registered.

isRegistered bool GeomVertexFormat::is_registered(void) const; Description: Returns true if this format has been registered, false if it has not. It may not be used for a Geom until it has been registered, but once registered, it may no longer be modified.

modifyArray GeomVertexArrayFormat *GeomVertexFormat::modify_array(int array); Description: Returns a modifiable pointer to the indicated array. This means duplicating it if it is shared or registered. This may not be called once the format has been registered.

operator = void GeomVertexFormat::operator =(GeomVertexFormat const &copy); Description:

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

packColumns void GeomVertexFormat::pack_columns(void); Description: Removes wasted space between columns.

registerFormat static ConstPointerTo< GeomVertexFormat > GeomVertexFormat::register_format(GeomVertexFormat const *format); Description: Adds the indicated format to the registry, if there is not an equivalent format already there; in either case, returns the pointer to the equivalent format now in the registry. This must be called before a format may be used in a Geom. After this call, you should discard the original pointer you passed in (which may or may not now be invalid) and let its reference count decrement normally; you should use only the returned value from this point on. Description: This flavor of register_format() implicitly creates a one-array vertex format from the array definition.

removeArray void GeomVertexFormat::remove_array(int array); Description: Removes the nth array from the format. This may not be called once the format has been registered.

removeColumn void GeomVertexFormat::remove_column(InternalName const *name); Description: Removes the named column from the format, from whichever array it exists in. If there are other columns remaining in the array, the array is left with a gap where the column used to be; if this was the only column in the array, the array is removed. This may not be called once the format has been registered.

setAnimation void GeomVertexFormat::set_animation(GeomVertexAnimationSpec const &animation); Description: Resets the GeomVertexAnimationSpec that indicates how this format's vertices are set up for animation. You should also, of course, change the columns in the tables accordingly. This may not be called once the format has been registered.

setArray void GeomVertexFormat::set_array(int array, GeomVertexArrayFormat const *format); Description: Replaces the definition of the indicated array. This may not be called once the format has been registered.

unref bool GeomVertexFormat::unref(void) const; Description: This method overrides ReferenceCount::unref() to unregister the object when its reference count goes to zero.

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

writeWithData void GeomVertexFormat::write_with_data(ostream &out, int indent_level, GeomVertexData const *data) 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.