GeomPrimitive

from panda3d.core import GeomPrimitive
class GeomPrimitive

Bases: CopyOnWriteObject, GeomEnums

This is an abstract base class for a family of classes that represent the fundamental geometry primitives that may be stored in a Geom.

They all have in common the fact that they are defined by tables of vertex data stored in a GeomVertexData object. Each GeomPrimitive object contains an ordered list of integers, which index into the vertex array defined by the GeomVertexData and define the particular vertices of the GeomVertexData that are used for this primitive.

The meaning of a given arrangement of vertices is defined by each individual primitive type; for instance, a GeomTriangle renders a triangle from each three consecutive vertices, while a GeomTriangleStrip renders a strip of (n - 2) connected triangles from each sequence of n vertices.

Inheritance diagram

Inheritance diagram of GeomPrimitive

__init__(*args, **kwargs)
addConsecutiveVertices()

C++ Interface: add_consecutive_vertices(const GeomPrimitive self, int start, int num_vertices)

/**
  • 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()

C++ Interface: add_next_vertices(const GeomPrimitive self, int num_vertices)

/**
  • 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()

C++ Interface: add_vertex(const GeomPrimitive self, int vertex)

/**
  • 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()

C++ Interface: add_vertices(const GeomPrimitive self, int v1, int v2) add_vertices(const GeomPrimitive self, int v1, int v2, int v3) add_vertices(const GeomPrimitive self, int v1, int v2, int v3, int v4)

/**
  • Adds several vertices in a row.

*/

/**
  • Adds several vertices in a row.

*/

/**
  • Adds several vertices in a row.

*/

add_consecutive_vertices()

C++ Interface: add_consecutive_vertices(const GeomPrimitive self, int start, int num_vertices)

/**
  • 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.

*/

add_next_vertices()

C++ Interface: add_next_vertices(const GeomPrimitive self, int num_vertices)

/**
  • 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.

*/

add_vertex()

C++ Interface: add_vertex(const GeomPrimitive self, int vertex)

/**
  • 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.

*/

add_vertices()

C++ Interface: add_vertices(const GeomPrimitive self, int v1, int v2) add_vertices(const GeomPrimitive self, int v1, int v2, int v3) add_vertices(const GeomPrimitive self, int v1, int v2, int v3, int v4)

/**
  • Adds several vertices in a row.

*/

/**
  • Adds several vertices in a row.

*/

/**
  • Adds several vertices in a row.

*/

checkValid()

C++ Interface: check_valid(GeomPrimitive self, const GeomVertexData vertex_data)

/**
  • 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.

*/

/**

*/

check_valid()

C++ Interface: check_valid(GeomPrimitive self, const GeomVertexData vertex_data)

/**
  • 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.

*/

/**

*/

clearMinmax()

C++ Interface: clear_minmax(const GeomPrimitive self)

/**
  • Undoes a previous call to set_minmax(), and allows the minimum and maximum

  • values to be recomputed normally.

  • This method is intended for low-level usage only. There are higher-level

  • methods for more common usage. We recommend you do not use this method

  • directly. If you do, be sure you know what you are doing!

*/

clearVertices()

C++ Interface: clear_vertices(const GeomPrimitive self)

/**
  • 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.

*/

clear_minmax()

C++ Interface: clear_minmax(const GeomPrimitive self)

/**
  • Undoes a previous call to set_minmax(), and allows the minimum and maximum

  • values to be recomputed normally.

  • This method is intended for low-level usage only. There are higher-level

  • methods for more common usage. We recommend you do not use this method

  • directly. If you do, be sure you know what you are doing!

*/

clear_vertices()

C++ Interface: clear_vertices(const GeomPrimitive self)

/**
  • 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()

C++ Interface: close_primitive(const GeomPrimitive self)

/**
  • 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.

*/

close_primitive()

C++ Interface: close_primitive(const GeomPrimitive self)

/**
  • 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.

*/

data_size_bytes
decompose()

C++ Interface: decompose(GeomPrimitive self)

/**
  • 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.

*/

doubleside()

C++ Interface: doubleside(GeomPrimitive self)

/**
  • Duplicates triangles in the primitive so that each triangle is back-to-back

  • with another triangle facing in the opposite direction. Note that this

  • doesn’t affect vertex normals, so this operation alone won’t work in the

  • presence of lighting (but see SceneGraphReducer::doubleside()).

  • Also see CullFaceAttrib, which can enable rendering of both sides of a

  • triangle without having to duplicate it (but which doesn’t necessarily work

  • in the presence of lighting).

*/

geom_rendering
getClassType()

C++ Interface: get_class_type()

getDataSizeBytes()

C++ Interface: get_data_size_bytes(GeomPrimitive self)

/**
  • Returns the number of bytes stored in the vertices array.

*/

