Panda3D
Classes | Public Member Functions | Friends

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

List of all members.

Classes

class  Packer
class  Packer_argb_packed
class  Packer_color
class  Packer_float32_3
class  Packer_float64_3
class  Packer_nativedouble_3
class  Packer_nativefloat_3
class  Packer_point
class  Packer_point_float32_2
class  Packer_point_float32_3
class  Packer_point_float32_4
class  Packer_point_float64_2
class  Packer_point_float64_3
class  Packer_point_float64_4
class  Packer_point_nativedouble_2
class  Packer_point_nativedouble_3
class  Packer_point_nativedouble_4
class  Packer_point_nativefloat_2
class  Packer_point_nativefloat_3
class  Packer_point_nativefloat_4
class  Packer_rgba_float32_4
class  Packer_rgba_nativefloat_4
class  Packer_rgba_uint8_4
class  Packer_uint16_1

Public Member Functions

 GeomVertexColumn (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.
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.
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_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 (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 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 GeomVertexReader
class GeomVertexWriter

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

Referenced by GeomVertexArrayFormat::complete_pointers().

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

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

Referenced by GeomVertexArrayFormat::fillin().

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

Referenced by GeomVertexArrayFormat::add_column().

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

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

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 GeomVertexArrayFormat::add_column(), GeomVertexArrayFormat::align_columns_for_animation(), STTerrain::convert_vertex_column(), GeomVertexData::copy_from(), GeomVertexData::describe_vertex(), GeomVertexArrayFormat::finalize(), and GeomVertexArrayFormat::pack_columns().

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 GeomVertexArrayFormat::align_columns_for_animation(), GeomTransformer::apply_texture_colors(), STTerrain::convert_vertex_column(), GeomVertexArrayFormat::pack_columns(), and GeomTransformer::transform_texcoords().

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

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

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

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

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 203 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 235 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 251 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 265 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 330 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 307 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 222 of file geomVertexColumn.I.

Referenced by GeomVertexArrayFormat::get_column().

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

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

Referenced by GeomVertexArrayFormat::write_datagram().


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations