Panda3D

Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Friends | List of all members
GeomMunger Class Reference

Objects of this class are used to convert vertex data from a Geom into a format suitable for passing to the rendering backend. More...

`#include "geomMunger.h"`

Inheritance diagram for GeomMunger:

## Public Member Functions
| GeomMunger (const GeomMunger &copy)
| GeomMunger (GraphicsStateGuardianBase *gsg)
int | compare_to (const GeomMunger &other) const
virtual TypeHandle | force_init_type ()
int | geom_compare_to (const GeomMunger &other) const
GraphicsStateGuardianBase * | get_gsg () const
| Returns a pointer to the GSG that created this munger.
virtual TypeHandle | get_type () const
bool | is_registered () const
| Returns true if this munger has been registered, false if it has not.
ConstPointerTo< GeomVertexData > | munge_data (const GeomVertexData *data) const
ConstPointerTo< GeomVertexFormat > | munge_format (const GeomVertexFormat *format, const GeomVertexAnimationSpec &animation) const
bool | munge_geom (ConstPointerTo< Geom > &geom, ConstPointerTo< GeomVertexData > &data, bool force, Thread *current_thread)
| Applies the indicated munger to the geom and its data, and returns a (possibly different) geom and data, according to the munger's whim.
void | operator= (const GeomMunger &copy)
ConstPointerTo< GeomVertexData > | premunge_data (const GeomVertexData *data) const
ConstPointerTo< GeomVertexFormat > | premunge_format (const GeomVertexFormat *format) const
void | premunge_geom (ConstPointerTo< Geom > &geom, ConstPointerTo< GeomVertexData > &data) const
void | remove_data (const GeomVertexData *data)
| Removes a prepared GeomVertexData from the cache.
Public Member Functions inherited from TypedReferenceCount
| TypedReferenceCount (const TypedReferenceCount &copy)
void | operator= (const TypedReferenceCount &copy)
Public Member Functions inherited from TypedObject
| TypedObject (const TypedObject &copy)=default
TypedObject * | as_typed_object ()
| Returns the object, upcast (if necessary) to a TypedObject pointer.
const TypedObject * | as_typed_object () const
| Returns the object, upcast (if necessary) to a TypedObject pointer.
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.
bool | is_exact_type (TypeHandle handle) const
| Returns true if the current object is the indicated type exactly.
bool | is_of_type (TypeHandle handle) const
| Returns true if the current object is or derives from the indicated type.
TypedObject & | operator= (const TypedObject &copy)=default
Public Member Functions inherited from MemoryBase
void | operator delete (void *, void *)
void | operator delete (void *ptr)
void | operator delete[] (void *, void *)
void | operator delete[] (void *ptr)
void * | operator new (size_t size)
void * | operator new (size_t size, void *ptr)
void * | operator new[] (size_t size)
void * | operator new[] (size_t size, void *ptr)
Public Member Functions inherited from ReferenceCount
int | get_ref_count () const
WeakReferenceList * | get_weak_list () const
| Returns the WeakReferenceList associated with this ReferenceCount object.
bool | has_weak_list () const
| Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise.
void | local_object ()
| This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack.
void | ref () const
| Explicitly increments the reference count.
bool | ref_if_nonzero () const
| Atomically increases the reference count of this object if it is not zero.
bool | test_ref_count_integrity () const
| Does some easy checks to make sure that the reference count isn't completely bogus.
bool | test_ref_count_nonzero () const
| Does some easy checks to make sure that the reference count isn't zero, or completely bogus.
virtual bool | unref () const
| Explicitly decrements the reference count.
bool | unref_if_one () const
| Atomically decreases the reference count of this object if it is one.
WeakReferenceList * | weak_ref ()
| Adds the indicated PointerToVoid as a weak reference to this object.
void | weak_unref ()
| Removes the indicated PointerToVoid as a weak reference to this object.

## Static Public Member Functions
static TypeHandle | get_class_type ()
static void | init_type ()
static PointerTo< GeomMunger > | register_munger (GeomMunger *munger, Thread *current_thread)
static void | unregister_mungers_for_gsg (GraphicsStateGuardianBase *gsg)
| Removes all the mungers from the registry that are associated with the indicated GSG.
Static Public Member Functions inherited from TypedReferenceCount
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.
Static Public Member Functions inherited from ReferenceCount
static TypeHandle | get_class_type ()
static void | init_type ()

## Friends
class | Geom
class | GeomCacheManager

