00001 /********************************************************************** 00002 * sils_texture.C 00003 **********************************************************************/ 00004 #include "std/config.H" 00005 #include "geom/gl_view.H" 00006 #include "sils_texture.H" 00007 00008 /********************************************************************** 00009 * SilsTexture: 00010 **********************************************************************/ 00011 int 00012 SilsTexture::draw(CVIEWptr& v) 00013 { 00014 if (_ctrl) 00015 return _ctrl->draw(v); 00016 00017 if (!_patch) 00018 return 0; 00019 00020 static bool antialias = Config::get_var_bool("ANTIALIAS_SILS",true); 00021 if (antialias) { 00022 // push attributes, enable line smoothing, and set line width 00023 GL_VIEW::init_line_smooth(GLfloat(v->line_scale()*_width), 00024 GL_CURRENT_BIT); 00025 } else { 00026 // enable line smoothing and and set line width 00027 glPushAttrib(GL_LINE_BIT | GL_ENABLE_BIT | GL_CURRENT_BIT); 00028 glLineWidth(float(v->line_scale()*_width)); // GL_LINE_BIT 00029 } 00030 00031 glDisable(GL_LIGHTING); // GL_ENABLE_BIT 00032 GL_COL(_color, alpha()); // GL_CURRENT_BIT 00033 00034 if (_draw_borders) 00035 _patch->cur_sils().draw(_cb); 00036 else 00037 _patch->cur_sils().get_filtered(!BorderEdgeFilter()).draw(_cb); 00038 00039 // restore gl state: 00040 glPopAttrib(); 00041 00042 return 1; 00043 } 00044 00045 int 00046 SilsTexture::draw_vis_ref() 00047 { 00048 // You can pick what you can see ... for SilsTexture you see 00049 // silhouettes, so that's what we draw into the visibility 00050 // reference image: 00051 00052 if (!_patch) 00053 return 0; 00054 00055 if (_draw_borders) 00056 return ColorIDTexture::draw_edges(&_patch->cur_sils(), 3.0); 00057 00058 EdgeStrip sils = _patch->cur_sils().get_filtered(!BorderEdgeFilter()); 00059 return ColorIDTexture::draw_edges(&sils, 3.0); 00060 } 00061 00062 /* end of file sils_texture.C */