+ include missing header files
This commit is contained in:
parent
d826ad5b51
commit
2b53da4eee
|
@ -41,7 +41,9 @@
|
||||||
# include <QGLFramebufferObject>
|
# include <QGLFramebufferObject>
|
||||||
#endif
|
#endif
|
||||||
# include <QSessionManager>
|
# include <QSessionManager>
|
||||||
|
# include <QStatusBar>
|
||||||
# include <QTextStream>
|
# include <QTextStream>
|
||||||
|
# include <QTimer>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <boost/interprocess/sync/file_lock.hpp>
|
#include <boost/interprocess/sync/file_lock.hpp>
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "PreCompiled.h"
|
#include "PreCompiled.h"
|
||||||
|
|
||||||
#ifndef _PreComp_
|
#ifndef _PreComp_
|
||||||
|
# include <QApplication>
|
||||||
# include <qfileinfo.h>
|
# include <qfileinfo.h>
|
||||||
# include <qdir.h>
|
# include <qdir.h>
|
||||||
# include <QPrinter>
|
# include <QPrinter>
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "PreCompiled.h"
|
#include "PreCompiled.h"
|
||||||
#ifndef _PreComp_
|
#ifndef _PreComp_
|
||||||
# include <sstream>
|
# include <sstream>
|
||||||
|
# include <QApplication>
|
||||||
# include <QDir>
|
# include <QDir>
|
||||||
# include <QKeySequence>
|
# include <QKeySequence>
|
||||||
# include <QMessageBox>
|
# include <QMessageBox>
|
||||||
|
|
|
@ -25,8 +25,10 @@
|
||||||
#ifndef _PreComp_
|
#ifndef _PreComp_
|
||||||
# include <QInputDialog>
|
# include <QInputDialog>
|
||||||
# include <QHeaderView>
|
# include <QHeaderView>
|
||||||
|
# include <QMenu>
|
||||||
# include <QMessageBox>
|
# include <QMessageBox>
|
||||||
# include <QToolBar>
|
# include <QToolBar>
|
||||||
|
# include <QToolButton>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "DlgToolbarsImp.h"
|
#include "DlgToolbarsImp.h"
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
#include "PreCompiled.h"
|
#include "PreCompiled.h"
|
||||||
#ifndef _PreComp_
|
#ifndef _PreComp_
|
||||||
|
# include <QDebug>
|
||||||
# include <QInputDialog>
|
# include <QInputDialog>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,7 @@ private:
|
||||||
try {
|
try {
|
||||||
Base::Vector3d m1 = arc->getCenter();
|
Base::Vector3d m1 = arc->getCenter();
|
||||||
//Base::Vector3d a3 = arc->getStartPoint();
|
//Base::Vector3d a3 = arc->getStartPoint();
|
||||||
Base::Vector3d a3 = arc->getEndPoint();
|
Base::Vector3d a3 = arc->getEndPoint(true);
|
||||||
Base::Vector3d l1 = seg->getStartPoint();
|
Base::Vector3d l1 = seg->getStartPoint();
|
||||||
Base::Vector3d l2 = seg->getEndPoint();
|
Base::Vector3d l2 = seg->getEndPoint();
|
||||||
#if 0
|
#if 0
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
# ifdef FC_OS_WIN32
|
# ifdef FC_OS_WIN32
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
# endif
|
# endif
|
||||||
|
# include <QApplication>
|
||||||
# include <QCalendarWidget>
|
# include <QCalendarWidget>
|
||||||
# include <QColorDialog>
|
# include <QColorDialog>
|
||||||
# include <QCryptographicHash>
|
# include <QCryptographicHash>
|
||||||
|
|
|
@ -25,12 +25,13 @@
|
||||||
|
|
||||||
#ifndef _PreComp_
|
#ifndef _PreComp_
|
||||||
# include <QGLWidget>
|
# include <QGLWidget>
|
||||||
|
# include <QGridLayout>
|
||||||
# include <Inventor/actions/SoAction.h>
|
# include <Inventor/actions/SoAction.h>
|
||||||
# include <Inventor/elements/SoModelMatrixElement.h>
|
# include <Inventor/elements/SoModelMatrixElement.h>
|
||||||
# include <Inventor/elements/SoViewVolumeElement.h>
|
# include <Inventor/elements/SoViewVolumeElement.h>
|
||||||
# include <Inventor/elements/SoViewportRegionElement.h>
|
# include <Inventor/elements/SoViewportRegionElement.h>
|
||||||
# include <Inventor/SoPrimitiveVertex.h>
|
# include <Inventor/SoPrimitiveVertex.h>
|
||||||
# include <Inventor/SbLinear.h>
|
# include <Inventor/SbLinear.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "Workbench.h"
|
#include "Workbench.h"
|
||||||
|
@ -135,135 +136,135 @@ Gui::DockWindowItems* Workbench::setupDockWindows() const
|
||||||
|
|
||||||
// ----------------------------------------------------
|
// ----------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
SO_NODE_SOURCE(SoWidgetShape);
|
SO_NODE_SOURCE(SoWidgetShape);
|
||||||
|
|
||||||
void SoWidgetShape::initClass()
|
void SoWidgetShape::initClass()
|
||||||
{
|
{
|
||||||
SO_NODE_INIT_CLASS(SoWidgetShape, SoShape, "Shape");
|
SO_NODE_INIT_CLASS(SoWidgetShape, SoShape, "Shape");
|
||||||
}
|
}
|
||||||
|
|
||||||
SoWidgetShape::SoWidgetShape()
|
SoWidgetShape::SoWidgetShape()
|
||||||
{
|
{
|
||||||
SO_NODE_CONSTRUCTOR(SoWidgetShape);
|
SO_NODE_CONSTRUCTOR(SoWidgetShape);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SoWidgetShape::GLRender(SoGLRenderAction *action)
|
void SoWidgetShape::GLRender(SoGLRenderAction *action)
|
||||||
{
|
{
|
||||||
#if 1
|
#if 1
|
||||||
this->image = QPixmap::grabWidget(w, w->rect()).toImage();
|
this->image = QPixmap::grabWidget(w, w->rect()).toImage();
|
||||||
this->image = QGLWidget::convertToGLFormat(this->image);
|
this->image = QGLWidget::convertToGLFormat(this->image);
|
||||||
#endif
|
#endif
|
||||||
glRasterPos2d(10,10);
|
glRasterPos2d(10,10);
|
||||||
glDrawPixels(this->image.width(),this->image.height(),GL_RGBA,GL_UNSIGNED_BYTE,this->image.bits());
|
glDrawPixels(this->image.width(),this->image.height(),GL_RGBA,GL_UNSIGNED_BYTE,this->image.bits());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SoWidgetShape::computeBBox(SoAction *action, SbBox3f &box, SbVec3f ¢er)
|
void SoWidgetShape::computeBBox(SoAction *action, SbBox3f &box, SbVec3f ¢er)
|
||||||
{
|
{
|
||||||
// ignore if node is empty
|
// ignore if node is empty
|
||||||
if (this->image.isNull()) return;
|
if (this->image.isNull()) return;
|
||||||
|
|
||||||
SbVec3f v0, v1, v2, v3;
|
SbVec3f v0, v1, v2, v3;
|
||||||
// this will cause a cache dependency on the view volume,
|
// this will cause a cache dependency on the view volume,
|
||||||
// model matrix and viewport.
|
// model matrix and viewport.
|
||||||
this->getQuad(action->getState(), v0, v1, v2, v3);
|
this->getQuad(action->getState(), v0, v1, v2, v3);
|
||||||
|
|
||||||
box.makeEmpty();
|
box.makeEmpty();
|
||||||
box.extendBy(v0);
|
box.extendBy(v0);
|
||||||
box.extendBy(v1);
|
box.extendBy(v1);
|
||||||
box.extendBy(v2);
|
box.extendBy(v2);
|
||||||
box.extendBy(v3);
|
box.extendBy(v3);
|
||||||
center = box.getCenter();
|
center = box.getCenter();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculates the quad in 3D.
|
||||||
|
void
|
||||||
|
SoWidgetShape::getQuad(SoState * state, SbVec3f & v0, SbVec3f & v1,
|
||||||
|
SbVec3f & v2, SbVec3f & v3)
|
||||||
|
{
|
||||||
|
SbVec3f nilpoint(0.0f, 0.0f, 0.0f);
|
||||||
|
const SbMatrix & mat = SoModelMatrixElement::get(state);
|
||||||
|
mat.multVecMatrix(nilpoint, nilpoint);
|
||||||
|
|
||||||
|
const SbViewVolume &vv = SoViewVolumeElement::get(state);
|
||||||
|
|
||||||
|
SbVec3f screenpoint;
|
||||||
|
vv.projectToScreen(nilpoint, screenpoint);
|
||||||
|
|
||||||
|
const SbViewportRegion & vp = SoViewportRegionElement::get(state);
|
||||||
|
SbVec2s vpsize = vp.getViewportSizePixels();
|
||||||
|
|
||||||
|
// find normalized width and height of image
|
||||||
|
float nw = (float)this->image.width();
|
||||||
|
nw /= (float)vpsize[0];
|
||||||
|
float nh = (float)this->image.height();
|
||||||
|
nh /= (float)vpsize[1];
|
||||||
|
|
||||||
|
// need only half the width
|
||||||
|
nw *= 0.5f;
|
||||||
|
nh *= 0.5f;
|
||||||
|
|
||||||
|
SbVec2f n0, n1, n2, n3;
|
||||||
|
|
||||||
|
n0 = SbVec2f(screenpoint[0]-nw, screenpoint[1]-nh);
|
||||||
|
n1 = SbVec2f(screenpoint[0]+nw, screenpoint[1]-nh);
|
||||||
|
n2 = SbVec2f(screenpoint[0]+nw, screenpoint[1]+nh);
|
||||||
|
n3 = SbVec2f(screenpoint[0]-nw, screenpoint[1]+nh);
|
||||||
|
|
||||||
|
// get distance from nilpoint to camera plane
|
||||||
|
float dist = -vv.getPlane(0.0f).getDistance(nilpoint);
|
||||||
|
|
||||||
|
// find the four image points in the plane
|
||||||
|
v0 = vv.getPlanePoint(dist, n0);
|
||||||
|
v1 = vv.getPlanePoint(dist, n1);
|
||||||
|
v2 = vv.getPlanePoint(dist, n2);
|
||||||
|
v3 = vv.getPlanePoint(dist, n3);
|
||||||
|
|
||||||
|
// transform back to object space
|
||||||
|
SbMatrix inv = mat.inverse();
|
||||||
|
inv.multVecMatrix(v0, v0);
|
||||||
|
inv.multVecMatrix(v1, v1);
|
||||||
|
inv.multVecMatrix(v2, v2);
|
||||||
|
inv.multVecMatrix(v3, v3);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculates the quad in 3D.
|
|
||||||
void
|
|
||||||
SoWidgetShape::getQuad(SoState * state, SbVec3f & v0, SbVec3f & v1,
|
|
||||||
SbVec3f & v2, SbVec3f & v3)
|
|
||||||
{
|
|
||||||
SbVec3f nilpoint(0.0f, 0.0f, 0.0f);
|
|
||||||
const SbMatrix & mat = SoModelMatrixElement::get(state);
|
|
||||||
mat.multVecMatrix(nilpoint, nilpoint);
|
|
||||||
|
|
||||||
const SbViewVolume &vv = SoViewVolumeElement::get(state);
|
|
||||||
|
|
||||||
SbVec3f screenpoint;
|
|
||||||
vv.projectToScreen(nilpoint, screenpoint);
|
|
||||||
|
|
||||||
const SbViewportRegion & vp = SoViewportRegionElement::get(state);
|
|
||||||
SbVec2s vpsize = vp.getViewportSizePixels();
|
|
||||||
|
|
||||||
// find normalized width and height of image
|
|
||||||
float nw = (float)this->image.width();
|
|
||||||
nw /= (float)vpsize[0];
|
|
||||||
float nh = (float)this->image.height();
|
|
||||||
nh /= (float)vpsize[1];
|
|
||||||
|
|
||||||
// need only half the width
|
|
||||||
nw *= 0.5f;
|
|
||||||
nh *= 0.5f;
|
|
||||||
|
|
||||||
SbVec2f n0, n1, n2, n3;
|
|
||||||
|
|
||||||
n0 = SbVec2f(screenpoint[0]-nw, screenpoint[1]-nh);
|
|
||||||
n1 = SbVec2f(screenpoint[0]+nw, screenpoint[1]-nh);
|
|
||||||
n2 = SbVec2f(screenpoint[0]+nw, screenpoint[1]+nh);
|
|
||||||
n3 = SbVec2f(screenpoint[0]-nw, screenpoint[1]+nh);
|
|
||||||
|
|
||||||
// get distance from nilpoint to camera plane
|
|
||||||
float dist = -vv.getPlane(0.0f).getDistance(nilpoint);
|
|
||||||
|
|
||||||
// find the four image points in the plane
|
|
||||||
v0 = vv.getPlanePoint(dist, n0);
|
|
||||||
v1 = vv.getPlanePoint(dist, n1);
|
|
||||||
v2 = vv.getPlanePoint(dist, n2);
|
|
||||||
v3 = vv.getPlanePoint(dist, n3);
|
|
||||||
|
|
||||||
// transform back to object space
|
|
||||||
SbMatrix inv = mat.inverse();
|
|
||||||
inv.multVecMatrix(v0, v0);
|
|
||||||
inv.multVecMatrix(v1, v1);
|
|
||||||
inv.multVecMatrix(v2, v2);
|
|
||||||
inv.multVecMatrix(v3, v3);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SoWidgetShape::generatePrimitives(SoAction *action)
|
void SoWidgetShape::generatePrimitives(SoAction *action)
|
||||||
{
|
{
|
||||||
if (this->image.isNull()) return;
|
if (this->image.isNull()) return;
|
||||||
|
|
||||||
SoState *state = action->getState();
|
SoState *state = action->getState();
|
||||||
state->push();
|
state->push();
|
||||||
|
|
||||||
SbVec2s size;
|
SbVec2s size;
|
||||||
SbVec3f v0, v1, v2, v3;
|
SbVec3f v0, v1, v2, v3;
|
||||||
this->getQuad(action->getState(), v0, v1, v2, v3);
|
this->getQuad(action->getState(), v0, v1, v2, v3);
|
||||||
|
|
||||||
SbVec3f n = (v1-v0).cross(v2-v0);
|
SbVec3f n = (v1-v0).cross(v2-v0);
|
||||||
n.normalize();
|
n.normalize();
|
||||||
|
|
||||||
this->beginShape(action, SoShape::QUADS);
|
this->beginShape(action, SoShape::QUADS);
|
||||||
SoPrimitiveVertex vertex;
|
SoPrimitiveVertex vertex;
|
||||||
vertex.setNormal(n);
|
vertex.setNormal(n);
|
||||||
|
|
||||||
vertex.setTextureCoords(SbVec2f(0,0));
|
vertex.setTextureCoords(SbVec2f(0,0));
|
||||||
vertex.setPoint(v0);
|
vertex.setPoint(v0);
|
||||||
this->shapeVertex(&vertex);
|
this->shapeVertex(&vertex);
|
||||||
|
|
||||||
vertex.setTextureCoords(SbVec2f(1,0));
|
vertex.setTextureCoords(SbVec2f(1,0));
|
||||||
vertex.setPoint(v1);
|
vertex.setPoint(v1);
|
||||||
this->shapeVertex(&vertex);
|
this->shapeVertex(&vertex);
|
||||||
|
|
||||||
vertex.setTextureCoords(SbVec2f(1,1));
|
vertex.setTextureCoords(SbVec2f(1,1));
|
||||||
vertex.setPoint(v2);
|
vertex.setPoint(v2);
|
||||||
this->shapeVertex(&vertex);
|
this->shapeVertex(&vertex);
|
||||||
|
|
||||||
vertex.setTextureCoords(SbVec2f(0,1));
|
vertex.setTextureCoords(SbVec2f(0,1));
|
||||||
vertex.setPoint(v3);
|
vertex.setPoint(v3);
|
||||||
this->shapeVertex(&vertex);
|
this->shapeVertex(&vertex);
|
||||||
|
|
||||||
this->endShape();
|
this->endShape();
|
||||||
|
|
||||||
state->pop();
|
state->pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SoWidgetShape::setWidget(QWidget* w)
|
void SoWidgetShape::setWidget(QWidget* w)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user