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, int num_elements=0, int element_stride=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 (std::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 | GeomVertexData |
class | GeomVertexReader |
class | GeomVertexWriter |
Additional Inherited Members | |
Public Types inherited from GeomEnums | |
enum | AnimationType { AT_none, AT_panda, AT_hardware } |
enum | Contents { C_other, C_point, C_clip_point, C_vector, C_texcoord, C_color, C_index, C_morph_delta, C_matrix, C_normal } |
enum | GeomRendering { GR_indexed_point = 0x00001, GR_indexed_other = 0x10000, GR_indexed_bits = 0x10001, GR_point = 0x00002, GR_point_uniform_size = 0x00004, GR_per_point_size = 0x00008, GR_point_perspective = 0x00010, GR_point_aspect_ratio = 0x00020, GR_point_scale = 0x00040, GR_point_rotate = 0x00080, GR_point_sprite = 0x00100, GR_point_sprite_tex_matrix = 0x00200, GR_point_bits = 0x003fe, GR_triangle_strip = 0x00400, GR_triangle_fan = 0x00800, GR_line_strip = 0x01000, GR_composite_bits = 0x01c00, GR_strip_cut_index = 0x20000, GR_flat_first_vertex = 0x02000, GR_flat_last_vertex = 0x04000, GR_shade_model_bits = 0x06000, GR_render_mode_wireframe = 0x40000, GR_render_mode_point = 0x80000, GR_adjacency = 0x100000 } |
enum | NumericType { NT_uint8, NT_uint16, NT_uint32, NT_packed_dcba, NT_packed_dabc, NT_float32, NT_float64, NT_stdfloat, NT_int8, NT_int16, NT_int32, NT_packed_ufloat } |
enum | PrimitiveType { PT_none, PT_polygons, PT_lines, PT_points, PT_patches } |
enum | ShadeModel { SM_uniform, SM_smooth, SM_flat_first_vertex, SM_flat_last_vertex } |
enum | UsageHint { UH_client, UH_stream, UH_dynamic, UH_static, UH_unspecified } |
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 37 of file geomVertexColumn.h.
|
inline |
This is used to unquify columns, and hence formats, for the GeomVertexFormat registry.
Definition at line 243 of file geomVertexColumn.I.
Referenced by 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 404 of file geomVertexColumn.cxx.
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 424 of file geomVertexColumn.cxx.
References DatagramIterator::get_uint8(), and BamReader::read_pointer().
|
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 144 of file geomVertexColumn.I.
|
inline |
Returns the number of bytes used by each component (that is, by one element of the numeric type).
Definition at line 162 of file geomVertexColumn.I.
|
inline |
Returns the token representing the semantic meaning of the stored value.
Definition at line 124 of file geomVertexColumn.I.
|
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 153 of file geomVertexColumn.I.
|
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 77 of file geomVertexColumn.I.
Referenced by GeomVertexData::copy_from(), and GeomVertexArrayFormat::finalize().
|
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 87 of file geomVertexColumn.I.
Referenced by GeomVertexArrayFormat::get_format_string().
|
inline |
Returns the number of times this column is repeated.
This is usually 1, except for matrices.
Definition at line 108 of file geomVertexColumn.I.
|
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 99 of file geomVertexColumn.I.
|
inline |
Returns the token representing the numeric type of the data storage.
Definition at line 116 of file geomVertexColumn.I.
Referenced by GeomVertexArrayFormat::get_format_string().
|
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 133 of file geomVertexColumn.I.
Referenced by GeomVertexArrayFormat::count_unused_space(), and GeomVertexArrayFormat::get_format_string().
|
inline |
Returns the number of bytes used by each element of the column: component_bytes * num_components.
Definition at line 171 of file geomVertexColumn.I.
Referenced by GeomVertexArrayFormat::count_unused_space(), and GeomVertexArrayFormat::get_format_string().
|
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 183 of file geomVertexColumn.I.
|
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 209 of file geomVertexColumn.I.
|
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 221 of file geomVertexColumn.I.
|
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 232 of file geomVertexColumn.I.
|
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 293 of file geomVertexColumn.I.
|
inline |
Returns true if the two columns are exactly equivalent, false otherwise.
Definition at line 275 of file geomVertexColumn.I.
References 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 199 of file geomVertexColumn.I.
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 94 of file geomVertexColumn.cxx.
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 74 of file geomVertexColumn.cxx.
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 44 of file geomVertexColumn.cxx.
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 54 of file geomVertexColumn.cxx.
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 64 of file geomVertexColumn.cxx.
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 84 of file geomVertexColumn.cxx.
Writes the contents of this object to the datagram for shipping out to a Bam file.
Definition at line 380 of file geomVertexColumn.cxx.
References Datagram::add_uint16(), Datagram::add_uint8(), BamWriter::get_file_minor_ver(), and BamWriter::write_pointer().
Referenced by GeomVertexArrayFormat::write_datagram().