#include <Iguana/GLBrowsers/interface/IgGLRenderCategory.h>
Public Member Functions | |
virtual void | browserChanged (Ig3DBaseBrowser *browser) |
IgGLRenderCategory (IgState *state) | |
~IgGLRenderCategory () | |
Private Slots | |
virtual void | setAntialiasing (bool option) |
virtual void | setAntialiasingPasses (unsigned int passes) |
virtual void | setAutoRedraw (bool option) |
virtual void | setPassUpdate (bool option) |
virtual void | setRedrawPriority (unsigned int priority) |
virtual void | setTransparencyType (int type) |
virtual void | updateTransparencyType (int type) |
Private Member Functions | |
void | addGLRenderTab (void) |
IG_DECLARE_STATE_ELEMENT (IgGLRenderCategory) | |
void | updateTransparencyTypeHelp (void) |
Private Attributes | |
QCheckBox * | m_antialiasing |
IgQtRangeControlUInt * | m_antialiasingPasses |
QCheckBox * | m_autoRedraw |
QCheckBox * | m_passUpdate |
IgQtRangeControlUInt * | m_redrawPriority |
QComboBox * | m_transparencyType |
Definition at line 21 of file IgGLRenderCategory.h.
IgGLRenderCategory::IgGLRenderCategory | ( | IgState * | state | ) |
Definition at line 27 of file IgGLRenderCategory.cc.
References addGLRenderTab(), and IgState::put().
00028 : IgCommonViewCategory (state, "GL Render"), 00029 m_transparencyType(0), 00030 m_redrawPriority (0), 00031 m_antialiasingPasses(0), 00032 m_antialiasing (0), 00033 m_autoRedraw (0), 00034 m_passUpdate (0) 00035 { 00036 addGLRenderTab (); 00037 state->put (s_key, this); 00038 }
IgGLRenderCategory::~IgGLRenderCategory | ( | void | ) |
Definition at line 40 of file IgGLRenderCategory.cc.
References IgState::detach(), and IgControlCategory::state().
Definition at line 44 of file IgGLRenderCategory.cc.
References reco::fitHelper::add(), HLT_VtxMuL3::connect, FALSE, m_antialiasing, m_antialiasingPasses, m_autoRedraw, m_passUpdate, m_redrawPriority, m_transparencyType, IgControlCategory::panel(), setAntialiasing(), setAntialiasingPasses(), setAutoRedraw(), IgQtRangeControlImp< T >::setLongStep(), IgQtRangeValue< T >::setMinValue(), setPassUpdate(), setRedrawPriority(), IgQtRangeControlImp< T >::setSmallStep(), setTransparencyType(), IgQtRangeControlCommon::StepperPart, IgControlCategory::topArea(), IgControlCategory::topLayout(), IgQtRangeControlCommon::ValuePart, and IgQtRangeControlCommon::widget().
Referenced by IgGLRenderCategory().
00045 { 00046 QWidget *renderOptions = new QWidget (topArea ()); 00047 topLayout ()->addWidget (renderOptions); 00048 00049 QVBoxLayout *renderOptionsVLayout = new QVBoxLayout (renderOptions); 00050 QGridLayout *renderOptionsLayout = new QGridLayout (renderOptionsVLayout); 00051 00052 QLabel *transpTypeLabel = new QLabel (renderOptions, "transpTypeLabel"); 00053 transpTypeLabel->setText (tr ("Transparency Type")); 00054 renderOptionsLayout->addWidget (transpTypeLabel, 0, 0); 00055 00056 QLabel *redrawPriorityLabel = new QLabel (renderOptions, "redrawPriorityLabel"); 00057 redrawPriorityLabel->setText (tr ("Redraw Priority")); 00058 renderOptionsLayout->addWidget (redrawPriorityLabel, 1, 0); 00059 00060 m_antialiasing = new QCheckBox (renderOptions, "m_antialiasing"); 00061 m_antialiasing->setText (tr ("Antialiasing Passes")); 00062 QWhatsThis::add (m_antialiasing, tr ("Enable / disable antialiasing.")); 00063 renderOptionsLayout->addWidget (m_antialiasing, 2, 0); 00064 00065 m_transparencyType = new QComboBox (FALSE, renderOptions, "m_transparencyType" ); 00066 m_transparencyType->clear (); 00067 m_transparencyType->insertItem (tr ("Screen door")); 00068 m_transparencyType->insertItem (tr ("Add")); 00069 m_transparencyType->insertItem (tr ("Delayed add")); 00070 m_transparencyType->insertItem (tr ("Sorted object add")); 00071 m_transparencyType->insertItem (tr ("Blend")); 00072 m_transparencyType->insertItem (tr ("Delayed blend")); 00073 m_transparencyType->insertItem (tr ("Sorted object blend")); 00074 QWhatsThis::add (m_transparencyType, tr ("Select GL render transparency type.")); 00075 renderOptionsLayout->addWidget (m_transparencyType, 0, 1); 00076 00077 m_redrawPriority = new IgQtRangeControlUInt (renderOptions, 00078 IgQtRangeControl::StepperPart 00079 | IgQtRangeControl::ValuePart); 00080 00081 m_redrawPriority->setMinValue (1); 00082 m_redrawPriority->setLongStep (5); 00083 m_redrawPriority->setSmallStep (1); 00084 QWhatsThis::add (m_redrawPriority->widget (), tr ("Set redraw priority.")); 00085 renderOptionsLayout->addWidget (m_redrawPriority->widget (), 1, 1); 00086 00087 m_antialiasingPasses = new IgQtRangeControlUInt (renderOptions, 00088 IgQtRangeControl::StepperPart 00089 | IgQtRangeControl::ValuePart); 00090 00091 m_antialiasingPasses->setMinValue (1); 00092 m_antialiasingPasses->setLongStep (5); 00093 m_antialiasingPasses->setSmallStep (1); 00094 m_antialiasingPasses->widget ()->setEnabled (false); 00095 QWhatsThis::add (m_antialiasingPasses->widget (), tr ("Edit antialiasing passes.")); 00096 renderOptionsLayout->addWidget (m_antialiasingPasses->widget (), 2, 1); 00097 00098 m_autoRedraw = new QCheckBox (renderOptions, "m_autoRedraw"); 00099 m_autoRedraw->setText (tr ("Auto Redraw")); 00100 QWhatsThis::add (m_autoRedraw, tr ("Enable / disable automatically redraw when scenegraph changes.")); 00101 renderOptionsVLayout->addWidget (m_autoRedraw); 00102 00103 m_passUpdate = new QCheckBox (renderOptions, "m_passUpdate"); 00104 m_passUpdate->setText (tr ("Render Pass Update")); 00105 QWhatsThis::add (m_passUpdate, tr ("Enable / disable update on each render pass.")); 00106 renderOptionsVLayout->addWidget (m_passUpdate); 00107 00108 renderOptionsVLayout->addItem (new QSpacerItem ( 0, 0, QSizePolicy::Expanding, 00109 QSizePolicy::Expanding)); 00110 00111 connect (m_transparencyType,SIGNAL (activated (int)), 00112 this, SLOT (setTransparencyType (int))); 00113 connect (m_redrawPriority, SIGNAL (newValue (unsigned int)), 00114 this, SLOT (setRedrawPriority (unsigned int))); 00115 connect (m_antialiasingPasses,SIGNAL(newValue (unsigned int)), 00116 this, SLOT (setAntialiasingPasses (unsigned int))); 00117 connect (m_antialiasing, SIGNAL (toggled (bool)), 00118 this, SLOT (setAntialiasing(bool))); 00119 connect (m_antialiasing, SIGNAL (toggled (bool)), 00120 m_antialiasingPasses->widget (),SLOT(setEnabled (bool))); 00121 connect (m_autoRedraw, SIGNAL (toggled (bool)), 00122 this, SLOT (setAutoRedraw(bool))); 00123 connect (m_passUpdate, SIGNAL (toggled (bool)), 00124 this, SLOT (setPassUpdate(bool))); 00125 00126 QWhatsThis::add (panel (), "Edit GL Render properties"); 00127 QWhatsThis::add (renderOptions, "Edit GL Render properties"); 00128 }
void IgGLRenderCategory::browserChanged | ( | Ig3DBaseBrowser * | browser | ) | [virtual] |
Reimplemented from IgCommonViewCategory.
Definition at line 131 of file IgGLRenderCategory.cc.
References ASSERT, IgCommonViewCategory::browserChanged(), m_antialiasing, m_antialiasingPasses, m_autoRedraw, m_passUpdate, m_redrawPriority, IgCommonViewCategory::m_source, IgQtRangeControlImp< T >::setValue(), and updateTransparencyType().
00132 { 00133 if (source) 00134 { 00135 IgCommonViewCategory::browserChanged (source); 00136 ASSERT (m_source->getGLRenderAction ()); 00137 SoGLRenderAction *ra = m_source->getGLRenderAction (); 00138 SbBool antialising; 00139 int numPass; 00140 m_source->getAntialiasing (antialising, numPass); 00141 00142 updateTransparencyType (ra->getTransparencyType ()); 00143 m_redrawPriority->setValue (m_source->getRedrawPriority ()); 00144 m_antialiasingPasses->setValue (numPass); 00145 m_antialiasing->setChecked (antialising); 00146 m_autoRedraw->setChecked (m_source->isAutoRedraw ()); 00147 m_passUpdate->setChecked (ra->isPassUpdate ()); 00148 } 00149 }
IgGLRenderCategory::IG_DECLARE_STATE_ELEMENT | ( | IgGLRenderCategory | ) | [private] |
Definition at line 305 of file IgGLRenderCategory.cc.
References m_antialiasingPasses, IgCommonViewCategory::m_source, and IgQtRangeValue< T >::value().
Referenced by addGLRenderTab().
00306 { m_source->setAntialiasing (option, int (m_antialiasingPasses->value ())); }
Definition at line 301 of file IgGLRenderCategory.cc.
References int, m_antialiasing, and IgCommonViewCategory::m_source.
Referenced by addGLRenderTab().
00302 { m_source->setAntialiasing (m_antialiasing->isChecked (), int(passes)); }
Definition at line 309 of file IgGLRenderCategory.cc.
References IgCommonViewCategory::m_source, and old.
Referenced by addGLRenderTab().
00310 { 00311 bool old = m_source->isAutoRedraw (); 00312 if (old != option) 00313 m_source->setAutoRedraw (option); 00314 }
Definition at line 317 of file IgGLRenderCategory.cc.
References ASSERT, IgCommonViewCategory::m_source, and old.
Referenced by addGLRenderTab().
00318 { 00319 ASSERT (m_source->getGLRenderAction ()); 00320 SoGLRenderAction *ra = m_source->getGLRenderAction (); 00321 bool old = ra->isPassUpdate (); 00322 if (old != option) 00323 ra->setPassUpdate (option); 00324 }
Definition at line 297 of file IgGLRenderCategory.cc.
References IgCommonViewCategory::m_source.
Referenced by addGLRenderTab().
00298 { m_source->setRedrawPriority (int (priority)); }
Definition at line 153 of file IgGLRenderCategory.cc.
References ASSERT, IgCommonViewCategory::m_source, and updateTransparencyTypeHelp().
Referenced by addGLRenderTab().
00154 { 00155 ASSERT (m_source->getGLRenderAction ()); 00156 SoGLRenderAction *ra = m_source->getGLRenderAction (); 00157 switch (type) 00158 { 00159 case 0: 00160 ra->setTransparencyType (SoGLRenderAction::SCREEN_DOOR); 00161 break; 00162 case 1: 00163 ra->setTransparencyType (SoGLRenderAction::ADD); 00164 break; 00165 case 2: 00166 ra->setTransparencyType (SoGLRenderAction::DELAYED_ADD); 00167 break; 00168 case 3: 00169 ra->setTransparencyType (SoGLRenderAction::SORTED_OBJECT_ADD); 00170 break; 00171 case 4: 00172 ra->setTransparencyType (SoGLRenderAction::BLEND); 00173 break; 00174 case 5: 00175 ra->setTransparencyType (SoGLRenderAction::DELAYED_BLEND); 00176 break; 00177 case 6: 00178 ra->setTransparencyType (SoGLRenderAction::SORTED_OBJECT_BLEND); 00179 break; 00180 default: 00181 ASSERT (false); 00182 } 00183 updateTransparencyTypeHelp (); 00184 }
Definition at line 187 of file IgGLRenderCategory.cc.
References ASSERT, m_transparencyType, and updateTransparencyTypeHelp().
Referenced by browserChanged().
00188 { 00189 switch (type) 00190 { 00191 case SoGLRenderAction::SCREEN_DOOR: 00192 m_transparencyType->setCurrentItem (0); 00193 break; 00194 case SoGLRenderAction::ADD: 00195 m_transparencyType->setCurrentItem (1); 00196 break; 00197 case SoGLRenderAction::DELAYED_ADD: 00198 m_transparencyType->setCurrentItem (2); 00199 break; 00200 case SoGLRenderAction::SORTED_OBJECT_ADD: 00201 m_transparencyType->setCurrentItem (3); 00202 break; 00203 case SoGLRenderAction::BLEND: 00204 m_transparencyType->setCurrentItem (4); 00205 break; 00206 case SoGLRenderAction::DELAYED_BLEND: 00207 m_transparencyType->setCurrentItem (5); 00208 break; 00209 case SoGLRenderAction::SORTED_OBJECT_BLEND: 00210 m_transparencyType->setCurrentItem (6); 00211 break; 00212 default: 00213 ASSERT (false); 00214 } 00215 updateTransparencyTypeHelp (); 00216 }
Definition at line 219 of file IgGLRenderCategory.cc.
References reco::fitHelper::add(), ASSERT, and m_transparencyType.
Referenced by setTransparencyType(), and updateTransparencyType().
00220 { 00221 switch (m_transparencyType->currentItem ()) 00222 { 00223 case 0: 00224 QWhatsThis::add (m_transparencyType, 00225 "Transparent triangles are rendered with a dither pattern. This is a " 00226 "fast (on most GFX cards) but not-so-high-quality transparency mode.\n" 00227 "One particular feature of this mode is that you are guaranteed that " 00228 "it always renders the transparent parts of the scene correct with " 00229 "regard to internal depth ordering of objects / polygons, something " 00230 "which is not the case for any other transparency mode."); 00231 break; 00232 case 1: 00233 QWhatsThis::add (m_transparencyType, 00234 "Transparent objects are rendered using additive alpha blending. " 00235 "Additive blending is probably mostly used to create special " 00236 "transparency effects. The new pixel color is calculated as the " 00237 "current pixel color plus the source pixel color multiplied with " 00238 "the source pixel alpha value."); 00239 break; 00240 case 2: 00241 QWhatsThis::add (m_transparencyType, 00242 "Transparent objects are rendered using additive alpha blending, " 00243 "in a second rendering pass with depth buffer updates disabled."); 00244 break; 00245 case 3: 00246 QWhatsThis::add (m_transparencyType, 00247 "Transparent objects are rendered using additive alpha blending. " 00248 "Opaque objects are rendered first, and transparent objects are " 00249 "rendered back to front with z-buffer updates disabled."); 00250 break; 00251 case 4: 00252 QWhatsThis::add (m_transparencyType, 00253 "Transparent objects are rendered using multiplicative alpha " 00254 "blending.\n" 00255 "Multiplicative alpha blending is the blending type that is most " 00256 "often used to render transparent objects. The new pixel value is " 00257 "calculated as the old pixel color multiplied with one minus the " 00258 "source alpha value, plus the source pixel color multiplied with " 00259 "the source alpha value.\n" 00260 "We recommend that you use this transparency mode if you have only " 00261 "one transparent object in your scene, and you know that it will be " 00262 "rendered after the opaque objects."); 00263 break; 00264 case 5: 00265 QWhatsThis::add (m_transparencyType, 00266 "Transparent objects are rendered using multiplicative alpha " 00267 "blending, in a second rendering pass with depth buffer " 00268 "updates disabled.\n" 00269 "Use this transparency type when you have one transparent object, " 00270 "or several transparent object that you know will never overlap " 00271 "(when projected to screen). Since the transparent objects are " 00272 "rendered after opaque ones, you'll not have to worry about putting " 00273 "the transparent objects at the end of your scene graph. It will not " 00274 "be as fast as the BLEND transparency type, of course, since the " 00275 "scene graph is traversed twice."); 00276 break; 00277 case 6: 00278 QWhatsThis::add (m_transparencyType, 00279 "Transparent objects are rendered using multiplicative alpha " 00280 "blending, Opaque objects are rendered first, and transparent " 00281 "objects are rendered back to front with z-buffer updates disabled.\n" 00282 "Use this transparency mode when you have several transparent object " 00283 "that you know might overlap (when projected to screen). This method " 00284 "will require 1 + num_transparent_objects rendering passes. Path " 00285 "traversal is used when rendering transparent objects, of course, " 00286 "but it might still be slow if you have lots of state changes before " 00287 "your transparent object. When using this mode, we recommend placing " 00288 "the transparent objects as early as possible in the scene graph to " 00289 "minimize traversal overhead."); 00290 break; 00291 default: 00292 ASSERT (false); 00293 } 00294 }
QCheckBox* IgGLRenderCategory::m_antialiasing [private] |
Definition at line 50 of file IgGLRenderCategory.h.
Referenced by addGLRenderTab(), browserChanged(), and setAntialiasingPasses().
Definition at line 49 of file IgGLRenderCategory.h.
Referenced by addGLRenderTab(), browserChanged(), and setAntialiasing().
QCheckBox* IgGLRenderCategory::m_autoRedraw [private] |
Definition at line 51 of file IgGLRenderCategory.h.
Referenced by addGLRenderTab(), and browserChanged().
QCheckBox* IgGLRenderCategory::m_passUpdate [private] |
Definition at line 52 of file IgGLRenderCategory.h.
Referenced by addGLRenderTab(), and browserChanged().
Definition at line 48 of file IgGLRenderCategory.h.
Referenced by addGLRenderTab(), and browserChanged().
QComboBox* IgGLRenderCategory::m_transparencyType [private] |
Definition at line 47 of file IgGLRenderCategory.h.
Referenced by addGLRenderTab(), updateTransparencyType(), and updateTransparencyTypeHelp().