Panda3D
|
This defines the actual numeric vertex data stored in a Geom, in the structure defined by a particular GeomVertexFormat object. More...
#include "geomVertexData.h"
Classes | |
class | CacheEntry |
class | CacheKey |
Public Types | |
typedef pmap< const CacheKey *, PT(CacheEntry), IndirectLess< CacheKey > > | Cache |
![]() | |
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 ©) | |
GeomVertexData (const GeomVertexData ©, 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 () |
void | clear_cache () |
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 () |
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 |
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 SliderTable * | get_slider_table () const |
Returns a const pointer to the SliderTable assigned to this data. More... | |
const TransformTable * | get_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 ©) |
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 | transform_vertices (const LMatrix4 &mat, const SparseArray &rows) |
Applies the indicated transform matrix to all of the vertices mentioned in the sparse array. 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... | |
![]() | |
CopyOnWriteObject (const CopyOnWriteObject ©) | |
void | operator= (const CopyOnWriteObject ©) |
![]() | |
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... | |
![]() | |
TypedWritableReferenceCount (const TypedWritableReferenceCount ©) | |
virtual ReferenceCount * | as_reference_count () |
Returns the pointer cast to a ReferenceCount pointer, if it is in fact of that type. More... | |
void | operator= (const TypedWritableReferenceCount ©) |
![]() | |
TypedWritable (const TypedWritable ©) | |
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 ©) |
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... | |
![]() | |
TypedObject (const TypedObject ©) | |
TypedObject * | as_typed_object () |
Returns the object, upcast (if necessary) to a TypedObject pointer. More... | |
const TypedObject * | as_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 ©) |
![]() | |
int | get_ref_count () const |
Returns the current reference count. More... | |
WeakReferenceList * | get_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 TypeHandle | get_class_type () |
static void | init_type () |
![]() | |
static TypeHandle | get_class_type () |
static void | init_type () |
![]() | |
static TypeHandle | get_class_type () |
static void | init_type () |
static | PT (TypedWritableReferenceCount) decode_from_bam_stream(const string &data |
![]() | |
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 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 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 |
![]() | |
static BamReader * | reader = NULL) |
Friends | |
class | CacheEntry |
class | GeomVertexDataPipelineBase |
class | GeomVertexDataPipelineReader |
class | GeomVertexDataPipelineWriter |
Additional Inherited Members | |
![]() | |
static TypedWritable *const | Null = (TypedWritable*)0L |
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.
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.
References 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 1500 of file geomVertexData.cxx.
References GeomVertexRewriter::get_array_handle(), GeomVertexRewriter::get_column(), GeomVertexColumn::get_contents(), GeomVertexReader::get_data1i(), GeomVertexReader::get_data3(), GeomVertexReader::get_data4(), get_name(), get_num_rows(), SparseArray::get_num_subranges(), GeomVertexColumn::get_num_values(), GeomVertexColumn::get_numeric_type(), GeomVertexColumn::get_start(), GeomVertexRewriter::get_stride(), SparseArray::get_subrange_begin(), SparseArray::get_subrange_end(), LMatrix4f::get_upper_3(), get_usage_hint(), GeomVertexArrayDataHandle::get_write_pointer(), GeomVertexReader::has_column(), GeomVertexColumn::has_homogeneous_coord(), LMatrix4f::invert_from(), SparseArray::is_inverse(), SparseArray::is_zero(), LVecBase3f::normalize(), pack_abcd(), register_with_read_factory(), GeomVertexWriter::set_data3(), GeomVertexWriter::set_data4(), GeomVertexRewriter::set_row_unsafe(), GeomVertexReader::set_row_unsafe(), unpack_abcd_a(), unpack_abcd_b(), unpack_abcd_c(), unpack_abcd_d(), and LVecBase3f::zero().
Referenced by clear_rows(), set_format(), set_slider_table(), set_transform_blend_table(), set_transform_table(), set_usage_hint(), transform_vertices(), 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(), Geom::get_next_modified(), and set_transform_table().
Referenced by unclean_set_format().
|
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 get_num_bytes(), and set_slider_table().
Referenced by get_slider_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 get_slider_table(), set_transform_blend_table(), and set_transform_table().
Referenced by get_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.
References set_name().
Referenced by operator=().
|
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 2167 of file geomVertexData.cxx.
References TypedWritable::complete_pointers(), and require_fully_complete().
Referenced by write_datagram().
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 copy_row_from(), 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 request_resident(), and 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 LightMutexDirect::acquire(), Thread::get_current_thread(), GeomVertexReader::get_data3(), GeomVertexReader::get_data4(), get_format(), get_name(), get_num_rows(), get_slider_table(), get_usage_hint(), GeomVertexRewriter::is_at_end(), GeomVertexWriter::is_at_end(), LightMutexDirect::release(), request_resident(), GeomVertexWriter::set_data3(), GeomVertexWriter::set_data4(), set_num_rows(), and transform_vertices().
Referenced by copy_from(), GeomPrimitive::make_nonindexed(), and GeomPrimitive::pack_vertices().
|
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 2195 of file geomVertexData.cxx.
References BamReader::change_pointer(), GeomVertexData::CacheEntry::evict_callback(), TypedWritable::fillin(), DatagramIterator::get_string(), BamReader::read_cdata(), and set_name().
Referenced by require_fully_complete().
|
inline |
Returns a pointer to the GeomVertexFormat structure that defines this data.
Definition at line 55 of file geomVertexData.I.
References has_column().
Referenced by copy_from(), copy_row_from(), RigidBodyCombiner::cull_callback(), STBasicTerrain::fill_vertices(), GeomTransformer::finish_collect(), get_usage_hint(), TextAssembler::is_whitespace(), GeomMunger::munge_geom(), and transform_vertices().
|
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.
References pack_abcd().
Referenced by get_num_bytes(), and GeomMunger::munge_geom().
|
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.
References get_usage_hint().
Referenced by clear_cache_stage(), copy_row_from(), GeomTransformer::finish_collect(), and transform_vertices().
|
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.
References Thread::get_current_thread(), and set_array().
Referenced by GeomTransformer::finish_collect(), reserve_num_rows(), and transform_vertices().
|
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(), and get_modified().
Referenced by clear_slider_table().
|
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(), and set_num_rows().
Referenced by clear_cache_stage(), copy_from(), copy_row_from(), GeomVertexData::CacheEntry::evict_callback(), GeomTransformer::finish_collect(), has_column(), GeomPrimitive::make_nonindexed(), GeomPrimitive::pack_vertices(), RopeNode::reset_bound(), transform_vertices(), and ColladaInput::write_data().
|
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.
References clear_slider_table().
Referenced by clear_transform_table(), copy_row_from(), and GeomTransformer::finish_collect().
|
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.
References clear_transform_table().
Referenced by GeomTransformer::finish_collect(), and set_array().
|
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.
References get_format().
Referenced by clear_cache_stage(), copy_row_from(), GeomTransformer::finish_collect(), TextGlyph::get_character(), get_name(), and transform_vertices().
|
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.
References get_num_rows().
Referenced by EggSaver::add_node(), and get_format().
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 compare_to(), and Geom::get_next_modified().
Referenced by GeomVertexData().
|
inlinestatic |
Packs four values in a DirectX-style NT_packed_abcd value.
Definition at line 354 of file geomVertexData.I.
References unpack_abcd_a().
Referenced by clear_cache_stage(), GeomVertexColumn::fillin(), and get_modified().
|
static |
Tells the BamReader how to create objects of type GeomVertexData.
Definition at line 2120 of file geomVertexData.cxx.
References BamReader::get_factory(), Factory< Type >::register_factory(), and write_datagram().
Referenced by clear_cache_stage().
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.
References copy_from().
Referenced by copy_row_from(), GeomMunger::munge_geom(), and set_slider_table().
|
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 2183 of file geomVertexData.cxx.
References finalize().
Referenced by complete_pointers().
|
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(), and get_num_arrays().
Referenced by copy_from(), GeomVertexData::CacheEntry::evict_callback(), and unclean_set_num_rows().
|
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(), and get_transform_table().
Referenced by copy_from(), and get_num_arrays().
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(), Geom::get_next_modified(), and unclean_set_format().
Referenced by set_usage_hint().
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.
References set_usage_hint().
Referenced by compare_to(), and finalize().
|
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(), and unclean_set_num_rows().
Referenced by copy_from(), copy_row_from(), get_num_rows(), PfmVizzer::make_displacement(), GeomPrimitive::make_nonindexed(), RopeNode::reset_bound(), and SpeedTreeNode::write_error().
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(), SliderTable::is_registered(), and request_resident().
Referenced by clear_slider_table(), and set_transform_blend_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(), Geom::get_next_modified(), and set_slider_table().
Referenced by clear_transform_table(), and set_transform_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(), TransformTable::is_registered(), and set_transform_blend_table().
Referenced by clear_rows(), 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(), Geom::get_next_modified(), and set_format().
Referenced by set_name().
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().
Referenced by copy_row_from(), and transform_vertices().
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(), and transform_vertices().
void GeomVertexData::transform_vertices | ( | const LMatrix4 & | mat, |
const SparseArray & | rows | ||
) |
Applies the indicated transform matrix to all of the vertices mentioned in the sparse array.
The transform is applied to all "point" and "vector" type columns described in the format.
Definition at line 1208 of file geomVertexData.cxx.
References clear_cache_stage(), Datagram::dump_hex(), GeomVertexWriter::get_array(), TransformBlendTable::get_blend(), GeomVertexReader::get_data1i(), GeomVertexReader::get_data4(), get_format(), GeomVertexColumn::get_name(), get_name(), get_num_arrays(), get_num_rows(), SparseArray::get_num_subranges(), GeomVertexColumn::get_num_values(), SparseArray::get_subrange_begin(), SparseArray::get_subrange_end(), GeomVertexColumn::get_total_bytes(), get_usage_hint(), SparseArray::is_zero(), GeomVertexReader::set_column(), GeomVertexArrayData::set_num_rows(), and GeomVertexReader::set_row_unsafe().
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(), clear_rows(), Thread::get_current_thread(), and Geom::get_next_modified().
Referenced by set_format().
|
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(), and reserve_num_rows().
Referenced by GeomVertexData::CacheEntry::evict_callback(), CullableObject::munge_geom(), set_num_rows(), and ColladaInput::write_data().
|
inlinestatic |
Returns the first packed value from a DirectX-style NT_packed_abcd.
Definition at line 369 of file geomVertexData.I.
References unpack_abcd_b().
Referenced by clear_cache_stage(), GeomVertexColumn::fillin(), and pack_abcd().
|
inlinestatic |
Returns the second packed value from a DirectX-style NT_packed_abcd.
Definition at line 380 of file geomVertexData.I.
References unpack_abcd_c().
Referenced by clear_cache_stage(), GeomVertexColumn::fillin(), and unpack_abcd_a().
|
inlinestatic |
Returns the third packed value from a DirectX-style NT_packed_abcd.
Definition at line 391 of file geomVertexData.I.
References unpack_abcd_d().
Referenced by clear_cache_stage(), GeomVertexColumn::fillin(), and unpack_abcd_b().
|
inlinestatic |
Returns the fourth packed value from a DirectX-style NT_packed_abcd.
Definition at line 402 of file geomVertexData.I.
References TransformTable::add_transform(), TransformTable::get_num_transforms(), and GeomVertexData::CacheKey::operator<().
Referenced by clear_cache_stage(), GeomVertexColumn::fillin(), and unpack_abcd_c().
Writes the contents of this object to the datagram for shipping out to a Bam file.
Reimplemented from TypedWritable.
Definition at line 2131 of file geomVertexData.cxx.
References Datagram::add_string(), complete_pointers(), BamReader::register_finalize(), BamWriter::write_cdata(), and TypedWritable::write_datagram().
Referenced by register_with_read_factory().