00001 // Filename: cLwoPolygons.h 00002 // Created by: drose (25Apr01) 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 CLWOPOLYGONS_H 00016 #define CLWOPOLYGONS_H 00017 00018 #include "pandatoolbase.h" 00019 00020 #include "lwoPolygons.h" 00021 #include "eggGroup.h" 00022 #include "pointerTo.h" 00023 00024 #include "pmap.h" 00025 00026 class LwoToEggConverter; 00027 class CLwoPoints; 00028 class CLwoSurface; 00029 class LwoTags; 00030 class LwoPolygonTags; 00031 class LwoDiscontinuousVertexMap; 00032 00033 //////////////////////////////////////////////////////////////////// 00034 // Class : CLwoPolygons 00035 // Description : This class is a wrapper around LwoPolygons and stores 00036 // additional information useful during the 00037 // conversion-to-egg process. 00038 //////////////////////////////////////////////////////////////////// 00039 class CLwoPolygons { 00040 public: 00041 INLINE CLwoPolygons(LwoToEggConverter *converter, 00042 const LwoPolygons *polygons, 00043 CLwoPoints *points); 00044 00045 void add_ptags(const LwoPolygonTags *lwo_ptags, const LwoTags *tags); 00046 void add_vmad(const LwoDiscontinuousVertexMap *lwo_vmad); 00047 00048 CLwoSurface *get_surface(int polygon_index) const; 00049 bool get_uv(const string &uv_name, int pi, int vi, LPoint2 &uv) const; 00050 00051 void make_egg(); 00052 void connect_egg(); 00053 00054 LwoToEggConverter *_converter; 00055 CPT(LwoPolygons) _polygons; 00056 CLwoPoints *_points; 00057 PT(EggGroup) _egg_group; 00058 00059 const LwoTags *_tags; 00060 typedef pmap<IffId, const LwoPolygonTags *> PTags; 00061 PTags _ptags; 00062 00063 const LwoPolygonTags *_surf_ptags; 00064 00065 // There might be named maps associated with the polygons to bring a 00066 // per-polygon mapping to the UV's. 00067 typedef pmap<string, const LwoDiscontinuousVertexMap *> VMad; 00068 VMad _txuv; 00069 00070 private: 00071 void make_faces(); 00072 }; 00073 00074 #include "cLwoPolygons.I" 00075 00076 #endif 00077 00078