|
Panda3D
|
Defines a series of "patches", fixed-size groupings of vertices that must be processed by a tessellation shader. More...
#include "geomPatches.h"
Public Member Functions | |
| GeomPatches (const GeomPatches ©) | |
| GeomPatches (int num_vertices_per_patch, UsageHint usage_hint) | |
| The number of vertices per patch must be specified to the GeomPatches constructor, and it may not be changed during the lifetime of the GeomPatches object. | |
| virtual bool | draw (GraphicsStateGuardianBase *gsg, const GeomPrimitivePipelineReader *reader, bool force) const |
| Calls the appropriate method on the GSG to draw the primitive. | |
| virtual TypeHandle | force_init_type () |
| virtual int | get_num_vertices_per_primitive () const |
| If the primitive type is a simple type in which all primitives have the same number of vertices, like patches, returns the number of vertices per primitive. | |
| virtual PrimitiveType | get_primitive_type () const |
| Returns the fundamental rendering type of this primitive: whether it is points, lines, or polygons. | |
| virtual TypeHandle | get_type () const |
| virtual PointerTo< GeomPrimitive > | make_copy () 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. | |
Public Member Functions inherited from GeomPrimitive | |
| GeomPrimitive (const GeomPrimitive ©) | |
| GeomPrimitive (UsageHint usage_hint) | |
| void | add_consecutive_vertices (int start, int num_vertices) |
| Adds a consecutive sequence of vertices, beginning at start, to the primitive. | |
| void | add_next_vertices (int num_vertices) |
| Adds the next n vertices in sequence, beginning from the last vertex added to the primitive + 1. | |
| void | add_vertex (int vertex) |
| Adds the indicated vertex to the list of vertex indices used by the graphics primitive type. | |
| void | add_vertices (int v1, int v2) |
| void | add_vertices (int v1, int v2, int v3) |
| Adds several vertices in a row. | |
| void | add_vertices (int v1, int v2, int v3, int v4) |
| Adds several vertices in a row. | |
| void | calc_sphere_radius (const LPoint3 ¢er, PN_stdfloat &sq_radius, bool &found_any, const GeomVertexData *vertex_data, Thread *current_thread) const |
| Expands radius so that a sphere with the given center point fits all of the vertices. | |
| void | calc_tight_bounds (LPoint3 &min_point, LPoint3 &max_point, PN_stdfloat &sq_center_dist, bool &found_any, const GeomVertexData *vertex_data, bool got_mat, const LMatrix4 &mat, const InternalName *column_name, Thread *current_thread) const |
| Expands min_point and max_point to include all of the vertices in the Geom, if any (or the data of any point type, for instance, texture coordinates– based on the column name). | |
| bool | check_valid (const GeomVertexData *vertex_data) const |
| Verifies that the primitive only references vertices that actually exist within the indicated GeomVertexData. | |
| bool | check_valid (const GeomVertexDataPipelineReader *data_reader) const |
| void | clear_minmax () |
| Undoes a previous call to set_minmax(), and allows the minimum and maximum values to be recomputed normally. | |
| void | clear_vertices () |
| Removes all of the vertices and primitives from the object, so they can be re-added. | |
| bool | close_primitive () |
| Indicates that the previous n calls to add_vertex(), since the last call to close_primitive(), have fully defined a new primitive. | |
| ConstPointerTo< GeomPrimitive > | decompose () const |
| Decomposes a complex primitive type into a simpler primitive type, for instance triangle strips to triangles, and returns a pointer to the new primitive definition. | |
| ConstPointerTo< GeomPrimitive > | doubleside () const |
| Duplicates triangles in the primitive so that each triangle is back-to-back with another triangle facing in the opposite direction. | |
| 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. | |
| int | get_data_size_bytes () const |
| CPTA_int | get_ends () const |
| Returns a const pointer to the primitive ends array so application code can read it directly. | |
| int | get_first_vertex () const |
| Returns the first vertex number referenced by the primitive. | |
| virtual int | get_geom_rendering () const |
| const GeomVertexArrayFormat * | get_index_format () const |
| Returns a registered format appropriate for using to store the index table. | |
| int | get_index_stride () const |
| NumericType | get_index_type () const |
| int | get_max_vertex () const |
| Returns the maximum vertex index number used by all the primitives in this object. | |
| ConstPointerTo< GeomVertexArrayData > | get_maxs () const |
| virtual int | get_min_num_vertices_per_primitive () const |
| int | get_min_vertex () const |
| Returns the minimum vertex index number used by all the primitives in this object. | |
| ConstPointerTo< GeomVertexArrayData > | get_mins () const |
| UpdateSeq | get_modified () const |
| int | get_num_bytes () const |
| int | get_num_faces () const |
| Returns the number of triangles or other fundamental type (such as line segments) represented by all the primitives in this object. | |
| int | get_num_primitives () const |
| Returns the number of individual primitives stored within this object. | |
| virtual int | get_num_unused_vertices_per_primitive () const |
| int | get_num_used_vertices () const |
| Returns the number of vertices used by all of the primitives. | |
| int | get_num_vertices () const |
| int | get_primitive_end (int n) const |
| Returns the element within the _vertices list at which the nth primitive ends. | |
| int | get_primitive_max_vertex (int n) const |
| Returns the maximum vertex index number used by the nth primitive in this object. | |
| int | get_primitive_min_vertex (int n) const |
| Returns the minimum vertex index number used by the nth primitive in this object. | |
| int | get_primitive_num_faces (int n) const |
| Returns the number of triangles or other fundamental type (such as line segments) represented by the nth primitive in this object. | |
| int | get_primitive_num_vertices (int n) const |
| Returns the number of vertices used by the nth primitive. | |
| int | get_primitive_start (int n) const |
| Returns the element within the _vertices list at which the nth primitive starts. | |
| ShadeModel | get_shade_model () const |
| int | get_strip_cut_index () const |
| UsageHint | get_usage_hint () const |
| int | get_vertex (int i) const |
| ConstPointerTo< GeomVertexArrayData > | get_vertices () const |
| ConstPointerTo< GeomVertexArrayDataHandle > | get_vertices_handle (Thread *current_thread) const |
| bool | is_composite () const |
| Returns true if the primitive is a composite primitive such as a tristrip or trifan, or false if it is a fundamental primitive such as a collection of triangles. | |
| bool | is_indexed () const |
| Returns true if the primitive is indexed, false otherwise. | |
| bool | is_prepared (PreparedGraphicsObjects *prepared_objects) const |
| Returns true if the data has already been prepared or enqueued for preparation on the indicated GSG, false otherwise. | |
| virtual ConstPointerTo< GeomPrimitive > | make_adjacency () const |
| Adds adjacency information to this primitive. | |
| PointerTo< GeomVertexArrayData > | make_index_data () const |
| void | make_indexed () |
| Converts the primitive from nonindexed form to indexed form. | |
| ConstPointerTo< GeomPrimitive > | make_lines () const |
| Returns a new GeomLines primitive that represents each of the edges in the original primitive rendered as a line. | |
| void | make_nonindexed (GeomVertexData *dest, const GeomVertexData *source) |
| Converts the primitive from indexed to nonindexed by duplicating vertices as necessary into the indicated dest GeomVertexData. | |
| ConstPointerTo< GeomPrimitive > | make_patches () const |
| Decomposes a complex primitive type into a simpler primitive type, for instance triangle strips to triangles, puts these in a new GeomPatches object and returns a pointer to the new primitive definition. | |
| ConstPointerTo< GeomPrimitive > | make_points () const |
| Returns a new GeomPoints primitive that represents each of the vertices in the original primitive, rendered exactly once. | |
| ConstPointerTo< GeomPrimitive > | match_shade_model (ShadeModel shade_model) const |
| Returns a new primitive that is compatible with the indicated shade model, if possible, or NULL if this is not possible. | |
| PTA_int | modify_ends () |
| Returns a modifiable pointer to the primitive ends array, so application code can directly fiddle with this data. | |
| PointerTo< GeomVertexArrayData > | modify_vertices (int num_vertices=-1) |
| Returns a modifiable pointer to the vertex index list, so application code can directly fiddle with this data. | |
| PointerTo< GeomVertexArrayDataHandle > | modify_vertices_handle (Thread *current_thread) |
| void | offset_vertices (int offset) |
| Adds the indicated offset to all vertices used by the primitive. | |
| void | offset_vertices (int offset, int begin_row, int end_row) |
| Adds the indicated offset to the indicated segment of vertices used by the primitive. | |
| void | operator= (const GeomPrimitive ©) |
| The copy assignment operator is not pipeline-safe. | |
| virtual void | output (std::ostream &out) const |
| void | pack_vertices (GeomVertexData *dest, const GeomVertexData *source) |
| Packs the vertices used by the primitive from the indicated source array onto the end of the indicated destination array. | |
| void | prepare (PreparedGraphicsObjects *prepared_objects) |
| Indicates that the data should be enqueued to be prepared in the indicated prepared_objects at the beginning of the next frame. | |
| IndexBufferContext * | prepare_now (PreparedGraphicsObjects *prepared_objects, GraphicsStateGuardianBase *gsg) |
| Creates a context for the data on the particular GSG, if it does not already exist. | |
| bool | release (PreparedGraphicsObjects *prepared_objects) |
| Frees the data context only on the indicated object, if it exists there. | |
| int | release_all () |
| Frees the context allocated on all objects for which the data has been declared. | |
| bool | request_resident (Thread *current_thread=Thread::get_current_thread()) const |
| Returns true if the primitive data is currently resident in memory. | |
| void | reserve_num_vertices (int num_vertices) |
| This ensures that enough memory space for n vertices is allocated, so that you may increase the number of vertices to n without causing a new memory allocation. | |
| ConstPointerTo< GeomPrimitive > | reverse () const |
| Reverses the winding order in the primitive so that each triangle is facing in the opposite direction it was originally. | |
| ConstPointerTo< GeomPrimitive > | rotate () const |
| Returns a new primitive with the shade_model reversed (if it is flat shaded), if possible. | |
| void | set_ends (PTA_int ends) |
| Completely replaces the primitive ends array with a new table. | |
| void | set_index_type (NumericType index_type) |
| Changes the numeric type of the index column. | |
| void | set_minmax (int min_vertex, int max_vertex, GeomVertexArrayData *mins, GeomVertexArrayData *maxs) |
| Explicitly specifies the minimum and maximum vertices, as well as the lists of per-component min and max. | |
| void | set_nonindexed_vertices (int first_vertex, int num_vertices) |
| Sets the primitive up as a nonindexed primitive, using the indicated vertex range. | |
| void | set_shade_model (ShadeModel shade_model) |
| Changes the ShadeModel hint for this primitive. | |
| void | set_usage_hint (UsageHint usage_hint) |
| Changes the UsageHint hint for this primitive. | |
| void | set_vertices (const GeomVertexArrayData *vertices, int num_vertices=-1) |
| Completely replaces the vertex index list with a new table. | |
| virtual void | write (std::ostream &out, int indent_level) const |
Public Member Functions inherited from CopyOnWriteObject | |
| CopyOnWriteObject (const CopyOnWriteObject ©) | |
| void | operator= (const CopyOnWriteObject ©) |
Public Member Functions inherited from CachedTypedWritableReferenceCount | |
| void | cache_ref () const |
| Explicitly increments the cache reference count and the normal reference count simultaneously. | |
| void | cache_ref_only () const |
| Decrements the cache reference count without affecting the normal reference count. | |
| bool | cache_unref () const |
| Explicitly decrements the cache reference count and the normal reference count simultaneously. | |
| 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. | |
Public Member Functions inherited from TypedWritableReferenceCount | |
| TypedWritableReferenceCount (const TypedWritableReferenceCount ©) | |
| virtual ReferenceCount * | as_reference_count () |
| Returns the pointer cast to a ReferenceCount pointer, if it is in fact of that type. | |
| void | operator= (const TypedWritableReferenceCount ©) |
Public Member Functions inherited from TypedWritable | |
| TypedWritable (const TypedWritable ©) | |
| 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(). | |
| 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. | |
| 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. | |
| UpdateSeq | get_bam_modified () const |
| Returns the current bam_modified counter. | |
| void | mark_bam_modified () |
| Increments the bam_modified counter, so that this object will be invalidated and retransmitted on any open bam streams. | |
| void | operator= (const TypedWritable ©) |
| 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. | |
| 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. | |
Public Member Functions inherited from TypedObject | |
| TypedObject (const TypedObject ©)=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 ©)=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 void | register_with_read_factory () |
| Tells the BamReader how to create objects of type Geom. | |
Static Public Member Functions inherited from GeomPrimitive | |
| static TypeHandle | get_class_type () |
| static const GeomVertexArrayFormat * | get_index_format (NumericType index_type) |
| Returns a registered GeomVertexArrayFormat of the indicated unsigned integer numeric type for storing index values. | |
| static void | init_type () |
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. | |
| 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 |
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 GeomPrimitive | |
| get_data_size_bytes | |
| Returns the number of bytes stored in the vertices array. | |
| get_geom_rendering | |
| Returns the set of GeomRendering bits that represent the rendering properties required to properly render this primitive. | |
| get_index_stride | |
| A convenience function to return the gap between successive index numbers, in bytes, of the index data. | |
| get_index_type | |
| Returns the numeric type of the index column. | |
| get_maxs | |
| get_min_num_vertices_per_primitive | |
| Returns the minimum number of vertices that must be added before close_primitive() may legally be called. | |
| get_mins | |
| get_modified | |
| Returns a sequence number which is guaranteed to change at least every time the vertex index array is modified. | |
| get_num_bytes | |
| Returns the number of bytes consumed by the primitive and its index table(s). | |
| get_num_unused_vertices_per_primitive | |
| Returns the number of vertices that are added between primitives that aren't, strictly speaking, part of the primitives themselves. | |
| get_num_vertices | |
| Returns the number of indices used by all the primitives in this object. | |
| get_num_vertices_per_primitive | |
| If the primitive type is a simple type in which all primitives have the same number of vertices, like triangles, returns the number of vertices per primitive. | |
| get_primitive_type | |
| get_shade_model | |
| Returns the ShadeModel hint for this primitive. | |
| get_strip_cut_index | |
| Returns the index of the indicated type that is reserved for use as a strip cut index, if enabled for the primitive. | |
| get_usage_hint | |
| Returns the usage hint for this primitive. | |
| get_vertex | |
| Returns the ith vertex index in the table. | |
Public Attributes inherited from CachedTypedWritableReferenceCount | |
| get_cache_ref_count | |
| Returns the current reference count. | |
Public Attributes inherited from TypedWritableReferenceCount | |
| static BamReader * | reader = nullptr) |
Public Attributes inherited from TypedObject | |
| get_type | |
Public Attributes inherited from ReferenceCount | |
| get_ref_count | |
| Returns the current reference count. | |
Static Public Attributes inherited from TypedWritable | |
| static TypedWritable *const | Null = nullptr |
Defines a series of "patches", fixed-size groupings of vertices that must be processed by a tessellation shader.
Definition at line 24 of file geomPatches.h.
|
explicit |
The number of vertices per patch must be specified to the GeomPatches constructor, and it may not be changed during the lifetime of the GeomPatches object.
Create a new GeomPatches if you need to have a different value.
Definition at line 29 of file geomPatches.cxx.
| GeomPatches::GeomPatches | ( | const GeomPatches & | copy | ) |
Definition at line 39 of file geomPatches.cxx.
|
virtual |
Definition at line 49 of file geomPatches.cxx.
|
virtual |
Calls the appropriate method on the GSG to draw the primitive.
Implements GeomPrimitive.
Definition at line 92 of file geomPatches.cxx.
|
inlinevirtual |
Reimplemented from GeomPrimitive.
Definition at line 65 of file geomPatches.h.
|
inlinestatic |
Definition at line 54 of file geomPatches.h.
|
virtual |
If the primitive type is a simple type in which all primitives have the same number of vertices, like patches, returns the number of vertices per primitive.
If the primitive type is a more complex type in which different primitives might have different numbers of vertices, for instance a triangle strip, returns 0.
In the case of GeomPatches, this returns the fixed number that was specified to the constructor.
Reimplemented from GeomPrimitive.
Definition at line 84 of file geomPatches.cxx.
|
virtual |
Returns the fundamental rendering type of this primitive: whether it is points, lines, or polygons.
This is used to set up the appropriate antialiasing settings when AntialiasAttrib::M_auto is in effect; it also implies the type of primitive that will be produced when decompose() is called.
Implements GeomPrimitive.
Definition at line 69 of file geomPatches.cxx.
|
inlinevirtual |
Reimplemented from GeomPrimitive.
Definition at line 62 of file geomPatches.h.
|
inlinestatic |
Definition at line 57 of file geomPatches.h.
|
virtual |
Implements GeomPrimitive.
Definition at line 56 of file geomPatches.cxx.
|
static |
Tells the BamReader how to create objects of type Geom.
Definition at line 101 of file geomPatches.cxx.
References BamReader::get_factory(), and Factory< Type >::register_factory().
Writes the contents of this object to the datagram for shipping out to a Bam file.
Reimplemented from GeomPrimitive.
Definition at line 110 of file geomPatches.cxx.
References Datagram::add_uint16(), and GeomPrimitive::write_datagram().
|
friend |
Definition at line 70 of file geomPatches.h.