00001 00002 /********************************************************************** 00003 * lstrip.H: 00004 **********************************************************************/ 00005 #ifndef LSTRIP_H_IS_INCLUDED 00006 #define LSTRIP_H_IS_INCLUDED 00007 00008 #include "tri_strip.H" 00009 #include "lface.H" 00010 00011 /********************************************************************** 00012 * Lstrip: 00013 * 00014 * A triangle strip for LMESH (subdivision mesh) that optimizes 00015 * triangle strip creation by using the triangle strips already 00016 * created on the control mesh to efficiently generate triangle 00017 * strips for each subdivision mesh. 00018 **********************************************************************/ 00019 #define CLstrip const Lstrip 00020 class Lstrip : public TriStrip { 00021 public: 00022 //******** MANAGERS ******** 00023 Lstrip(int s=0) : TriStrip(s), _right_substrip(0), _left_substrip(0) {} 00024 virtual ~Lstrip() { delete_substrips(); } 00025 00026 void delete_substrips(); 00027 00028 //******** BUILDING ******** 00029 virtual void reset(); 00030 void add(Bvert* v, Bface* f) { TriStrip::add(v,f); } 00031 00032 //******** DRAWING ******** 00033 virtual void draw(StripCB* cb) { draw(cur_level(), cb); } 00034 00035 protected: 00036 //******** MEMBER DATA ******** 00037 Lstrip* _right_substrip; // the 2 00038 Lstrip* _left_substrip; // child strips 00039 00040 //******** INTERNAL METHODS ******** 00041 // convenience lookups. 00042 // given vertex or edge (respectively) in parent strip, 00043 // find corresponding vertex in subdiv strip: 00044 Bvert* subvert(int j) const { 00045 return ((Lvert*)_verts[j])->subdiv_vertex(); 00046 } 00047 Bvert* subvert(int j, int k) const { 00048 return ((Ledge*)_verts[j]->lookup_edge(_verts[k]))->subdiv_vertex(); 00049 } 00050 00051 //******** BUILDING METHODS ******** 00052 void build_substrip1(Lstrip* substrip); 00053 void build_substrip2(Lstrip* substrip); 00054 void add(Bvert*); 00055 00056 //******** MANAGING SUBSTRIPS ******** 00057 void generate_substrips(); 00058 int cur_level() const; 00059 00060 //******** DRAWING ******** 00061 void draw(int level, StripCB* cb); 00062 }; 00063 00064 #endif // LSTRIP_H_IS_INCLUDED 00065 00066 /* end of file lstrip.H */