Panda3D
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Friends
FltVertex Class Reference

Represents a single vertex in the vertex palette. More...

#include "fltVertex.h"

Inheritance diagram for FltVertex:
FltRecord TypedReferenceCount TypedObject ReferenceCount MemoryBase MemoryBase

List of all members.

Public Types

enum  Flags { F_hard_edge = 0x8000, F_normal_frozen = 0x4000, F_no_color = 0x2000, F_packed_color = 0x1000 }

Public Member Functions

 FltVertex (FltHeader *header)
virtual TypeHandle force_init_type ()
LColor get_color () const
 If has_color() indicates true, returns the color of the vertex, as a four-component value.
FltOpcode get_opcode () const
 Returns the opcode that this record will be written as.
int get_record_length () const
 Returns the length of this record in bytes as it will be written to the flt file.
LRGBColor get_rgb () const
 If has_color() indicates true, returns the color of the vertex, as a three-component value.
virtual TypeHandle get_type () const
bool has_color () const
 Returns true if the vertex has a primary color indicated, false otherwise.
void set_color (const LColor &color)
 Sets the color of the vertex, using the packed color convention.
void set_rgb (const LRGBColor &rgb)
 Sets the color of the vertex, using the packed color convention.

Static Public Member Functions

static TypeHandle get_class_type ()
static void init_type ()
 This function is declared non-inline to work around a compiler bug in g++ 2.96.

Public Attributes

int _color_index
int _color_name_index
unsigned int _flags
bool _has_normal
bool _has_uv
LPoint3 _normal
FltPackedColor _packed_color
LPoint3d _pos
LPoint2 _uv

Protected Member Functions

virtual bool build_record (FltRecordWriter &writer) const
 Fills up the current record on the FltRecordWriter with data for this record, but does not advance the writer.
virtual bool extract_record (FltRecordReader &reader)
 Fills in the information in this record based on the information given in the indicated datagram, whose opcode has already been read.

Friends

class FltHeader

Detailed Description

Represents a single vertex in the vertex palette.

Flt files index vertices by their byte offset in the vertex palette; within this library, we map those byte offsets to pointers automatically.

This may represent a vertex with or without a normal or texture coordinates.

Definition at line 35 of file fltVertex.h.


Member Function Documentation

bool FltVertex::build_record ( FltRecordWriter writer) const [protected, virtual]

Fills up the current record on the FltRecordWriter with data for this record, but does not advance the writer.

Returns true on success, false if there is some error.

Reimplemented from FltRecord.

Definition at line 241 of file fltVertex.cxx.

References Datagram::add_be_float32(), Datagram::add_be_float64(), Datagram::add_be_int16(), Datagram::add_be_uint16(), Datagram::add_be_uint32(), FltRecord::build_record(), FltHeader::get_flt_version(), Datagram::get_length(), get_opcode(), get_record_length(), Datagram::pad_bytes(), FltRecordWriter::set_opcode(), and FltRecordWriter::update_datagram().

bool FltVertex::extract_record ( FltRecordReader reader) [protected, virtual]

Fills in the information in this record based on the information given in the indicated datagram, whose opcode has already been read.

Returns true on success, false if the datagram is invalid.

Reimplemented from FltRecord.

Definition at line 165 of file fltVertex.cxx.

References FltRecord::check_remaining_size(), FltRecord::extract_record(), DatagramIterator::get_be_float32(), DatagramIterator::get_be_float64(), DatagramIterator::get_be_int16(), DatagramIterator::get_be_int32(), DatagramIterator::get_be_uint16(), FltHeader::get_flt_version(), FltRecordReader::get_iterator(), FltRecordReader::get_opcode(), DatagramIterator::get_remaining_size(), and DatagramIterator::skip_bytes().

If has_color() indicates true, returns the color of the vertex, as a four-component value.

In the case of a vertex, the alpha channel will always be 1.0, as MultiGen does not store transparency per-vertex.

Definition at line 123 of file fltVertex.cxx.

References FltHeader::get_color(), and has_color().

Referenced by FltLocalVertexPool::build_record().

FltOpcode FltVertex::get_opcode ( ) const

Returns the opcode that this record will be written as.

Definition at line 47 of file fltVertex.cxx.

Referenced by build_record(), and get_record_length().

Returns the length of this record in bytes as it will be written to the flt file.

Definition at line 70 of file fltVertex.cxx.

References FltHeader::get_flt_version(), and get_opcode().

Referenced by build_record().

If has_color() indicates true, returns the color of the vertex, as a three-component value.

Definition at line 137 of file fltVertex.cxx.

References FltHeader::get_rgb(), and has_color().

bool FltVertex::has_color ( ) const [inline]

Returns true if the vertex has a primary color indicated, false otherwise.

Definition at line 23 of file fltVertex.I.

Referenced by FltLocalVertexPool::build_record(), get_color(), and get_rgb().

static void FltVertex::init_type ( ) [inline, static]

This function is declared non-inline to work around a compiler bug in g++ 2.96.

Making it inline seems to cause problems in the optimizer.

Reimplemented from FltRecord.

Definition at line 80 of file fltVertex.h.

void FltVertex::set_color ( const LColor color) [inline]

Sets the color of the vertex, using the packed color convention.

The alpha component is ignored.

Definition at line 37 of file fltVertex.I.

References set_rgb().

void FltVertex::set_rgb ( const LRGBColor rgb)

Sets the color of the vertex, using the packed color convention.

Definition at line 151 of file fltVertex.cxx.

References FltPackedColor::set_rgb().

Referenced by set_color().


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