Skip to content

Commit

Permalink
Gui: [skip ci] add options to set one-pass and backface-pass rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Apr 6, 2020
1 parent 359d3a2 commit ea8d3bb
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 8 deletions.
55 changes: 47 additions & 8 deletions src/Gui/DlgSettings3DView.ui
Expand Up @@ -214,6 +214,45 @@ but slower response to any scene changes.</string>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="transparentRenderLabel">
<property name="toolTip">
<string/>
</property>
<property name="text">
<string>Transparent objects:</string>
</property>
</widget>
</item>
<item row="2" column="4">
<widget class="Gui::PrefComboBox" name="comboTransparentRender">
<property name="minimumSize">
<size>
<width>120</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Render types of transparent objects</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>TransparentObjectRenderType</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>View</cstring>
</property>
<item>
<property name="text">
<string>One pass</string>
</property>
</item>
<item>
<property name="text">
<string>Backface pass</string>
</property>
</item>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="markerSizeLabel">
<property name="toolTip">
<string/>
Expand All @@ -223,7 +262,7 @@ but slower response to any scene changes.</string>
</property>
</widget>
</item>
<item row="2" column="4">
<item row="3" column="4">
<widget class="QComboBox" name="boxMarkerSize">
<property name="minimumSize">
<size>
Expand All @@ -236,14 +275,14 @@ but slower response to any scene changes.</string>
</property>
</widget>
</item>
<item row="3" column="0">
<item row="4" column="0">
<widget class="QLabel" name="textLabel1">
<property name="text">
<string>Eye to eye distance for stereo modes</string>
</property>
</widget>
</item>
<item row="3" column="4">
<item row="4" column="4">
<widget class="Gui::PrefDoubleSpinBox" name="FloatSpinBox_EyeDistance">
<property name="minimumSize">
<size>
Expand Down Expand Up @@ -279,7 +318,7 @@ bounding box size of the 3D object that is currently displayed. </string>
</property>
</widget>
</item>
<item row="4" column="0">
<item row="5" column="0">
<widget class="Gui::PrefCheckBox" name="checkBoxBacklight">
<property name="toolTip">
<string>Backlight is enabled with the defined color</string>
Expand All @@ -295,7 +334,7 @@ bounding box size of the 3D object that is currently displayed. </string>
</property>
</widget>
</item>
<item row="4" column="1">
<item row="5" column="1">
<widget class="Gui::PrefColorButton" name="backlightColor">
<property name="enabled">
<bool>false</bool>
Expand All @@ -318,7 +357,7 @@ bounding box size of the 3D object that is currently displayed. </string>
</property>
</widget>
</item>
<item row="4" column="2">
<item row="5" column="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
Expand All @@ -331,7 +370,7 @@ bounding box size of the 3D object that is currently displayed. </string>
</property>
</spacer>
</item>
<item row="4" column="3">
<item row="5" column="3">
<widget class="QLabel" name="backlightLabel">
<property name="enabled">
<bool>false</bool>
Expand All @@ -347,7 +386,7 @@ bounding box size of the 3D object that is currently displayed. </string>
</property>
</widget>
</item>
<item row="4" column="4">
<item row="5" column="4">
<widget class="Gui::PrefSlider" name="sliderIntensity">
<property name="enabled">
<bool>false</bool>
Expand Down
4 changes: 4 additions & 0 deletions src/Gui/DlgSettings3DViewImp.cpp
Expand Up @@ -83,6 +83,8 @@ void DlgSettings3DViewImp::saveSettings()
index = ui->renderCache->currentIndex();
hGrp->SetInt("RenderCache", index);

ui->comboTransparentRender->onSave();

QVariant const &vBoxMarkerSize = ui->boxMarkerSize->itemData(ui->boxMarkerSize->currentIndex());
hGrp->SetInt("MarkerSize", vBoxMarkerSize.toInt());

Expand Down Expand Up @@ -124,6 +126,8 @@ void DlgSettings3DViewImp::loadSettings()
index = hGrp->GetInt("RenderCache", 0);
ui->renderCache->setCurrentIndex(index);

ui->comboTransparentRender->onRestore();

int const current = hGrp->GetInt("MarkerSize", 9L);
ui->boxMarkerSize->addItem(tr("5px"), QVariant(5));
ui->boxMarkerSize->addItem(tr("7px"), QVariant(7));
Expand Down
12 changes: 12 additions & 0 deletions src/Gui/View3DInventor.cpp
Expand Up @@ -189,6 +189,7 @@ View3DInventor::View3DInventor(Gui::Document* pcDocument, QWidget* parent,
OnChange(*hGrp,"Dimensions3dVisible");
OnChange(*hGrp,"DimensionsDeltaVisible");
OnChange(*hGrp,"PickRadius");
OnChange(*hGrp,"TransparentObjectRenderType");

stopSpinTimer = new QTimer(this);
connect(stopSpinTimer, SIGNAL(timeout()), this, SLOT(stopAnimating()));
Expand Down Expand Up @@ -414,6 +415,17 @@ void View3DInventor::OnChange(ParameterGrp::SubjectType &rCaller,ParameterGrp::M
else if (strcmp(Reason, "PickRadius") == 0) {
_viewer->setPickRadius(rGrp.GetFloat("PickRadius", 5.0f));
}
else if (strcmp(Reason, "TransparentObjectRenderType") == 0) {
long renderType = rGrp.GetInt("TransparentObjectRenderType", 0);
if (renderType == 0) {
_viewer->getSoRenderManager()->getGLRenderAction()
->setTransparentDelayedObjectRenderType(SoGLRenderAction::ONE_PASS);
}
else if (renderType == 1) {
_viewer->getSoRenderManager()->getGLRenderAction()
->setTransparentDelayedObjectRenderType(SoGLRenderAction::NONSOLID_SEPARATE_BACKFACE_PASS);
}
}
else {
unsigned long col1 = rGrp.GetUnsigned("BackgroundColor",3940932863UL);
unsigned long col2 = rGrp.GetUnsigned("BackgroundColor2",859006463UL); // default color (dark blue)
Expand Down

0 comments on commit ea8d3bb

Please sign in to comment.