Panda3D
 All Classes Functions Variables Enumerations
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)
 
 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 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 &copy)
 
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

- 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
}
 

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 40 of file geomVertexColumn.h.

Member Function Documentation

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 301 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 412 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 428 of file geomVertexColumn.cxx.

References BamReader::get_file_minor_ver(), DatagramIterator::get_uint16(), DatagramIterator::get_uint8(), and BamReader::read_pointer().

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 175 of file geomVertexColumn.I.

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 198 of file geomVertexColumn.I.

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

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

Definition at line 148 of file geomVertexColumn.I.

Referenced by GeomTransformer::transform_texcoords().

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 187 of file geomVertexColumn.I.

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 86 of file geomVertexColumn.I.

Referenced by GeomVertexData::copy_from(), and GeomVertexData::describe_vertex().

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 99 of file geomVertexColumn.I.

Referenced by GeomTransformer::apply_texture_colors(), and GeomTransformer::transform_texcoords().

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 126 of file geomVertexColumn.I.

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 115 of file geomVertexColumn.I.

Referenced by GeomVertexData::describe_vertex().

GeomVertexColumn::NumericType GeomVertexColumn::get_numeric_type ( ) const
inline

Returns the token representing the numeric type of the data storage.

Definition at line 137 of file geomVertexColumn.I.

Referenced by GeomTransformer::transform_texcoords().

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 160 of file geomVertexColumn.I.

Referenced by GeomVertexData::copy_from().

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 209 of file geomVertexColumn.I.

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 226 of file geomVertexColumn.I.

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 258 of file geomVertexColumn.I.

Referenced by GeomVertexData::copy_from().

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 274 of file geomVertexColumn.I.

Referenced by GeomVertexData::copy_from().

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 288 of file geomVertexColumn.I.

Referenced by GeomVertexData::copy_from().

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 353 of file geomVertexColumn.I.

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

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

Definition at line 330 of file geomVertexColumn.I.

References compare_to().

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 245 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 110 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 84 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 45 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 58 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 71 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 97 of file geomVertexColumn.cxx.

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

References Datagram::add_uint16(), Datagram::add_uint8(), and BamWriter::write_pointer().


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