# GeomTrifans

from pandac.PandaModules import GeomTrifans

Class : GeomTrifans
Description : Defines a series of triangle fans.

## Inheritance:

GeomTrifans: GeomPrimitive
GeomPrimitive: TypedWritableReferenceCount GeomEnums
TypedWritableReferenceCount: TypedWritable ReferenceCount
TypedWritable: TypedObject
TypedObject:
ReferenceCount:
GeomEnums:

## Methods of GeomTrifans:

getClassType

## Methods of GeomPrimitive:

addConsecutiveVertices
addNextVertices
addVertex
addVertices
checkValid
clearVertices
closePrimitive
decompose
getClassType
getDataSizeBytes
getFirstVertex
getGeomRendering
getIndexType
getMaxVertex
getMinVertex
getModified
getNumBytes
getNumFaces
getNumPrimitives
getNumVertices
getPrimitiveEnd
getPrimitiveMaxVertex
getPrimitiveMinVertex
getPrimitiveNumFaces
getPrimitiveNumVertices
getPrimitiveStart
getPrimitiveType
getShadeModel
getUsageHint
getVertex
isComposite
isIndexed
makeCopy
makeIndexed
makeNonindexed
matchShadeModel
offsetVertices
operator =
operator delete
operator new
output
packVertices
rotate
setIndexType
setShadeModel
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)

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

addConsecutiveVertices void GeomPrimitive::add_consecutive_vertices(int start, int num_vertices); Description: Adds a consecutive sequence of vertices, beginning at start, to the primitive. 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.

addNextVertices void GeomPrimitive::add_next_vertices(int num_vertices); Description: Adds the next n vertices in sequence, beginning from the last vertex added to the primitive + 1. This is most useful when you are building up a primitive and a GeomVertexData at the same time, and you just want the primitive to reference the first n vertices from the data, then the next n, and so on.

addVertex void GeomPrimitive::add_vertex(int vertex); Description: Adds the indicated vertex to the list of vertex indices used by the graphics primitive type. To define a primitive, you must call add_vertex() for each vertex of the new primitive, and then call close_primitive() after you have specified the last vertex of each primitive. 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.

addVertices void GeomPrimitive::add_vertices(int v1, int v2); Description: Adds several vertices in a row.

checkValid bool GeomPrimitive::check_valid(GeomVertexData const *vertex_data) const; Description: Verifies that the primitive only references vertices that actually exist within the indicated GeomVertexData. Returns true if the primitive appears to be valid, false otherwise.

clearVertices void GeomPrimitive::clear_vertices(void); Description: Removes all of the vertices and primitives from the object, so they can be re-added. 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.

closePrimitive bool GeomPrimitive::close_primitive(void); Description: Indicates that the previous n calls to add_vertex(), since the last call to close_primitive(), have fully defined a new primitive. Returns true if successful, false otherwise. 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.

decompose ConstPointerTo< GeomPrimitive > GeomPrimitive::decompose(void) const; Description: Decomposes a complex primitive type into a simpler primitive type, for instance triangle strips to triangles, and returns a pointer to the new primitive definition. If the decomposition cannot be performed, this might return the original object. This method is useful for application code that wants to iterate through the set of triangles on the primitive without having to write handlers for each possible kind of primitive type.

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

getDataSizeBytes int GeomPrimitive::get_data_size_bytes(void) const; Description: Returns the number of bytes stored in the vertices array.

getFirstVertex int GeomPrimitive::get_first_vertex(void) const; Description: Returns the first vertex number referenced by the primitive. This is particularly important in the case of a nonindexed primitive, in which case get_first_vertex() and get_num_vertices() completely define the extent of the vertex range.

getGeomRendering virtual int GeomPrimitive::get_geom_rendering(void) const; Description: Returns the set of GeomRendering bits that represent the rendering properties required to properly render this primitive.

getIndexType GeomEnums::NumericType GeomPrimitive::get_index_type(void) const; Description: Returns the numeric type of the index column. Normally, this will be either NT_uint16 or NT_uint32.

getMaxVertex int GeomPrimitive::get_max_vertex(void) const; Description: Returns the maximum vertex index number used by all the primitives in this object.

getMinVertex int GeomPrimitive::get_min_vertex(void) const; Description: Returns the minimum vertex index number used by all the primitives in this object.

getModified UpdateSeq GeomPrimitive::get_modified(void) const; Description: Returns a sequence number which is guaranteed to change at least every time the vertex index array is modified.

getNumBytes int GeomPrimitive::get_num_bytes(void) const; Description: Returns the number of bytes consumed by the primitive and its index table(s).

getNumFaces int GeomPrimitive::get_num_faces(void) const; Description: Returns the number of triangles or other fundamental type (such as line segments) represented by all the primitives in this object.

getNumPrimitives int GeomPrimitive::get_num_primitives(void) const; Description: Returns the number of individual primitives stored within this object. All primitives are the same type.

getNumVertices int GeomPrimitive::get_num_vertices(void) const; Description: Returns the number of vertex vertices used by all the primitives in this object.

getPrimitiveEnd int GeomPrimitive::get_primitive_end(int n) const; Description: Returns the element within the _vertices list at which the nth primitive ends. This is one past the last valid element for the nth primitive.

getPrimitiveMaxVertex int GeomPrimitive::get_primitive_max_vertex(int n) const; Description: Returns the maximum vertex index number used by the nth primitive in this object.

getPrimitiveMinVertex int GeomPrimitive::get_primitive_min_vertex(int n) const; Description: Returns the minimum vertex index number used by the nth primitive in this object.

