00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef LWOPOLYGONS_H
00016 #define LWOPOLYGONS_H
00017
00018 #include "pandatoolbase.h"
00019
00020 #include "lwoChunk.h"
00021
00022 #include "luse.h"
00023 #include "vector_int.h"
00024 #include "referenceCount.h"
00025 #include "pointerTo.h"
00026
00027
00028
00029
00030
00031
00032 class LwoPolygons : public LwoChunk {
00033 public:
00034 enum PolygonFlags {
00035 PF_continuity_1 = 0x0400,
00036 PF_continuity_2 = 0x0800,
00037 PF_numverts_mask = 0x03f,
00038
00039
00040
00041
00042 PF_decal = 0x0001
00043 };
00044
00045 class Polygon : public ReferenceCount {
00046 public:
00047 int _flags;
00048 vector_int _vertices;
00049
00050
00051
00052
00053
00054 int _surface_index;
00055 };
00056
00057 int get_num_polygons() const;
00058 Polygon *get_polygon(int n) const;
00059
00060 IffId _polygon_type;
00061
00062 public:
00063 virtual bool read_iff(IffInputFile *in, size_t stop_at);
00064 virtual void write(ostream &out, int indent_level = 0) const;
00065
00066 private:
00067 typedef pvector< PT(Polygon) > Polygons;
00068 Polygons _polygons;
00069
00070 public:
00071 virtual TypeHandle get_type() const {
00072 return get_class_type();
00073 }
00074 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00075 static TypeHandle get_class_type() {
00076 return _type_handle;
00077 }
00078 static void init_type() {
00079 LwoChunk::init_type();
00080 register_type(_type_handle, "LwoPolygons",
00081 LwoChunk::get_class_type());
00082 }
00083
00084 private:
00085 static TypeHandle _type_handle;
00086 };
00087
00088 #endif
00089
00090