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

A container for geometry primitives. More...

#include "geom.h"

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

Classes

class  CacheEntry
 
class  CacheKey
 

Public Types

typedef pmap< const CacheKey *, PT(CacheEntry), IndirectLess< CacheKey > > Cache
 
- Public Types inherited from GeomEnums
enum  AnimationType { AT_none, AT_panda, AT_hardware }
 
enum  Contents {
  C_other, C_point, C_clip_point, C_vector,
  C_texcoord, C_color, C_index, C_morph_delta,
  C_matrix, C_normal
}
 
enum  GeomRendering {
  GR_indexed_point = 0x00001, GR_indexed_other = 0x10000, GR_indexed_bits = 0x10001, GR_point = 0x00002,
  GR_point_uniform_size = 0x00004, GR_per_point_size = 0x00008, GR_point_perspective = 0x00010, GR_point_aspect_ratio = 0x00020,
  GR_point_scale = 0x00040, GR_point_rotate = 0x00080, GR_point_sprite = 0x00100, GR_point_sprite_tex_matrix = 0x00200,
  GR_point_bits = 0x003fe, GR_triangle_strip = 0x00400, GR_triangle_fan = 0x00800, GR_line_strip = 0x01000,
  GR_composite_bits = 0x01c00, GR_strip_cut_index = 0x20000, GR_flat_first_vertex = 0x02000, GR_flat_last_vertex = 0x04000,
  GR_shade_model_bits = 0x06000, GR_render_mode_wireframe = 0x40000, GR_render_mode_point = 0x80000, GR_adjacency = 0x100000
}
 
enum  NumericType {
  NT_uint8, NT_uint16, NT_uint32, NT_packed_dcba,
  NT_packed_dabc, NT_float32, NT_float64, NT_stdfloat,
  NT_int8, NT_int16, NT_int32, NT_packed_ufloat
}
 
enum  PrimitiveType {
  PT_none, PT_polygons, PT_lines, PT_points,
  PT_patches
}
 
enum  ShadeModel { SM_uniform, SM_smooth, SM_flat_first_vertex, SM_flat_last_vertex }
 
enum  UsageHint {
  UH_client, UH_stream, UH_dynamic, UH_static,
  UH_unspecified
}
 

Public Member Functions

 Geom (const GeomVertexData *data)
 
void add_primitive (const GeomPrimitive *primitive)
 Inserts a new GeomPrimitive structure to the Geom object. More...
 
void calc_tight_bounds (LPoint3 &min_point, LPoint3 &max_point, bool &found_any, const GeomVertexData *vertex_data, bool got_mat, const LMatrix4 &mat, Thread *current_thread) const
 Expands min_point and max_point to include all of the vertices in the Geom, if any. More...
 
void calc_tight_bounds (LPoint3 &min_point, LPoint3 &max_point, bool &found_any, Thread *current_thread) const
 Expands min_point and max_point to include all of the vertices in the Geom, if any. More...
 
void calc_tight_bounds (LPoint3 &min_point, LPoint3 &max_point, bool &found_any, const GeomVertexData *vertex_data, bool got_mat, const LMatrix4 &mat, const InternalName *column_name, Thread *current_thread) const
 Similar to calc_tight_bounds(), for UV coordinates or other named columns. More...
 
bool check_valid () const
 Verifies that the all of the primitives within the geom reference vertices that actually exist within the geom's GeomVertexData. More...
 
bool check_valid (const GeomVertexData *vertex_data) const
 Verifies that the all of the primitives within the geom reference vertices that actually exist within the indicated GeomVertexData. More...
 
void clear_bounds ()
 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...
 
void clear_cache ()
 
void clear_cache_stage (Thread *current_thread)
 Removes all of the previously-cached results of munge_geom(), at the current pipeline stage and upstream. More...
 
void clear_primitives ()
 Removes all the primitives from the Geom object (but keeps the same table of vertices). More...
 
