Panda3D
 All Classes Functions Variables Enumerations
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Friends | List of all members
GeomVertexData Class Reference

This defines the actual numeric vertex data stored in a Geom, in the structure defined by a particular GeomVertexFormat object. More...

#include "geomVertexData.h"

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

Classes

class  CacheEntry
 
class  CacheKey
 

Public Types

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

Public Member Functions

 GeomVertexData (const string &name, const GeomVertexFormat *format, UsageHint usage_hint)
 
 GeomVertexData (const GeomVertexData &copy)
 
 GeomVertexData (const GeomVertexData &copy, const GeomVertexFormat *format)
 This constructor copies all of the basic properties of the source VertexData, like usage_hint and animation tables, but does not copy the actual data, and it allows you to specify a different format. More...
 
void clear_animated_vertices ()
 Removes the cache of animated vertices computed by a previous call to animate_vertices() within the same frame. More...
 
void clear_cache ()
 Removes all of the previously-cached results of convert_to(). More...
 
void clear_cache_stage ()
 Removes all of the previously-cached results of convert_to(), at the current pipeline stage and upstream. More...
 
void clear_rows ()
 Removes all of the rows from the arrays; functionally equivalent to set_num_rows(0) (but faster). More...
 
void clear_slider_table ()
 Sets the SliderTable pointer to NULL, removing the table from the vertex data. More...
 
void clear_transform_blend_table ()
 Sets the TransformBlendTable pointer to NULL, removing the table from the vertex data. More...
 
void clear_transform_table ()
 Sets the TransformTable pointer to NULL, removing the table from the vertex data. More...
 
int compare_to (const GeomVertexData &other) const
 Returns 0 if the two objects are equivalent, even if they are not the same pointer. More...
 
virtual int complete_pointers (TypedWritable **plist, BamReader *manager)
 Receives an array of pointers, one for each time manager->read_pointer() was called in fillin(). More...
 
void copy_from (const GeomVertexData *source, bool keep_data_objects, Thread *current_thread=Thread::get_current_thread())
 Copies all the data from the other array into the corresponding data types in this array, by matching data types name-by-name. More...
 