getPrimitiveNumFaces int GeomPrimitive::get_primitive_num_faces(int n) const; Description: Returns the number of triangles or other fundamental type (such as line segments) represented by the nth primitive in this object.

getPrimitiveNumVertices int GeomPrimitive::get_primitive_num_vertices(int n) const; Description: Returns the number of vertices used by the nth primitive. This is the same thing as get_primitive_end(n) - get_primitive_start(n).

getPrimitiveStart int GeomPrimitive::get_primitive_start(int n) const; Description: Returns the element within the _vertices list at which the nth primitive starts. If i is one more than the highest valid primitive vertex, the return value will be one more than the last valid vertex. Thus, it is generally true that the vertices used by a particular primitive i are the set get_primitive_start(n) <= vi < get_primitive_start(n + 1) (although this range also includes the unused vertices between primitives).

getPrimitiveType virtual GeomEnums::PrimitiveType GeomPrimitive::get_primitive_type(void) const = 0; Undocumented function.

getShadeModel GeomEnums::ShadeModel GeomPrimitive::get_shade_model(void) const; Filename: geomPrimitive.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 ShadeModel hint for this primitive. This is intended as a hint to the renderer to tell it how the per-vertex colors and normals are applied.

getUsageHint GeomEnums::UsageHint GeomPrimitive::get_usage_hint(void) const; Description: Returns the usage hint for this primitive. See geomEnums.h. This has nothing to do with the usage hint associated with the primitive's vertices; this only specifies how often the vertex indices that define the primitive will be modified. It is perfectly legal (and, in fact, common) for a GeomPrimitive to have UH_static on itself, while referencing vertex data with UH_dynamic. This means that the vertices themselves will be animated, but the primitive will always reference the same set of vertices from the pool.

getVertex int GeomPrimitive::get_vertex(int i) const; Description: Returns the ith vertex index in the table.

isComposite bool GeomPrimitive::is_composite(void) const; The following published methods are provided for safe, high-level iteration through the vertices and sub-primitives within the GeomPrimitive class. These work correctly regardless of the primitive type and without depending on knowledge about the way primitives' lengths are encoded. You can also safely build up a composite primitive using these methods. Description: Returns true if the primitive is a composite primitive such as a tristrip or trifan, or false if it is a fundamental primitive such as a collection of triangles.

isIndexed bool GeomPrimitive::is_indexed(void) const; Description: Returns true if the primitive is indexed, false otherwise. An indexed primitive stores a table of index numbers into its GeomVertexData, so that it can reference the vertices in any order. A nonindexed primitive, on the other hand, stores only the first vertex number and number of vertices used, so that it can only reference the vertices consecutively.

makeCopy virtual PointerTo< GeomPrimitive > GeomPrimitive::make_copy(void) const = 0; Undocumented function.

makeIndexed void GeomPrimitive::make_indexed(void); Description: Converts the primitive from nonindexed form to indexed form. This will simply create an index table that is numbered consecutively from get_first_vertex(); it does not automatically collapse together identical vertices that may have been split apart by a previous call to make_nonindexed(). 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.

makeNonindexed void GeomPrimitive::make_nonindexed(GeomVertexData *dest, GeomVertexData const *source); Description: Converts the primitive from indexed to nonindexed by duplicating vertices as necessary into the indicated dest GeomVertexData.

matchShadeModel ConstPointerTo< GeomPrimitive > GeomPrimitive::match_shade_model(GeomEnums::ShadeModel shade_model) const; Description: Returns a new primitive that is compatible with the indicated shade model, if possible, or NULL if this is not possible. In most cases, this will return either NULL or the original primitive. In the case of a SM_flat_first_vertex vs. a SM_flat_last_vertex (or vice-versa), however, it will return a rotated primitive.

offsetVertices void GeomPrimitive::offset_vertices(int offset); Description: Adds the indicated offset to all vertices used by the primitive. 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 GeomPrimitive::operator =(GeomPrimitive 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 GeomPrimitive that is actively being used for rendering.

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

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

output virtual void GeomPrimitive::output(ostream &out) const; Description:

packVertices void GeomPrimitive::pack_vertices(GeomVertexData *dest, GeomVertexData const *source); Description: Packs the vertices used by the primitive from the indicated source array onto the end of the indicated destination array.

rotate ConstPointerTo< GeomPrimitive > GeomPrimitive::rotate(void) const; Description: Returns a new primitive with the shade_model reversed (if it is flat shaded), if possible. If the primitive type cannot be rotated, returns the original primitive, unrotated. If the current shade_model indicates flat_vertex_last, this should bring the last vertex to the first position; if it indicates flat_vertex_first, this should bring the first vertex to the last position.

setIndexType void GeomPrimitive::set_index_type(GeomEnums::NumericType index_type); Description: Changes the numeric type of the index column. Normally, this should be either NT_uint16 or NT_uint32. The index type must be large enough to include all of the index values in the primitive. It may be automatically elevated, if necessary, to a larger index type, by a subsequent call to add_index() that names an index value that does not fit in the index type you specify. 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.

setShadeModel void GeomPrimitive::set_shade_model(GeomEnums::ShadeModel shade_model); Description: Changes the ShadeModel hint for this primitive. This is different from the ShadeModelAttrib that might also be applied from the scene graph. This does not affect the shade model that is in effect when rendering, but rather serves as a hint to the renderer to tell it how the per-vertex colors and normals on this primitive are applied. 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 GeomPrimitive::set_usage_hint(GeomEnums::UsageHint usage_hint); Description: Changes the UsageHint hint for this primitive. 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 virtual void GeomPrimitive::write(ostream &out, int indent_level) 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.