Panda3D
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Geom Class Reference

A container for geometry primitives. More...

Inheritance diagram for Geom:
CopyOnWriteObject GeomEnums CachedTypedWritableReferenceCount TypedWritableReferenceCount TypedWritable ReferenceCount TypedObject GeomTextGlyph

Public Member Functions

 __init__ (const GeomVertexData data)
 
 addPrimitive (const GeomPrimitive primitive)
 Inserts a new GeomPrimitive structure to the Geom object. More...
 
bool checkValid ()
 Verifies that the all of the primitives within the geom reference vertices that actually exist within the geom's GeomVertexData. More...
 
bool checkValid (const GeomVertexData vertex_data)
 Verifies that the all of the primitives within the geom reference vertices that actually exist within the indicated GeomVertexData. More...
 
 clearBounds ()
 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. More...
 
 clearCache ()
 Removes all of the previously-cached results of munge_geom(). More...
 
 clearCacheStage (Thread current_thread)
 Removes all of the previously-cached results of munge_geom(), at the current pipeline stage and upstream. More...
 
 clearPrimitives ()
 Removes all the primitives from the Geom object (but keeps the same table of vertices). More...
 
bool copyPrimitivesFrom (const Geom other)
 Copies the primitives from the indicated Geom into this one. More...
 
Geom decompose ()
 Decomposes all of the primitives within this Geom, returning the result. More...
 
 decomposeInPlace ()
 Decomposes all of the primitives within this Geom, leaving the results in place. More...
 
Geom doubleside ()
 Doublesides all of the primitives within this Geom, returning the result. More...
 
 doublesideInPlace ()
 Doublesides all of the primitives within this Geom, leaving the results in place. More...
 
const GeomVertexData getAnimatedVertexData (bool force, Thread current_thread)
 Returns a GeomVertexData that represents the results of computing the vertex animation on the CPU for this Geom's vertex data. More...
 
const BoundingVolume getBounds (Thread current_thread)
 Returns the bounding volume for the Geom. More...
 
BoundingVolume::BoundsType getBoundsType ()
 Returns the bounding volume type set with set_bounds_type(). More...
 
int getGeomRendering ()
 Returns the set of GeomRendering bits that represent the rendering properties required to properly render this Geom. More...
 
UpdateSeq getModified (Thread current_thread)
 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. More...
 
int getNestedVertices (Thread current_thread)
 Returns the number of vertices rendered by all primitives within the Geom. More...
 
int getNumBytes ()
 Returns the number of bytes consumed by the geom and its primitives (but not including its vertex table). More...
 
int getNumPrimitives ()
 Returns the number of GeomPrimitive objects stored within the Geom, each of which represents a number of primitives of a particular type. More...
 
const GeomPrimitive getPrimitive (int i)
 Returns a const pointer to the ith GeomPrimitive object stored within the Geom. More...
 
list getPrimitives ()
 
GeomEnums::PrimitiveType getPrimitiveType ()
 Returns the fundamental primitive type that is common to all GeomPrimitives added within the Geom. More...
 
GeomEnums::ShadeModel getShadeModel ()
 Returns the shade model common to all of the individual GeomPrimitives that have been added to the geom. More...
 
