+ fix transparency issue, disable sample buffers when using front buffer
This commit is contained in:
@@ -55,6 +55,8 @@ void AbstractMouseSelection::grabMouseModel( Gui::View3DInventorViewer* viewer )
|
||||
{
|
||||
_pcView3D = viewer;
|
||||
m_cPrevCursor = _pcView3D->getWidget()->cursor();
|
||||
m_antiAliasing = (int)_pcView3D->getAntiAliasingMode();
|
||||
_pcView3D->setAntiAliasingMode(View3DInventorViewer::None);
|
||||
|
||||
// do initialization of your mousemodel
|
||||
initialize();
|
||||
@@ -67,6 +69,7 @@ void AbstractMouseSelection::releaseMouseModel()
|
||||
terminate();
|
||||
|
||||
_pcView3D->getWidget()->setCursor(m_cPrevCursor);
|
||||
_pcView3D->setAntiAliasingMode(View3DInventorViewer::AntiAliasing(m_antiAliasing));
|
||||
_pcView3D = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,6 +87,7 @@ protected:
|
||||
QCursor m_cPrevCursor;
|
||||
int m_iXold, m_iYold;
|
||||
int m_iXnew, m_iYnew;
|
||||
int m_antiAliasing;
|
||||
SbBool m_bInner;
|
||||
SbBool mustRedraw;
|
||||
std::vector<SbVec2s> _clPoly;
|
||||
|
||||
@@ -1012,6 +1012,10 @@ void View3DInventorViewer::renderFramebuffer()
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
}
|
||||
|
||||
//#define ENABLE_GL_DEPTH_RANGE
|
||||
// The calls of glDepthRange inside renderScene() causes problems with transparent objects
|
||||
// so that's why it is disabled now: http://forum.freecadweb.org/viewtopic.php?f=3&t=6037&hilit=transparency
|
||||
|
||||
// Documented in superclass. Overrides this method to be able to draw
|
||||
// the axis cross, if selected, and to keep a continuous animation
|
||||
// upon spin.
|
||||
@@ -1051,8 +1055,10 @@ void View3DInventorViewer::renderScene(void)
|
||||
glClearColor(col[0], col[1], col[2], 0.0f);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
#if defined(ENABLE_GL_DEPTH_RANGE)
|
||||
// using 90% of the z-buffer for the background and the main node
|
||||
glDepthRange(0.1,1.0);
|
||||
#endif
|
||||
|
||||
// Render our scenegraph with the image.
|
||||
SoGLRenderAction * glra = this->getGLRenderAction();
|
||||
@@ -1074,16 +1080,20 @@ void View3DInventorViewer::renderScene(void)
|
||||
QObject::tr("Not enough memory available to display the data."));
|
||||
}
|
||||
|
||||
#if defined (ENABLE_GL_DEPTH_RANGE)
|
||||
// using 10% of the z-buffer for the foreground node
|
||||
glDepthRange(0.0,0.1);
|
||||
#endif
|
||||
|
||||
// Render overlay front scenegraph.
|
||||
glra->apply(this->foregroundroot);
|
||||
|
||||
if (this->axiscrossEnabled) { this->drawAxisCross(); }
|
||||
|
||||
|
||||
#if defined (ENABLE_GL_DEPTH_RANGE)
|
||||
// using the main portion of z-buffer again (for frontbuffer highlighting)
|
||||
glDepthRange(0.1,1.0);
|
||||
#endif
|
||||
|
||||
// Immediately reschedule to get continous spin animation.
|
||||
if (this->isAnimating()) { this->scheduleRedraw(); }
|
||||
|
||||
@@ -3338,10 +3338,15 @@ void ViewProviderSketch::setEditViewer(Gui::View3DInventorViewer* viewer, int Mo
|
||||
viewer->setEditing(TRUE);
|
||||
SoNode* root = viewer->getSceneGraph();
|
||||
static_cast<Gui::SoFCUnifiedSelection*>(root)->selectionRole.setValue(FALSE);
|
||||
antiAliasing = (int)viewer->getAntiAliasingMode();
|
||||
if (antiAliasing != Gui::View3DInventorViewer::None)
|
||||
viewer->setAntiAliasingMode(Gui::View3DInventorViewer::None);
|
||||
}
|
||||
|
||||
void ViewProviderSketch::unsetEditViewer(Gui::View3DInventorViewer* viewer)
|
||||
{
|
||||
if (antiAliasing != Gui::View3DInventorViewer::None)
|
||||
viewer->setAntiAliasingMode(Gui::View3DInventorViewer::AntiAliasing(antiAliasing));
|
||||
viewer->setEditing(FALSE);
|
||||
SoNode* root = viewer->getSceneGraph();
|
||||
static_cast<Gui::SoFCUnifiedSelection*>(root)->selectionRole.setValue(TRUE);
|
||||
|
||||
@@ -264,6 +264,7 @@ protected:
|
||||
// reference coordinates for relative operations
|
||||
double xInit,yInit;
|
||||
bool relative;
|
||||
int antiAliasing;
|
||||
};
|
||||
|
||||
} // namespace PartGui
|
||||
|
||||
Reference in New Issue
Block a user