void copy_row_from (int dest_row, const GeomVertexData *source, int source_row, Thread *current_thread)
 Copies a single row of the data from the other array into the indicated row of this array. More...
 
 CPT (GeomVertexArrayData) get_array(int i) const
 
 CPT (TransformBlendTable) get_transform_blend_table() const
 
 CPT (GeomVertexData) convert_to(const GeomVertexFormat *new_format) const
 
 CPT (GeomVertexData) scale_color(const LVecBase4 &color_scale) const
 
 CPT (GeomVertexData) scale_color(const LVecBase4 &color_scale
 
 CPT (GeomVertexData) set_color(const LColor &color) const
 
 CPT (GeomVertexData) set_color(const LColor &color
 
 CPT (GeomVertexData) reverse_normals() const
 
 CPT (GeomVertexData) animate_vertices(bool force
 
void describe_vertex (ostream &out, int row) const
 Writes a verbose, human-friendly description of the indicated vertex number. More...
 
virtual void finalize (BamReader *manager)
 Called by the BamReader to perform any final actions needed for setting up the object after all objects have been read and all pointers have been completed. More...
 
virtual TypeHandle force_init_type ()
 
const GeomVertexFormat * get_format () const
 Returns a pointer to the GeomVertexFormat structure that defines this data. More...
 
UpdateSeq get_modified (Thread *current_thread=Thread::get_current_thread()) const
 Returns a sequence number which is guaranteed to change at least every time the vertex data is modified. More...
 
const string & get_name () const
 Returns the name passed to the constructor, if any. More...
 
int get_num_arrays () const
 Returns the number of individual arrays stored within the data. More...
 
int get_num_bytes () const
 Returns the total number of bytes consumed by the different arrays of the vertex data. More...
 
int get_num_rows () const
 Returns the number of rows stored within all the arrays. More...
 
const SliderTableget_slider_table () const
 Returns a const pointer to the SliderTable assigned to this data. More...
 
const TransformTableget_transform_table () const
 Returns a const pointer to the TransformTable assigned to this data. More...
 
virtual TypeHandle get_type () const
 
UsageHint get_usage_hint () const
 Returns the usage hint that was passed to the constructor, and which will be passed to each array data object created initially, and arrays created as the result of a convert_to() operation. More...
 
bool has_column (const InternalName *name) const
 Returns true if the data has the named column, false otherwise. More...
 
 MAKE_SEQ (get_arrays, get_num_arrays, get_array)
 
void operator= (const GeomVertexData &copy)
 The copy assignment operator is not pipeline-safe. More...
 
void output (ostream &out) const
 
 PT (GeomVertexArrayData) modify_array(int i)
 
 PT (TransformBlendTable) modify_transform_blend_table()
 
 PT (GeomVertexData) replace_column(InternalName *name
 
bool request_resident () const
 Returns true if the vertex data is currently resident in memory. More...
 
virtual bool require_fully_complete () const
 Some objects require all of their nested pointers to have been completed before the objects themselves can be completed. More...
 
bool reserve_num_rows (int n)
 This ensures that enough memory space for n rows is allocated, so that you may increase the number of rows to n without causing a new memory allocation. More...
 
void set_array (int i, const GeomVertexArrayData *array)
 Replaces the indicated vertex data array with a completely new array. More...
 
void set_format (const GeomVertexFormat *format)
 Changes the format of the vertex data. More...
 
void set_name (const string &name)
 Changes the name of the vertex data. More...
 
bool set_num_rows (int n)
 Sets the length of the array to n rows in all of the various arrays (presumably by adding rows). More...
 
void set_slider_table (const SliderTable *table)
 Replaces the SliderTable on this vertex data with the indicated table. More...
 
void set_transform_blend_table (const TransformBlendTable *table)
 Replaces the TransformBlendTable on this vertex data with the indicated table. More...
 
void set_transform_table (const TransformTable *table)
 Replaces the TransformTable on this vertex data with the indicated table. More...
 
void set_usage_hint (UsageHint usage_hint)
 Changes the UsageHint hint for this vertex data, and for all of the arrays that share this data. More...
 
void transform_vertices (const LMatrix4 &mat)
 Applies the indicated transform matrix to all of the vertices in the GeomVertexData. More...
 
void transform_vertices (const LMatrix4 &mat, int begin_row, int end_row)
 Applies the indicated transform matrix to all of the vertices from begin_row up to but not including end_row. More...
 
void unclean_set_format (const GeomVertexFormat *format)
 Changes the format of the vertex data, without reformatting the data to match. More...
 
bool unclean_set_num_rows (int n)
 This method behaves like set_num_rows(), except the new data is not initialized. More...
 
void write (ostream &out, int indent_level=0) const
 
virtual void write_datagram (BamWriter *manager, Datagram &dg)
 Writes the contents of this object to the datagram for shipping out to a Bam file. More...
 
- Public Member Functions inherited from CopyOnWriteObject
 CopyOnWriteObject (const CopyOnWriteObject &copy)
 
void operator= (const CopyOnWriteObject &copy)
 
- Public Member Functions inherited from CachedTypedWritableReferenceCount
void cache_ref () const
 Explicitly increments the cache reference count and the normal reference count simultaneously. More...
 
bool cache_unref () const
 Explicitly decrements the cache reference count and the normal reference count simultaneously. More...
 
int get_cache_ref_count () const
 Returns the current reference count. More...
 
bool test_ref_count_integrity () const
 Does some easy checks to make sure that the reference count isn't completely bogus. More...
 
- Public Member Functions inherited from TypedWritableReferenceCount
 TypedWritableReferenceCount (const TypedWritableReferenceCount &copy)
 
virtual ReferenceCountas_reference_count ()
 Returns the pointer cast to a ReferenceCount pointer, if it is in fact of that type. More...
 
void operator= (const TypedWritableReferenceCount &copy)
 
- Public Member Functions inherited from TypedWritable
 TypedWritable (const TypedWritable &copy)
 
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. More...
 
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. More...
 
UpdateSeq get_bam_modified () const
 Returns the current bam_modified counter. More...
 
void mark_bam_modified ()
 Increments the bam_modified counter, so that this object will be invalidated and retransmitted on any open bam streams. More...
 
void operator= (const TypedWritable &copy)
 
virtual void update_bam_nested (BamWriter *manager)
 Called by the BamWriter when this object has not itself been modified recently, but it should check its nested objects for updates. More...
 
- Public Member Functions inherited from TypedObject
 TypedObject (const TypedObject &copy)
 
TypedObjectas_typed_object ()
 Returns the object, upcast (if necessary) to a TypedObject pointer. More...
 
const TypedObjectas_typed_object () const
 Returns the object, upcast (if necessary) to a TypedObject pointer. More...
 
int get_best_parent_from_Set (const std::set< int > &) const
 
int get_type_index () const
 Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. More...
 
bool is_exact_type (TypeHandle handle) const
 Returns true if the current object is the indicated type exactly. More...
 
bool is_of_type (TypeHandle handle) const
 Returns true if the current object is or derives from the indicated type. More...
 
void operator= (const TypedObject &copy)
 
- Public Member Functions inherited from ReferenceCount
int get_ref_count () const
 Returns the current reference count. More...
 
WeakReferenceListget_weak_list () const
 Returns the WeakReferenceList associated with this ReferenceCount object. More...
 
bool has_weak_list () const
 Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise. More...
 
void local_object ()
 This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack. More...
 
void ref () const
 Explicitly increments the reference count. More...
 
bool test_ref_count_integrity () const
 Does some easy checks to make sure that the reference count isn't completely bogus. More...
 
bool test_ref_count_nonzero () const
 Does some easy checks to make sure that the reference count isn't zero, or completely bogus. More...
 
virtual bool unref () const
 Explicitly decrements the reference count. More...
 
void weak_ref (WeakPointerToVoid *ptv)
 Adds the indicated PointerToVoid as a weak reference to this object. More...
 
void weak_unref (WeakPointerToVoid *ptv)
 Removes the indicated PointerToVoid as a weak reference to this object. More...
 

Static Public Member Functions

static TypeHandle get_class_type ()
 
static void init_type ()
 
static PN_uint32 pack_abcd (unsigned int a, unsigned int b, unsigned int c, unsigned int d)
 Packs four values in a DirectX-style NT_packed_abcd value. More...
 
static void register_with_read_factory ()
 Tells the BamReader how to create objects of type GeomVertexData. More...
 
static unsigned int unpack_abcd_a (PN_uint32 data)
 Returns the first packed value from a DirectX-style NT_packed_abcd. More...
 
static unsigned int unpack_abcd_b (PN_uint32 data)
 Returns the second packed value from a DirectX-style NT_packed_abcd. More...
 
static unsigned int unpack_abcd_c (PN_uint32 data)
 Returns the third packed value from a DirectX-style NT_packed_abcd. More...
 
static unsigned int unpack_abcd_d (PN_uint32 data)
 Returns the fourth packed value from a DirectX-style NT_packed_abcd. More...
 
- Static Public Member Functions inherited from CopyOnWriteObject
static TypeHandle get_class_type ()
 
static void init_type ()
 
- Static Public Member Functions inherited from CachedTypedWritableReferenceCount
static TypeHandle get_class_type ()
 
static void init_type ()
 
- Static Public Member Functions inherited from TypedWritableReferenceCount
static TypeHandle get_class_type ()
 
static void init_type ()
 
static PT (TypedWritableReferenceCount) decode_from_bam_stream(const string &data
 
- Static Public Member Functions inherited from TypedWritable
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. More...
 
static TypeHandle get_class_type ()
 
static void init_type ()
 
- Static Public Member Functions inherited from TypedObject
static TypeHandle get_class_type ()
 
static void init_type ()
 This function is declared non-inline to work around a compiler bug in g++ 2.96. More...
 
- Static Public Member Functions inherited from ReferenceCount
static TypeHandle get_class_type ()
 
static void init_type ()
 

Public Attributes

int NumericType Contents contents const
 
Thread *current_thread const
 
int num_components
 
int NumericType numeric_type
 
- Public Attributes inherited from TypedWritableReferenceCount
static BamReaderreader = NULL)
 

Friends

class CacheEntry
 
class GeomVertexDataPipelineBase
 
class GeomVertexDataPipelineReader
 
class GeomVertexDataPipelineWriter
 

Additional Inherited Members

- Static Public Attributes inherited from TypedWritable
static TypedWritable *const Null = (TypedWritable*)0L
 

Detailed Description

This defines the actual numeric vertex data stored in a Geom, in the structure defined by a particular GeomVertexFormat object.

The data consists of one or more arrays, each of which in turn consists of a series of rows, one per vertex. All arrays should have the same number of rows; each vertex is defined by the column data from a particular row across all arrays.

Often, there will be only one array per Geom, and the various columns defined in the GeomVertexFormat will be interleaved within that array. However, it is also possible to have multiple different arrays, with a certain subset of the total columns defined in each array.

However the data is distributed, the effect is of a single table of vertices, where each vertex is represented by one row of the table.

In general, application code should not attempt to directly manipulate the vertex data through this structure; instead, use the GeomVertexReader, GeomVertexWriter, and GeomVertexRewriter objects to read and write vertex data at a high level.

Definition at line 76 of file geomVertexData.h.

Constructor & Destructor Documentation

GeomVertexData::GeomVertexData ( const GeomVertexData copy,
const GeomVertexFormat *  format 
)

This constructor copies all of the basic properties of the source VertexData, like usage_hint and animation tables, but does not copy the actual data, and it allows you to specify a different format.

Definition at line 130 of file geomVertexData.cxx.

Member Function Documentation

void GeomVertexData::clear_animated_vertices ( )

Removes the cache of animated vertices computed by a previous call to animate_vertices() within the same frame.

This will force the next call to animate_vertices() to recompute these values from scratch. Normally it is not necessary to call this.

Definition at line 1150 of file geomVertexData.cxx.

void GeomVertexData::clear_cache ( )

Removes all of the previously-cached results of convert_to().

This blows away the entire cache, upstream and downstream the pipeline. Use clear_cache_stage() instead if you only want to blow away the cache at the current stage and upstream.

Definition at line 1438 of file geomVertexData.cxx.

Referenced by operator=().

void GeomVertexData::clear_cache_stage ( )

Removes all of the previously-cached results of convert_to(), at the current pipeline stage and upstream.

Does not affect the downstream cache.

Don't call this in a downstream thread unless you don't mind it blowing away other changes you might have recently made in an upstream thread.

Definition at line 1461 of file geomVertexData.cxx.

Referenced by clear_rows(), set_format(), set_slider_table(), set_transform_blend_table(), set_transform_table(), set_usage_hint(), and unclean_set_format().

void GeomVertexData::clear_rows ( )

Removes all of the rows from the arrays; functionally equivalent to set_num_rows(0) (but faster).

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 394 of file geomVertexData.cxx.

References clear_cache_stage(), Thread::get_current_thread(), and Geom::get_next_modified().

void GeomVertexData::clear_slider_table ( )
inline

Sets the SliderTable pointer to NULL, removing the table from the vertex data.

This disables morph (blend shape) animation.

Definition at line 318 of file geomVertexData.I.

References set_slider_table().

void GeomVertexData::clear_transform_blend_table ( )
inline

Sets the TransformBlendTable pointer to NULL, removing the table from the vertex data.

This disables CPU-driven vertex animation.

Definition at line 289 of file geomVertexData.I.

References set_transform_blend_table().

Referenced by copy_from().

void GeomVertexData::clear_transform_table ( )
inline

Sets the TransformTable pointer to NULL, removing the table from the vertex data.

This disables hardware-driven vertex animation.

Definition at line 257 of file geomVertexData.I.

References set_transform_table().

int GeomVertexData::compare_to ( const GeomVertexData other) const

Returns 0 if the two objects are equivalent, even if they are not the same pointer.

Definition at line 210 of file geomVertexData.cxx.

int GeomVertexData::complete_pointers ( TypedWritable **  p_list,
BamReader manager 
)
virtual

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

Returns the number of pointers processed.

Reimplemented from TypedWritable.

Definition at line 2128 of file geomVertexData.cxx.

References TypedWritable::complete_pointers().

void GeomVertexData::copy_from ( const GeomVertexData source,
bool  keep_data_objects,
Thread current_thread = Thread::get_current_thread() 
)

Copies all the data from the other array into the corresponding data types in this array, by matching data types name-by-name.

keep_data_objects specifies what to do when one or more of the arrays can be copied without the need to apply any conversion operation. If it is true, the original GeomVertexArrayData objects in this object are retained, and their data arrays are copied byte-by-byte from the source; if it is false, then the GeomVertexArrayData objects are copied pointerwise from the source.

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 553 of file geomVertexData.cxx.

References clear_transform_blend_table(), GeomVertexAnimationSpec::get_animation_type(), GeomVertexWriter::get_array(), TransformBlend::get_blend(), GeomVertexReader::get_data1i(), GeomVertexReader::get_data4(), get_format(), GeomVertexAnimationSpec::get_indexed_transforms(), GeomVertexColumn::get_name(), get_num_rows(), TransformBlend::get_num_transforms(), GeomVertexColumn::get_start(), TransformBlend::get_transform(), TransformBlend::get_weight(), GeomVertexWriter::has_column(), GeomVertexReader::is_at_end(), GeomVertexColumn::is_bytewise_equivalent(), GeomVertexColumn::is_packed_argb(), GeomVertexColumn::is_uint8_rgba(), reserve_num_rows(), set_array(), GeomVertexReader::set_column(), GeomVertexWriter::set_column(), GeomVertexWriter::set_data4(), GeomVertexWriter::set_data4i(), set_num_rows(), set_transform_table(), and LVecBase4f::zero().

Referenced by set_format().

void GeomVertexData::copy_row_from ( int  dest_row,
const GeomVertexData source,
int  source_row,
Thread current_thread 
)

Copies a single row of the data from the other array into the indicated row of this array.

In this case, the source format must exactly match the destination format.

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 757 of file geomVertexData.cxx.

References get_format(), get_num_rows(), and set_num_rows().

Referenced by GeomPrimitive::make_nonindexed(), and GeomPrimitive::pack_vertices().

void GeomVertexData::describe_vertex ( ostream &  out,
int  row 
) const
void GeomVertexData::finalize ( BamReader manager)
virtual

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

Reimplemented from TypedWritable.

Definition at line 2156 of file geomVertexData.cxx.

References BamReader::change_pointer().

const GeomVertexFormat * GeomVertexData::get_format ( ) const
inline

Returns a pointer to the GeomVertexFormat structure that defines this data.

Definition at line 55 of file geomVertexData.I.

Referenced by GeomTransformer::apply_texture_colors(), GeomTransformer::collect_vertex_data(), copy_from(), copy_row_from(), describe_vertex(), STBasicTerrain::fill_vertices(), GeomNode::finalize(), and transform_vertices().

UpdateSeq GeomVertexData::get_modified ( Thread current_thread = Thread::get_current_thread()) const
inline

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

Definition at line 342 of file geomVertexData.I.

Referenced by GeomMunger::munge_geom().

const string & GeomVertexData::get_name ( ) const
inline

Returns the name passed to the constructor, if any.

This name is reported on the PStats graph for vertex computations.

Definition at line 24 of file geomVertexData.I.

Referenced by GeomTransformer::collect_vertex_data().

int GeomVertexData::get_num_arrays ( ) const
inline

Returns the number of individual arrays stored within the data.

This must match get_format()->get_num_arrays().

Definition at line 170 of file geomVertexData.I.

int GeomVertexData::get_num_bytes ( ) const
inline

Returns the total number of bytes consumed by the different arrays of the vertex data.

Definition at line 329 of file geomVertexData.I.

References Thread::get_current_thread().

int GeomVertexData::get_num_rows ( ) const
inline

Returns the number of rows stored within all the arrays.

All arrays store data for the same n rows.

Definition at line 81 of file geomVertexData.I.

References Thread::get_current_thread().

Referenced by GeomTransformer::collect_vertex_data(), copy_from(), copy_row_from(), describe_vertex(), GeomPrimitive::make_nonindexed(), GeomPrimitive::pack_vertices(), transform_vertices(), and SceneGraphAnalyzer::write().

const SliderTable * GeomVertexData::get_slider_table ( ) const
inline

Returns a const pointer to the SliderTable assigned to this data.

Vertices within the vertex data will look up their morph offsets, if any, within this table.

This will return NULL if the vertex data does not have a SliderTable assigned.

Definition at line 305 of file geomVertexData.I.

const TransformTable * GeomVertexData::get_transform_table ( ) const
inline

Returns a const pointer to the TransformTable assigned to this data.

Vertices within the table will index into this table to indicate their dynamic skinning information; this table is used when the vertex animation is to be performed by the graphics hardware (but also see get_transform_blend_table()).

This will return NULL if the vertex data does not have a TransformTable assigned (which implies the vertices will not be animated by the graphics hardware).

Definition at line 244 of file geomVertexData.I.

GeomVertexData::UsageHint GeomVertexData::get_usage_hint ( ) const
inline

Returns the usage hint that was passed to the constructor, and which will be passed to each array data object created initially, and arrays created as the result of a convert_to() operation.

See geomEnums.h.

However, each individual array may be replaced with a different array object with an independent usage hint specified, so there is no guarantee that the individual arrays all have the same usage_hint.

Definition at line 43 of file geomVertexData.I.

Referenced by GeomTransformer::collect_vertex_data().

bool GeomVertexData::has_column ( const InternalName *  name) const
inline

Returns true if the data has the named column, false otherwise.

This is really just a shortcut for asking the same thing from the format.

Definition at line 68 of file geomVertexData.I.

Referenced by GeomNode::finalize().

void GeomVertexData::operator= ( const GeomVertexData copy)

The copy assignment operator is not pipeline-safe.

This will completely obliterate all stages of the pipeline, so don't do it for a GeomVertexData that is actively being used for rendering.

Definition at line 172 of file geomVertexData.cxx.

References clear_cache(), and Geom::get_next_modified().

PN_uint32 GeomVertexData::pack_abcd ( unsigned int  a,
unsigned int  b,
unsigned int  c,
unsigned int  d 
)
inlinestatic

Packs four values in a DirectX-style NT_packed_abcd value.

Definition at line 354 of file geomVertexData.I.

void GeomVertexData::register_with_read_factory ( )
static

Tells the BamReader how to create objects of type GeomVertexData.

Definition at line 2081 of file geomVertexData.cxx.

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

bool GeomVertexData::request_resident ( ) const

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

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

Definition at line 515 of file geomVertexData.cxx.

Referenced by GeomMunger::munge_geom().

bool GeomVertexData::require_fully_complete ( ) const
virtual

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 from TypedWritable.

Definition at line 2144 of file geomVertexData.cxx.

bool GeomVertexData::reserve_num_rows ( int  n)
inline

This ensures that enough memory space for n rows is allocated, so that you may increase the number of rows to n without causing a new memory allocation.

This is a performance optimization only; it is especially useful when you know ahead of time that you will be adding n rows to the data.

If you know exactly how many rows you will be needing, it is significantly faster to use set_num_rows() or unclean_set_num_rows() instead.

Definition at line 156 of file geomVertexData.I.

References Thread::get_current_thread().

Referenced by copy_from().

void GeomVertexData::set_array ( int  i,
const GeomVertexArrayData array 
)
inline

Replaces the indicated vertex data array with a completely new array.

You should be careful that the new array has the same length and format as the old one, unless you know what you are doing.

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 222 of file geomVertexData.I.

References Thread::get_current_thread().

Referenced by copy_from().

void GeomVertexData::set_format ( const GeomVertexFormat *  format)

Changes the format of the vertex data.

If the data is not empty, this will implicitly change every row to match the new format.

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 296 of file geomVertexData.cxx.

References clear_cache_stage(), copy_from(), Thread::get_current_thread(), and Geom::get_next_modified().

void GeomVertexData::set_name ( const string &  name)

Changes the name of the vertex data.

This name is reported on the PStats graph for vertex computations.

Definition at line 248 of file geomVertexData.cxx.

bool GeomVertexData::set_num_rows ( int  n)
inline

Sets the length of the array to n rows in all of the various arrays (presumably by adding rows).

The new vertex data is initialized to 0, except for the "color" column, which is initialized to (1, 1, 1, 1).

The return value is true if the number of rows was changed, false if the object already contained n rows (or if there was some error).

This can be used when you know exactly how many rows you will be needing. It is faster than reserve_num_rows(). Also see unclean_set_num_rows() if you are planning to fill in all the data yourself.

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 111 of file geomVertexData.I.

References Thread::get_current_thread().

Referenced by copy_from(), copy_row_from(), PfmVizzer::generate_vis_points(), and GeomPrimitive::make_nonindexed().

void GeomVertexData::set_slider_table ( const SliderTable table)

Replaces the SliderTable on this vertex data with the indicated table.

There should be an entry in this table for each kind of morph offset defined in the vertex data.

The SliderTable object must have been registered prior to setting it on the GeomVertexData.

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 497 of file geomVertexData.cxx.

References clear_cache_stage(), Geom::get_next_modified(), and SliderTable::is_registered().

Referenced by clear_slider_table().

void GeomVertexData::set_transform_blend_table ( const TransformBlendTable table)

Replaces the TransformBlendTable on this vertex data with the indicated table.

The length of this table should be consistent with the maximum table index assigned to the vertices under the "transform_blend" name.

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 473 of file geomVertexData.cxx.

References clear_cache_stage(), and Geom::get_next_modified().

Referenced by clear_transform_blend_table().

void GeomVertexData::set_transform_table ( const TransformTable table)

Replaces the TransformTable on this vertex data with the indicated table.

The length of this table should be consistent with the maximum table index assigned to the vertices under the "transform_index" name.

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 425 of file geomVertexData.cxx.

References clear_cache_stage(), Thread::get_current_thread(), Geom::get_next_modified(), and TransformTable::is_registered().

Referenced by clear_transform_table(), and copy_from().

void GeomVertexData::set_usage_hint ( GeomVertexData::UsageHint  usage_hint)

Changes the UsageHint hint for this vertex data, and for all of the arrays that share this data.

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 268 of file geomVertexData.cxx.

References clear_cache_stage(), and Geom::get_next_modified().

void GeomVertexData::transform_vertices ( const LMatrix4 mat)

Applies the indicated transform matrix to all of the vertices in the GeomVertexData.

The transform is applied to all "point" and "vector" type columns described in the format.

Definition at line 1166 of file geomVertexData.cxx.

References get_num_rows().

void GeomVertexData::transform_vertices ( const LMatrix4 mat,
int  begin_row,
int  end_row 
)

Applies the indicated transform matrix to all of the vertices from begin_row up to but not including end_row.

The transform is applied to all "point" and "vector" type columns described in the format.

Definition at line 1179 of file geomVertexData.cxx.

References get_format().

void GeomVertexData::unclean_set_format ( const GeomVertexFormat *  format)

Changes the format of the vertex data, without reformatting the data to match.

The data is exactly the same after this operation, but will be reinterpreted according to the new format. This assumes that the new format is fundamentally compatible with the old format; in particular, it must have the same number of arrays with the same stride in each one. No checking is performed that the data remains sensible.

Definition at line 348 of file geomVertexData.cxx.

References clear_cache_stage(), Thread::get_current_thread(), and Geom::get_next_modified().

bool GeomVertexData::unclean_set_num_rows ( int  n)
inline

This method behaves like set_num_rows(), except the new data is not initialized.

Furthermore, after this call, *any* of the data in the GeomVertexData may be uninitialized, including the earlier rows.

This is intended for applications that are about to completely fill the GeomVertexData with new data anyway; it provides a tiny performance boost over set_num_rows().

This can be used when you know exactly how many rows you will be needing. It is faster than reserve_num_rows().

Definition at line 135 of file geomVertexData.I.

References Thread::get_current_thread().

unsigned int GeomVertexData::unpack_abcd_a ( PN_uint32  data)
inlinestatic

Returns the first packed value from a DirectX-style NT_packed_abcd.

Definition at line 369 of file geomVertexData.I.

unsigned int GeomVertexData::unpack_abcd_b ( PN_uint32  data)
inlinestatic

Returns the second packed value from a DirectX-style NT_packed_abcd.

Definition at line 380 of file geomVertexData.I.

unsigned int GeomVertexData::unpack_abcd_c ( PN_uint32  data)
inlinestatic

Returns the third packed value from a DirectX-style NT_packed_abcd.

Definition at line 391 of file geomVertexData.I.

unsigned int GeomVertexData::unpack_abcd_d ( PN_uint32  data)
inlinestatic

Returns the fourth packed value from a DirectX-style NT_packed_abcd.

Definition at line 402 of file geomVertexData.I.

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

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

Reimplemented from TypedWritable.

Definition at line 2092 of file geomVertexData.cxx.

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


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