getEnds()

C++ Interface: get_ends(GeomPrimitive self)

/**
  • Returns a const pointer to the primitive ends array so application code can

  • read it directly. Do not attempt to modify the returned array; use

  • modify_ends() or set_ends() for this.

  • Note that simple primitive types, like triangles, do not have a ends array:

  • since all the primitives have the same number of vertices, it is not

  • needed.

  • This method is intended for low-level usage only. There are higher-level

  • methods for more common usage. We recommend you do not use this method

  • directly. If you do, be sure you know what you are doing!

*/

getFirstVertex()

C++ Interface: get_first_vertex(GeomPrimitive self)

/**
  • 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()

C++ Interface: get_geom_rendering(GeomPrimitive self)

/**
  • Returns the set of GeomRendering bits that represent the rendering

  • properties required to properly render this primitive.

*/

getIndexStride()

C++ Interface: get_index_stride(GeomPrimitive self)

/**
  • A convenience function to return the gap between successive index numbers,

  • in bytes, of the index data.

  • This method is intended for low-level usage only. There are higher-level

  • methods for more common usage. We recommend you do not use this method

  • directly. If you do, be sure you know what you are doing!

*/

getIndexType()

C++ Interface: get_index_type(GeomPrimitive self)

/**
  • Returns the numeric type of the index column. Normally, this will be

  • either NT_uint16 or NT_uint32.

*/

getMaxVertex()

C++ Interface: get_max_vertex(GeomPrimitive self)

/**
  • Returns the maximum vertex index number used by all the primitives in this

  • object.

*/

getMaxs()

C++ Interface: get_maxs(GeomPrimitive self)

/**
  • Returns a const pointer to the primitive maxs array so application code can

  • read it directly. Do not attempt to modify the returned array; use

  • set_minmax().

  • Note that simple primitive types, like triangles, do not have a maxs array.

  • This method is intended for low-level usage only. There are higher-level

  • methods for more common usage. We recommend you do not use this method

  • directly. If you do, be sure you know what you are doing!

*/

getMinNumVerticesPerPrimitive()

C++ Interface: get_min_num_vertices_per_primitive(GeomPrimitive self)

/**
  • Returns the minimum number of vertices that must be added before

  • close_primitive() may legally be called.

  • This method is intended for low-level usage only. There are higher-level

  • methods for more common usage. We recommend you do not use this method

  • directly. If you do, be sure you know what you are doing!

*/

getMinVertex()

C++ Interface: get_min_vertex(GeomPrimitive self)

/**
  • Returns the minimum vertex index number used by all the primitives in this

  • object.

*/

getMins()

C++ Interface: get_mins(GeomPrimitive self)

/**
  • Returns a const pointer to the primitive mins array so application code can

  • read it directly. Do not attempt to modify the returned array; use

  • set_minmax() for this.

  • Note that simple primitive types, like triangles, do not have a mins array.

  • This method is intended for low-level usage only. There are higher-level

  • methods for more common usage. We recommend you do not use this method

  • directly. If you do, be sure you know what you are doing!

*/

getModified()

C++ Interface: get_modified(GeomPrimitive self)

/**
  • Returns a sequence number which is guaranteed to change at least every time

  • the vertex index array is modified.

*/

getNumBytes()

C++ Interface: get_num_bytes(GeomPrimitive self)

/**
  • Returns the number of bytes consumed by the primitive and its index

  • table(s).

*/

getNumFaces()

C++ Interface: get_num_faces(GeomPrimitive self)

/**
  • Returns the number of triangles or other fundamental type (such as line

  • segments) represented by all the primitives in this object.

*/

getNumPrimitives()

C++ Interface: get_num_primitives(GeomPrimitive self)

/**
  • Returns the number of individual primitives stored within this object. All

  • primitives are the same type.

*/

getNumUnusedVerticesPerPrimitive()

C++ Interface: get_num_unused_vertices_per_primitive(GeomPrimitive self)

/**
  • Returns the number of vertices that are added between primitives that

  • aren’t, strictly speaking, part of the primitives themselves. This is

  • used, for instance, to define degenerate triangles to connect otherwise

  • disconnected triangle strips.

  • This method is intended for low-level usage only. There are higher-level

  • methods for more common usage. We recommend you do not use this method

  • directly. If you do, be sure you know what you are doing!

*/

getNumUsedVertices()

C++ Interface: get_num_used_vertices(GeomPrimitive self)

/**
  • Returns the number of vertices used by all of the primitives. This is the

  • same as summing get_primitive_num_vertices(n) for n in

  • get_num_primitives(). It is like get_num_vertices except that it excludes

  • all of the degenerate vertices and strip-cut indices.

*/

getNumVertices()

C++ Interface: get_num_vertices(GeomPrimitive self)