GeomEnums::UsageHint getUsageHint ()
 Returns the minimum (i.e. More...
 
const GeomVertexData getVertexData (Thread current_thread)
 Returns a const pointer to the GeomVertexData, for application code to directly examine (but not modify) the geom's underlying data. More...
 
 insertPrimitive (int i, const GeomPrimitive primitive)
 Inserts a new GeomPrimitive structure to the Geom object. More...
 
bool isEmpty ()
 Returns true if there appear to be no vertices to be rendered by this Geom, false if has some actual data. More...
 
bool isPrepared (PreparedGraphicsObjects prepared_objects)
 Returns true if the geom has already been prepared or enqueued for preparation on the indicated GSG, false otherwise. More...
 
Geom makeAdjacency ()
 Returns a new Geom with each primitive converted into a corresponding version with adjacency information. More...
 
 makeAdjacencyInPlace ()
 Replaces the GeomPrimitives within this Geom with corresponding versions with adjacency information. More...
 
Geom makeCopy ()
 Returns a newly-allocated Geom that is a shallow copy of this one. More...
 
Geom makeLines ()
 Returns a new Geom with lines at all the edges. More...
 
 makeLinesInPlace ()
 Replaces the GeomPrimitives within this Geom with corresponding GeomLines, representing a wireframe of the primitives. More...
 
int makeNonindexed (bool composite_only)
 Converts the geom from indexed to nonindexed by duplicating vertices as necessary. More...
 
Geom makePatches ()
 Returns a new Geom with each primitive converted into a patch. More...
 
 makePatchesInPlace ()
 Replaces the GeomPrimitives within this Geom with corresponding GeomPatches. More...
 
Geom makePoints ()
 Returns a new Geom with points at all the vertices. More...
 
 makePointsInPlace ()
 Replaces the GeomPrimitives within this Geom with corresponding GeomPoints. More...
 
 markBoundsStale ()
 Marks the bounding volume of the Geom as stale so that it should be recomputed. More...
 
GeomPrimitive modifyPrimitive (int i)
 Returns a modifiable pointer to the ith GeomPrimitive object stored within the Geom, so application code can directly manipulate the properties of this primitive. More...
 
GeomVertexData modifyVertexData ()
 Returns a modifiable pointer to the GeomVertexData, so that application code may directly maniuplate the geom's underlying data. More...
 
 offsetVertices (const GeomVertexData data, int offset)
 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. More...
 
 operator new (int size)
 
Geom operator= (const Geom copy)
 
 output (Ostream out)
 
 prepare (PreparedGraphicsObjects prepared_objects)
 Indicates that the geom should be enqueued to be prepared in the indicated prepared_objects at the beginning of the next frame. More...
 
GeomContext prepareNow (PreparedGraphicsObjects prepared_objects, GraphicsStateGuardianBase gsg)
 Creates a context for the geom on the particular GSG, if it does not already exist. More...
 
bool release (PreparedGraphicsObjects prepared_objects)
 Frees the geom context only on the indicated object, if it exists there. More...
 
int releaseAll ()
 Frees the context allocated on all objects for which the geom has been declared. More...
 
 removePrimitive (int i)
 Removes the ith primitive from the list. More...
 
bool requestResident ()
 Returns true if all the primitive arrays are currently resident in memory. More...
 
Geom reverse ()
 Reverses all of the primitives within this Geom, returning the result. More...
 
 reverseInPlace ()
 Reverses all of the primitives within this Geom, leaving the results in place. More...
 
Geom rotate ()
 Rotates all of the primitives within this Geom, returning the result. More...
 
 rotateInPlace ()
 Rotates all of the primitives within this Geom, leaving the results in place. More...
 
 setBounds (const BoundingVolume volume)
 Resets the bounding volume so that it is the indicated volume. More...
 
 setBoundsType (BoundingVolume::BoundsType bounds_type)
 Specifies the desired type of bounding volume that will be created for this Geom. More...
 
 setPrimitive (int i, const GeomPrimitive primitive)
 Replaces the ith GeomPrimitive object stored within the Geom with the new object. More...
 
 setUsageHint (GeomEnums::UsageHint usage_hint)
 Changes the UsageHint hint for all of the primitives on this Geom to the same value. More...
 
 setVertexData (const GeomVertexData data)
 Replaces the Geom's underlying vertex data table with a completely new table. More...
 
 transformVertices (const LMatrix4 mat)
 Applies the indicated transform to all of the vertices in the Geom. More...
 
Geom unify (int max_indices, bool preserve_order)
 Unifies all of the primitives contained within this Geom into a single (or as few as possible, within the constraints of max_indices) primitive objects. More...
 
 unifyInPlace (int max_indices, bool preserve_order)
 Unifies all of the primitives contained within this Geom into a single (or as few as possible, within the constraints of max_indices) primitive objects. More...
 
 write (Ostream out, int indent_level)
 
- Public Member Functions inherited from CopyOnWriteObject
 cacheRef ()
 
bool cacheUnref ()
 
- Public Member Functions inherited from CachedTypedWritableReferenceCount
 cacheRef ()
 Explicitly increments the cache reference count and the normal reference count simultaneously. More...
 
bool cacheUnref ()
 Explicitly decrements the cache reference count and the normal reference count simultaneously. More...
 
int getCacheRefCount ()
 Returns the current reference count. More...
 
bool testRefCountIntegrity ()
 Does some easy checks to make sure that the reference count isn't completely bogus. More...
 
- Public Member Functions inherited from TypedWritable
object __reduce__ ()
 
object __reduce_persist__ (object pickler)
 
VectorUchar encodeToBamStream ()
 Converts the TypedWritable object into a single stream of data using a BamWriter, and returns that data as a bytes object. More...
 
bool encodeToBamStream (VectorUchar data, BamWriter writer)
 Converts the TypedWritable object into a single stream of data using a BamWriter, and stores that data in the indicated string. More...
 
 fillin (DatagramIterator scan, BamReader manager)
 This internal function is intended to be called by each class's make_from_bam() method to read in all of the relevant data from the BamFile for the new object. More...
 
UpdateSeq getBamModified ()
 Returns the current bam_modified counter. More...
 
 markBamModified ()
 Increments the bam_modified counter, so that this object will be invalidated and retransmitted on any open bam streams. More...
 
- Public Member Functions inherited from TypedObject
TypeHandle getType ()
 
int getTypeIndex ()
 Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. More...
 
bool isExactType (TypeHandle handle)
 Returns true if the current object is the indicated type exactly. More...
 
bool isOfType (TypeHandle handle)
 Returns true if the current object is or derives from the indicated type. More...
 
- Public Member Functions inherited from ReferenceCount
int getRefCount ()
 Returns the current reference count. More...
 
 ref ()
 Explicitly increments the reference count. More...
 
bool testRefCountIntegrity ()
 Does some easy checks to make sure that the reference count isn't completely bogus. More...
 
bool testRefCountNonzero ()
 Does some easy checks to make sure that the reference count isn't zero, or completely bogus. More...
 
bool unref ()
 Explicitly decrements the reference count. More...
 
- Public Member Functions inherited from GeomEnums
 __init__ ()
 
 __init__ (const GeomEnums)
 

Static Public Member Functions

static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from CopyOnWriteObject
static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from CachedTypedWritableReferenceCount
static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from TypedWritableReferenceCount
static TypedWritableReferenceCount decodeFromBamStream (VectorUchar data, BamReader reader)
 Reads the bytes created by a previous call to encode_to_bam_stream(), and extracts and returns the single object on those bytes. More...
 
static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from TypedWritable
static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from TypedObject
static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from ReferenceCount
static TypeHandle getClassType ()
 

Public Attributes

BoundingVolume::BoundsType bounds_type
 Returns the bounding volume type set with set_bounds_type(). More...
 
int geom_rendering
 Returns the set of GeomRendering bits that represent the rendering properties required to properly render this Geom. More...
 
UpdateSeq modified
 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. More...
 
int num_bytes
 Returns the number of bytes consumed by the geom and its primitives (but not including its vertex table). More...
 
GeomEnums::PrimitiveType primitive_type
 Returns the fundamental primitive type that is common to all GeomPrimitives added within the Geom. More...
 
ConstPointerToGeomPrimitive primitives []
 
GeomEnums::ShadeModel shade_model
 Returns the shade model common to all of the individual GeomPrimitives that have been added to the geom. More...
 
- Public Attributes inherited from CachedTypedWritableReferenceCount
int cache_ref_count
 Returns the current reference count. More...
 
- Public Attributes inherited from TypedObject
TypeHandle type
 Returns the TypeHandle representing this object's type. More...
 
- Public Attributes inherited from ReferenceCount
int ref_count
 The current reference count. More...
 

Additional Inherited Members

- Public Types inherited from GeomEnums
enum  AnimationType { AT_none = 0, AT_panda = 1, AT_hardware = 2 }
 
enum  Contents {
  C_other = 0, C_point = 1, C_clip_point = 2, C_vector = 3,
  C_texcoord = 4, C_color = 5, C_index = 6, C_morph_delta = 7,
  C_matrix = 8, C_normal = 9
}
 
enum  GeomRendering {
  GR_indexed_point = 1, GR_indexed_other = 65536, GR_indexed_bits = 65537, GR_point = 2,
  GR_point_uniform_size = 4, GR_per_point_size = 8, GR_point_perspective = 16, GR_point_aspect_ratio = 32,
  GR_point_scale = 64, GR_point_rotate = 128, GR_point_sprite = 256, GR_point_sprite_tex_matrix = 512,
  GR_point_bits = 1022, GR_triangle_strip = 1024, GR_triangle_fan = 2048, GR_line_strip = 4096,
  GR_composite_bits = 7168, GR_strip_cut_index = 131072, GR_flat_first_vertex = 8192, GR_flat_last_vertex = 16384,
  GR_shade_model_bits = 24576, GR_render_mode_wireframe = 262144, GR_render_mode_point = 524288, GR_adjacency = 1048576
}
 
enum  NumericType {
  NT_uint8 = 0, NT_uint16 = 1, NT_uint32 = 2, NT_packed_dcba = 3,
  NT_packed_dabc = 4, NT_float32 = 5, NT_float64 = 6, NT_stdfloat = 7,
  NT_int8 = 8, NT_int16 = 9, NT_int32 = 10, NT_packed_ufloat = 11
}
 
enum  PrimitiveType {
  PT_none = 0, PT_polygons = 1, PT_lines = 2, PT_points = 3,
  PT_patches = 4
}
 
enum  ShadeModel { SM_uniform = 0, SM_smooth = 1, SM_flat_first_vertex = 2, SM_flat_last_vertex = 3 }
 
enum  UsageHint {
  UH_client = 0, UH_stream = 1, UH_dynamic = 2, UH_static = 3,
  UH_unspecified = 4
}
 

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

Member Function Documentation

◆ __init__()

__init__ ( const GeomVertexData  data)

◆ addPrimitive()

addPrimitive ( const GeomPrimitive  primitive)

Inserts 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() [1/2]

bool checkValid ( )

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.

◆ checkValid() [2/2]

bool checkValid ( const GeomVertexData  vertex_data)

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

clearBounds ( )

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

clearCache ( )

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

clearCacheStage ( Thread  current_thread)

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

clearPrimitives ( )

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

bool copyPrimitivesFrom ( const Geom  other)

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

Geom decompose ( )

Decomposes all of the primitives within this Geom, returning the result.

See GeomPrimitive::decompose().

◆ decomposeInPlace()

decomposeInPlace ( )

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.

◆ doubleside()

Geom doubleside ( )

Doublesides all of the primitives within this Geom, returning the result.

See GeomPrimitive::doubleside().

◆ doublesideInPlace()

doublesideInPlace ( )

Doublesides all of the primitives within this Geom, leaving the results in place.

See GeomPrimitive::doubleside().

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.

◆ getAnimatedVertexData()

const GeomVertexData getAnimatedVertexData ( bool  force,
Thread  current_thread 
)

Returns a GeomVertexData that represents the results of computing the vertex animation on the CPU for this Geom's vertex data.

If there is no CPU-defined vertex animation on this object, this just returns the original object.

If there is vertex animation, but the VertexTransform values have not changed since last time, this may return the same pointer it returned previously. Even if the VertexTransform values have changed, it may still return the same pointer, but with its contents modified (this is preferred, since it allows the graphics backend to update vertex buffers optimally).

If force is false, this method may return immediately with stale data, if the vertex data is not completely resident. If force is true, this method will never return stale data, but may block until the data is available.

◆ getBounds()

const BoundingVolume getBounds ( Thread  current_thread)

Returns the bounding volume for the Geom.

◆ getBoundsType()

BoundingVolume::BoundsType getBoundsType ( )

Returns the bounding volume type set with set_bounds_type().

◆ getClassType()

static TypeHandle getClassType ( )
static

◆ getGeomRendering()

int getGeomRendering ( )

Returns the set of GeomRendering bits that represent the rendering properties required to properly render this Geom.

◆ getModified()

UpdateSeq getModified ( Thread  current_thread)

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.

◆ getNestedVertices()

int getNestedVertices ( Thread  current_thread)

Returns the number of vertices rendered by all primitives within the Geom.

◆ getNumBytes()

int getNumBytes ( )

Returns the number of bytes consumed by the geom and its primitives (but not including its vertex table).

◆ getNumPrimitives()

int getNumPrimitives ( )

Returns the number of GeomPrimitive objects stored within the Geom, each of which represents a number of primitives of a particular type.

◆ getPrimitive()

const GeomPrimitive getPrimitive ( int  i)

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.

◆ getPrimitives()

list getPrimitives ( )

◆ getPrimitiveType()

GeomEnums::PrimitiveType getPrimitiveType ( )

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 getShadeModel ( )

Returns the shade model common to all of the individual GeomPrimitives that have been added to the geom.

◆ getUsageHint()

GeomEnums::UsageHint getUsageHint ( )

Returns the minimum (i.e.

most dynamic) usage_hint among all of the individual GeomPrimitives that have been added to the geom.

◆ getVertexData()

const GeomVertexData getVertexData ( Thread  current_thread)

Returns a const pointer to the GeomVertexData, for application code to directly examine (but not modify) the geom's underlying data.

◆ insertPrimitive()

insertPrimitive ( int  i,
const GeomPrimitive  primitive 
)

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

◆ isEmpty()

bool isEmpty ( )

Returns true if there appear to be no vertices to be rendered by this Geom, false if has some actual data.

◆ isPrepared()

bool isPrepared ( PreparedGraphicsObjects  prepared_objects)

Returns true if the geom has already been prepared or enqueued for preparation on the indicated GSG, false otherwise.

◆ makeAdjacency()

Geom makeAdjacency ( )

Returns a new Geom with each primitive converted into a corresponding version with adjacency information.

Since
1.10.0

◆ makeAdjacencyInPlace()

makeAdjacencyInPlace ( )

Replaces the GeomPrimitives within this Geom with corresponding versions with adjacency information.

See GeomPrimitive::make_adjacency().

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.

Since
1.10.0

◆ makeCopy()

Geom makeCopy ( )

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.

◆ makeLines()

Geom makeLines ( )

Returns a new Geom with lines at all the edges.

See GeomPrimitive::make_lines().

◆ makeLinesInPlace()

makeLinesInPlace ( )

Replaces the GeomPrimitives within this Geom with corresponding GeomLines, representing a wireframe of the primitives.

See GeomPrimitive::make_lines().

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

int makeNonindexed ( bool  composite_only)

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.

◆ makePatches()

Geom makePatches ( )

Returns a new Geom with each primitive converted into a patch.

Calls decompose() first.

◆ makePatchesInPlace()

makePatchesInPlace ( )

Replaces the GeomPrimitives within this Geom with corresponding GeomPatches.

See GeomPrimitive::make_patches().

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.

◆ makePoints()

Geom makePoints ( )

Returns a new Geom with points at all the vertices.

See GeomPrimitive::make_points().

◆ makePointsInPlace()

makePointsInPlace ( )

Replaces the GeomPrimitives within this Geom with corresponding GeomPoints.

See GeomPrimitive::make_points().

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

markBoundsStale ( )

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 modifyPrimitive ( int  i)

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

GeomVertexData modifyVertexData ( )

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

offsetVertices ( const GeomVertexData  data,
int  offset 
)

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 new()

operator new ( int  size)

◆ operator=()

Geom operator= ( const Geom  copy)

◆ output()

output ( Ostream  out)

◆ prepare()

prepare ( PreparedGraphicsObjects  prepared_objects)

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.

◆ prepareNow()

GeomContext prepareNow ( PreparedGraphicsObjects  prepared_objects,
GraphicsStateGuardianBase  gsg 
)

Creates a context for the geom on the particular GSG, if it does not already exist.

Returns the new (or old) GeomContext. This assumes that the GraphicsStateGuardian is the currently active rendering context and that it is ready to accept new geoms. If this is not necessarily the case, you should use prepare() instead.

Normally, this is not called directly except by the GraphicsStateGuardian; a geom does not need to be explicitly prepared by the user before it may be rendered.

◆ release()

bool release ( PreparedGraphicsObjects  prepared_objects)

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 releaseAll ( )

Frees the context allocated on all objects for which the geom has been declared.

Returns the number of contexts which have been freed.

◆ removePrimitive()

removePrimitive ( int  i)

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.

◆ requestResident()

bool requestResident ( )

Returns true if all the primitive arrays are currently resident in memory.

If this returns false, the data will be brought back into memory shortly; try again later.

This does not also test the Geom's associated GeomVertexData. That must be tested separately.

◆ reverse()

Geom reverse ( )

Reverses all of the primitives within this Geom, returning the result.

See GeomPrimitive::reverse().

◆ reverseInPlace()

reverseInPlace ( )

Reverses all of the primitives within this Geom, leaving the results in place.

See GeomPrimitive::reverse().

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

Geom rotate ( )

Rotates all of the primitives within this Geom, returning the result.

See GeomPrimitive::rotate().

◆ rotateInPlace()

rotateInPlace ( )

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

setBounds ( const BoundingVolume  volume)

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.

◆ setBoundsType()

setBoundsType ( BoundingVolume::BoundsType  bounds_type)

Specifies the desired type of bounding volume that will be created for this Geom.

This is normally BoundingVolume::BT_default, which means to set the type according to the config variable "bounds-type".

If this is BT_sphere or BT_box, a BoundingSphere or BoundingBox is explicitly created. If it is BT_best, a BoundingBox is created.

This affects the implicit bounding volume only. If an explicit bounding volume is set on the Geom with set_bounds(), that bounding volume type is used. (This is different behavior from the similar method on PandaNode.)

◆ setPrimitive()

setPrimitive ( int  i,
const GeomPrimitive  primitive 
)

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

setUsageHint ( GeomEnums::UsageHint  usage_hint)

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

setVertexData ( const GeomVertexData  data)

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

transformVertices ( const LMatrix4  mat)

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

Geom unify ( int  max_indices,
bool  preserve_order 
)

Unifies all of the primitives contained within this Geom into a single (or as few as possible, within the constraints of max_indices) primitive objects.

This may require decomposing the primitives if, for instance, the Geom contains both triangle strips and triangle fans.

max_indices represents the maximum number of indices that will be put in any one GeomPrimitive. If preserve_order is true, then the primitives will not be reordered during the operation, even if this results in a suboptimal result.

◆ unifyInPlace()

unifyInPlace ( int  max_indices,
bool  preserve_order 
)

Unifies all of the primitives contained within this Geom into a single (or as few as possible, within the constraints of max_indices) primitive objects.

This may require decomposing the primitives if, for instance, the Geom contains both triangle strips and triangle fans.

max_indices represents the maximum number of indices that will be put in any one GeomPrimitive. If preserve_order is true, then the primitives will not be reordered during the operation, even if this results in a suboptimal result.

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

write ( Ostream  out,
int  indent_level 
)

Member Data Documentation

◆ bounds_type

Returns the bounding volume type set with set_bounds_type().

◆ geom_rendering

int geom_rendering

Returns the set of GeomRendering bits that represent the rendering properties required to properly render this Geom.

◆ modified

UpdateSeq modified

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.

◆ num_bytes

int num_bytes

Returns the number of bytes consumed by the geom and its primitives (but not including its vertex table).

◆ primitive_type

GeomEnums::PrimitiveType primitive_type

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

◆ primitives

ConstPointerToGeomPrimitive primitives[]

◆ shade_model

GeomEnums::ShadeModel shade_model

Returns the shade model common to all of the individual GeomPrimitives that have been added to the geom.