# Geom

from pandac.PandaModules import Geom

Class : Geom
Description : A container for geometry primitives. This class associates one or more GeomPrimitive objects with a table of vertices defined by a GeomVertexData object. All of the primitives stored in a particular Geom are drawn from the same set of vertices (each primitive uses a subset of all of the vertices in the table), and all of them must be rendered at the same time, in the same graphics state.

## Inheritance:

Geom: TypedWritableReferenceCount GeomEnums
TypedWritableReferenceCount: TypedWritable ReferenceCount
TypedWritable: TypedObject
TypedObject:
ReferenceCount:
GeomEnums:

## Methods of Geom:

addPrimitive
checkValid
clearBounds
clearCache
clearCacheStage
clearPrimitives
copyPrimitivesFrom
decompose
decomposeInPlace
getBounds
getClassType
getGeomRendering
getModified
getNumBytes
getNumPrimitives
getPrimitive
getPrimitiveType
getShadeModel
getUsageHint
getVertexData
makeCopy
makeNonindexed
markBoundsStale
modifyPrimitive
modifyVertexData
offsetVertices
operator =
operator delete
operator new
output
prepare
release
releaseAll
removePrimitive
rotate
rotateInPlace
setBounds
setPrimitive
setUsageHint
setVertexData
transformVertices
unify
unifyInPlace
write

## Methods of TypedWritableReferenceCount:

getClassType

## Methods of TypedWritable:

getClassType

## Methods of TypedObject:

getBestParentFromSet
getClassType
getType
getTypeIndex
isExactType
isOfType

## Methods of ReferenceCount:

getClassType
getRefCount
ref
testRefCountIntegrity
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)

addPrimitive void Geom::add_primitive(GeomPrimitive const *primitive); Description: Adds a new GeomPrimitive structure to the Geom object. This specifies a particular subset of vertices that are used to define geometric primitives of the indicated type. 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.

checkValid bool Geom::check_valid(void) const; Description: Verifies that the all of the primitives within the geom reference vertices that actually exist within the geom's GeomVertexData. Returns true if the geom appears to be valid, false otherwise. Description: Verifies that the all of the primitives within the geom reference vertices that actually exist within the indicated GeomVertexData. Returns true if the geom appears to be valid, false otherwise.

clearBounds void Geom::clear_bounds(void); Description: Reverses the effect of a previous call to set_bounds(), and allows the bounding volume to be automatically computed once more based on the vertices. 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.

clearCache void Geom::clear_cache(void); Description: Removes all of the previously-cached results of munge_geom(). This blows away the entire cache, upstream and downstream the pipeline. Use clear_cache_stage() instead if you only want to blow away the cache at the current stage and upstream.

clearCacheStage void Geom::clear_cache_stage(void); Description: Removes all of the previously-cached results of munge_geom(), at the current pipeline stage and upstream. Does not affect the downstream cache. Don't call this in a downstream thread unless you don't mind it blowing away other changes you might have recently made in an upstream thread.

clearPrimitives void Geom::clear_primitives(void); Description: Removes all the primitives from the Geom object (but keeps the same table of vertices). You may then re-add primitives one at a time via calls to add_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.

copyPrimitivesFrom virtual bool Geom::copy_primitives_from(Geom const *other); Description: Copies the primitives from the indicated Geom into this one. This does require that both Geoms contain the same fundamental type primitives, both have a compatible shade model, and both use the same GeomVertexData. Both Geoms must also be the same specific class type (i.e. if one is a GeomTextGlyph, they both must be.) Returns true if the copy is successful, or false otherwise (because the Geoms were mismatched).

decompose PointerTo< Geom > Geom::decompose(void) const; Description: Decomposes all of the primitives within this Geom, returning the result. See GeomPrimitive::decompose().

decomposeInPlace void Geom::decompose_in_place(void); Description: Decomposes all of the primitives within this Geom, leaving the results in place. See GeomPrimitive::decompose(). 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.

getBounds ConstPointerTo< BoundingVolume > Geom::get_bounds(void) const; Description: Returns the bounding volume for the Geom.

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

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

getModified UpdateSeq Geom::get_modified(void) const; Description: Returns a sequence number which is guaranteed to change at least every time any of the primitives in the Geom is modified, or the set of primitives is modified. However, this does not include modifications to the vertex data, which should be tested separately.

getNumBytes int Geom::get_num_bytes(void) const; Description: Returns the number of bytes consumed by the geom and its primitives (but not including its vertex table).

getNumPrimitives int Geom::get_num_primitives(void) const; Description: Returns the number of GeomPrimitive objects stored within the Geom, each of which represents a number of primitives of a particular type.

getPrimitive GeomPrimitive const *Geom::get_primitive(int i) const; Description: Returns a const pointer to the ith GeomPrimitive object stored within the Geom. Use this call only to inspect the ith object; use modify_primitive() or set_primitive() if you want to modify it.

getPrimitiveType GeomEnums::PrimitiveType Geom::get_primitive_type(void) const; Filename: geom.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 fundamental primitive type that is common to all GeomPrimitives added within the Geom. All nested primitives within a particular Geom must be the same type (that is, you can mix triangles and tristrips, because they are both the same fundamental type PT_polygons, but you cannot mix triangles and points withn the same Geom).