/**
  • Returns the number of indices used by all the primitives in this object.

*/

getNumVerticesPerPrimitive()

C++ Interface: get_num_vertices_per_primitive(GeomPrimitive self)

/**
  • If the primitive type is a simple type in which all primitives have the

  • same number of vertices, like triangles, returns the number of vertices per

  • primitive. If the primitive type is a more complex type in which different

  • primitives might have different numbers of vertices, for instance a

  • triangle strip, returns 0.

  • This method is intended for low-level usage only. There are higher-level

  • methods for more common usage. We recommend you do not use this method

  • directly. If you do, be sure you know what you are doing!

*/

getPrimitiveEnd()

C++ Interface: get_primitive_end(GeomPrimitive self, int n)

/**
  • 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()

C++ Interface: get_primitive_max_vertex(GeomPrimitive self, int n)

/**
  • Returns the maximum vertex index number used by the nth primitive in this

  • object.

*/

getPrimitiveMinVertex()

C++ Interface: get_primitive_min_vertex(GeomPrimitive self, int n)

/**
  • Returns the minimum vertex index number used by the nth primitive in this

  • object.

*/

getPrimitiveNumFaces()

C++ Interface: get_primitive_num_faces(GeomPrimitive self, int n)

/**
  • Returns the number of triangles or other fundamental type (such as line

  • segments) represented by the nth primitive in this object.

*/

getPrimitiveNumVertices()

C++ Interface: get_primitive_num_vertices(GeomPrimitive self, int n)

/**
  • 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()

C++ Interface: get_primitive_start(GeomPrimitive self, int n)

/**
  • 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()

C++ Interface: get_primitive_type(GeomPrimitive self)

getShadeModel()

C++ Interface: get_shade_model(GeomPrimitive self)

/**
  • 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.

*/

getStripCutIndex()

C++ Interface: get_strip_cut_index(GeomPrimitive self)

/**
  • If relevant, returns the index value that may be used in some cases to

  • signify the end of a primitive. This is typically the highest value that

  • the numeric type can store.

*/

/**
  • Returns the index of the indicated type that is reserved for use as a strip

  • cut index, if enabled for the primitive. When the renderer encounters this

  • index, it will restart the primitive. This is guaranteed not to point to

  • an actual vertex.

*/

getUsageHint()

C++ Interface: get_usage_hint(GeomPrimitive self)

/**
  • 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()

C++ Interface: get_vertex(GeomPrimitive self, int i)

/**
  • Returns the ith vertex index in the table.

*/

getVertexList()
getVertices()

C++ Interface: get_vertices(GeomPrimitive self)

/**
  • Returns a const pointer to the vertex index array so application code can

  • read it directly. This might return NULL if the primitive is nonindexed.

  • Do not attempt to modify the returned array; use modify_vertices() or

  • set_vertices() for this.

  • This method is intended for low-level usage only. There are higher-level

  • methods for more common usage. We recommend you do not use this method

  • directly. If you do, be sure you know what you are doing!

*/

getVerticesHandle()

C++ Interface: get_vertices_handle(GeomPrimitive self, Thread current_thread)

/**
  • Equivalent to get_vertices().get_handle().

*/

get_class_type()

C++ Interface: get_class_type()

get_data_size_bytes()

C++ Interface: get_data_size_bytes(GeomPrimitive self)

/**
  • Returns the number of bytes stored in the vertices array.

*/

get_ends()

C++ Interface: get_ends(GeomPrimitive self)

/**
  • Returns a const pointer to the primitive ends array so application code can

  • read it directly. Do not attempt to modify the returned array; use

  • modify_ends() or set_ends() for this.

  • Note that simple primitive types, like triangles, do not have a ends array:

  • since all the primitives have the same number of vertices, it is not

  • needed.

  • This method is intended for low-level usage only. There are higher-level

  • methods for more common usage. We recommend you do not use this method

  • directly. If you do, be sure you know what you are doing!

*/

get_first_vertex()

C++ Interface: get_first_vertex(GeomPrimitive self)

/**
  • 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.

*/

get_geom_rendering()

C++ Interface: get_geom_rendering(GeomPrimitive self)

/**
  • Returns the set of GeomRendering bits that represent the rendering

  • properties required to properly render this primitive.

*/

get_index_stride()

C++ Interface: get_index_stride(GeomPrimitive self)

/**
  • A convenience function to return the gap between successive index numbers,

  • in bytes, of the index data.

  • This method is intended for low-level usage only. There are higher-level

  • methods for more common usage. We recommend you do not use this method

  • directly. If you do, be sure you know what you are doing!

*/

get_index_type()

C++ Interface: get_index_type(GeomPrimitive self)

/**
  • Returns the numeric type of the index column. Normally, this will be

  • either NT_uint16 or NT_uint32.

*/

get_max_vertex()

