86 lines
2.0 KiB
C++
86 lines
2.0 KiB
C++
// Filename: fltVertex.h
|
|
// Created by: drose (25Aug00)
|
|
//
|
|
////////////////////////////////////////////////////////////////////
|
|
|
|
#ifndef FLTVERTEX_H
|
|
#define FLTVERTEX_H
|
|
|
|
#include <pandatoolbase.h>
|
|
|
|
#include "fltRecord.h"
|
|
#include "fltPackedColor.h"
|
|
|
|
#include <luse.h>
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
// Class : FltVertex
|
|
// 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.
|
|
////////////////////////////////////////////////////////////////////
|
|
class FltVertex : public FltRecord {
|
|
public:
|
|
FltVertex(FltHeader *header);
|
|
|
|
FltOpcode get_opcode() const;
|
|
int get_record_length() const;
|
|
|
|
enum Flags {
|
|
F_hard_edge = 0x80000000,
|
|
F_normal_frozen = 0x40000000,
|
|
F_no_color = 0x20000000,
|
|
F_packed_color = 0x10000000
|
|
};
|
|
|
|
int _color_name_index;
|
|
unsigned int _flags;
|
|
LPoint3d _pos;
|
|
LPoint3f _normal;
|
|
LPoint2f _uv;
|
|
FltPackedColor _packed_color;
|
|
int _color_index;
|
|
|
|
bool _has_normal;
|
|
bool _has_uv;
|
|
|
|
public:
|
|
INLINE bool has_color() const;
|
|
Colorf get_color() const;
|
|
RGBColorf get_rgb() const;
|
|
|
|
|
|
protected:
|
|
virtual bool extract_record(FltRecordReader &reader);
|
|
virtual bool build_record(FltRecordWriter &writer) const;
|
|
|
|
public:
|
|
virtual TypeHandle get_type() const {
|
|
return get_class_type();
|
|
}
|
|
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
|
|
static TypeHandle get_class_type() {
|
|
return _type_handle;
|
|
}
|
|
static void init_type() {
|
|
FltRecord::init_type();
|
|
register_type(_type_handle, "FltVertex",
|
|
FltRecord::get_class_type());
|
|
}
|
|
|
|
private:
|
|
static TypeHandle _type_handle;
|
|
|
|
friend class FltHeader;
|
|
};
|
|
|
|
#include "fltVertex.I"
|
|
|
|
#endif
|
|
|
|
|