00001 00002 /********************************************************************** 00003 * tri_strip.H: 00004 **********************************************************************/ 00005 #ifndef TRI_STRIP_H_IS_INCLUDED 00006 #define TRI_STRIP_H_IS_INCLUDED 00007 00008 #include "bface.H" 00009 00010 class StripCB; 00011 /********************************************************************** 00012 * TriStrip: 00013 * 00014 * Builds and stores triangle strips 00015 **********************************************************************/ 00016 #define CTriStrip const TriStrip 00017 class TriStrip { 00018 public: 00019 //******** MANAGERS ******** 00020 TriStrip(int s=0) : _orientation(!!s), _verts(0), _faces(0) {} // start empty 00021 virtual ~TriStrip() {} 00022 00023 //******** ACCESSORS ******** 00024 CBvert_list& verts() const { return _verts;} 00025 CBface_list& faces() const { return _faces;} 00026 00027 Bvert* vert(int i) const { return _verts[i]; } 00028 Bface* face(int i) const { return _faces[i]; } 00029 00030 bool orientation() const { return _orientation;} 00031 bool empty() const { return _verts.empty(); } 00032 int num() const { return _verts.num(); } 00033 00034 //******** BUILDING ******** 00035 virtual void reset() { _verts.clear(); _faces.clear(); _orientation = 0; } 00036 void add(Bvert* v, Bface* f) { _verts += v; _faces += f; } 00037 static void get_strips(Bface*, ARRAY<TriStrip*>&); 00038 00039 //******** DRAWING ******** 00040 virtual void draw(StripCB* cb); 00041 00042 protected: 00043 // True if strip is "negatively oriented", 00044 // i.e. need to start w/ repeated 1st vertex: 00045 bool _orientation; // XXX - rename; 00046 Bvert_list _verts; // sequence of vertices 00047 Bface_list _faces; // face i corresponds to verts i, i-1, i-2 00048 00049 Bface* backup_strip(Bface*, Bvert*&); 00050 bool build(Bface*, Bface_list&); 00051 }; 00052 00053 #endif // TRI_STRIP_H_IS_INCLUDED 00054 00055 /* end of file tri_strip.H */