C++ Interface: get_max_vertex(GeomPrimitive self)

/**
  • Returns the maximum vertex index number used by all the primitives in this

  • object.

*/

get_maxs()

C++ Interface: get_maxs(GeomPrimitive self)

/**
  • Returns a const pointer to the primitive maxs array so application code can

  • read it directly. Do not attempt to modify the returned array; use

  • set_minmax().

  • Note that simple primitive types, like triangles, do not have a maxs array.

  • This method is intended for low-level usage only. There are higher-level

  • methods for more common usage. We recommend you do not use this method

  • directly. If you do, be sure you know what you are doing!

*/

get_min_num_vertices_per_primitive()

C++ Interface: get_min_num_vertices_per_primitive(GeomPrimitive self)

/**
  • Returns the minimum number of vertices that must be added before

  • close_primitive() may legally be called.

  • This method is intended for low-level usage only. There are higher-level

  • methods for more common usage. We recommend you do not use this method

  • directly. If you do, be sure you know what you are doing!

*/

get_min_vertex()

C++ Interface: get_min_vertex(GeomPrimitive self)

/**
  • Returns the minimum vertex index number used by all the primitives in this

  • object.

*/

get_mins()

C++ Interface: get_mins(GeomPrimitive self)

/**
  • Returns a const pointer to the primitive mins array so application code can

  • read it directly. Do not attempt to modify the returned array; use

  • set_minmax() for this.

  • Note that simple primitive types, like triangles, do not have a mins array.

  • This method is intended for low-level usage only. There are higher-level

  • methods for more common usage. We recommend you do not use this method

  • directly. If you do, be sure you know what you are doing!

*/

get_modified()

C++ Interface: get_modified(GeomPrimitive self)

/**
  • Returns a sequence number which is guaranteed to change at least every time

  • the vertex index array is modified.

*/

get_num_bytes()

C++ Interface: get_num_bytes(GeomPrimitive self)

/**
  • Returns the number of bytes consumed by the primitive and its index

  • table(s).

*/

get_num_faces()

C++ Interface: get_num_faces(GeomPrimitive self)

/**
  • Returns the number of triangles or other fundamental type (such as line

  • segments) represented by all the primitives in this object.

*/

get_num_primitives()

C++ Interface: get_num_primitives(GeomPrimitive self)

/**
  • Returns the number of individual primitives stored within this object. All

  • primitives are the same type.

*/

get_num_unused_vertices_per_primitive()

C++ Interface: get_num_unused_vertices_per_primitive(GeomPrimitive self)

/**
  • Returns the number of vertices that are added between primitives that

  • aren’t, strictly speaking, part of the primitives themselves. This is

  • used, for instance, to define degenerate triangles to connect otherwise

  • disconnected triangle strips.

  • This method is intended for low-level usage only. There are higher-level

  • methods for more common usage. We recommend you do not use this method

  • directly. If you do, be sure you know what you are doing!

*/

get_num_used_vertices()

C++ Interface: get_num_used_vertices(GeomPrimitive self)

/**
  • Returns the number of vertices used by all of the primitives. This is the

  • same as summing get_primitive_num_vertices(n) for n in

  • get_num_primitives(). It is like get_num_vertices except that it excludes

  • all of the degenerate vertices and strip-cut indices.

*/

get_num_vertices()

C++ Interface: get_num_vertices(GeomPrimitive self)

/**
  • Returns the number of indices used by all the primitives in this object.

*/

get_num_vertices_per_primitive()

C++ Interface: get_num_vertices_per_primitive(GeomPrimitive self)

/**
  • If the primitive type is a simple type in which all primitives have the

  • same number of vertices, like triangles, returns the number of vertices per

  • primitive. If the primitive type is a more complex type in which different

  • primitives might have different numbers of vertices, for instance a

  • triangle strip, returns 0.

  • This method is intended for low-level usage only. There are higher-level

  • methods for more common usage. We recommend you do not use this method

  • directly. If you do, be sure you know what you are doing!

*/

get_primitive_end()

C++ Interface: get_primitive_end(GeomPrimitive self, int n)

/**
  • 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.

*/

get_primitive_max_vertex()

C++ Interface: get_primitive_max_vertex(GeomPrimitive self, int n)

/**
  • Returns the maximum vertex index number used by the nth primitive in this

  • object.

*/

get_primitive_min_vertex()

C++ Interface: get_primitive_min_vertex(GeomPrimitive self, int n)

/**
  • Returns the minimum vertex index number used by the nth primitive in this

  • object.

*/

get_primitive_num_faces()

C++ Interface: get_primitive_num_faces(GeomPrimitive self, int n)

/**
  • Returns the number of triangles or other fundamental type (such as line

  • segments) represented by the nth primitive in this object.

*/

get_primitive_num_vertices()

