本文整理汇总了C++中QVector2D::toVector3D方法的典型用法代码示例。如果您正苦于以下问题:C++ QVector2D::toVector3D方法的具体用法?C++ QVector2D::toVector3D怎么用?C++ QVector2D::toVector3D使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QVector2D
的用法示例。
在下文中一共展示了QVector2D::toVector3D方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void GLWidget3D::mouseMoveEvent(QMouseEvent *event) {
QVector2D pos;
mouseTo2D(event->x(), event->y(), pos);
float dx = (float)(event->x() - lastPos.x());
float dy = (float)(event->y() - lastPos.y());
float camElevation = camera->getCamElevation();
vboRenderManager.mousePos3D=pos.toVector3D();
switch (mainWin->mode) {
case MainWindow::MODE_AREA_SELECT:
/*if(altPressed==false&&G::global()["3d_render_mode"]==1){
camera3D.motion(dx,dy);
lastPos = event->pos();
break;
}*/
if (altPressed) { // editing
if (event->buttons() & Qt::RightButton||event->buttons() & Qt::LeftButton||event->buttons() & Qt::MiddleButton) {//make sure something is clicking
// normal Gaussian edition
float change=mainWin->controlWidget->ui.terrainPaint_changeSlider->value()*0.003f;
float radi=mainWin->controlWidget->ui.terrainPaint_sizeSlider->value()*0.01f;
change*=0.2f;//while moving, it is not necessary to change much
if (event->buttons() & Qt::RightButton) {
change = -change;
}
if (event->buttons() & Qt::MiddleButton) {
change=FLT_MAX;//hack: flat terrain
}
//mainWin->urbanGeometry->vboRenderManager->addValue(pos.x(), pos.y(), change);
float xM=1.0f-(vboRenderManager.side/2.0f-pos.x())/vboRenderManager.side;
float yM=1.0f-(vboRenderManager.side/2.0f-pos.y())/vboRenderManager.side;
vboRenderManager.vboTerrain.updateTerrain(xM,yM,change,radi);//rad,change);
mainWin->urbanGeometry->adaptToTerrain();
shadow.makeShadowMap(this);
}
} else if (event->buttons() & Qt::LeftButton) { // Rotate
camera->changeXRotation(rotationSensitivity * dy);
camera->changeZRotation(-rotationSensitivity * dx);
updateCamera();
lastPos = event->pos();
} else if (event->buttons() & Qt::MidButton) {
camera->changeXYZTranslation(-dx, dy, 0);
updateCamera();
lastPos = event->pos();
} else if (event->buttons() & Qt::RightButton) { // Zoom
camera->changeXYZTranslation(0, 0, -zoomSensitivity * dy);
updateCamera();
lastPos = event->pos();
}
break;
}
updateGL();
}
示例2: wheelEvent
void MouseMoveSceneStrategy::wheelEvent(std::shared_ptr<Model> const &model, QWheelEvent *mouseEvent,
QVector2D pos)
{
pos = (model->view->aspectMatrix.inverted() * pos.toVector3D()).toVector2D();
float delta = mouseEvent->delta();
float delta2 = powf(2, delta / 120);
std::shared_ptr<ResizeScene> op = std::make_shared<ResizeScene>(delta2, pos);
operationRunner.lock()->RunOperation(op);
}
示例3: mouseMoveEvent
void MouseMoveSceneStrategy::mouseMoveEvent(std::shared_ptr<Model> const &model, QMouseEvent *mouseEvent,
QVector2D pos)
{
pos = (model->view->aspectMatrix.inverted() * pos.toVector3D()).toVector2D();
QVector2D offset = pos - this->mousePos;
this->mousePos = pos;
auto buttons = mouseEvent->buttons();
if (buttons & Qt::LeftButton)
{
std::shared_ptr<TranslateScene> op = std::make_shared<TranslateScene>(offset);
MouseStrategy::operationRunner.lock()->RunOperation(op);
}
}
示例4: mousePressEvent
void MouseMoveSceneStrategy::mousePressEvent(std::shared_ptr<Model> const &model, QMouseEvent *event,
QVector2D pos)
{
pos = (model->view->aspectMatrix.inverted() * pos.toVector3D()).toVector2D();
this->mousePos = pos;
}
示例5:
bool Util::segmentSegmentIntersectXY3D(const QVector3D& a, const QVector3D& b, const QVector3D& c, const QVector3D& d, float *tab, float *tcd, bool segmentOnly, QVector3D& intPoint) {
QVector2D interPoint;
bool res=segmentSegmentIntersectXY(QVector2D(a.x(),a.y()),QVector2D(b.x(),b.y()),QVector2D(c.x(),c.y()),QVector2D(d.x(),d.y()),tab,tcd,segmentOnly,interPoint);
intPoint=interPoint.toVector3D();
return res;
}//