Panda3D
Loading...
Searching...
No Matches
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 (const GeomVertexColumn &copy)
 
 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)
 
int compare_to (const GeomVertexColumn &other) const
 This is used to unquify columns, and hence formats, for the GeomVertexFormat registry.
 
int complete_pointers (TypedWritable **plist, BamReader *manager)
 Receives an array of pointers, one for each time manager->read_pointer() was called in fillin().
 
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.
 
int get_column_alignment () const
 Returns the alignment requirements for this column.
 
int get_component_bytes () const
 Returns the number of bytes used by each component (that is, by one element of the numeric type).
 
Contents get_contents () const
 Returns the token representing the semantic meaning of the stored value.
 
int get_element_stride () const
 This value is only relevant for matrix types.
 
const InternalNameget_name () const
 Returns the name of this particular data field, e.g.
 
int get_num_components () const
 Returns the number of components of the column: the number of instances of the NumericType in each element.
 
int get_num_elements () const
 Returns the number of times this column is repeated.
 
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.
 
NumericType get_numeric_type () const
 Returns the token representing the numeric type of the data storage.
 
int get_start () const
 Returns the byte within the array record at which this column starts.
 
int get_total_bytes () const
 Returns the number of bytes used by each element of the column: component_bytes * num_components.
 
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.
 
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.
 
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).
 
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.
 
bool operator!= (const GeomVertexColumn &other) const
 
bool operator< (const GeomVertexColumn &other) const
 This is used to put columns in order within a particular GeomVertexArrayFormat.
 
void operator= (const GeomVertexColumn &copy)
 
bool operator== (const GeomVertexColumn &other) const
 Returns true if the two columns are exactly equivalent, false otherwise.
 
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.
 
void set_column_alignment (int column_alignment)
 Changes the column alignment of an existing column.
 
void set_contents (Contents contents)
 Changes the semantic meaning of an existing column.
 
void set_name (InternalName *name)
 Replaces the name of an existing column.
 
void set_num_components (int num_components)
 Changes the number of components of an existing column.
 
void set_numeric_type (NumericType numeric_type)
 Changes the numeric type an existing column.
 
void set_start (int start)
 Changes the start byte of an existing column.
 
void write_datagram (BamWriter *manager, Datagram &dg)
 Writes the contents of this object to the datagram for shipping out to a Bam file.
 

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.

Constructor & Destructor Documentation

◆ GeomVertexColumn() [1/2]

GeomVertexColumn::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 )
inlineexplicit

Definition at line 26 of file geomVertexColumn.I.

◆ GeomVertexColumn() [2/2]

GeomVertexColumn::GeomVertexColumn ( const GeomVertexColumn & copy)
inline

Definition at line 47 of file geomVertexColumn.I.

◆ ~GeomVertexColumn()

GeomVertexColumn::~GeomVertexColumn ( )
inline

Definition at line 65 of file geomVertexColumn.I.

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

References BamReader::get_file_minor_ver().

Referenced by GeomVertexArrayFormat::complete_pointers().

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

References BamReader::get_file_minor_ver(), DatagramIterator::get_uint16(), 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 143 of file geomVertexColumn.I.

Referenced by GeomVertexArrayFormat::add_column(), and GeomVertexArrayFormat::align_columns_for_animation().

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

Referenced by GeomVertexArrayFormat::get_format_string().

◆ get_contents()

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

◆ get_element_stride()

int GeomVertexColumn::get_element_stride ( ) const
inline

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

Referenced by GeomVertexArrayFormat::add_column(), GeomVertexArrayFormat::align_columns_for_animation(), GeomVertexData::copy_from(), CPT(), GeomVertexArrayFormat::finalize(), and GeomVertexArrayFormat::pack_columns().

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

Referenced by GeomVertexArrayFormat::align_columns_for_animation(), GeomTransformer::apply_texture_colors(), CPT(), GeomVertexArrayFormat::get_format_string(), GeomVertexArrayFormat::pack_columns(), and GeomTransformer::transform_texcoords().

◆ get_num_elements()

int GeomVertexColumn::get_num_elements ( ) const
inline

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

Referenced by CPT().

◆ get_numeric_type()

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

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

Referenced by GeomVertexArrayFormat::add_column(), GeomVertexData::copy_from(), GeomVertexArrayFormat::count_unused_space(), GeomVertexArrayFormat::get_format_string(), and GeomVertexArrayFormat::remove_column().

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

Referenced by GeomVertexArrayFormat::add_column(), GeomVertexArrayFormat::count_unused_space(), GeomVertexArrayFormat::get_format_string(), and GeomVertexArrayFormat::remove_column().

◆ 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 182 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 208 of file geomVertexColumn.I.

Referenced by GeomVertexData::copy_from().

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

Referenced by GeomVertexData::copy_from().

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

Referenced by GeomVertexData::copy_from().

◆ operator!=()

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

Definition at line 282 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 292 of file geomVertexColumn.I.

◆ operator=()

void GeomVertexColumn::operator= ( const GeomVertexColumn & copy)

Definition at line 25 of file geomVertexColumn.cxx.

◆ operator==()

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

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

Definition at line 274 of file geomVertexColumn.I.

References compare_to().

◆ output()

void GeomVertexColumn::output ( std::ostream & out) const

Definition at line 102 of file geomVertexColumn.cxx.

◆ 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 198 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 93 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 73 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 43 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 53 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 63 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 83 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 385 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().

Friends And Related Symbol Documentation

◆ GeomVertexArrayFormat

friend class GeomVertexArrayFormat
friend

Definition at line 434 of file geomVertexColumn.h.

◆ GeomVertexData

friend class GeomVertexData
friend

Definition at line 435 of file geomVertexColumn.h.

◆ GeomVertexReader

friend class GeomVertexReader
friend

Definition at line 436 of file geomVertexColumn.h.

◆ GeomVertexWriter

friend class GeomVertexWriter
friend

Definition at line 437 of file geomVertexColumn.h.


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