C++ Interface: get_primitive_num_vertices(GeomPrimitive self, int n)

/**
  • Returns the number of vertices used by the nth primitive. This is the same

  • thing as get_primitive_end(n) - get_primitive_start(n).

*/

get_primitive_start()

C++ Interface: get_primitive_start(GeomPrimitive self, int n)

/**
  • 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).

*/

get_primitive_type()

C++ Interface: get_primitive_type(GeomPrimitive self)

get_shade_model()

C++ Interface: get_shade_model(GeomPrimitive self)

/**
  • 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.

*/

get_strip_cut_index()

C++ Interface: get_strip_cut_index(GeomPrimitive self)

/**
  • If relevant, returns the index value that may be used in some cases to

  • signify the end of a primitive. This is typically the highest value that

  • the numeric type can store.

*/

/**
  • Returns the index of the indicated type that is reserved for use as a strip

  • cut index, if enabled for the primitive. When the renderer encounters this

  • index, it will restart the primitive. This is guaranteed not to point to

  • an actual vertex.

*/

get_usage_hint()

C++ Interface: get_usage_hint(GeomPrimitive self)

/**
  • 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.

*/

get_vertex()

C++ Interface: get_vertex(GeomPrimitive self, int i)

/**
  • Returns the ith vertex index in the table.

*/

get_vertex_list()
get_vertices()

C++ Interface: get_vertices(GeomPrimitive self)

/**
  • Returns a const pointer to the vertex index array so application code can

  • read it directly. This might return NULL if the primitive is nonindexed.

  • Do not attempt to modify the returned array; use modify_vertices() or

  • set_vertices() for this.

  • This method is intended for low-level usage only. There are higher-level

  • methods for more common usage. We recommend you do not use this method

  • directly. If you do, be sure you know what you are doing!

*/

get_vertices_handle()

C++ Interface: get_vertices_handle(GeomPrimitive self, Thread current_thread)

/**
  • Equivalent to get_vertices().get_handle().

*/

index_stride
index_type
isComposite()

C++ Interface: is_composite(GeomPrimitive self)

/**
  • 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()

C++ Interface: is_indexed(GeomPrimitive self)

/**
  • 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.

*/

is_composite()

C++ Interface: is_composite(GeomPrimitive self)

/**
  • 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.

*/

is_indexed()

C++ Interface: is_indexed(GeomPrimitive self)

/**
  • 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.

*/

makeAdjacency()

C++ Interface: make_adjacency(GeomPrimitive self)

/**
  • Adds adjacency information to this primitive. May return null if this type

  • of geometry does not support adjacency information.

  • @since 1.10.0

*/

makeCopy()

C++ Interface: make_copy(GeomPrimitive self)

makeIndexed()

C++ Interface: make_indexed(const GeomPrimitive self)

/**
  • 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.

*/

makeLines()

C++ Interface: make_lines(GeomPrimitive self)

/**
  • Returns a new GeomLines primitive that represents each of the edges in the

  • original primitive rendered as a line. If the original primitive is

  • already a GeomLines primitive, returns the original primitive unchanged.

*/

makeNonindexed()

C++ Interface: make_nonindexed(const GeomPrimitive self, GeomVertexData dest, const GeomVertexData source)

/**
  • Converts the primitive from indexed to nonindexed by duplicating vertices

  • as necessary into the indicated dest GeomVertexData. Note: does not

  • support primitives with strip cut indices.

*/

makePatches()

C++ Interface: make_patches(GeomPrimitive self)

/**
  • Decomposes a complex primitive type into a simpler primitive type, for

  • instance triangle strips to triangles, puts these in a new GeomPatches

  • object 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 use tesselation

  • shaders on arbitrary geometry.

*/

makePoints()

C++ Interface: make_points(GeomPrimitive self)

/**
  • Returns a new GeomPoints primitive that represents each of the vertices in

  • the original primitive, rendered exactly once. If the original primitive

  • is already a GeomPoints primitive, returns the original primitive

  • unchanged.

*/

make_adjacency()

C++ Interface: make_adjacency(GeomPrimitive self)

/**
  • Adds adjacency information to this primitive. May return null if this type

  • of geometry does not support adjacency information.

  • @since 1.10.0

*/

make_copy()

C++ Interface: make_copy(GeomPrimitive self)

make_indexed()

C++ Interface: make_indexed(const GeomPrimitive self)

/**
  • 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.

*/

make_lines()

C++ Interface: make_lines(GeomPrimitive self)

/**
  • Returns a new GeomLines primitive that represents each of the edges in the

  • original primitive rendered as a line. If the original primitive is

  • already a GeomLines primitive, returns the original primitive unchanged.

*/

make_nonindexed()

C++ Interface: make_nonindexed(const GeomPrimitive self, GeomVertexData dest, const GeomVertexData source)

