Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

pandatool/src/flt/fltVertex.h

Go to the documentation of this file.
00001 // Filename: fltVertex.h
00002 // Created by:  drose (25Aug00)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 #ifndef FLTVERTEX_H
00020 #define FLTVERTEX_H
00021 
00022 #include <pandatoolbase.h>
00023 
00024 #include "fltRecord.h"
00025 #include "fltPackedColor.h"
00026 
00027 #include <luse.h>
00028 
00029 ////////////////////////////////////////////////////////////////////
00030 //       Class : FltVertex
00031 // Description : Represents a single vertex in the vertex palette.
00032 //               Flt files index vertices by their byte offset in the
00033 //               vertex palette; within this library, we map those
00034 //               byte offsets to pointers automatically.
00035 //
00036 //               This may represent a vertex with or without a normal
00037 //               or texture coordinates.
00038 ////////////////////////////////////////////////////////////////////
00039 class FltVertex : public FltRecord {
00040 public:
00041   FltVertex(FltHeader *header);
00042 
00043   FltOpcode get_opcode() const;
00044   int get_record_length() const;
00045 
00046   enum Flags {
00047     F_hard_edge         = 0x8000,
00048     F_normal_frozen     = 0x4000,
00049     F_no_color          = 0x2000,
00050     F_packed_color      = 0x1000
00051   };
00052 
00053   int _color_name_index;
00054   unsigned int _flags;
00055   LPoint3d _pos;
00056   LPoint3f _normal;
00057   LPoint2f _uv;
00058   FltPackedColor _packed_color;
00059   int _color_index;
00060 
00061   bool _has_normal;
00062   bool _has_uv;
00063 
00064 public:
00065   INLINE bool has_color() const;
00066   Colorf get_color() const;
00067   RGBColorf get_rgb() const;
00068 
00069 
00070 protected:
00071   virtual bool extract_record(FltRecordReader &reader);
00072   virtual bool build_record(FltRecordWriter &writer) const;
00073 
00074 public:
00075   virtual TypeHandle get_type() const {
00076     return get_class_type();
00077   }
00078   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00079   static TypeHandle get_class_type() {
00080     return _type_handle;
00081   }
00082   static void init_type() {
00083     FltRecord::init_type();
00084     register_type(_type_handle, "FltVertex",
00085                   FltRecord::get_class_type());
00086   }
00087 
00088 private:
00089   static TypeHandle _type_handle;
00090 
00091   friend class FltHeader;
00092 };
00093 
00094 #include "fltVertex.I"
00095 
00096 #endif
00097 
00098 

Generated on Fri May 2 03:19:50 2003 for Panda-Tool by doxygen1.3