Panda3D

lwoPolygonTags.h

00001 // Filename: lwoPolygonTags.h
00002 // Created by:  drose (24Apr01)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #ifndef LWOPOLYGONTAGS_H
00016 #define LWOPOLYGONTAGS_H
00017 
00018 #include "pandatoolbase.h"
00019 
00020 #include "lwoChunk.h"
00021 
00022 ////////////////////////////////////////////////////////////////////
00023 //       Class : LwoPolygonTags
00024 // Description : An association of polygons defined in the most recent
00025 //               LwoPolygons chunk to tag ids defined in the most
00026 //               recent LwoTags chunk.  This associated properties
00027 //               with the polygons, depending on the tag_type.
00028 ////////////////////////////////////////////////////////////////////
00029 class LwoPolygonTags : public LwoChunk {
00030 public:
00031   bool has_tag(int polygon_index) const;
00032   int get_tag(int polygon_index) const;
00033 
00034   IffId _tag_type;
00035 
00036 public:
00037   virtual bool read_iff(IffInputFile *in, size_t stop_at);
00038   virtual void write(ostream &out, int indent_level = 0) const;
00039 
00040 private:
00041   typedef pmap<int, int> TMap;
00042   TMap _tmap;
00043 
00044 public:
00045   virtual TypeHandle get_type() const {
00046     return get_class_type();
00047   }
00048   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00049   static TypeHandle get_class_type() {
00050     return _type_handle;
00051   }
00052   static void init_type() {
00053     LwoChunk::init_type();
00054     register_type(_type_handle, "LwoPolygonTags",
00055                   LwoChunk::get_class_type());
00056   }
00057 
00058 private:
00059   static TypeHandle _type_handle;
00060 };
00061 
00062 #endif
00063 
00064 
 All Classes Functions Variables Enumerations