/**
  • Converts the primitive from indexed to nonindexed by duplicating vertices

  • as necessary into the indicated dest GeomVertexData. Note: does not

  • support primitives with strip cut indices.

*/

make_patches()

C++ Interface: make_patches(GeomPrimitive self)

/**
  • Decomposes a complex primitive type into a simpler primitive type, for

  • instance triangle strips to triangles, puts these in a new GeomPatches

  • object 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 use tesselation

  • shaders on arbitrary geometry.

*/

make_points()

C++ Interface: make_points(GeomPrimitive self)

/**
  • Returns a new GeomPoints primitive that represents each of the vertices in

  • the original primitive, rendered exactly once. If the original primitive

  • is already a GeomPoints primitive, returns the original primitive

  • unchanged.

*/

matchShadeModel()

C++ Interface: match_shade_model(GeomPrimitive self, int shade_model)

/**
  • 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.

*/

match_shade_model()

C++ Interface: match_shade_model(GeomPrimitive self, int shade_model)

/**
  • 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.

*/

maxs
min_num_vertices_per_primitive
mins
modified
modifyEnds()

C++ Interface: modify_ends(const GeomPrimitive self)

/**
  • Returns a modifiable pointer to the primitive ends array, so application

  • code can directly fiddle with this data. Use with caution, since there are

  • no checks that the data will be left in a stable state.

  • Note that simple primitive types, like triangles, do not have a ends array:

  • since all the primitives have the same number of vertices, it is not

  • needed.

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

  • This method is intended for low-level usage only. There are higher-level

  • methods for more common usage. We recommend you do not use this method

  • directly. If you do, be sure you know what you are doing!

*/

modifyVertices()

C++ Interface: modify_vertices(const GeomPrimitive self, int num_vertices)

/**
  • Returns a modifiable pointer to the vertex index list, so application code

  • can directly fiddle with this data. Use with caution, since there are no

  • checks that the data will be left in a stable state.

  • If this is called on a nonindexed primitive, it will implicitly be

  • converted to an indexed primitive.

  • If num_vertices is not -1, it specifies an artificial limit to the number

  • of vertices in the array. Otherwise, all of the vertices in the array will

  • be used.

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

  • This method is intended for low-level usage only. There are higher-level

  • methods for more common usage. We recommend you do not use this method

  • directly. If you do, be sure you know what you are doing!

*/

modifyVerticesHandle()

C++ Interface: modify_vertices_handle(const GeomPrimitive self, Thread current_thread)

/**
  • Equivalent to modify_vertices().get_handle().

*/

modify_ends()

C++ Interface: modify_ends(const GeomPrimitive self)

/**
  • Returns a modifiable pointer to the primitive ends array, so application

  • code can directly fiddle with this data. Use with caution, since there are

  • no checks that the data will be left in a stable state.

  • Note that simple primitive types, like triangles, do not have a ends array:

  • since all the primitives have the same number of vertices, it is not

  • needed.

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

  • This method is intended for low-level usage only. There are higher-level

  • methods for more common usage. We recommend you do not use this method

  • directly. If you do, be sure you know what you are doing!

*/

modify_vertices()

C++ Interface: modify_vertices(const GeomPrimitive self, int num_vertices)

/**
  • Returns a modifiable pointer to the vertex index list, so application code

  • can directly fiddle with this data. Use with caution, since there are no

  • checks that the data will be left in a stable state.

  • If this is called on a nonindexed primitive, it will implicitly be

  • converted to an indexed primitive.

  • If num_vertices is not -1, it specifies an artificial limit to the number

  • of vertices in the array. Otherwise, all of the vertices in the array will

  • be used.

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

  • This method is intended for low-level usage only. There are higher-level

  • methods for more common usage. We recommend you do not use this method

  • directly. If you do, be sure you know what you are doing!

*/

modify_vertices_handle()

C++ Interface: modify_vertices_handle(const GeomPrimitive self, Thread current_thread)

/**
  • Equivalent to modify_vertices().get_handle().

*/

num_bytes
num_unused_vertices_per_primitive
num_vertices_per_primitive
offsetVertices()

C++ Interface: offset_vertices(const GeomPrimitive self, int offset) offset_vertices(const GeomPrimitive self, int offset, int begin_row, int end_row)

/**
  • 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.

*/

/**
  • Adds the indicated offset to the indicated segment of vertices used by the

  • primitive. Unlike the other version of offset_vertices, this makes the

  • geometry indexed if it isn’t already.

  • Note that end_row indicates one past the last row that should be offset.

  • In other words, the number of vertices touched is (end_row - begin_row).

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

*/

offset_vertices()

C++ Interface: offset_vertices(const GeomPrimitive self, int offset) offset_vertices(const GeomPrimitive self, int offset, int begin_row, int end_row)

