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