Panda3D
|
This defines how a single column is interleaved within a vertex array stored within a Geom. More...
#include "geomVertexColumn.h"
Public Member Functions | |
GeomVertexColumn (CPT_InternalName name, int num_components, NumericType numeric_type, Contents contents, int start, int column_alignment=0) | |
GeomVertexColumn (const GeomVertexColumn ©) | |
int | compare_to (const GeomVertexColumn &other) const |
This is used to unquify columns, and hence formats, for the GeomVertexFormat registry. More... | |
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 | 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 GeomVertexColumn. More... | |
int | get_column_alignment () const |
Returns the alignment requirements for this column. More... | |
int | get_component_bytes () const |
Returns the number of bytes used by each component (that is, by one element of the numeric type). More... | |
Contents | get_contents () const |
Returns the token representing the semantic meaning of the stored value. More... | |
int | get_element_stride () const |
This value is only relevant for matrix types. More... | |
const InternalName * | get_name () const |
Returns the name of this particular data field, e.g. More... | |
int | get_num_components () const |
Returns the number of components of the column: the number of instances of the NumericType in each element. More... | |
int | get_num_elements () const |
Returns the number of times this column is repeated. More... | |
int | get_num_values () const |
Returns the number of numeric values of the column: the number of distinct numeric values that go into each element. More... | |
NumericType | get_numeric_type () const |
Returns the token representing the numeric type of the data storage. More... | |
int | get_start () const |
Returns the byte within the array record at which this column starts. More... | |
int | get_total_bytes () const |
Returns the number of bytes used by each element of the column: component_bytes * num_components. More... | |
bool | has_homogeneous_coord () const |
Returns true if this Contents type is one that includes a homogeneous coordinate in the fourth component, or false otherwise. More... | |
bool | is_bytewise_equivalent (const GeomVertexColumn &other) const |
Returns true if the data store of this column is exactly the same as that of the other, irrespective of name or start position within the record. More... | |
bool | is_packed_argb () const |
Returns true if this column is the standard DirectX representation of 4-component color: C_color, in NT_packed_dabc, with 1 component (4 values). More... | |
bool | is_uint8_rgba () const |
Returns true if this column is the standard OpenGL representation of 4-component color: C_color, in NT_uint8, with 4 components. More... | |
bool | operator!= (const GeomVertexColumn &other) const |
bool | operator< (const GeomVertexColumn &other) const |
This is used to put columns in order within a particular GeomVertexArrayFormat. More... | |
void | operator= (const GeomVertexColumn ©) |
bool | operator== (const GeomVertexColumn &other) const |
Returns true if the two columns are exactly equivalent, false otherwise. More... | |
void | output (ostream &out) const |
bool | overlaps_with (int start_byte, int num_bytes) const |
Returns true if this column overlaps with any of the bytes in the indicated range, false if it does not. More... | |
void | set_column_alignment (int column_alignment) |
Changes the column alignment of an existing column. More... | |
void | set_contents (Contents contents) |
Changes the semantic meaning of an existing column. More... | |
void | set_name (InternalName *name) |
Replaces the name of an existing column. More... | |
void | set_num_components (int num_components) |
Changes the number of components of an existing column. More... | |
void | set_numeric_type (NumericType numeric_type) |
Changes the numeric type an existing column. More... | |
void | set_start (int start) |
Changes the start byte of an existing column. More... | |
void | write_datagram (BamWriter *manager, Datagram &dg) |
Writes the contents of this object to the datagram for shipping out to a Bam file. More... | |
Friends | |
class | GeomVertexArrayFormat |
class | GeomVertexReader |
class | GeomVertexWriter |
Additional Inherited Members | |
![]() | |
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 } |
This defines how a single column is interleaved within a vertex array stored within a Geom.
The GeomVertexArrayFormat class maintains a list of these to completely define a particular array structure.
Definition at line 40 of file geomVertexColumn.h.
|
inline |
This is used to unquify columns, and hence formats, for the GeomVertexFormat registry.
Definition at line 301 of file geomVertexColumn.I.
References operator==().
Referenced by is_uint8_rgba(), and operator==().
int GeomVertexColumn::complete_pointers | ( | TypedWritable ** | p_list, |
BamReader * | manager | ||
) |
Receives an array of pointers, one for each time manager->read_pointer() was called in fillin().
Returns the number of pointers processed.
Definition at line 412 of file geomVertexColumn.cxx.
References fillin().
Referenced by write_datagram().
void GeomVertexColumn::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 GeomVertexColumn.
Definition at line 428 of file geomVertexColumn.cxx.
References BamReader::get_file_minor_ver(), DatagramIterator::get_uint16(), DatagramIterator::get_uint8(), GeomVertexData::pack_abcd(), BamReader::read_pointer(), GeomVertexData::unpack_abcd_a(), GeomVertexData::unpack_abcd_b(), GeomVertexData::unpack_abcd_c(), and GeomVertexData::unpack_abcd_d().
Referenced by complete_pointers().
|
inline |
Returns the alignment requirements for this column.
If this is greater than 1, it restricts the column to appear only on memory addresses that are integer multiples of this value; this has implications for this column's start value, as well as the stride of the resulting array.
Definition at line 175 of file geomVertexColumn.I.
References get_element_stride().
Referenced by get_start().
|
inline |
Returns the number of bytes used by each component (that is, by one element of the numeric type).
Definition at line 198 of file geomVertexColumn.I.
References get_total_bytes().
Referenced by GeomVertexArrayData::evict_lru(), and get_element_stride().
|
inline |
Returns the token representing the semantic meaning of the stored value.
Definition at line 148 of file geomVertexColumn.I.
References get_start().
Referenced by GeomVertexData::clear_cache_stage(), MultitexReducer::flatten(), get_numeric_type(), CullableObject::munge_geom(), GeomVertexData::CacheKey::operator<(), set_column_alignment(), GeomTransformer::transform_texcoords(), and DXGeomMunger9::wp_callback().
|
inline |
This value is only relevant for matrix types.
Returns the number of bytes to add to access the next row of the matrix.
Definition at line 187 of file geomVertexColumn.I.
References get_component_bytes().
Referenced by GeomVertexData::CacheEntry::evict_callback(), and get_column_alignment().
|
inline |
Returns the name of this particular data field, e.g.
"vertex" or "normal". The name may be a user-defined string, or it may be one of the standard system-defined field types. Only the system-defined field types are used for the actual rendering.
Definition at line 86 of file geomVertexColumn.I.
References get_num_components().
Referenced by GeomVertexData::copy_from(), STTerrain::get_st_vertex_format(), GeomVertexWriter::reserve_num_rows(), GeomVertexReader::set_column(), set_column_alignment(), GeomVertexData::transform_vertices(), and DXGeomMunger9::wp_callback().
|
inline |
Returns the number of components of the column: the number of instances of the NumericType in each element.
This is usually, but not always, the same thing as get_num_values().
Definition at line 99 of file geomVertexColumn.I.
References get_num_values().
Referenced by GeomTransformer::apply_texture_colors(), GeomVertexArrayData::evict_lru(), MultitexReducer::flatten(), get_name(), STTerrain::get_st_vertex_format(), CullableObject::munge_geom(), set_column_alignment(), GeomTransformer::transform_texcoords(), and DXGeomMunger9::wp_callback().
|
inline |
Returns the number of times this column is repeated.
This is usually 1, except for matrices.
Definition at line 126 of file geomVertexColumn.I.
References get_numeric_type().
Referenced by GeomVertexData::CacheEntry::evict_callback(), and get_num_values().
|
inline |
Returns the number of numeric values of the column: the number of distinct numeric values that go into each element.
This is usually, but not always, the same thing as get_num_components(); the difference is in the case of a composite numeric type like NT_packed_dcba, which has four numeric values per component.
Definition at line 115 of file geomVertexColumn.I.
References get_num_elements().
Referenced by GeomVertexData::clear_cache_stage(), GeomVertexData::CacheEntry::evict_callback(), GeomTransformer::finish_collect(), get_num_components(), set_column_alignment(), GeomVertexData::transform_vertices(), and DXGeomMunger9::wp_callback().
|
inline |
Returns the token representing the numeric type of the data storage.
Definition at line 137 of file geomVertexColumn.I.
References get_contents().
Referenced by GeomVertexData::clear_cache_stage(), GeomVertexData::CacheEntry::evict_callback(), MultitexReducer::flatten(), get_num_elements(), STTerrain::get_st_vertex_format(), CullableObject::munge_geom(), set_column_alignment(), GeomTransformer::transform_texcoords(), DXGeomMunger9::wp_callback(), and SceneGraphAnalyzer::write().
|
inline |
Returns the byte within the array record at which this column starts.
This can be set to non-zero to implement interleaved arrays.
Definition at line 160 of file geomVertexColumn.I.
References get_column_alignment().
Referenced by GeomVertexData::clear_cache_stage(), GeomVertexData::copy_from(), GeomVertexData::CacheEntry::evict_callback(), GeomVertexArrayData::evict_lru(), and get_contents().
|
inline |
Returns the number of bytes used by each element of the column: component_bytes * num_components.
Definition at line 209 of file geomVertexColumn.I.
References has_homogeneous_coord().
Referenced by GeomVertexData::CacheEntry::evict_callback(), get_component_bytes(), STTerrain::get_st_vertex_format(), and GeomVertexData::transform_vertices().
|
inline |
Returns true if this Contents type is one that includes a homogeneous coordinate in the fourth component, or false otherwise.
If this is true, correct operation on the vertex data may require scaling by the homogeneous coordinate from time to time (but in general this is handled automatically if you use the 3-component or smaller forms of get_data() and set_data()).
Definition at line 226 of file geomVertexColumn.I.
References overlaps_with().
Referenced by GeomVertexData::clear_cache_stage(), and get_total_bytes().
|
inline |
Returns true if the data store of this column is exactly the same as that of the other, irrespective of name or start position within the record.
Definition at line 258 of file geomVertexColumn.I.
References is_packed_argb().
Referenced by GeomVertexData::copy_from(), and overlaps_with().
|
inline |
Returns true if this column is the standard DirectX representation of 4-component color: C_color, in NT_packed_dabc, with 1 component (4 values).
Definition at line 274 of file geomVertexColumn.I.
References is_uint8_rgba().
Referenced by GeomVertexData::copy_from(), and is_bytewise_equivalent().
|
inline |
Returns true if this column is the standard OpenGL representation of 4-component color: C_color, in NT_uint8, with 4 components.
Definition at line 288 of file geomVertexColumn.I.
References compare_to().
Referenced by GeomVertexData::copy_from(), and is_packed_argb().
|
inline |
This is used to put columns in order within a particular GeomVertexArrayFormat.
Note that it is not* in the same space as operator == and operator !=.
Definition at line 353 of file geomVertexColumn.I.
Referenced by operator==().
|
inline |
Returns true if the two columns are exactly equivalent, false otherwise.
Definition at line 330 of file geomVertexColumn.I.
References compare_to(), and operator<().
Referenced by compare_to().
|
inline |
Returns true if this column overlaps with any of the bytes in the indicated range, false if it does not.
Definition at line 245 of file geomVertexColumn.I.
References is_bytewise_equivalent().
Referenced by has_homogeneous_coord().
void GeomVertexColumn::set_column_alignment | ( | int | column_alignment | ) |
Changes the column alignment of an existing column.
This is only legal on an unregistered format (i.e. when constructing the format initially).
Definition at line 110 of file geomVertexColumn.cxx.
References get_contents(), get_name(), get_num_components(), get_num_values(), get_numeric_type(), and write_datagram().
Referenced by set_start().
void GeomVertexColumn::set_contents | ( | Contents | contents | ) |
Changes the semantic meaning of an existing column.
This is only legal on an unregistered format (i.e. when constructing the format initially).
Definition at line 84 of file geomVertexColumn.cxx.
References set_start().
Referenced by set_numeric_type().
void GeomVertexColumn::set_name | ( | InternalName * | name | ) |
Replaces the name of an existing column.
This is only legal on an unregistered format (i.e. when constructing the format initially).
Definition at line 45 of file geomVertexColumn.cxx.
References set_num_components().
void GeomVertexColumn::set_num_components | ( | int | num_components | ) |
Changes the number of components of an existing column.
This is only legal on an unregistered format (i.e. when constructing the format initially).
Definition at line 58 of file geomVertexColumn.cxx.
References set_numeric_type().
Referenced by set_name().
void GeomVertexColumn::set_numeric_type | ( | NumericType | numeric_type | ) |
Changes the numeric type an existing column.
This is only legal on an unregistered format (i.e. when constructing the format initially).
Definition at line 71 of file geomVertexColumn.cxx.
References set_contents().
Referenced by set_num_components().
void GeomVertexColumn::set_start | ( | int | start | ) |
Changes the start byte of an existing column.
This is only legal on an unregistered format (i.e. when constructing the format initially).
Definition at line 97 of file geomVertexColumn.cxx.
References set_column_alignment().
Referenced by set_contents().
Writes the contents of this object to the datagram for shipping out to a Bam file.
Definition at line 395 of file geomVertexColumn.cxx.
References Datagram::add_uint16(), Datagram::add_uint8(), complete_pointers(), and BamWriter::write_pointer().
Referenced by set_column_alignment().