+ add new render type to 3d viewer
This commit is contained in:
parent
980b17ca86
commit
a7157ce6a9
|
@ -55,8 +55,6 @@ 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();
|
||||
|
@ -64,12 +62,11 @@ void AbstractMouseSelection::grabMouseModel(Gui::View3DInventorViewer* viewer)
|
|||
|
||||
void AbstractMouseSelection::releaseMouseModel()
|
||||
{
|
||||
if(_pcView3D) {
|
||||
if (_pcView3D) {
|
||||
// do termination of your mousemodel
|
||||
terminate();
|
||||
|
||||
_pcView3D->getWidget()->setCursor(m_cPrevCursor);
|
||||
_pcView3D->setAntiAliasingMode(View3DInventorViewer::AntiAliasing(m_antiAliasing));
|
||||
_pcView3D = 0;
|
||||
}
|
||||
}
|
||||
|
@ -95,11 +92,11 @@ int AbstractMouseSelection::handleEvent(const SoEvent* const ev, const SbViewpor
|
|||
loc.getValue(x,y);
|
||||
y = h-y; // the origin is at the left bottom corner (instead of left top corner)
|
||||
|
||||
if(ev->getTypeId().isDerivedFrom(SoMouseButtonEvent::getClassTypeId())) {
|
||||
if (ev->getTypeId().isDerivedFrom(SoMouseButtonEvent::getClassTypeId())) {
|
||||
const SoMouseButtonEvent* const event = (const SoMouseButtonEvent*) ev;
|
||||
const SbBool press = event->getState() == SoButtonEvent::DOWN ? TRUE : FALSE;
|
||||
|
||||
if(press) {
|
||||
if (press) {
|
||||
_clPoly.push_back(ev->getPosition());
|
||||
ret = mouseButtonEvent(static_cast<const SoMouseButtonEvent*>(ev), QPoint(x,y));
|
||||
}
|
||||
|
@ -107,14 +104,14 @@ int AbstractMouseSelection::handleEvent(const SoEvent* const ev, const SbViewpor
|
|||
ret = mouseButtonEvent(static_cast<const SoMouseButtonEvent*>(ev), QPoint(x,y));
|
||||
}
|
||||
}
|
||||
else if(ev->getTypeId().isDerivedFrom(SoLocation2Event::getClassTypeId())) {
|
||||
else if (ev->getTypeId().isDerivedFrom(SoLocation2Event::getClassTypeId())) {
|
||||
ret = locationEvent(static_cast<const SoLocation2Event*>(ev), QPoint(x,y));
|
||||
}
|
||||
else if(ev->getTypeId().isDerivedFrom(SoKeyboardEvent::getClassTypeId())) {
|
||||
else if (ev->getTypeId().isDerivedFrom(SoKeyboardEvent::getClassTypeId())) {
|
||||
ret = keyboardEvent(static_cast<const SoKeyboardEvent*>(ev));
|
||||
}
|
||||
|
||||
if(ret == Restart)
|
||||
if (ret == Restart)
|
||||
_clPoly.clear();
|
||||
|
||||
return ret;
|
||||
|
@ -264,14 +261,14 @@ void PolyPickerSelection::initialize()
|
|||
polyline.setColor(0.0,0.0,1.0,1.0);
|
||||
|
||||
_pcView3D->addGraphicsItem(&polyline);
|
||||
_pcView3D->setRenderFramebuffer(true);
|
||||
_pcView3D->setRenderType(View3DInventorViewer::Framebuffer);
|
||||
_pcView3D->redraw();
|
||||
}
|
||||
|
||||
void PolyPickerSelection::terminate()
|
||||
{
|
||||
_pcView3D->removeGraphicsItem(&polyline);
|
||||
_pcView3D->setRenderFramebuffer(false);
|
||||
_pcView3D->setRenderType(View3DInventorViewer::Native);
|
||||
_pcView3D->redraw();
|
||||
}
|
||||
|
||||
|
@ -296,9 +293,9 @@ int PolyPickerSelection::popupMenu()
|
|||
|
||||
QAction* id = menu.exec(QCursor::pos());
|
||||
|
||||
if(id == fi)
|
||||
if (id == fi)
|
||||
return Finish;
|
||||
else if(id == ca)
|
||||
else if (id == ca)
|
||||
return Cancel;
|
||||
else
|
||||
return Restart;
|
||||
|
@ -314,7 +311,7 @@ int PolyPickerSelection::mouseButtonEvent(const SoMouseButtonEvent* const e, con
|
|||
{
|
||||
case SoMouseButtonEvent::BUTTON1:
|
||||
{
|
||||
if(!polyline.isWorking()) {
|
||||
if (!polyline.isWorking()) {
|
||||
polyline.setWorking(true);
|
||||
polyline.clear();
|
||||
};
|
||||
|
@ -352,10 +349,10 @@ int PolyPickerSelection::mouseButtonEvent(const SoMouseButtonEvent* const e, con
|
|||
// an inconsistent state.
|
||||
int id = popupMenu();
|
||||
|
||||
if(id == Finish || id == Cancel) {
|
||||
if (id == Finish || id == Cancel) {
|
||||
releaseMouseModel();
|
||||
}
|
||||
else if(id == Restart) {
|
||||
else if (id == Restart) {
|
||||
_pcView3D->getWidget()->setCursor(cur);
|
||||
}
|
||||
|
||||
|
@ -378,21 +375,21 @@ int PolyPickerSelection::locationEvent(const SoLocation2Event* const e, const QP
|
|||
// do all the drawing stuff for us
|
||||
QPoint clPoint = pos;
|
||||
|
||||
if(polyline.isWorking()) {
|
||||
if (polyline.isWorking()) {
|
||||
// check the position
|
||||
QRect r = _pcView3D->getGLWidget()->rect();
|
||||
|
||||
if(!r.contains(clPoint)) {
|
||||
if(clPoint.x() < r.left())
|
||||
if (!r.contains(clPoint)) {
|
||||
if (clPoint.x() < r.left())
|
||||
clPoint.setX(r.left());
|
||||
|
||||
if(clPoint.x() > r.right())
|
||||
if (clPoint.x() > r.right())
|
||||
clPoint.setX(r.right());
|
||||
|
||||
if(clPoint.y() < r.top())
|
||||
if (clPoint.y() < r.top())
|
||||
clPoint.setY(r.top());
|
||||
|
||||
if(clPoint.y() > r.bottom())
|
||||
if (clPoint.y() > r.bottom())
|
||||
clPoint.setY(r.bottom());
|
||||
|
||||
#ifdef FC_OS_WINDOWS
|
||||
|
@ -432,22 +429,22 @@ int PolyClipSelection::popupMenu()
|
|||
QAction* co = menu.addAction(QObject::tr("Outer"));
|
||||
QAction* ca = menu.addAction(QObject::tr("Cancel"));
|
||||
|
||||
if(getPositions().size() < 3) {
|
||||
if (getPositions().size() < 3) {
|
||||
ci->setEnabled(false);
|
||||
co->setEnabled(false);
|
||||
}
|
||||
|
||||
QAction* id = menu.exec(QCursor::pos());
|
||||
|
||||
if(id == ci) {
|
||||
if (id == ci) {
|
||||
m_bInner = true;
|
||||
return Finish;
|
||||
}
|
||||
else if(id == co) {
|
||||
else if (id == co) {
|
||||
m_bInner = false;
|
||||
return Finish;
|
||||
}
|
||||
else if(id == ca)
|
||||
else if (id == ca)
|
||||
return Cancel;
|
||||
else
|
||||
return Restart;
|
||||
|
@ -492,9 +489,9 @@ int BrushSelection::popupMenu()
|
|||
|
||||
QAction* id = menu.exec(QCursor::pos());
|
||||
|
||||
if(id == fi)
|
||||
if (id == fi)
|
||||
return Finish;
|
||||
else if(id == ca)
|
||||
else if (id == ca)
|
||||
return Cancel;
|
||||
else
|
||||
return Restart;
|
||||
|
@ -505,28 +502,28 @@ int BrushSelection::locationEvent(const SoLocation2Event* const e, const QPoint&
|
|||
// do all the drawing stuff for us
|
||||
QPoint clPoint = pos;
|
||||
|
||||
if(polyline.isWorking()) {
|
||||
if (polyline.isWorking()) {
|
||||
// check the position
|
||||
QRect r = _pcView3D->getGLWidget()->rect();
|
||||
|
||||
if(!r.contains(clPoint)) {
|
||||
if(clPoint.x() < r.left())
|
||||
if (!r.contains(clPoint)) {
|
||||
if (clPoint.x() < r.left())
|
||||
clPoint.setX(r.left());
|
||||
|
||||
if(clPoint.x() > r.right())
|
||||
if (clPoint.x() > r.right())
|
||||
clPoint.setX(r.right());
|
||||
|
||||
if(clPoint.y() < r.top())
|
||||
if (clPoint.y() < r.top())
|
||||
clPoint.setY(r.top());
|
||||
|
||||
if(clPoint.y() > r.bottom())
|
||||
if (clPoint.y() > r.bottom())
|
||||
clPoint.setY(r.bottom());
|
||||
}
|
||||
|
||||
SbVec2s last = _clPoly.back();
|
||||
SbVec2s curr = e->getPosition();
|
||||
|
||||
if(abs(last[0]-curr[0]) > 20 || abs(last[1]-curr[1]) > 20)
|
||||
if (abs(last[0]-curr[0]) > 20 || abs(last[1]-curr[1]) > 20)
|
||||
_clPoly.push_back(curr);
|
||||
|
||||
polyline.addNode(clPoint);
|
||||
|
@ -570,7 +567,7 @@ void RubberbandSelection::initialize()
|
|||
rubberband.setColor(1.0, 1.0, 0.0, 0.5);
|
||||
_pcView3D->addGraphicsItem(&rubberband);
|
||||
if (QGLFramebufferObject::hasOpenGLFramebufferObjects()) {
|
||||
_pcView3D->setRenderFramebuffer(true);
|
||||
_pcView3D->setRenderType(View3DInventorViewer::Image);
|
||||
}
|
||||
_pcView3D->redraw();
|
||||
}
|
||||
|
@ -579,7 +576,7 @@ void RubberbandSelection::terminate()
|
|||
{
|
||||
_pcView3D->removeGraphicsItem(&rubberband);
|
||||
if (QGLFramebufferObject::hasOpenGLFramebufferObjects()) {
|
||||
_pcView3D->setRenderFramebuffer(false);
|
||||
_pcView3D->setRenderType(View3DInventorViewer::Native);
|
||||
}
|
||||
_pcView3D->redraw();
|
||||
}
|
||||
|
@ -596,7 +593,7 @@ int RubberbandSelection::mouseButtonEvent(const SoMouseButtonEvent* const e, con
|
|||
|
||||
int ret = Continue;
|
||||
|
||||
if(press) {
|
||||
if (press) {
|
||||
switch(button)
|
||||
{
|
||||
case SoMouseButtonEvent::BUTTON1:
|
||||
|
|
|
@ -98,7 +98,6 @@ 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;
|
||||
|
|
|
@ -297,7 +297,7 @@ public:
|
|||
// *************************************************************************
|
||||
View3DInventorViewer::View3DInventorViewer(QWidget* parent, const QGLWidget* sharewidget)
|
||||
: Quarter::SoQTQuarterAdaptor(parent, sharewidget), editViewProvider(0), navigation(0),
|
||||
framebuffer(0), axisCross(0), axisGroup(0), editing(FALSE), redirected(FALSE),
|
||||
renderType(Native), framebuffer(0), axisCross(0), axisGroup(0), editing(FALSE), redirected(FALSE),
|
||||
allowredir(FALSE), overrideMode("As Is"), _viewerPy(0)
|
||||
{
|
||||
init();
|
||||
|
@ -305,7 +305,7 @@ View3DInventorViewer::View3DInventorViewer(QWidget* parent, const QGLWidget* sha
|
|||
|
||||
View3DInventorViewer::View3DInventorViewer(const QGLFormat& format, QWidget* parent, const QGLWidget* sharewidget)
|
||||
: Quarter::SoQTQuarterAdaptor(format, parent, sharewidget), editViewProvider(0), navigation(0),
|
||||
framebuffer(0), axisCross(0), axisGroup(0), editing(FALSE), redirected(FALSE),
|
||||
renderType(Native), framebuffer(0), axisCross(0), axisGroup(0), editing(FALSE), redirected(FALSE),
|
||||
allowredir(FALSE), overrideMode("As Is"), _viewerPy(0)
|
||||
{
|
||||
init();
|
||||
|
@ -1186,27 +1186,47 @@ void View3DInventorViewer::clearGraphicsItems()
|
|||
this->graphicsItems.clear();
|
||||
}
|
||||
|
||||
void View3DInventorViewer::setRenderFramebuffer(const SbBool enable)
|
||||
void View3DInventorViewer::setRenderType(const RenderType type)
|
||||
{
|
||||
if(!enable) {
|
||||
renderType = type;
|
||||
|
||||
glImage = QImage();
|
||||
if (type != Framebuffer) {
|
||||
delete framebuffer;
|
||||
framebuffer = 0;
|
||||
}
|
||||
else if(!this->framebuffer) {
|
||||
const SbViewportRegion vp = this->getSoRenderManager()->getViewportRegion();
|
||||
SbVec2s size = vp.getViewportSizePixels();
|
||||
|
||||
static_cast<QGLWidget*>(this->viewport())->makeCurrent();
|
||||
this->framebuffer = new QGLFramebufferObject(size[0],size[1],QGLFramebufferObject::Depth);
|
||||
renderToFramebuffer(this->framebuffer);
|
||||
switch (type) {
|
||||
case Native:
|
||||
break;
|
||||
case Framebuffer:
|
||||
if (!framebuffer) {
|
||||
const SbViewportRegion vp = this->getSoRenderManager()->getViewportRegion();
|
||||
SbVec2s size = vp.getViewportSizePixels();
|
||||
|
||||
QGLWidget* gl = static_cast<QGLWidget*>(this->viewport());
|
||||
gl->makeCurrent();
|
||||
framebuffer = new QGLFramebufferObject(size[0],size[1],QGLFramebufferObject::Depth);
|
||||
renderToFramebuffer(framebuffer);
|
||||
}
|
||||
break;
|
||||
case Image:
|
||||
{
|
||||
const SbViewportRegion vp = this->getSoRenderManager()->getViewportRegion();
|
||||
SbVec2s size = vp.getViewportSizePixels();
|
||||
|
||||
QGLWidget* gl = static_cast<QGLWidget*>(this->viewport());
|
||||
gl->makeCurrent();
|
||||
int w = gl->width();
|
||||
int h = gl->height();
|
||||
QImage img(QSize(w,h), QImage::Format_RGB32);
|
||||
glReadPixels(0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, img.bits());
|
||||
glImage = img;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
SbBool View3DInventorViewer::isRenderFramebuffer() const
|
||||
{
|
||||
return this->framebuffer != 0;
|
||||
}
|
||||
|
||||
void View3DInventorViewer::renderToFramebuffer(QGLFramebufferObject* fbo)
|
||||
{
|
||||
static_cast<QGLWidget*>(this->viewport())->makeCurrent();
|
||||
|
@ -1240,10 +1260,17 @@ void View3DInventorViewer::renderToFramebuffer(QGLFramebufferObject* fbo)
|
|||
|
||||
void View3DInventorViewer::actualRedraw()
|
||||
{
|
||||
if(this->framebuffer)
|
||||
renderFramebuffer();
|
||||
else
|
||||
switch (renderType) {
|
||||
case Native:
|
||||
renderScene();
|
||||
break;
|
||||
case Framebuffer:
|
||||
renderFramebuffer();
|
||||
break;
|
||||
case Image:
|
||||
renderGLImage();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void View3DInventorViewer::renderFramebuffer()
|
||||
|
@ -1278,7 +1305,33 @@ void View3DInventorViewer::renderFramebuffer()
|
|||
printDimension();
|
||||
navigation->redraw();
|
||||
|
||||
for(std::list<GLGraphicsItem*>::iterator it = this->graphicsItems.begin(); it != this->graphicsItems.end(); ++it)
|
||||
for (std::list<GLGraphicsItem*>::iterator it = this->graphicsItems.begin(); it != this->graphicsItems.end(); ++it)
|
||||
(*it)->paintGL();
|
||||
|
||||
glEnable(GL_LIGHTING);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
}
|
||||
|
||||
void View3DInventorViewer::renderGLImage()
|
||||
{
|
||||
const SbViewportRegion vp = this->getSoRenderManager()->getViewportRegion();
|
||||
SbVec2s size = vp.getViewportSizePixels();
|
||||
|
||||
glDisable(GL_LIGHTING);
|
||||
glViewport(0, 0, size[0], size[1]);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
glDrawPixels(glImage.width(),glImage.height(),GL_RGBA,GL_UNSIGNED_BYTE,glImage.bits());
|
||||
|
||||
printDimension();
|
||||
navigation->redraw();
|
||||
|
||||
for (std::list<GLGraphicsItem*>::iterator it = this->graphicsItems.begin(); it != this->graphicsItems.end(); ++it)
|
||||
(*it)->paintGL();
|
||||
|
||||
glEnable(GL_LIGHTING);
|
||||
|
@ -1342,7 +1395,7 @@ void View3DInventorViewer::renderScene(void)
|
|||
// Render overlay front scenegraph.
|
||||
glra->apply(this->foregroundroot);
|
||||
|
||||
if(this->axiscrossEnabled) {
|
||||
if (this->axiscrossEnabled) {
|
||||
this->drawAxisCross();
|
||||
}
|
||||
|
||||
|
@ -1352,7 +1405,7 @@ void View3DInventorViewer::renderScene(void)
|
|||
#endif
|
||||
|
||||
// Immediately reschedule to get continous spin animation.
|
||||
if(this->isAnimating()) {
|
||||
if (this->isAnimating()) {
|
||||
this->getSoRenderManager()->scheduleRedraw();
|
||||
}
|
||||
|
||||
|
@ -1364,7 +1417,7 @@ void View3DInventorViewer::renderScene(void)
|
|||
printDimension();
|
||||
navigation->redraw();
|
||||
|
||||
for(std::list<GLGraphicsItem*>::iterator it = this->graphicsItems.begin(); it != this->graphicsItems.end(); ++it)
|
||||
for (std::list<GLGraphicsItem*>::iterator it = this->graphicsItems.begin(); it != this->graphicsItems.end(); ++it)
|
||||
(*it)->paintGL();
|
||||
|
||||
//fps rendering
|
||||
|
@ -2640,66 +2693,6 @@ void View3DInventorViewer::turnDeltaDimensionsOff()
|
|||
static_cast<SoSwitch*>(dimensionRoot->getChild(1))->whichChild = SO_SWITCH_NONE;
|
||||
}
|
||||
|
||||
void View3DInventorViewer::setAntiAliasingMode(View3DInventorViewer::AntiAliasing mode)
|
||||
{
|
||||
int buffers = 1;
|
||||
SbBool smoothing = false;
|
||||
|
||||
switch(mode) {
|
||||
case Smoothing:
|
||||
smoothing = true;
|
||||
break;
|
||||
|
||||
case MSAA2x:
|
||||
buffers = 2;
|
||||
break;
|
||||
|
||||
case MSAA4x:
|
||||
buffers = 4;
|
||||
break;
|
||||
|
||||
case MSAA8x:
|
||||
buffers = 8;
|
||||
break;
|
||||
|
||||
case None:
|
||||
default:
|
||||
break;
|
||||
};
|
||||
|
||||
if (getSoRenderManager()->getGLRenderAction()->isSmoothing() != smoothing)
|
||||
getSoRenderManager()->getGLRenderAction()->setSmoothing(smoothing);
|
||||
|
||||
if (static_cast<QGLWidget*>(this->viewport())->format().samples() != buffers)
|
||||
Base::Console().Message("To change multisampling settings please close and open the 3d view again\n");
|
||||
|
||||
}
|
||||
|
||||
View3DInventorViewer::AntiAliasing View3DInventorViewer::getAntiAliasingMode() const
|
||||
{
|
||||
if(getSoRenderManager()->getGLRenderAction()->isSmoothing())
|
||||
return Smoothing;
|
||||
|
||||
int buffers = static_cast<QGLWidget*>(this->viewport())->format().samples();
|
||||
|
||||
switch(buffers) {
|
||||
case 1:
|
||||
return None;
|
||||
|
||||
case 2:
|
||||
return MSAA2x;
|
||||
|
||||
case 4:
|
||||
return MSAA4x;
|
||||
|
||||
case 8:
|
||||
return MSAA8x;
|
||||
|
||||
default:
|
||||
return None;
|
||||
};
|
||||
}
|
||||
|
||||
PyObject *View3DInventorViewer::getPyObject(void)
|
||||
{
|
||||
if (!_viewerPy)
|
||||
|
|
|
@ -33,8 +33,9 @@
|
|||
#include <Inventor/nodes/SoEventCallback.h>
|
||||
#include <Inventor/nodes/SoSwitch.h>
|
||||
#include <Inventor/SbRotation.h>
|
||||
#include "Gui/Quarter/SoQTQuarterAdaptor.h"
|
||||
#include <Gui/Quarter/SoQTQuarterAdaptor.h>
|
||||
#include <QCursor>
|
||||
#include <QImage>
|
||||
|
||||
#include <Gui/Selection.h>
|
||||
|
||||
|
@ -120,6 +121,16 @@ public:
|
|||
};
|
||||
//@}
|
||||
|
||||
/** @name Render mode
|
||||
*/
|
||||
//@{
|
||||
enum RenderType {
|
||||
Native,
|
||||
Framebuffer,
|
||||
Image
|
||||
};
|
||||
//@}
|
||||
|
||||
View3DInventorViewer (QWidget *parent, const QGLWidget* sharewidget = 0);
|
||||
View3DInventorViewer (const QGLFormat& format, QWidget *parent, const QGLWidget* sharewidget = 0);
|
||||
virtual ~View3DInventorViewer();
|
||||
|
@ -151,8 +162,7 @@ public:
|
|||
void setFeedbackSize(const int size);
|
||||
int getFeedbackSize(void) const;
|
||||
|
||||
void setRenderFramebuffer(const SbBool enable);
|
||||
SbBool isRenderFramebuffer() const;
|
||||
void setRenderType(const RenderType type);
|
||||
void renderToFramebuffer(QGLFramebufferObject*);
|
||||
|
||||
virtual void setViewing(SbBool enable);
|
||||
|
@ -293,15 +303,6 @@ public:
|
|||
void addDimension3d(SoNode *node);
|
||||
void addDimensionDelta(SoNode *node);
|
||||
//@}
|
||||
|
||||
/** @name Anti-Aliasing Control
|
||||
* the anti-aliasing mode is controled by parameters through view3dinventor.
|
||||
* don't call them directly. Instead set the parameter View/AntiAliasing.
|
||||
*/
|
||||
//@{
|
||||
void setAntiAliasingMode(AntiAliasing mode);
|
||||
AntiAliasing getAntiAliasingMode() const;
|
||||
//@}
|
||||
|
||||
/**
|
||||
* Set the camera's orientation. If isAnimationEnabled() returns
|
||||
|
@ -321,8 +322,8 @@ public:
|
|||
void viewAll();
|
||||
void viewAll(float factor);
|
||||
|
||||
/// Breaks out a VR window for a Rift
|
||||
void viewVR(void);
|
||||
/// Breaks out a VR window for a Rift
|
||||
void viewVR(void);
|
||||
|
||||
/**
|
||||
* Reposition the current camera so we can see all selected objects
|
||||
|
@ -354,6 +355,7 @@ public:
|
|||
protected:
|
||||
void renderScene();
|
||||
void renderFramebuffer();
|
||||
void renderGLImage();
|
||||
void animatedViewAll(int steps, int ms);
|
||||
virtual void actualRedraw(void);
|
||||
virtual void setSeekMode(SbBool enable);
|
||||
|
@ -394,7 +396,10 @@ private:
|
|||
SoEventCallback* pEventCallback;
|
||||
NavigationStyle* navigation;
|
||||
SoFCUnifiedSelection* selectionRoot;
|
||||
|
||||
RenderType renderType;
|
||||
QGLFramebufferObject* framebuffer;
|
||||
QImage glImage;
|
||||
SoSwitch *dimensionRoot;
|
||||
|
||||
// small axis cross in the corner
|
||||
|
|
|
@ -340,7 +340,7 @@ Rubberband(Gui::View3DInventorViewer* v) :view(v)
|
|||
rubberBandCorner1.setY(200);
|
||||
rubberBandCorner2.setX(800);
|
||||
rubberBandCorner2.setY(600);
|
||||
v->setRenderFramebuffer(true);
|
||||
v->setRenderType(Gui::View3DInventorViewer::Image);
|
||||
v->getSoRenderManager()->scheduleRedraw();
|
||||
}
|
||||
|
||||
|
|
|
@ -752,8 +752,8 @@ bool ViewProviderSketch::mouseButtonPressed(int Button, bool pressed, const SbVe
|
|||
rubberband->setWorking(false);
|
||||
|
||||
//disable framebuffer drawing in viewer
|
||||
if(Gui::Application::Instance->activeDocument()->getActiveView()) {
|
||||
static_cast<Gui::View3DInventor *>(Gui::Application::Instance->activeDocument()->getActiveView())->getViewer()->setRenderFramebuffer(false);
|
||||
if (Gui::Application::Instance->activeDocument()->getActiveView()) {
|
||||
static_cast<Gui::View3DInventor *>(Gui::Application::Instance->activeDocument()->getActiveView())->getViewer()->setRenderType(Gui::View3DInventorViewer::Native);
|
||||
}
|
||||
|
||||
// a redraw is required in order to clear the rubberband
|
||||
|
@ -1085,7 +1085,7 @@ bool ViewProviderSketch::mouseMove(const SbVec2s &cursorPos, Gui::View3DInventor
|
|||
case STATUS_SKETCH_StartRubberBand: {
|
||||
Mode = STATUS_SKETCH_UseRubberBand;
|
||||
rubberband->setWorking(true);
|
||||
viewer->setRenderFramebuffer(true);
|
||||
viewer->setRenderType(Gui::View3DInventorViewer::Framebuffer);
|
||||
return true;
|
||||
}
|
||||
case STATUS_SKETCH_UseRubberBand: {
|
||||
|
|
Loading…
Reference in New Issue
Block a user