getShadeModel GeomEnums::ShadeModel Geom::get_shade_model(void) const; Description: Returns the shade model common to all of the individual GeomPrimitives that have been added to the geom.

getUsageHint GeomEnums::UsageHint Geom::get_usage_hint(void) const; Description: Returns the minimum (i.e. most dynamic) usage_hint among all of the individual GeomPrimitives that have been added to the geom.

getVertexData ConstPointerTo< GeomVertexData > Geom::get_vertex_data(void) const; Description: Returns a const pointer to the GeomVertexData, for application code to directly examine (but not modify) the geom's underlying data.

makeCopy virtual Geom *Geom::make_copy(void) const; Description: Returns a newly-allocated Geom that is a shallow copy of this one. It will be a different Geom pointer, but its internal data may or may not be shared with that of the original Geom.

makeNonindexed int Geom::make_nonindexed(bool composite_only); Description: Converts the geom from indexed to nonindexed by duplicating vertices as necessary. If composite_only is true, then only composite primitives such as trifans and tristrips are converted. Returns the number of GeomPrimitive objects converted. 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.

markBoundsStale void Geom::mark_bounds_stale(void) const; Description: Marks the bounding volume of the Geom as stale so that it should be recomputed. Usually it is not necessary to call this explicitly.

modifyPrimitive GeomPrimitive *Geom::modify_primitive(int i); Description: Returns a modifiable pointer to the ith GeomPrimitive object stored within the Geom, so application code can directly manipulate the properties of this 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.

modifyVertexData PointerTo< GeomVertexData > Geom::modify_vertex_data(void); Description: Returns a modifiable pointer to the GeomVertexData, so that application code may directly maniuplate the geom's underlying data. 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.

offsetVertices void Geom::offset_vertices(GeomVertexData const *data, int offset); Description: Replaces a Geom's vertex table with a new table, and simultaneously adds the indicated offset to all vertex references within the Geom's primitives. This is intended to be used to combine multiple GeomVertexDatas from different Geoms into a single big buffer, with each Geom referencing a subset of the vertices in the buffer. 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 Geom::operator =(Geom 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 Geom that is actively being used for rendering.

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

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

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

prepare void Geom::prepare(PreparedGraphicsObjects *prepared_objects); Description: Indicates that the geom should be enqueued to be prepared in the indicated prepared_objects at the beginning of the next frame. This will ensure the geom is already loaded into geom memory if it is expected to be rendered soon. Use this function instead of prepare_now() to preload geoms from a user interface standpoint.

release bool Geom::release(PreparedGraphicsObjects *prepared_objects); Description: Frees the geom context only on the indicated object, if it exists there. Returns true if it was released, false if it had not been prepared.

releaseAll int Geom::release_all(void); Description: Frees the context allocated on all objects for which the geom has been declared. Returns the number of contexts which have been freed.

removePrimitive void Geom::remove_primitive(int i); Description: Removes the ith primitive from the list. 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.

rotate PointerTo< Geom > Geom::rotate(void) const; Description: Rotates all of the primitives within this Geom, returning the result. See GeomPrimitive::rotate().

rotateInPlace void Geom::rotate_in_place(void); Description: Rotates all of the primitives within this Geom, leaving the results in place. See GeomPrimitive::rotate(). 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.

setBounds void Geom::set_bounds(BoundingVolume const *volume); Description: Resets the bounding volume so that it is the indicated volume. When it is explicitly set, the bounding volume will no longer be automatically computed; call clear_bounds() if you would like to return the bounding volume to its default behavior. 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.

setPrimitive void Geom::set_primitive(int i, GeomPrimitive const *primitive); Description: Replaces the ith GeomPrimitive object stored within the Geom with the new object. 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 Geom::set_usage_hint(GeomEnums::UsageHint usage_hint); Description: Changes the UsageHint hint for all of the primitives on this Geom to the same value. 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.

setVertexData void Geom::set_vertex_data(GeomVertexData const *data); Description: Replaces the Geom's underlying vertex data table with a completely new table. Don't call this in a downstream thread unless you don't mind it blowing away other changes you might have recently made in an upstream thread.

transformVertices void Geom::transform_vertices(LMatrix4f const &mat); Description: Applies the indicated transform to all of the vertices in the Geom. If the Geom happens to share a vertex table with another Geom, this operation will duplicate the vertex table instead of breaking the other Geom; however, if multiple Geoms with shared tables are transformed by the same matrix, they will no longer share tables after the operation. Consider using the GeomTransformer if you will be applying the same transform to multiple Geoms.

unify PointerTo< Geom > Geom::unify(void) const; Description: Unifies all of the primitives contained within this Geom into a single primitive object. This may require decomposing the primitives if, for instance, the Geom contains both triangle strips and triangle fans.

unifyInPlace void Geom::unify_in_place(void); Description: Unifies all of the primitives contained within this Geom into a single primitive object. This may require decomposing the primitives if, for instance, the Geom contains both triangle strips and triangle fans. 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 Geom::write(ostream &out, int indent_level = (0)) const; Description:

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

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

getBestParentFromSet int TypedObject::get_best_parent_from_Set(set< int > const &) const; Description: Returns true if the current object is the indicated type exactly.

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.

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.