virtual bool copy_primitives_from (const Geom *other)
 Copies the primitives from the indicated Geom into this one. More...
 
 CPT (GeomVertexData) get_vertex_data(Thread *current_thread
 
 CPT (GeomVertexData) get_animated_vertex_data(bool force
 
 CPT (GeomPrimitive) get_primitive(size_t i) const
 
 CPT (BoundingVolume) get_bounds(Thread *current_thread
 
void decompose_in_place ()
 Decomposes all of the primitives within this Geom, leaving the results in place. More...
 
void doubleside_in_place ()
 Doublesides all of the primitives within this Geom, leaving the results in place. More...
 
bool draw (GraphicsStateGuardianBase *gsg, const GeomVertexData *vertex_data, bool force, Thread *current_thread) const
 Actually draws the Geom with the indicated GSG, using the indicated vertex data (which might have been pre-munged to support the GSG's needs). More...
 
virtual void finalize (BamReader *manager)
 Called by the BamReader to perform any final actions needed for setting up the object after all objects have been read and all pointers have been completed. More...
 
virtual TypeHandle force_init_type ()
 
BoundingVolume::BoundsType get_bounds_type () const
 
int get_geom_rendering () const
 
UpdateSeq get_modified (Thread *current_thread=Thread::get_current_thread()) const
 
int get_nested_vertices (Thread *current_thread=Thread::get_current_thread()) const
 
int get_num_bytes () const
 
size_t get_num_primitives () const
 
PrimitiveType get_primitive_type () const
 
ShadeModel get_shade_model () const
 
virtual TypeHandle get_type () const
 
UsageHint get_usage_hint () const
 Returns the minimum (i.e. More...
 
void insert_primitive (size_t i, const GeomPrimitive *primitive)
 
bool is_empty () const
 
bool is_prepared (PreparedGraphicsObjects *prepared_objects) const
 Returns true if the geom has already been prepared or enqueued for preparation on the indicated GSG, false otherwise. More...
 
void make_adjacency_in_place ()
 Replaces the GeomPrimitives within this Geom with corresponding versions with adjacency information. More...
 
virtual Geommake_copy () const
 Returns a newly-allocated Geom that is a shallow copy of this one. More...
 
void make_lines_in_place ()
 Replaces the GeomPrimitives within this Geom with corresponding GeomLines, representing a wireframe of the primitives. More...
 
int make_nonindexed (bool composite_only)
 Converts the geom from indexed to nonindexed by duplicating vertices as necessary. More...
 
void make_patches_in_place ()
 Replaces the GeomPrimitives within this Geom with corresponding GeomPatches. More...
 
void make_points_in_place ()
 Replaces the GeomPrimitives within this Geom with corresponding GeomPoints. More...
 
void mark_bounds_stale () const
 
void offset_vertices (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...
 
void operator= (const Geom &copy)
 The copy assignment operator is not pipeline-safe. More...
 
virtual void output (std::ostream &out) const
 
void 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...
 
GeomContextprepare_now (PreparedGraphicsObjects *prepared_objects, GraphicsStateGuardianBase *gsg)
 Creates a context for the geom on the particular GSG, if it does not already exist. More...
 
 PT (GeomVertexData) modify_vertex_data()
 
 PT (GeomPrimitive) modify_primitive(size_t i)
 
 PT (Geom) decompose() const
 
 PT (Geom) doubleside() const
 
 PT (Geom) reverse() const
 
 PT (Geom) rotate() const
 
 PT (Geom) unify(int max_indices
 
 PT (Geom) make_points() const
 
 PT (Geom) make_lines() const
 
 PT (Geom) make_patches() const
 
 PT (Geom) make_adjacency() const
 
bool release (PreparedGraphicsObjects *prepared_objects)
 Frees the geom context only on the indicated object, if it exists there. More...
 
int release_all ()
 Frees the context allocated on all objects for which the geom has been declared. More...
 
void remove_primitive (size_t i)
 
bool request_resident () const
 Returns true if all the primitive arrays are currently resident in memory. More...
 
void reverse_in_place ()
 Reverses all of the primitives within this Geom, leaving the results in place. More...
 
void rotate_in_place ()
 Rotates all of the primitives within this Geom, leaving the results in place. More...
 
void set_bounds (const BoundingVolume *volume)
 Resets the bounding volume so that it is the indicated volume. More...
 
void set_bounds_type (BoundingVolume::BoundsType bounds_type)
 
void set_primitive (size_t i, const GeomPrimitive *primitive)
 
void set_usage_hint (UsageHint usage_hint)
 Changes the UsageHint hint for all of the primitives on this Geom to the same value. More...
 
void set_vertex_data (const GeomVertexData *data)
 Replaces the Geom's underlying vertex data table with a completely new table. More...
 
void transform_vertices (const LMatrix4 &mat)
 Applies the indicated transform to all of the vertices in the Geom. More...
 
void unify_in_place (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...
 
virtual void write (std::ostream &out, int indent_level=0) const
 
virtual void write_datagram (BamWriter *manager, Datagram &dg)
 Writes the contents of this object to the datagram for shipping out to a Bam file. More...
 
- Public Member Functions inherited from CopyOnWriteObject
 CopyOnWriteObject (const CopyOnWriteObject &copy)
 
void operator= (const CopyOnWriteObject &copy)
 
- Public Member Functions inherited from CachedTypedWritableReferenceCount
void cache_ref () const
 Explicitly increments the cache reference count and the normal reference count simultaneously. More...
 
void cache_ref_only () const
 Decrements the cache reference count without affecting the normal reference count. More...
 
bool cache_unref () const
 Explicitly decrements the cache reference count and the normal reference count simultaneously. More...
 
int get_cache_ref_count () const
 
bool test_ref_count_integrity () const
 Does some easy checks to make sure that the reference count isn't completely bogus. More...
 
- Public Member Functions inherited from TypedWritableReferenceCount
 TypedWritableReferenceCount (const TypedWritableReferenceCount &copy)
 
virtual ReferenceCountas_reference_count ()
 Returns the pointer cast to a ReferenceCount pointer, if it is in fact of that type. More...
 
void operator= (const TypedWritableReferenceCount &copy)
 
- Public Member Functions inherited from TypedWritable
 TypedWritable (const TypedWritable &copy)
 
virtual int complete_pointers (TypedWritable **p_list, BamReader *manager)
 Receives an array of pointers, one for each time manager->read_pointer() was called in fillin(). More...
 
vector_uchar encode_to_bam_stream () const
 Converts the TypedWritable object into a single stream of data using a BamWriter, and returns that data as a bytes object. More...
 
bool encode_to_bam_stream (vector_uchar &data, BamWriter *writer=nullptr) const
 Converts the TypedWritable object into a single stream of data using a BamWriter, and stores that data in the indicated string. More...
 
UpdateSeq get_bam_modified () const
 Returns the current bam_modified counter. More...
 
void mark_bam_modified ()
 Increments the bam_modified counter, so that this object will be invalidated and retransmitted on any open bam streams. More...
 
void operator= (const TypedWritable &copy)
 
virtual bool require_fully_complete () const
 Some objects require all of their nested pointers to have been completed before the objects themselves can be completed. More...
 
virtual void update_bam_nested (BamWriter *manager)
 Called by the BamWriter when this object has not itself been modified recently, but it should check its nested objects for updates. More...
 
- Public Member Functions inherited from TypedObject
 TypedObject (const TypedObject &copy)=default
 
TypedObjectas_typed_object ()
 Returns the object, upcast (if necessary) to a TypedObject pointer. More...
 
const TypedObjectas_typed_object () const
 Returns the object, upcast (if necessary) to a TypedObject pointer. More...
 
int get_best_parent_from_Set (const std::set< int > &) const
 
int get_type_index () const
 Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. More...
 
bool is_exact_type (TypeHandle handle) const
 Returns true if the current object is the indicated type exactly. More...
 
bool is_of_type (TypeHandle handle) const
 Returns true if the current object is or derives from the indicated type. More...
 
TypedObjectoperator= (const TypedObject &copy)=default
 
- Public Member Functions inherited from ReferenceCount
int get_ref_count () const
 
WeakReferenceListget_weak_list () const
 Returns the WeakReferenceList associated with this ReferenceCount object. More...
 
bool has_weak_list () const
 Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise. More...
 
void local_object ()
 This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack. More...
 
void ref () const
 Explicitly increments the reference count. More...
 
bool ref_if_nonzero () const
 Atomically increases the reference count of this object if it is not zero. More...
 
bool test_ref_count_integrity () const
 Does some easy checks to make sure that the reference count isn't completely bogus. More...
 
bool test_ref_count_nonzero () const
 Does some easy checks to make sure that the reference count isn't zero, or completely bogus. More...
 
virtual bool unref () const
 Explicitly decrements the reference count. More...
 
WeakReferenceListweak_ref ()
 Adds the indicated PointerToVoid as a weak reference to this object. More...
 
void weak_unref ()
 Removes the indicated PointerToVoid as a weak reference to this object. More...
 

Static Public Member Functions

static TypeHandle get_class_type ()
 
static UpdateSeq get_next_modified ()
 Returns a monotonically increasing sequence. More...
 
static void init_type ()
 
static void register_with_read_factory ()
 Tells the BamReader how to create objects of type Geom. More...
 
- Static Public Member Functions inherited from CopyOnWriteObject
static TypeHandle get_class_type ()
 
static void init_type ()
 
- Static Public Member Functions inherited from CachedTypedWritableReferenceCount
static TypeHandle get_class_type ()
 
static void init_type ()
 
- Static Public Member Functions inherited from TypedWritableReferenceCount
static TypeHandle get_class_type ()
 
static void init_type ()
 
static PT (TypedWritableReferenceCount) decode_from_bam_stream(vector_uchar data
 
- Static Public Member Functions inherited from TypedWritable
static bool decode_raw_from_bam_stream (TypedWritable *&ptr, ReferenceCount *&ref_ptr, vector_uchar data, BamReader *reader=nullptr)
 Reads the bytes created by a previous call to encode_to_bam_stream(), and extracts the single object on those bytes. More...
 
static TypeHandle get_class_type ()
 
static void init_type ()
 
- Static Public Member Functions inherited from TypedObject
static TypeHandle get_class_type ()
 
static void init_type ()
 This function is declared non-inline to work around a compiler bug in g++ 2.96. More...
 
- Static Public Member Functions inherited from ReferenceCount
static TypeHandle get_class_type ()
 
static void init_type ()
 

Public Attributes

Thread *current_thread const
 
bool preserve_order const
 
 get_bounds_type
 Returns the bounding volume type set with set_bounds_type(). More...
 
 get_geom_rendering
 Returns the set of GeomRendering bits that represent the rendering properties required to properly render this Geom. More...
 
 get_modified
 
 get_num_bytes
 Returns the number of bytes consumed by the geom and its primitives (but not including its vertex table). More...
 
 get_num_primitives
 
 get_primitive
 
 get_primitive_type
 Returns the fundamental primitive type that is common to all GeomPrimitives added within the Geom. More...
 
 get_shade_model
 Returns the shade model common to all of the individual GeomPrimitives that have been added to the geom. More...
 
 insert_primitive
 Inserts a new GeomPrimitive structure to the Geom object. More...
 
 remove_primitive
 Removes the ith primitive from the list. More...
 
 set_bounds_type
 
 set_primitive
 
- Public Attributes inherited from CachedTypedWritableReferenceCount
 get_cache_ref_count
 Returns the current reference count. More...
 
- Public Attributes inherited from TypedWritableReferenceCount
static BamReaderreader = nullptr)
 
- Public Attributes inherited from TypedObject
 get_type
 
- Public Attributes inherited from ReferenceCount
 get_ref_count
 Returns the current reference count. More...
 

Friends

class CacheEntry
 
class GeomContext
 
class GeomMunger
 
class GeomPipelineReader
 
class PreparedGraphicsObjects
 

Additional Inherited Members

- Static Public Attributes inherited from TypedWritable
static TypedWritable *const Null = nullptr
 

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.

Definition at line 54 of file geom.h.

Member Function Documentation

◆ add_primitive()

void Geom::add_primitive ( const GeomPrimitive primitive)
inline

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.

Definition at line 116 of file geom.I.

References insert_primitive.

◆ calc_tight_bounds() [1/3]

void Geom::calc_tight_bounds ( LPoint3 &  min_point,
LPoint3 &  max_point,
bool &  found_any,
const GeomVertexData vertex_data,
bool  got_mat,
const LMatrix4 &  mat,
Thread current_thread 
) const
inline

Expands min_point and max_point to include all of the vertices in the Geom, if any.

found_any is set true if any points are found. It is the caller's responsibility to initialize min_point, max_point, and found_any before calling this function.

This version of the method allows the Geom to specify an alternate vertex data table (for instance, if the vertex data has already been munged), and also allows the result to be computed in any coordinate space by specifying a transform matrix.

Definition at line 324 of file geom.I.

Referenced by calc_tight_bounds().

◆ calc_tight_bounds() [2/3]

void Geom::calc_tight_bounds ( LPoint3 &  min_point,
LPoint3 &  max_point,
bool &  found_any,
Thread current_thread 
) const
inline

Expands min_point and max_point to include all of the vertices in the Geom, if any.

found_any is set true if any points are found. It is the caller's responsibility to initialize min_point, max_point, and found_any before calling this function.

This version of the method assumes the Geom will use its own vertex data, and the results are computed in the Geom's own coordinate space.

Definition at line 348 of file geom.I.

References calc_tight_bounds().

◆ calc_tight_bounds() [3/3]

void Geom::calc_tight_bounds ( LPoint3 &  min_point,
LPoint3 &  max_point,
bool &  found_any,
const GeomVertexData vertex_data,
bool  got_mat,
const LMatrix4 &  mat,
const InternalName column_name,
Thread current_thread 
) const
inline

Similar to calc_tight_bounds(), for UV coordinates or other named columns.

Definition at line 361 of file geom.I.

◆ check_valid() [1/2]

bool Geom::check_valid ( ) const

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.

Definition at line 1061 of file geom.cxx.

References CPT().

◆ check_valid() [2/2]

bool Geom::check_valid ( const GeomVertexData vertex_data) const

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.

Definition at line 1076 of file geom.cxx.

◆ clear_bounds()

void Geom::clear_bounds ( )
inline

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.

Definition at line 306 of file geom.I.

◆ clear_cache_stage()

void Geom::clear_cache_stage ( 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.

Definition at line 1186 of file geom.cxx.

Referenced by clear_primitives(), and PT().

◆ clear_primitives()

void Geom::clear_primitives ( )

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.

Definition at line 427 of file geom.cxx.

References clear_cache_stage().

◆ copy_primitives_from()

bool Geom::copy_primitives_from ( const Geom other)
virtual

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

Reimplemented in GeomTextGlyph.

Definition at line 941 of file geom.cxx.

References get_primitive_type, and get_shade_model.

Referenced by GeomTextGlyph::copy_primitives_from().

◆ decompose_in_place()

void Geom::decompose_in_place ( )

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.

Definition at line 446 of file geom.cxx.

◆ doubleside_in_place()

void Geom::doubleside_in_place ( )

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.

Definition at line 483 of file geom.cxx.

◆ draw()

bool Geom::draw ( GraphicsStateGuardianBase gsg,
const GeomVertexData vertex_data,
bool  force,
Thread current_thread 
) const

Actually draws the Geom with the indicated GSG, using the indicated vertex data (which might have been pre-munged to support the GSG's needs).

Returns true if all of the primitives were drawn normally, false if there was a problem (for instance, some of the data was nonresident). If force is passed true, it will wait for the data to become resident if necessary.

Definition at line 1306 of file geom.cxx.

References GeomPipelineReader::draw().

◆ finalize()

void Geom::finalize ( BamReader manager)
virtual

Called by the BamReader to perform any final actions needed for setting up the object after all objects have been read and all pointers have been completed.

Reimplemented from TypedWritable.

Definition at line 1682 of file geom.cxx.

◆ get_next_modified()

UpdateSeq Geom::get_next_modified ( )
static

Returns a monotonically increasing sequence.

Each time this is called, a new sequence number is returned, higher than the previous value.

This is used to ensure that GeomVertexArrayData::get_modified() and GeomPrimitive::get_modified() update from the same space, so that Geom::get_modified() returns a meaningful value.

Definition at line 1324 of file geom.cxx.

Referenced by GeomPrimitive::clear_vertices(), GeomPrimitive::modify_ends(), PT(), GeomPrimitive::set_minmax(), GeomVertexData::set_transform_blend_table(), and GeomPrimitive::set_usage_hint().

◆ get_usage_hint()

Geom::UsageHint Geom::get_usage_hint ( ) const

Returns the minimum (i.e.

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

Definition at line 110 of file geom.cxx.

◆ is_prepared()

bool Geom::is_prepared ( PreparedGraphicsObjects prepared_objects) const

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

Definition at line 1216 of file geom.cxx.

References PreparedGraphicsObjects::is_geom_queued().

Referenced by PreparedGraphicsObjects::is_geom_prepared().

◆ make_adjacency_in_place()

void Geom::make_adjacency_in_place ( )

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

Definition at line 899 of file geom.cxx.

◆ make_copy()

Geom * Geom::make_copy ( ) const
virtual

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.

Reimplemented in GeomTextGlyph.

Definition at line 100 of file geom.cxx.

Referenced by PT().

◆ make_lines_in_place()

void Geom::make_lines_in_place ( )

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.

Definition at line 786 of file geom.cxx.

◆ make_nonindexed()

int Geom::make_nonindexed ( 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.

Definition at line 234 of file geom.cxx.

References CPT(), and PT().

◆ make_patches_in_place()

void Geom::make_patches_in_place ( )

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.

Definition at line 860 of file geom.cxx.

◆ make_points_in_place()

void Geom::make_points_in_place ( )

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.

Definition at line 823 of file geom.cxx.

◆ offset_vertices()

void Geom::offset_vertices ( 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.

Definition at line 192 of file geom.cxx.

◆ operator=()

void Geom::operator= ( const Geom copy)

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.

Definition at line 71 of file geom.cxx.

◆ prepare()

void Geom::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.

Definition at line 1207 of file geom.cxx.

References PreparedGraphicsObjects::enqueue_geom().

◆ prepare_now()

GeomContext * Geom::prepare_now ( 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.

Definition at line 1282 of file geom.cxx.

References PreparedGraphicsObjects::prepare_geom_now().

Referenced by PreparedGraphicsObjects::begin_frame().

◆ register_with_read_factory()

void Geom::register_with_read_factory ( )
static

Tells the BamReader how to create objects of type Geom.

Definition at line 1643 of file geom.cxx.

References BamReader::get_factory(), and Factory< Type >::register_factory().

◆ release()

bool Geom::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.

Definition at line 1230 of file geom.cxx.

References PreparedGraphicsObjects::dequeue_geom(), and PreparedGraphicsObjects::release_geom().

◆ release_all()

int Geom::release_all ( )

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

Returns the number of contexts which have been freed.

Definition at line 1248 of file geom.cxx.

References PreparedGraphicsObjects::release_geom().

◆ request_resident()

bool Geom::request_resident ( ) const

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.

Definition at line 1003 of file geom.cxx.

◆ reverse_in_place()

void Geom::reverse_in_place ( )

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.

Definition at line 520 of file geom.cxx.

◆ rotate_in_place()

void Geom::rotate_in_place ( )

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.

Definition at line 557 of file geom.cxx.

◆ set_bounds()

void Geom::set_bounds ( const BoundingVolume volume)
inline

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.

Definition at line 288 of file geom.I.

◆ set_usage_hint()

void Geom::set_usage_hint ( Geom::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.

Definition at line 130 of file geom.cxx.

◆ set_vertex_data()

void Geom::set_vertex_data ( 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.

Definition at line 171 of file geom.cxx.

Referenced by PT(), and GeomTransformer::set_color().

◆ transform_vertices()

void Geom::transform_vertices ( 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.

Definition at line 1032 of file geom.cxx.

◆ unify_in_place()

void Geom::unify_in_place ( 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.

Definition at line 613 of file geom.cxx.

References PT().

◆ write_datagram()

void Geom::write_datagram ( BamWriter manager,
Datagram dg 
)
virtual

Writes the contents of this object to the datagram for shipping out to a Bam file.

Reimplemented from TypedWritable.

Definition at line 1652 of file geom.cxx.

References BamWriter::write_cdata(), and TypedWritable::write_datagram().

Member Data Documentation

◆ get_bounds_type

BoundingVolume::BoundsType Geom::get_bounds_type
inline

Returns the bounding volume type set with set_bounds_type().

Definition at line 143 of file geom.h.

◆ get_geom_rendering

int Geom::get_geom_rendering
inline

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

Definition at line 76 of file geom.h.

◆ get_num_bytes

int Geom::get_num_bytes

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

Definition at line 127 of file geom.h.

◆ get_primitive_type

Geom::PrimitiveType Geom::get_primitive_type
inline

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

Definition at line 74 of file geom.h.

Referenced by copy_primitives_from().

◆ get_shade_model

Geom::ShadeModel Geom::get_shade_model
inline

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

Definition at line 75 of file geom.h.

Referenced by copy_primitives_from().

◆ insert_primitive

void Geom::insert_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.

Definition at line 101 of file geom.h.

Referenced by add_primitive().

◆ remove_primitive

void Geom::remove_primitive

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.

Definition at line 101 of file geom.h.


The documentation for this class was generated from the following files: