Panda3D
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | Friends

GeomTristrips Class Reference

Defines a series of triangle strips. More...

#include "geomTristrips.h"

Inheritance diagram for GeomTristrips:
GeomPrimitive CopyOnWriteObject GeomEnums CachedTypedWritableReferenceCount TypedWritableReferenceCount TypedWritable ReferenceCount TypedObject MemoryBase MemoryBase

List of all members.

Public Types

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
}
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_flat_first_vertex = 0x02000, GR_flat_last_vertex = 0x04000, GR_shade_model_bits = 0x06000,
  GR_texcoord_light_vector = 0x08000
}
enum  NumericType {
  NT_uint8, NT_uint16, NT_uint32, NT_packed_dcba,
  NT_packed_dabc, NT_float32
}
enum  PrimitiveType { PT_none, PT_polygons, PT_lines, PT_points }
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

 GeomTristrips (UsageHint usage_hint)
 GeomTristrips (const GeomTristrips &copy)
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)
 Adds several vertices in a row.
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.
virtual ReferenceCountas_reference_count ()
 Returns the pointer cast to a ReferenceCount pointer, if it is in fact of that type.
TypedObjectas_typed_object ()
 Returns the object, upcast (if necessary) to a TypedObject pointer.
const TypedObjectas_typed_object () const
 Returns the object, upcast (if necessary) to a TypedObject pointer.
void cache_ref () const
 Explicitly increments the cache reference count and the normal reference count simultaneously.
bool cache_unref () const
 Explicitly decrements the cache reference count and the normal reference count simultaneously.
void calc_tight_bounds (LPoint3f &min_point, LPoint3f &max_point, bool &found_any, const GeomVertexData *vertex_data, bool got_mat, const LMatrix4f &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.
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.
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().
 CPT (GeomVertexArrayFormat) get_index_format() const
virtual bool draw (GraphicsStateGuardianBase *gsg, const GeomPrimitivePipelineReader *reader, bool force) const
 Calls the appropriate method on the GSG to draw the primitive.
string encode_to_bam_stream () const
 Converts the TypedWritable object into a single stream of data using a BamWriter, and returns that data as a string string.
bool encode_to_bam_stream (string &data, BamWriter *writer=NULL) const
 Converts the TypedWritable object into a single stream of data using a BamWriter, and stores that data in the indicated string.
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.
virtual TypeHandle force_init_type ()
UpdateSeq get_bam_modified () const
 Returns the current bam_modified counter.
int get_best_parent_from_Set (const std::set< int > &) const
int get_cache_ref_count () const
 Returns the current reference count.
int get_data_size_bytes () const
 Returns the number of bytes stored in the vertices array.
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
 Returns the set of GeomRendering bits that represent the rendering properties required to properly render this primitive.
int get_index_stride () const
 A convenience function to return the gap between successive index numbers, in bytes, of the index data.
NumericType get_index_type () const
 Returns the numeric type of the index column.
int get_max_vertex () const
 Returns the maximum vertex index number used by all the primitives in this object.
virtual int get_min_num_vertices_per_primitive () const
 Returns the minimum number of vertices that must be added before close_primitive() may legally be called.
int get_min_vertex () const
 Returns the minimum vertex index number used by all the primitives in this object.
UpdateSeq get_modified () const
 Returns a sequence number which is guaranteed to change at least every time the vertex index array is modified.
int get_num_bytes () const
 Returns the number of bytes consumed by the primitive and its index table(s).
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
 Returns the number of vertices that are added between primitives that aren't, strictly speaking, part of the primitives themselves.
int get_num_vertices () const
 Returns the number of vertices used by all the primitives in this object.
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 triangles, returns the number of vertices per primitive.
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.
virtual PrimitiveType get_primitive_type () const
 Returns the fundamental rendering type of this primitive: whether it is points, lines, or polygons.
int get_ref_count () const
 Returns the current reference count.
ShadeModel get_shade_model () const
 Returns the ShadeModel hint for this primitive.
virtual TypeHandle get_type () const
int get_type_index () const
 Returns the internal index number associated with this object's TypeHandle, a unique number for each different type.
UsageHint get_usage_hint () const
 Returns the usage hint for this primitive.
int get_vertex (int i) const
 Returns the ith vertex index in the table.
WeakReferenceListget_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.
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_exact_type (TypeHandle handle) const
 Returns true if the current object is the indicated type exactly.
bool is_indexed () const
 Returns true if the primitive is indexed, false otherwise.
bool is_of_type (TypeHandle handle) const
 Returns true if the current object is or derives from the indicated type.
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.
void local_object ()
 This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack.
void make_indexed ()
 Converts the primitive from nonindexed form to indexed form.
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.
 MAKE_SEQ (get_vertices, get_num_vertices, get_vertex)
void mark_bam_modified ()
 Increments the bam_modified counter, so that this object will be invalidated and retransmitted on any open bam streams.
PTA_int modify_ends ()
 Returns a modifiable pointer to the primitive ends array, so application code can directly fiddle with this data.
void offset_vertices (int offset)
 Adds the indicated offset to all vertices used by the primitive.
void operator delete (void *ptr)
void operator delete (void *ptr, void *)
void operator delete (void *ptr, void *)
void operator delete (void *ptr)
void operator delete[] (void *ptr)
void operator delete[] (void *ptr)
void operator delete[] (void *, void *)
void operator delete[] (void *, void *)
void * operator new (size_t size)
void * operator new (size_t size, void *ptr)
void * operator new (size_t size, void *ptr)
void * operator new (size_t size)
void * operator new[] (size_t size)
void * operator new[] (size_t size, void *ptr)
void * operator new[] (size_t size, void *ptr)
void * operator new[] (size_t size)
virtual void output (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.
IndexBufferContextprepare_now (PreparedGraphicsObjects *prepared_objects, GraphicsStateGuardianBase *gsg)
 Creates a context for the data on the particular GSG, if it does not already exist.
virtual PT (GeomPrimitive) make_copy() const
 PT (GeomVertexArrayData) make_index_data() const
 PT (GeomVertexArrayData) modify_vertices(int num_vertices
void ref () const
 Explicitly increments the reference count.
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 () const
 Returns true if the primitive data is currently resident in memory.
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.
void set_ends (CPTA_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.
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.
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.
void weak_ref (WeakPointerToVoid *ptv)
 Adds the indicated PointerToVoid as a weak reference to this object.
void weak_unref (WeakPointerToVoid *ptv)
 Removes the indicated PointerToVoid as a weak reference to this object.
virtual void write (ostream &out, int indent_level) 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.

Static Public Member Functions

static bool decode_raw_from_bam_stream (TypedWritable *&ptr, ReferenceCount *&ref_ptr, const string &data, BamReader *reader=NULL)
 Reads the string created by a previous call to encode_to_bam_stream(), and extracts the single object on that string.
static TypeHandle get_class_type ()
static void init_type ()
static PT (TypedWritableReferenceCount) decode_from_bam_stream(const string &data
static void register_with_read_factory ()
 Tells the BamReader how to create objects of type Geom.

Public Attributes

static BamReaderreader = NULL)

Static Public Attributes

static TypedWritable *const Null = (TypedWritable*)0L

Protected Member Functions

virtual void append_unused_vertices (GeomVertexArrayData *vertices, int vertex)
 Called when a new primitive is begun (other than the first primitive), this should add some degenerate vertices between primitives, if the primitive type requires that.
void cache_unref_only () const
 Decrements the cache reference count without affecting the normal reference count.
virtual CPT (GeomPrimitive) doubleside_impl() const
virtual CPT (GeomVertexArrayData) rotate_impl() const
virtual CPT (GeomPrimitive) decompose_impl() const
virtual CPT (GeomPrimitive) reverse_impl() const
bool do_test_ref_count_integrity () const
 Does some easy checks to make sure that the reference count isn't completely bogus.
bool do_test_ref_count_nonzero () const
 Returns true if the reference count is nonzero, false otherwise.
void fillin (DatagramIterator &scan, BamReader *manager)
 This internal function is called by make_from_bam to read in all of the relevant data from the BamFile for the new GeomPrimitive.
virtual PT (CopyOnWriteObject) make_cow_copy()
virtual bool requires_unused_vertices () const
 Should be redefined to return true in any primitive that implements append_unused_vertices().

Static Protected Member Functions

static TypedWritablemake_from_bam (const FactoryParams &params)
 This function is called by the BamReader's factory when a new object of type Geom is encountered in the Bam file.

Friends

class Geom

Detailed Description

Defines a series of triangle strips.

Definition at line 25 of file geomTristrips.h.


Member Function Documentation

void GeomPrimitive::add_consecutive_vertices ( int  start,
int  num_vertices 
) [inherited]

Adds a consecutive sequence of vertices, beginning at start, to the 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 248 of file geomPrimitive.cxx.

References GeomVertexWriter::add_data1i(), GeomPrimitive::append_unused_vertices(), Geom::get_next_modified(), GeomPrimitive::get_num_primitives(), GeomPrimitive::get_num_vertices(), GeomPrimitive::get_primitive_end(), and GeomVertexWriter::set_row().

Referenced by GeomPrimitive::add_next_vertices().

void GeomPrimitive::add_next_vertices ( int  num_vertices) [inherited]

Adds the next n vertices in sequence, beginning from the last vertex added to the primitive + 1.

This is most useful when you are building up a primitive and a GeomVertexData at the same time, and you just want the primitive to reference the first n vertices from the data, then the next n, and so on.

Definition at line 315 of file geomPrimitive.cxx.

References GeomPrimitive::add_consecutive_vertices(), GeomPrimitive::get_num_vertices(), and GeomPrimitive::get_vertex().

void GeomPrimitive::add_vertex ( int  vertex) [inherited]

Adds the indicated vertex to the list of vertex indices used by the graphics primitive type.

To define a primitive, you must call add_vertex() for each vertex of the new primitive, and then call close_primitive() after you have specified the last vertex of each 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 188 of file geomPrimitive.cxx.

References GeomVertexWriter::add_data1i(), GeomPrimitive::append_unused_vertices(), Geom::get_next_modified(), GeomPrimitive::get_num_primitives(), GeomPrimitive::get_num_vertices(), GeomPrimitive::get_primitive_end(), GeomPrimitive::requires_unused_vertices(), and GeomVertexWriter::set_row().

Referenced by GeomPrimitive::add_vertices().

void GeomPrimitive::add_vertices ( int  v1,
int  v2 
) [inline, inherited]

Adds several vertices in a row.

Definition at line 387 of file geomPrimitive.I.

References GeomPrimitive::add_vertex().

void GeomPrimitive::add_vertices ( int  v1,
int  v2,
int  v3 
) [inline, inherited]

Adds several vertices in a row.

Definition at line 398 of file geomPrimitive.I.

References GeomPrimitive::add_vertex().

void GeomPrimitive::add_vertices ( int  v1,
int  v2,
int  v3,
int  v4 
) [inline, inherited]

Adds several vertices in a row.

Definition at line 410 of file geomPrimitive.I.

References GeomPrimitive::add_vertex().

void GeomTristrips::append_unused_vertices ( GeomVertexArrayData vertices,
int  vertex 
) [protected, virtual]

Called when a new primitive is begun (other than the first primitive), this should add some degenerate vertices between primitives, if the primitive type requires that.

The second parameter is the first vertex that begins the new primitive.

Reimplemented from GeomPrimitive.

Definition at line 369 of file geomTristrips.cxx.

References GeomVertexWriter::add_data1i(), GeomVertexReader::get_data1i(), GeomVertexArrayData::get_num_rows(), GeomVertexWriter::set_row(), and GeomVertexReader::set_row().

ReferenceCount * TypedWritableReferenceCount::as_reference_count ( ) [virtual, inherited]

Returns the pointer cast to a ReferenceCount pointer, if it is in fact of that type.

Reimplemented from TypedWritable.

Definition at line 26 of file typedWritableReferenceCount.cxx.

TypedObject * TypedObject::as_typed_object ( ) [inline, inherited]

Returns the object, upcast (if necessary) to a TypedObject pointer.

Definition at line 99 of file typedObject.I.

const TypedObject * TypedObject::as_typed_object ( ) const [inline, inherited]

Returns the object, upcast (if necessary) to a TypedObject pointer.

Definition at line 110 of file typedObject.I.

void CachedTypedWritableReferenceCount::cache_ref ( ) const [inline, inherited]

Explicitly increments the cache reference count and the normal reference count simultaneously.

Reimplemented in RenderState, and TransformState.

Definition at line 147 of file cachedTypedWritableReferenceCount.I.

References ReferenceCount::ref(), and CachedTypedWritableReferenceCount::test_ref_count_integrity().

Referenced by CopyOnWritePointer::get_write_pointer().

bool CachedTypedWritableReferenceCount::cache_unref ( ) const [inline, inherited]

Explicitly decrements the cache reference count and the normal reference count simultaneously.

The return value is true if the new reference count is nonzero, false if it is zero.

Reimplemented in RenderState, and TransformState.

Definition at line 166 of file cachedTypedWritableReferenceCount.I.

References CachedTypedWritableReferenceCount::test_ref_count_integrity(), and ReferenceCount::unref().

void CachedTypedWritableReferenceCount::cache_unref_only ( ) const [inline, protected, inherited]

Decrements the cache reference count without affecting the normal reference count.

Intended to be called by derived classes only, presumably to reimplement cache_unref().

Definition at line 204 of file cachedTypedWritableReferenceCount.I.

References CachedTypedWritableReferenceCount::test_ref_count_integrity().

void GeomPrimitive::calc_tight_bounds ( LPoint3f min_point,
LPoint3f max_point,
bool &  found_any,
const GeomVertexData vertex_data,
bool  got_mat,
const LMatrix4f mat,
const InternalName column_name,
Thread current_thread 
) const [inherited]

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

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.

Definition at line 1434 of file geomPrimitive.cxx.

References GeomVertexReader::get_data1i(), GeomVertexReader::get_data3f(), GeomVertexReader::has_column(), GeomVertexReader::set_row(), and LMatrix4f::xform_point().

bool GeomPrimitive::check_valid ( const GeomVertexData vertex_data) const [inline, inherited]

Verifies that the primitive only references vertices that actually exist within the indicated GeomVertexData.

Returns true if the primitive appears to be valid, false otherwise.

Definition at line 265 of file geomPrimitive.I.

References GeomPrimitivePipelineReader::check_minmax(), and Thread::get_current_thread().

Referenced by Geom::add_primitive(), Geom::set_primitive(), and Geom::unify_in_place().

void GeomPrimitive::clear_minmax ( ) [inherited]

Undoes a previous call to set_minmax(), and allows the minimum and maximum values to be recomputed normally.

This method is intended for low-level usage only. There are higher-level methods for more common usage. We recommend you do not use this method directly. If you do, be sure you know what you are doing!

Definition at line 1196 of file geomPrimitive.cxx.

void GeomPrimitive::clear_vertices ( ) [inherited]

Removes all of the vertices and primitives from the object, so they can be re-added.

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 389 of file geomPrimitive.cxx.

References Geom::get_next_modified().

Referenced by Geom::unify_in_place().

bool GeomPrimitive::close_primitive ( ) [inherited]

Indicates that the previous n calls to add_vertex(), since the last call to close_primitive(), have fully defined a new primitive.

Returns true if successful, false otherwise.

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 336 of file geomPrimitive.cxx.

References GeomPrimitive::get_min_num_vertices_per_primitive(), Geom::get_next_modified(), GeomPrimitive::get_num_unused_vertices_per_primitive(), GeomPrimitive::get_num_vertices(), and GeomPrimitive::get_num_vertices_per_primitive().

int TypedWritable::complete_pointers ( TypedWritable **  p_list,
BamReader manager 
) [virtual, inherited]

Receives an array of pointers, one for each time manager->read_pointer() was called in fillin().

Returns the number of pointers processed.

This is the callback function that is made by the BamReader at some later point, after all of the required pointers have been filled in. It is necessary because there might be forward references in a bam file; when we call read_pointer() in fillin(), the object may not have been read from the file yet, so we do not have a pointer available at that time. Thus, instead of returning a pointer, read_pointer() simply reserves a later callback. This function provides that callback. The calling object is responsible for keeping track of the number of times it called read_pointer() and extracting the same number of pointers out of the supplied vector, and storing them appropriately within the object.

Reimplemented in CFDoCullCommand, AnimBundleNode, AnimChannelMatrixDynamic, AnimChannelScalarDynamic, AnimGroup, MovingPartBase, PartBundle, PartBundleNode, PartGroup, Character, CharacterJoint, CharacterJointEffect, CharacterVertexSlider, JointVertexTransform, CollisionNode, DataNodeTransmit, GeomVertexArrayData, GeomVertexArrayFormat, GeomVertexData, GeomVertexFormat, SliderTable, TextureStage, TransformBlendTable, TransformTable, PiecewiseCurve, ClipPlaneAttrib, FogAttrib, LensNode, LightAttrib, MaterialAttrib, PortalNode, RenderEffects, RenderState, TexGenAttrib, TexMatrixAttrib, TexProjectorEffect, TextureAttrib, BamCacheIndex, RecorderFrame, EggFile, ImageFile, PaletteGroup, PaletteGroups, PaletteImage, PalettePage, Palettizer, SourceTextureImage, TextureImage, TexturePlacement, TextureProperties, and TextureReference.

Definition at line 103 of file typedWritable.cxx.

bool TypedWritable::decode_raw_from_bam_stream ( TypedWritable *&  ptr,
ReferenceCount *&  ref_ptr,
const string &  data,
BamReader reader = NULL 
) [static, inherited]

Reads the string created by a previous call to encode_to_bam_stream(), and extracts the single object on that string.

Returns true on success, false on on error.

This variant sets the TypedWritable and ReferenceCount pointers separately; both are pointers to the same object. The reference count is not incremented; it is the caller's responsibility to manage the reference count.

Note that this method cannot be used to retrieve objects that do not inherit from ReferenceCount, because these objects cannot persist beyond the lifetime of the BamReader that reads them. To retrieve these objects from a bam stream, you must construct a BamReader directly.

If you happen to know that the particular object in question inherits from TypedWritableReferenceCount or PandaNode, consider calling the variant of decode_from_bam_stream() defined for those methods, which presents a simpler interface.

Definition at line 353 of file typedWritable.cxx.

References BamReader::init(), DatagramInputFile::open(), DatagramInputFile::read_header(), BamReader::read_object(), ReferenceCount::ref(), BamReader::resolve(), BamReader::set_source(), and ReferenceCount::unref().

bool CachedTypedWritableReferenceCount::do_test_ref_count_integrity ( ) const [protected, inherited]

Does some easy checks to make sure that the reference count isn't completely bogus.

Reimplemented from ReferenceCount.

Reimplemented in NodeCachedReferenceCount.

Definition at line 26 of file cachedTypedWritableReferenceCount.cxx.

Referenced by CachedTypedWritableReferenceCount::test_ref_count_integrity().

bool ReferenceCount::do_test_ref_count_nonzero ( ) const [protected, inherited]

Returns true if the reference count is nonzero, false otherwise.

Definition at line 56 of file referenceCount.cxx.

References ReferenceCount::do_test_ref_count_integrity().

Referenced by ReferenceCount::test_ref_count_nonzero().

bool GeomTristrips::draw ( GraphicsStateGuardianBase gsg,
const GeomPrimitivePipelineReader reader,
bool  force 
) const [virtual]

Calls the appropriate method on the GSG to draw the primitive.

Implements GeomPrimitive.

Definition at line 119 of file geomTristrips.cxx.

string TypedWritable::encode_to_bam_stream ( ) const [inline, inherited]

Converts the TypedWritable object into a single stream of data using a BamWriter, and returns that data as a string string.

Returns empty string on failure.

This is a convenience method particularly useful for cases when you are only serializing a single object. If you have many objects to process, it is more efficient to use the same BamWriter to serialize all of them together.

Definition at line 86 of file typedWritable.I.

bool TypedWritable::encode_to_bam_stream ( string &  data,
BamWriter writer = NULL 
) const [inherited]

Converts the TypedWritable object into a single stream of data using a BamWriter, and stores that data in the indicated string.

Returns true on success, false on failure.

This is a convenience method particularly useful for cases when you are only serializing a single object. If you have many objects to process, it is more efficient to use the same BamWriter to serialize all of them together.

Definition at line 283 of file typedWritable.cxx.

References BamWriter::init(), DatagramOutputFile::open(), BamWriter::set_target(), DatagramOutputFile::write_header(), and BamWriter::write_object().

void GeomPrimitive::fillin ( DatagramIterator scan,
BamReader manager 
) [protected, virtual, inherited]

This internal function is called by make_from_bam to read in all of the relevant data from the BamFile for the new GeomPrimitive.

Reimplemented from TypedWritable.

Definition at line 1839 of file geomPrimitive.cxx.

References BamReader::read_cdata(), and BamReader::register_finalize().

void GeomPrimitive::finalize ( BamReader manager) [virtual, inherited]

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 1824 of file geomPrimitive.cxx.

References GeomVertexArrayData::get_usage_hint(), and GeomPrimitive::set_usage_hint().

UpdateSeq TypedWritable::get_bam_modified ( ) const [inline, inherited]

Returns the current bam_modified counter.

This counter is normally incremented automatically whenever the object is modified.

Definition at line 66 of file typedWritable.I.

Referenced by BamWriter::consider_update(), and BamWriter::write_pointer().

int CachedTypedWritableReferenceCount::get_cache_ref_count ( ) const [inline, inherited]
int GeomPrimitive::get_data_size_bytes ( ) const [inline, inherited]

Returns the number of bytes stored in the vertices array.

Definition at line 238 of file geomPrimitive.I.

Referenced by PreparedGraphicsObjects::prepare_index_buffer_now(), and PreparedGraphicsObjects::release_index_buffer().

CPTA_int GeomPrimitive::get_ends ( ) const [inline, inherited]

Returns a const pointer to the primitive ends array so application code can read it directly.

Do not attempt to modify the returned array; use modify_ends() or set_ends() for this.

Note that simple primitive types, like triangles, do not have a ends array: since all the primitives have the same number of vertices, it is not needed.

This method is intended for low-level usage only. There are higher-level methods for more common usage. We recommend you do not use this method directly. If you do, be sure you know what you are doing!

Definition at line 330 of file geomPrimitive.I.

int GeomPrimitive::get_first_vertex ( ) const [inline, inherited]

Returns the first vertex number referenced by the primitive.

This is particularly important in the case of a nonindexed primitive, in which case get_first_vertex() and get_num_vertices() completely define the extent of the vertex range.

Definition at line 124 of file geomPrimitive.I.

References Thread::get_current_thread().

int GeomTristrips::get_geom_rendering ( ) const [virtual]

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

Reimplemented from GeomPrimitive.

Definition at line 90 of file geomTristrips.cxx.

References GeomPrimitive::is_indexed().

int GeomPrimitive::get_index_stride ( ) const [inline, inherited]

A convenience function to return the gap between successive index numbers, in bytes, of the index data.

This method is intended for low-level usage only. There are higher-level methods for more common usage. We recommend you do not use this method directly. If you do, be sure you know what you are doing!

Definition at line 307 of file geomPrimitive.I.

References Thread::get_current_thread().

GeomPrimitive::NumericType GeomPrimitive::get_index_type ( ) const [inline, inherited]

Returns the numeric type of the index column.

Normally, this will be either NT_uint16 or NT_uint32.

Definition at line 79 of file geomPrimitive.I.

int GeomPrimitive::get_max_vertex ( ) const [inline, inherited]

Returns the maximum vertex index number used by all the primitives in this object.

Definition at line 225 of file geomPrimitive.I.

References GeomPrimitivePipelineReader::check_minmax(), and Thread::get_current_thread().

Referenced by GeomPrimitive::set_index_type().

int GeomPrimitive::get_min_num_vertices_per_primitive ( ) const [virtual, inherited]

Returns the minimum number of vertices that must be added before close_primitive() may legally be called.

This method is intended for low-level usage only. There are higher-level methods for more common usage. We recommend you do not use this method directly. If you do, be sure you know what you are doing!

Reimplemented in GeomLines, GeomLinestrips, and GeomPoints.

Definition at line 1234 of file geomPrimitive.cxx.

Referenced by GeomPrimitive::close_primitive(), GeomPrimitive::get_num_faces(), and GeomPrimitive::get_primitive_num_faces().

int GeomPrimitive::get_min_vertex ( ) const [inline, inherited]

Returns the minimum vertex index number used by all the primitives in this object.

Definition at line 212 of file geomPrimitive.I.

References GeomPrimitivePipelineReader::check_minmax(), and Thread::get_current_thread().

UpdateSeq GeomPrimitive::get_modified ( ) const [inline, inherited]

Returns a sequence number which is guaranteed to change at least every time the vertex index array is modified.

Definition at line 251 of file geomPrimitive.I.

int GeomPrimitive::get_num_bytes ( ) const [inherited]

Returns the number of bytes consumed by the primitive and its index table(s).

Definition at line 895 of file geomPrimitive.cxx.

int GeomPrimitive::get_num_faces ( ) const [inline, inherited]

Returns the number of triangles or other fundamental type (such as line segments) represented by all the primitives in this object.

Definition at line 173 of file geomPrimitive.I.

References GeomPrimitive::get_min_num_vertices_per_primitive(), GeomPrimitive::get_num_primitives(), GeomPrimitive::get_num_unused_vertices_per_primitive(), GeomPrimitive::get_num_vertices(), and GeomPrimitive::get_num_vertices_per_primitive().

int GeomPrimitive::get_num_primitives ( ) const [inline, inherited]

Returns the number of individual primitives stored within this object.

All primitives are the same type.

Definition at line 160 of file geomPrimitive.I.

References Thread::get_current_thread().

Referenced by GeomPrimitive::add_consecutive_vertices(), GeomPrimitive::add_vertex(), and GeomPrimitive::get_num_faces().

int GeomTristrips::get_num_unused_vertices_per_primitive ( ) const [virtual]

Returns the number of vertices that are added between primitives that aren't, strictly speaking, part of the primitives themselves.

This is used, for instance, to define degenerate triangles to connect otherwise disconnected triangle strips.

Reimplemented from GeomPrimitive.

Definition at line 108 of file geomTristrips.cxx.

int GeomPrimitive::get_num_vertices ( ) const [inline, inherited]
int GeomPrimitive::get_num_vertices_per_primitive ( ) const [virtual, inherited]

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.

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.

This method is intended for low-level usage only. There are higher-level methods for more common usage. We recommend you do not use this method directly. If you do, be sure you know what you are doing!

Reimplemented in GeomLines, GeomPoints, and GeomTriangles.

Definition at line 1218 of file geomPrimitive.cxx.

Referenced by GeomPrimitive::close_primitive(), GeomPrimitive::get_num_faces(), GeomPrimitive::get_primitive_end(), GeomPrimitive::get_primitive_num_faces(), GeomPrimitive::get_primitive_num_vertices(), GeomPrimitive::get_primitive_start(), and GeomPrimitive::is_composite().

int GeomPrimitive::get_primitive_end ( int  n) const [inherited]

Returns the element within the _vertices list at which the nth primitive ends.

This is one past the last valid element for the nth primitive.

Definition at line 581 of file geomPrimitive.cxx.

References GeomPrimitive::get_num_unused_vertices_per_primitive(), and GeomPrimitive::get_num_vertices_per_primitive().

Referenced by GeomPrimitive::add_consecutive_vertices(), GeomPrimitive::add_vertex(), GeomPrimitive::get_primitive_max_vertex(), and Geom::unify_in_place().

int GeomPrimitive::get_primitive_max_vertex ( int  n) const [inherited]

Returns the maximum vertex index number used by the nth primitive in this object.

Definition at line 656 of file geomPrimitive.cxx.

References GeomVertexReader::get_data1i(), GeomPrimitive::get_primitive_end(), GeomPrimitive::is_indexed(), and GeomVertexReader::set_row().

int GeomPrimitive::get_primitive_min_vertex ( int  n) const [inherited]

Returns the minimum vertex index number used by the nth primitive in this object.

Definition at line 636 of file geomPrimitive.cxx.

References GeomVertexReader::get_data1i(), GeomPrimitive::get_primitive_start(), GeomPrimitive::is_indexed(), and GeomVertexReader::set_row().

int GeomPrimitive::get_primitive_num_faces ( int  n) const [inline, inherited]

Returns the number of triangles or other fundamental type (such as line segments) represented by the nth primitive in this object.

Definition at line 195 of file geomPrimitive.I.

References GeomPrimitive::get_min_num_vertices_per_primitive(), GeomPrimitive::get_num_vertices_per_primitive(), and GeomPrimitive::get_primitive_num_vertices().

int GeomPrimitive::get_primitive_num_vertices ( int  n) const [inherited]

Returns the number of vertices used by the nth primitive.

This is the same thing as get_primitive_end(n) - get_primitive_start(n).

Definition at line 607 of file geomPrimitive.cxx.

References GeomPrimitive::get_num_unused_vertices_per_primitive(), and GeomPrimitive::get_num_vertices_per_primitive().

Referenced by GeomPrimitive::get_primitive_num_faces(), and Geom::unify_in_place().

int GeomPrimitive::get_primitive_start ( int  n) const [inherited]

Returns the element within the _vertices list at which the nth primitive starts.

If i is one more than the highest valid primitive vertex, the return value will be one more than the last valid vertex. Thus, it is generally true that the vertices used by a particular primitive i are the set get_primitive_start(n) <= vi < get_primitive_start(n + 1) (although this range also includes the unused vertices between primitives).

Definition at line 551 of file geomPrimitive.cxx.

References GeomPrimitive::get_num_unused_vertices_per_primitive(), and GeomPrimitive::get_num_vertices_per_primitive().

Referenced by GeomPrimitive::get_primitive_min_vertex(), and Geom::unify_in_place().

GeomPrimitive::PrimitiveType GeomTristrips::get_primitive_type ( ) const [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 78 of file geomTristrips.cxx.

int ReferenceCount::get_ref_count ( ) const [inline, inherited]
GeomPrimitive::ShadeModel GeomPrimitive::get_shade_model ( ) const [inline, inherited]

Returns the ShadeModel hint for this primitive.

This is intended as a hint to the renderer to tell it how the per-vertex colors and normals are applied.

Definition at line 24 of file geomPrimitive.I.

int TypedObject::get_type_index ( ) const [inline, inherited]

Returns the internal index number associated with this object's TypeHandle, a unique number for each different type.

This is equivalent to get_type().get_index().

Definition at line 52 of file typedObject.I.

References TypeHandle::get_index().

GeomPrimitive::UsageHint GeomPrimitive::get_usage_hint ( ) const [inline, inherited]

Returns the usage hint for this primitive.

See geomEnums.h. This has nothing to do with the usage hint associated with the primitive's vertices; this only specifies how often the vertex indices that define the primitive will be modified.

It is perfectly legal (and, in fact, common) for a GeomPrimitive to have UH_static on itself, while referencing vertex data with UH_dynamic. This means that the vertices themselves will be animated, but the primitive will always reference the same set of vertices from the pool.

Definition at line 67 of file geomPrimitive.I.

Referenced by PreparedGraphicsObjects::prepare_index_buffer_now(), and PreparedGraphicsObjects::release_index_buffer().

int GeomPrimitive::get_vertex ( int  i) const [inline, inherited]
WeakReferenceList * ReferenceCount::get_weak_list ( ) const [inline, inherited]

Returns the WeakReferenceList associated with this ReferenceCount object.

If there has never been a WeakReferenceList associated with this object, creates one now.

Definition at line 307 of file referenceCount.I.

Referenced by ReferenceCount::weak_ref().

bool ReferenceCount::has_weak_list ( ) const [inline, inherited]

Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise.

In general, this will be true if there was ever a WeakPointerTo created for this object (even if there is not any for it now).

Definition at line 294 of file referenceCount.I.

Referenced by ReferenceCount::weak_unref().

bool GeomPrimitive::is_composite ( ) const [inline, inherited]

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.

Definition at line 93 of file geomPrimitive.I.

References GeomPrimitive::get_num_vertices_per_primitive().

Referenced by GeomPrimitive::request_resident().

bool TypedObject::is_exact_type ( TypeHandle  handle) const [inline, inherited]
bool GeomPrimitive::is_indexed ( ) const [inline, inherited]

Returns true if the primitive is indexed, false otherwise.

An indexed primitive stores a table of index numbers into its GeomVertexData, so that it can reference the vertices in any order. A nonindexed primitive, on the other hand, stores only the first vertex number and number of vertices used, so that it can only reference the vertices consecutively.

Definition at line 109 of file geomPrimitive.I.

References Thread::get_current_thread().

Referenced by GeomTrifans::get_geom_rendering(), GeomLinestrips::get_geom_rendering(), GeomPrimitive::get_geom_rendering(), get_geom_rendering(), GeomPoints::get_geom_rendering(), GeomPrimitive::get_primitive_max_vertex(), GeomPrimitive::get_primitive_min_vertex(), GeomPrimitive::offset_vertices(), and GeomPrimitive::pack_vertices().

bool TypedObject::is_of_type ( TypeHandle  handle) const [inline, inherited]

Returns true if the current object is or derives from the indicated type.

Definition at line 63 of file typedObject.I.

References TypeHandle::is_derived_from().

Referenced by EggSliderData::add_back_pointer(), EggJointData::add_back_pointer(), CIntervalManager::add_c_interval(), XFileNode::add_child(), CollisionTraverser::add_collider(), CollisionHandlerPhysical::add_collider(), EggXfmSAnim::add_data(), CharacterJointBundle::add_node(), NonlinearImager::add_screen(), EggGroupNode::apply_first_attribute(), EggGroupNode::apply_last_attribute(), DeferredNodeProperty::apply_to_node(), RecorderController::begin_playback(), NodePath::clear_clip_plane(), EggGroupNode::clear_connected_shading(), NodePath::clear_light(), EggBase::convert_paths(), NodePath::decode_from_bam_stream(), VrpnClient::disconnect_device(), PhysicsManager::do_physics(), GraphicsStateGuardian::fetch_specified_part(), EggRenderState::fill_state(), AnimBundleNode::find_anim_bundle(), EggGroupNode::find_coordsys_entry(), XFile::find_data_object(), Character::find_joint(), EggGroupNode::find_materials(), Character::find_slider(), XFile::find_template(), EggGroupNode::find_textures(), EggMaterialCollection::find_used_materials(), EggTextureCollection::find_used_textures(), EggGroupNode::force_filenames(), EggJointData::force_initial_rest_frame(), WindowFramework::get_aspect_2d(), EggPoolUniquifier::get_category(), EggGroupUniquifier::get_category(), EggGroupNode::get_connected_shading(), PandaFramework::get_mouse(), FactoryParams::get_param_of_type(), EggGroupNode::has_absolute_pathnames(), NodePath::has_clip_plane(), NodePath::has_clip_plane_off(), NodePath::has_light(), PandaFramework::hide_collision_solids(), x11GraphicsWindow::open_window(), eglGraphicsWindow::open_window(), EggNode::parse_egg(), CharacterMaker::part_to_node(), EggGroupNode::post_apply_flat_attribute(), EggBinner::prepare_node(), PortalClipper::prepare_portal(), NodePath::project_texture(), EggMatrixTablePointer::quantize_channels(), ParametricCurveCollection::r_add_curves(), SceneGraphReducer::r_collect_vertex_data(), EggGroupNode::r_load_externals(), EggGroupNode::rebuild_vertex_pools(), EggGroupNode::recompute_polygon_normals(), EggGroupNode::remove_invalid_primitives(), EggGroupNode::remove_unused_vertices(), EggLoader::reparent_decals(), EggMaterialCollection::replace_materials(), EggTextureCollection::replace_textures(), EggGroupNode::resolve_filenames(), EggGroupNode::reverse_vertex_ordering(), NodePath::set_clip_plane(), NodePath::set_clip_plane_off(), NodePath::set_light(), ProjectionScreen::set_projector(), NonlinearImager::set_source_camera(), EggXfmSAnim::set_value(), NonlinearImager::set_viewer_camera(), PandaFramework::show_collision_solids(), BamCache::store(), XFileToEggConverter::strip_nodes(), EggGroupNode::strip_normals(), DataGraphTraverser::traverse(), DataGraphTraverser::traverse_below(), EggGroupNode::triangulate_polygons(), EggGroupNode::unify_attributes(), EggNameUniquifier::uniquify(), NodeCullCallbackData::upcall(), PhysicsCollisionHandler::validate_target(), EggXfmSAnim::write(), EggGroup::write(), EggToDXFLayer::write_3d_face(), and EggToDXFLayer::write_entities().

bool GeomPrimitive::is_prepared ( PreparedGraphicsObjects prepared_objects) const [inherited]

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

Definition at line 1282 of file geomPrimitive.cxx.

References PreparedGraphicsObjects::is_index_buffer_queued().

Referenced by PreparedGraphicsObjects::is_index_buffer_prepared().

void ReferenceCount::local_object ( ) [inline, inherited]

This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack.

This allows the object to be passed to functions that will increment and decrement the object's reference count temporarily, and it will prevent the object from being deleted (inappropriately), when the reference count returns to zero. It actually achieves this by setting a large positive value in the reference count field.

Definition at line 276 of file referenceCount.I.

Referenced by PGTop::cull_callback(), BoundingSphere::extend_by_hexahedron(), AsyncTaskManager::find_task(), AsyncTaskManager::find_tasks(), and AsyncTaskManager::find_tasks_matching().

TypedWritable * GeomTristrips::make_from_bam ( const FactoryParams params) [static, protected]

This function is called by the BamReader's factory when a new object of type Geom is encountered in the Bam file.

It should create the Geom and extract its information from the file.

Definition at line 401 of file geomTristrips.cxx.

Referenced by register_with_read_factory().

void GeomPrimitive::make_indexed ( ) [inherited]

Converts the primitive from nonindexed form to indexed form.

This will simply create an index table that is numbered consecutively from get_first_vertex(); it does not automatically collapse together identical vertices that may have been split apart by a previous call to make_nonindexed().

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 531 of file geomPrimitive.cxx.

void GeomPrimitive::make_nonindexed ( GeomVertexData dest,
const GeomVertexData source 
) [inherited]

Converts the primitive from indexed to nonindexed by duplicating vertices as necessary into the indicated dest GeomVertexData.

Definition at line 454 of file geomPrimitive.cxx.

References GeomVertexData::copy_row_from(), Thread::get_current_thread(), GeomVertexData::get_num_rows(), GeomPrimitive::get_num_vertices(), GeomPrimitive::get_vertex(), GeomPrimitive::set_nonindexed_vertices(), and GeomVertexData::set_num_rows().

Referenced by GeomPrimitive::pack_vertices().

void TypedWritable::mark_bam_modified ( ) [inline, inherited]
PTA_int GeomPrimitive::modify_ends ( ) [inherited]

Returns a modifiable pointer to the primitive ends array, so application code can directly fiddle with this data.

Use with caution, since there are no checks that the data will be left in a stable state.

Note that simple primitive types, like triangles, do not have a ends array: since all the primitives have the same number of vertices, it is not needed.

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.

This method is intended for low-level usage only. There are higher-level methods for more common usage. We recommend you do not use this method directly. If you do, be sure you know what you are doing!

Definition at line 1105 of file geomPrimitive.cxx.

References Geom::get_next_modified().

void GeomPrimitive::offset_vertices ( int  offset) [inherited]

Adds the indicated offset to all vertices used by the 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 418 of file geomPrimitive.cxx.

References GeomVertexReader::get_data1i(), Geom::get_next_modified(), GeomVertexRewriter::is_at_end(), GeomPrimitive::is_indexed(), and GeomVertexWriter::set_data1i().

void GeomPrimitive::pack_vertices ( GeomVertexData dest,
const GeomVertexData source 
) [inherited]
void GeomPrimitive::prepare ( PreparedGraphicsObjects prepared_objects) [inherited]

Indicates that the data should be enqueued to be prepared in the indicated prepared_objects at the beginning of the next frame.

This will ensure the data is already loaded into the GSG if it is expected to be rendered soon.

Use this function instead of prepare_now() to preload datas from a user interface standpoint.

Definition at line 1270 of file geomPrimitive.cxx.

References PreparedGraphicsObjects::enqueue_index_buffer().

IndexBufferContext * GeomPrimitive::prepare_now ( PreparedGraphicsObjects prepared_objects,
GraphicsStateGuardianBase gsg 
) [inherited]

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

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

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

Definition at line 1308 of file geomPrimitive.cxx.

References PreparedGraphicsObjects::prepare_index_buffer_now().

Referenced by PreparedGraphicsObjects::begin_frame().

void ReferenceCount::ref ( ) const [inline, inherited]

Explicitly increments the reference count.

User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically.

This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it.

Definition at line 179 of file referenceCount.I.

References ReferenceCount::test_ref_count_integrity().

Referenced by CachedTypedWritableReferenceCount::cache_ref(), TypedWritable::decode_raw_from_bam_stream(), NodeCachedReferenceCount::node_ref(), NodeReferenceCount::node_ref(), BamCacheRecord::set_data(), CullableObject::set_draw_callback(), and ModelRoot::set_reference().

void GeomTristrips::register_with_read_factory ( ) [static]

Tells the BamReader how to create objects of type Geom.

Definition at line 388 of file geomTristrips.cxx.

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

bool GeomPrimitive::release ( PreparedGraphicsObjects prepared_objects) [inherited]

Frees the data 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 1331 of file geomPrimitive.cxx.

References PreparedGraphicsObjects::dequeue_index_buffer(), and PreparedGraphicsObjects::release_index_buffer().

int GeomPrimitive::release_all ( ) [inherited]

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

Returns the number of contexts which have been freed.

Definition at line 1352 of file geomPrimitive.cxx.

References PreparedGraphicsObjects::release_index_buffer().

bool GeomPrimitive::request_resident ( ) const [inherited]

Returns true if the primitive data is currently resident in memory.

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

Definition at line 914 of file geomPrimitive.cxx.

References GeomPrimitive::is_composite().

bool TypedWritable::require_fully_complete ( ) const [virtual, inherited]

Some objects require all of their nested pointers to have been completed before the objects themselves can be completed.

If this is the case, override this method to return true, and be careful with circular references (which would make the object unreadable from a bam file).

Reimplemented in GeomVertexData, ClipPlaneAttrib, and RenderEffects.

Definition at line 118 of file typedWritable.cxx.

bool GeomTristrips::requires_unused_vertices ( ) const [protected, virtual]

Should be redefined to return true in any primitive that implements append_unused_vertices().

Reimplemented from GeomPrimitive.

Definition at line 355 of file geomTristrips.cxx.

void GeomPrimitive::set_ends ( CPTA_int  ends) [inherited]

Completely replaces the primitive ends array with a new table.

Chances are good that you should also replace the vertices list with set_vertices() at the same time.

Note that simple primitive types, like triangles, do not have a ends array: since all the primitives have the same number of vertices, it is not needed.

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.

This method is intended for low-level usage only. There are higher-level methods for more common usage. We recommend you do not use this method directly. If you do, be sure you know what you are doing!

Definition at line 1141 of file geomPrimitive.cxx.

References Geom::get_next_modified().

void GeomPrimitive::set_index_type ( GeomPrimitive::NumericType  index_type) [inherited]

Changes the numeric type of the index column.

Normally, this should be either NT_uint16 or NT_uint32.

The index type must be large enough to include all of the index values in the primitive. It may be automatically elevated, if necessary, to a larger index type, by a subsequent call to add_index() that names an index value that does not fit in the index type you specify.

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 164 of file geomPrimitive.cxx.

References GeomPrimitive::get_max_vertex().

void GeomPrimitive::set_minmax ( int  min_vertex,
int  max_vertex,
GeomVertexArrayData mins,
GeomVertexArrayData maxs 
) [inherited]

Explicitly specifies the minimum and maximum vertices, as well as the lists of per-component min and max.

Use this method with extreme caution. It's generally better to let the GeomPrimitive compute these explicitly, unless for some reason you can do it faster and you absolutely need the speed improvement.

Note that any modification to the vertex array will normally cause this to be recomputed, unless you set it immediately again.

This method is intended for low-level usage only. There are higher-level methods for more common usage. We recommend you do not use this method directly. If you do, be sure you know what you are doing!

Definition at line 1171 of file geomPrimitive.cxx.

References Geom::get_next_modified().

void GeomPrimitive::set_nonindexed_vertices ( int  first_vertex,
int  num_vertices 
) [inherited]

Sets the primitive up as a nonindexed primitive, using the indicated vertex range.

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.

This method is intended for low-level usage only. There are higher-level methods for more common usage. We recommend you do not use this method directly. If you do, be sure you know what you are doing!

Definition at line 1069 of file geomPrimitive.cxx.

References Geom::get_next_modified().

Referenced by GeomPrimitive::make_nonindexed().

void GeomPrimitive::set_shade_model ( GeomPrimitive::ShadeModel  shade_model) [inline, inherited]

Changes the ShadeModel hint for this primitive.

This is different from the ShadeModelAttrib that might also be applied from the scene graph. This does not affect the shade model that is in effect when rendering, but rather serves as a hint to the renderer to tell it how the per-vertex colors and normals on this primitive are applied.

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 45 of file geomPrimitive.I.

Referenced by Geom::unify_in_place().

void GeomPrimitive::set_usage_hint ( GeomPrimitive::UsageHint  usage_hint) [inherited]

Changes the UsageHint hint for this primitive.

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 135 of file geomPrimitive.cxx.

References Geom::get_next_modified().

Referenced by GeomPrimitive::finalize().

void GeomPrimitive::set_vertices ( const GeomVertexArrayData vertices,
int  num_vertices = -1 
) [inherited]

Completely replaces the vertex index list with a new table.

Chances are good that you should also replace the ends list with set_ends() at the same time.

If num_vertices is not -1, it specifies an artificial limit to the number of vertices in the array. Otherwise, all of the vertices in the array will be used.

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.

This method is intended for low-level usage only. There are higher-level methods for more common usage. We recommend you do not use this method directly. If you do, be sure you know what you are doing!

Definition at line 1044 of file geomPrimitive.cxx.

References Geom::get_next_modified().

Referenced by GeomPrimitive::pack_vertices().

bool CachedTypedWritableReferenceCount::test_ref_count_integrity ( ) const [inline, inherited]
bool ReferenceCount::test_ref_count_nonzero ( ) const [inline, inherited]

Does some easy checks to make sure that the reference count isn't zero, or completely bogus.

Returns true if ok, false otherwise.

Definition at line 252 of file referenceCount.I.

References ReferenceCount::do_test_ref_count_nonzero().

Referenced by CopyOnWritePointer::test_ref_count_nonzero().

bool ReferenceCount::unref ( ) const [inline, virtual, inherited]

Explicitly decrements the reference count.

Note that the object will not be implicitly deleted by unref() simply because the reference count drops to zero. (Having a member function delete itself is problematic.) However, see the helper function unref_delete().

User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically.

This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it.

The return value is true if the new reference count is nonzero, false if it is zero.

Reimplemented in GeomVertexArrayFormat, GeomVertexFormat, InternalName, RenderAttrib, RenderEffects, RenderState, and TransformState.

Definition at line 214 of file referenceCount.I.

References ReferenceCount::test_ref_count_integrity().

Referenced by CachedTypedWritableReferenceCount::cache_unref(), TypedWritable::decode_raw_from_bam_stream(), RenderEffect::finalize(), NodeCachedReferenceCount::node_unref(), NodeReferenceCount::node_unref(), TransformState::unref(), RenderState::unref(), RenderEffects::unref(), RenderAttrib::unref(), InternalName::unref(), GeomVertexFormat::unref(), and GeomVertexArrayFormat::unref().

void TypedWritable::update_bam_nested ( BamWriter manager) [virtual, inherited]

Called by the BamWriter when this object has not itself been modified recently, but it should check its nested objects for updates.

Reimplemented in CFDoCullCommand, and PandaNode.

Definition at line 77 of file typedWritable.cxx.

void ReferenceCount::weak_ref ( WeakPointerToVoid ptv) [inline, inherited]

Adds the indicated PointerToVoid as a weak reference to this object.

Definition at line 321 of file referenceCount.I.

References WeakReferenceList::add_reference(), and ReferenceCount::get_weak_list().

void ReferenceCount::weak_unref ( WeakPointerToVoid ptv) [inline, inherited]

Removes the indicated PointerToVoid as a weak reference to this object.

It must have previously been added via a call to weak_ref().

Definition at line 334 of file referenceCount.I.

References WeakReferenceList::clear_reference(), and ReferenceCount::has_weak_list().

void GeomPrimitive::write_datagram ( BamWriter manager,
Datagram dg 
) [virtual, inherited]

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

Reimplemented from TypedWritable.

Definition at line 1810 of file geomPrimitive.cxx.

References TypedWritable::write_datagram().


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations