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

pandatool/src/lwo/lwoPolygons.h

Go to the documentation of this file.
00001 // Filename: lwoPolygons.h
00002 // Created by:  drose (24Apr01)
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 LWOPOLYGONS_H
00020 #define LWOPOLYGONS_H
00021 
00022 #include <pandatoolbase.h>
00023 
00024 #include "lwoChunk.h"
00025 
00026 #include <luse.h>
00027 #include <vector_int.h>
00028 #include <referenceCount.h>
00029 #include <pointerTo.h>
00030 
00031 ////////////////////////////////////////////////////////////////////
00032 //       Class : LwoPolygons
00033 // Description : An array of polygons that will be referenced by later
00034 //               chunks.
00035 ////////////////////////////////////////////////////////////////////
00036 class LwoPolygons : public LwoChunk {
00037 public:
00038   enum PolygonFlags {
00039     PF_continuity_1    = 0x0400,
00040     PF_continuity_2    = 0x0800,
00041     PF_numverts_mask   = 0x03ff,
00042 
00043     // This "flag" is stored artificially when reading 5.x LWOB files,
00044     // and indicates that the polygon is a decal of a preceding
00045     // polygon.
00046     PF_decal           = 0x0001
00047   };
00048 
00049   class Polygon : public ReferenceCount {
00050   public:
00051     int _flags;
00052     vector_int _vertices;
00053 
00054     // This value is only filled in when reading 5.x LWOB files, and
00055     // indicates the surface index of the polygon within a preceding
00056     // SRFS (LwoTags) chunk.  For 6.x and later files, this will be
00057     // set to -1.
00058     int _surface_index;
00059   };
00060 
00061   int get_num_polygons() const;
00062   Polygon *get_polygon(int n) const;
00063 
00064   IffId _polygon_type;
00065 
00066 public:
00067   virtual bool read_iff(IffInputFile *in, size_t stop_at);
00068   virtual void write(ostream &out, int indent_level = 0) const;
00069 
00070 private:
00071   typedef pvector< PT(Polygon) > Polygons;
00072   Polygons _polygons;
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     LwoChunk::init_type();
00084     register_type(_type_handle, "LwoPolygons",
00085                   LwoChunk::get_class_type());
00086   }
00087 
00088 private:
00089   static TypeHandle _type_handle;
00090 };
00091 
00092 #endif
00093 
00094 

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