Files Classes Functions Hierarchy
00001 #include <gobj.h> 00002 #include <stringconvert.h> 00003 #include <tokenizer.h> 00004 #include <visline.h> 00005 00006 visline::visline() 00007 { 00008 color = pt3(1.0,0.0,0.0); 00009 } 00010 00011 void visline::handlecommand( bool & matches, viscmd & c ) 00012 { 00013 assert(ve!=0); 00014 matches=false; 00015 if (c.command != this->id()) 00016 return; 00017 matches=true; 00018 00019 tokenizer ss; 00020 ss.seq.push_back(c.arg); 00021 ss.subtract(" "); 00022 //cout << SHOW( ss.seq.size() ) << endl; 00023 00024 uint sz=ss.seq.size(); 00025 assert(sz%2==0); 00026 if ((sz%2)!=0) 00027 { 00028 c.valid=false; 00029 return; 00030 } 00031 00032 vector<uint> vk; 00033 uint k; 00034 00035 vector< pt3 > & pi(ve->pi); 00036 00037 ss.reset(); 00038 for ( ss.reset(); !ss; ) 00039 { 00040 stringfrom(k,ss()); 00041 ++ss; 00042 if (k>= pi.size()) 00043 { 00044 c.valid=false; 00045 return; 00046 } 00047 00048 vk.push_back(k); 00049 } 00050 00051 gobjpush( new gobjglPushAttrib(GL_LIGHTING) ); 00052 gobjpush( new gobjglPushAttrib(GL_CURRENT_BIT) ); 00053 gobjpush( new gobjglColor3d(color) ); 00054 gobjpush( new gobjglDisable( GL_LIGHTING)); 00055 gobjpush( new gobjglBegin(GL_LINE) ); 00056 00057 for (uint i=0; i<vk.size()/2; ++i) 00058 { 00059 gobjpush( 00060 new gobjglVertex3d( 00061 pi[vk[i*2]])); 00062 gobjpush( 00063 new gobjglVertex3d( 00064 pi[vk[i*2+1]])); 00065 } 00066 00067 gobjpush( new gobjglEnd() ); 00068 gobjpush( new gobjglPopAttrib() ); 00069 gobjpush( new gobjglPopAttrib() ); 00070 00071 c.valid=true; 00072 } 00073 00074 00075 00076 00077 00078 00079 00080 00081 00082 00083 00084 00085 00086 00087 00088 00089 00090 00091 00092 00093 00094 00095 00096 00097 00098 00099 00100 00101 00102 00103 00104 00105
1.5.8