/**
  • 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.

*/

/**
  • Adds the indicated offset to the indicated segment of vertices used by the

  • primitive. Unlike the other version of offset_vertices, this makes the

  • geometry indexed if it isn’t already.

  • Note that end_row indicates one past the last row that should be offset.

  • In other words, the number of vertices touched is (end_row - begin_row).

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

*/

output()

C++ Interface: output(GeomPrimitive self, ostream out)

/**

*/

packVertices()

C++ Interface: pack_vertices(const GeomPrimitive self, GeomVertexData dest, const GeomVertexData source)

/**
  • Packs the vertices used by the primitive from the indicated source array

  • onto the end of the indicated destination array.

*/

pack_vertices()

C++ Interface: pack_vertices(const GeomPrimitive self, GeomVertexData dest, const GeomVertexData source)

/**
  • Packs the vertices used by the primitive from the indicated source array

  • onto the end of the indicated destination array.

*/

primitive_type
requestResident()

C++ Interface: request_resident(GeomPrimitive self, Thread current_thread)

/**
  • Returns true if the primitive data is currently resident in memory. If

  • this returns false, the primitive data will be brought back into memory

  • shortly; try again later.

*/

request_resident()

C++ Interface: request_resident(GeomPrimitive self, Thread current_thread)

/**
  • Returns true if the primitive data is currently resident in memory. If

  • this returns false, the primitive data will be brought back into memory

  • shortly; try again later.

*/

reserveNumVertices()

C++ Interface: reserve_num_vertices(const GeomPrimitive self, int num_vertices)

/**
  • This ensures that enough memory space for n vertices is allocated, so that

  • you may increase the number of vertices 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 vertices to

  • the primitive.

  • Note that the total you specify here should also include implicit vertices

  • which may be added at each close_primitive() call, according to

  • get_num_unused_vertices_per_primitive().

  • Note also that making this call will implicitly make the primitive indexed

  • if it is not already, which could result in a performance penalty. If

  • you would prefer not to lose the nonindexed nature of your existing

  • GeomPrimitives, check is_indexed() before making this call.

*/

reserve_num_vertices()

C++ Interface: reserve_num_vertices(const GeomPrimitive self, int num_vertices)

/**
  • This ensures that enough memory space for n vertices is allocated, so that

  • you may increase the number of vertices 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 vertices to

  • the primitive.

  • Note that the total you specify here should also include implicit vertices

  • which may be added at each close_primitive() call, according to

  • get_num_unused_vertices_per_primitive().

  • Note also that making this call will implicitly make the primitive indexed

  • if it is not already, which could result in a performance penalty. If

  • you would prefer not to lose the nonindexed nature of your existing

  • GeomPrimitives, check is_indexed() before making this call.

*/

reverse()

C++ Interface: reverse(GeomPrimitive self)

/**
  • Reverses the winding order in the primitive so that each triangle is facing

  • in the opposite direction it was originally. Note that this doesn’t affect

  • vertex normals, so this operation alone won’t work in the presence of

  • lighting (but see SceneGraphReducer::reverse()).

  • Also see CullFaceAttrib, which can change the visible direction of a

  • triangle without having to duplicate it (but which doesn’t necessarily work

  • in the presence of lighting).

*/

rotate()

C++ Interface: rotate(GeomPrimitive self)

/**
  • 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.

*/

setEnds()

C++ Interface: set_ends(const GeomPrimitive self, PointerToArray ends)

/**
  • Completely replaces the primitive ends array with a new table. Chances are

  • good that you should also replace the vertices list with set_vertices() at

  • the same time.

  • Note that simple primitive types, like triangles, do not have a ends array:

  • since all the primitives have the same number of vertices, it is not

  • needed.

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

  • This method is intended for low-level usage only. There are higher-level

  • methods for more common usage. We recommend you do not use this method

  • directly. If you do, be sure you know what you are doing!

*/

setIndexType()

C++ Interface: set_index_type(const GeomPrimitive self, int index_type)

/**
  • 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.

*/

setMinmax()

C++ Interface: set_minmax(const GeomPrimitive self, int min_vertex, int max_vertex, GeomVertexArrayData mins, GeomVertexArrayData maxs)

/**
  • Explicitly specifies the minimum and maximum vertices, as well as the lists

  • of per-component min and max.

  • Use this method with extreme caution. It’s generally better to let the

  • GeomPrimitive compute these explicitly, unless for some reason you can do

  • it faster and you absolutely need the speed improvement.

  • Note that any modification to the vertex array will normally cause this to

  • be recomputed, unless you set it immediately again.

  • This method is intended for low-level usage only. There are higher-level

  • methods for more common usage. We recommend you do not use this method

  • directly. If you do, be sure you know what you are doing!

*/

setNonindexedVertices()