## Additional Inherited Members
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 Attributes inherited from TypedObject
| get_type
Public Attributes inherited from ReferenceCount
| get_ref_count
| Returns the current reference count.

## Detailed Description

Objects of this class are used to convert vertex data from a Geom into a format suitable for passing to the rendering backend.

Typically, the rendering backend will create a specialization of this class to handle its particular needs (e.g. DXGeomMunger). This class is necessary because DirectX and OpenGL have somewhat different requirements for vertex format.

This also performs runtime application of state changes to the vertex data; for instance, by scaling all of the color values in response to a ColorScaleAttrib.

A GeomMunger must be registered before it can be used, and once registered, the object is constant and cannot be changed. All registered GeomMungers that perform the same operation will have the same pointer.

Definition at line 50 of file geomMunger.h.

## Constructor & Destructor Documentation

## ◆ GeomMunger() [1/2]

GeomMunger::GeomMunger | ( | GraphicsStateGuardianBase * | gsg | ) |

Definition at line 29 of file geomMunger.cxx.

## ◆ GeomMunger() [2/2]

GeomMunger::GeomMunger | ( | const GeomMunger & | copy | ) |

Definition at line 44 of file geomMunger.cxx.

## ◆ ~GeomMunger()

GeomMunger::~GeomMunger | ( |  | ) |
| virtual

Definition at line 66 of file geomMunger.cxx.

## Member Function Documentation

## ◆ force_init_type()

virtual TypeHandle GeomMunger::force_init_type | ( |  | ) |
| inline virtual

Reimplemented from TypedReferenceCount.

Definition at line 166 of file geomMunger.h.

## ◆ get_class_type()

static TypeHandle GeomMunger::get_class_type | ( |  | ) |
| inline static

Definition at line 155 of file geomMunger.h.

## ◆ get_gsg()

GraphicsStateGuardianBase * GeomMunger::get_gsg | ( |  | ) | const
| inline

Returns a pointer to the GSG that created this munger.

Definition at line 17 of file geomMunger.I.

Referenced by StandardMunger::get_gsg(), and StateMunger::munge_state().

## ◆ get_type()

virtual TypeHandle GeomMunger::get_type | ( |  | ) | const
| inline virtual

Reimplemented from TypedReferenceCount.

Definition at line 163 of file geomMunger.h.

## ◆ init_type()

static void GeomMunger::init_type | ( |  | ) |
| inline static

Definition at line 158 of file geomMunger.h.

## ◆ is_registered()

bool GeomMunger::is_registered | ( |  | ) | const
| inline

Returns true if this munger has been registered, false if it has not.

It may not be used for a Geom until it has been registered, but once registered, it may no longer be modified.

Definition at line 27 of file geomMunger.I.

## ◆ munge_geom()

bool GeomMunger::munge_geom | ( | ConstPointerTo< Geom > & | geom,
|  | ConstPointerTo< GeomVertexData > & | data,
|  | bool | force,
|  | Thread * | current_thread )

Applies the indicated munger to the geom and its data, and returns a (possibly different) geom and data, according to the munger's whim.

The assumption is that for a particular geom and a particular munger, the result will always be the same; so this result may be cached.

If force is false, this may do nothing and return false if the vertex data is nonresident. If force is true, this will always return true, but it may have to block while the vertex data is paged in.

Definition at line 94 of file geomMunger.cxx.

References LightMutexDirect::acquire(), LightMutexDirect::release(), and Geom::request_resident().

Referenced by CullableObject::munge_geom().

## ◆ operator=()

void GeomMunger::operator= | ( | const GeomMunger & | copy | ) |

Definition at line 58 of file geomMunger.cxx.

## ◆ remove_data()

void GeomMunger::remove_data | ( | const GeomVertexData * | data | ) |

Removes a prepared GeomVertexData from the cache.

Definition at line 75 of file geomMunger.cxx.

## ◆ unregister_mungers_for_gsg()

void GeomMunger::unregister_mungers_for_gsg | ( | GraphicsStateGuardianBase * | gsg | ) |
| inline static

Removes all the mungers from the registry that are associated with the indicated GSG.

Definition at line 51 of file geomMunger.I.

## Friends And Related Symbol Documentation

## ◆ Geom

friend class Geom
| friend

Definition at line 171 of file geomMunger.h.

## ◆ GeomCacheManager

friend class GeomCacheManager
| friend

Definition at line 152 of file geomMunger.h.

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

- panda/src/gobj/geomMunger.h
- panda/src/gobj/geomMunger.cxx
- panda/src/gobj/geomMunger.I