Panda3D
Classes | Public Member Functions | Friends | List of all members
GeomVertexColumn Class Reference

This defines how a single column is interleaved within a vertex array stored within a Geom. More...

#include "geomVertexColumn.h"

Inheritance diagram for GeomVertexColumn:
GeomEnums

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 &copy)
 
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 InternalNameget_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 &copy)
 
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
}
 

Detailed Description

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.

Member Function Documentation

◆ compare_to()

int GeomVertexColumn::compare_to ( const GeomVertexColumn other) const
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==().

◆ complete_pointers()

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.

◆ fillin()

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

◆ get_column_alignment()

int GeomVertexColumn::get_column_alignment ( ) const
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.

◆ get_component_bytes()

int GeomVertexColumn::get_component_bytes ( ) const
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.

◆ get_contents()

GeomVertexColumn::Contents GeomVertexColumn::get_contents ( ) const
inline

Returns the token representing the semantic meaning of the stored value.

Definition at line 124 of file geomVertexColumn.I.

◆ get_element_stride()

int GeomVertexColumn::get_element_stride ( ) const
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.

◆ get_name()

const InternalName * GeomVertexColumn::get_name ( ) const
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().

◆ get_num_components()

int GeomVertexColumn::get_num_components ( ) const
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().

◆ get_num_elements()

int GeomVertexColumn::get_num_elements ( ) const
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.

◆ get_num_values()

int GeomVertexColumn::get_num_values ( ) const
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.

◆ get_numeric_type()

GeomVertexColumn::NumericType GeomVertexColumn::get_numeric_type ( ) const
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().

◆ get_start()

int GeomVertexColumn::get_start ( ) const
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().

◆ get_total_bytes()

int GeomVertexColumn::get_total_bytes ( ) const
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().

◆ has_homogeneous_coord()

bool GeomVertexColumn::has_homogeneous_coord ( ) const
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.

◆ is_bytewise_equivalent()

bool GeomVertexColumn::is_bytewise_equivalent ( const GeomVertexColumn other) const
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.

◆ is_packed_argb()

bool GeomVertexColumn::is_packed_argb ( ) const
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.

◆ is_uint8_rgba()

bool GeomVertexColumn::is_uint8_rgba ( ) const
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.

◆ operator<()

bool GeomVertexColumn::operator< ( const GeomVertexColumn other) const
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.

◆ operator==()

bool GeomVertexColumn::operator== ( const GeomVertexColumn other) const
inline

Returns true if the two columns are exactly equivalent, false otherwise.

Definition at line 275 of file geomVertexColumn.I.

References compare_to().

◆ overlaps_with()

bool GeomVertexColumn::overlaps_with ( int  start_byte,
int  num_bytes 
) const
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.

◆ set_column_alignment()

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.

◆ set_contents()

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.

◆ set_name()

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.

◆ 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 54 of file geomVertexColumn.cxx.

◆ set_numeric_type()

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.

◆ set_start()

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.

◆ write_datagram()

void GeomVertexColumn::write_datagram ( BamWriter manager,
Datagram dg 
)

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


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