C++ Interface: set_nonindexed_vertices(const GeomPrimitive self, int first_vertex, int num_vertices)

/**
  • Sets the primitive up as a nonindexed primitive, using the indicated vertex

  • range.

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

  • This method is intended for low-level usage only. There are higher-level

  • methods for more common usage. We recommend you do not use this method

  • directly. If you do, be sure you know what you are doing!

*/

setShadeModel()

C++ Interface: set_shade_model(const GeomPrimitive self, int shade_model)

/**
  • 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()

C++ Interface: set_usage_hint(const GeomPrimitive self, int usage_hint)

/**
  • 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.

*/

setVertices()

C++ Interface: set_vertices(const GeomPrimitive self, const GeomVertexArrayData vertices, int num_vertices)

/**
  • Completely replaces the vertex index list with a new table. Chances are

  • good that you should also replace the ends list with set_ends() at the same

  • time.

  • If num_vertices is not -1, it specifies an artificial limit to the number

  • of vertices in the array. Otherwise, all of the vertices in the array will

  • be used.

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

  • This method is intended for low-level usage only. There are higher-level

  • methods for more common usage. We recommend you do not use this method

  • directly. If you do, be sure you know what you are doing!

*/

set_ends()

C++ Interface: set_ends(const GeomPrimitive self, PointerToArray ends)

/**
  • Completely replaces the primitive ends array with a new table. Chances are

  • good that you should also replace the vertices list with set_vertices() at

  • the same time.

  • Note that simple primitive types, like triangles, do not have a ends array:

  • since all the primitives have the same number of vertices, it is not

  • needed.

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

  • This method is intended for low-level usage only. There are higher-level

  • methods for more common usage. We recommend you do not use this method

  • directly. If you do, be sure you know what you are doing!

*/

set_index_type()

C++ Interface: set_index_type(const GeomPrimitive self, int index_type)

/**
  • 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.

*/

set_minmax()

C++ Interface: set_minmax(const GeomPrimitive self, int min_vertex, int max_vertex, GeomVertexArrayData mins, GeomVertexArrayData maxs)

/**
  • Explicitly specifies the minimum and maximum vertices, as well as the lists

  • of per-component min and max.

  • Use this method with extreme caution. It’s generally better to let the

  • GeomPrimitive compute these explicitly, unless for some reason you can do

  • it faster and you absolutely need the speed improvement.

  • Note that any modification to the vertex array will normally cause this to

  • be recomputed, unless you set it immediately again.

  • This method is intended for low-level usage only. There are higher-level

  • methods for more common usage. We recommend you do not use this method

  • directly. If you do, be sure you know what you are doing!

*/

set_nonindexed_vertices()

C++ Interface: set_nonindexed_vertices(const GeomPrimitive self, int first_vertex, int num_vertices)

/**
  • Sets the primitive up as a nonindexed primitive, using the indicated vertex

  • range.

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

  • This method is intended for low-level usage only. There are higher-level

  • methods for more common usage. We recommend you do not use this method

  • directly. If you do, be sure you know what you are doing!

*/

set_shade_model()

C++ Interface: set_shade_model(const GeomPrimitive self, int shade_model)

/**
  • 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.

*/

set_usage_hint()

C++ Interface: set_usage_hint(const GeomPrimitive self, int usage_hint)

/**
  • 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.

*/

set_vertices()

C++ Interface: set_vertices(const GeomPrimitive self, const GeomVertexArrayData vertices, int num_vertices)

/**
  • Completely replaces the vertex index list with a new table. Chances are

  • good that you should also replace the ends list with set_ends() at the same

  • time.

  • If num_vertices is not -1, it specifies an artificial limit to the number

  • of vertices in the array. Otherwise, all of the vertices in the array will

  • be used.

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

  • This method is intended for low-level usage only. There are higher-level

  • methods for more common usage. We recommend you do not use this method

  • directly. If you do, be sure you know what you are doing!

*/

shade_model
strip_cut_index
upcastToCopyOnWriteObject()

C++ Interface: upcast_to_CopyOnWriteObject(const GeomPrimitive self)

upcast from GeomPrimitive to CopyOnWriteObject

upcastToGeomEnums()

C++ Interface: upcast_to_GeomEnums(const GeomPrimitive self)

upcast from GeomPrimitive to GeomEnums

upcast_to_CopyOnWriteObject()

C++ Interface: upcast_to_CopyOnWriteObject(const GeomPrimitive self)

upcast from GeomPrimitive to CopyOnWriteObject

upcast_to_GeomEnums()

C++ Interface: upcast_to_GeomEnums(const GeomPrimitive self)

upcast from GeomPrimitive to GeomEnums

usage_hint
write()

C++ Interface: write(GeomPrimitive self, ostream out, int indent_level)

/**

*/