当前位置: 首页>>代码示例>>C++>>正文


C++ QVector4D::w方法代码示例

本文整理汇总了C++中QVector4D::w方法的典型用法代码示例。如果您正苦于以下问题:C++ QVector4D::w方法的具体用法?C++ QVector4D::w怎么用?C++ QVector4D::w使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QVector4D的用法示例。


在下文中一共展示了QVector4D::w方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

static inline QVector4D qt_sRGB_to_linear_RGB(const QVector4D &color)
{
    return QVector4D(qt_sRGB_to_linear_RGB(color.x()),
                     qt_sRGB_to_linear_RGB(color.y()),
                     qt_sRGB_to_linear_RGB(color.z()),
                     color.w());
}
开发者ID:SchleunigerAG,项目名称:WinEC7_Qt5.3.1_Fixes,代码行数:7,代码来源:qsgdefaultglyphnode_p.cpp

示例2: if

QVector<float> UniformItem::getGlData() const
{
    QVector<float> glData;
    if (type == UniformType::SPHERICAL_3D) {
        QVector4D cartesian = CoordinateConversions::sphericalToCartesian(data[0], data[1], data[2], 0.0);
        glData.push_back(cartesian.x());
        glData.push_back(cartesian.y());
        glData.push_back(cartesian.z());
    } else if (type == UniformType::SPHERICAL_4D) {
        QVector4D cartesian = CoordinateConversions::sphericalToCartesian(data[0], data[1], data[2], data[3]);
        glData.push_back(cartesian.x());
        glData.push_back(cartesian.y());
        glData.push_back(cartesian.z());
        glData.push_back(cartesian.w());
    } else if (type == UniformType::COLOR) {
        glData.push_back(data[0] / 255.0f);
        glData.push_back(data[1] / 255.0f);
        glData.push_back(data[2] / 255.0f);
    } else if (type == UniformType::COLOR_ALPHA) {
        glData.push_back(data[0] / 255.0f);
        glData.push_back(data[1] / 255.0f);
        glData.push_back(data[2] / 255.0f);
        glData.push_back(data[3] / 255.0f);
    } else {
        glData = data;
    }
    return glData;
}
开发者ID:eseidinger,项目名称:glsl-editor,代码行数:28,代码来源:uniformitem.cpp

示例3: vectorX

colour4::colour4( QVector4D in ) : vectorX( 4 )
{
    r() = in.x();
    g() = in.y();
    b() = in.z();
    a() = in.w();
}
开发者ID:davidmueller13,项目名称:vexx,代码行数:7,代码来源:math.colour4.cpp

示例4:

QDebug operator<<(QDebug dbg, const QVector4D &vector)
{
    dbg.nospace() << "QVector4D("
        << vector.x() << ", " << vector.y() << ", "
        << vector.z() << ", " << vector.w() << ')';
    return dbg.space();
}
开发者ID:husninazer,项目名称:qt,代码行数:7,代码来源:qvector4d.cpp

示例5:

void rpnoc::Cell::setBackGroundColor( QVector4D iColor )
{
	mBackgroundColor = iColor;
    GLfloat color[4] = { iColor.x(), iColor.y(), iColor.z(), iColor.w() };
    Vertex< 4 > oVertex[4] = { color, color, color, color };

    mPanel->setColor( oVertex );
}
开发者ID:Snodig,项目名称:Nagios,代码行数:8,代码来源:cell.cpp

示例6: tmp

static QVector3D unproject( QVector3D v, const QMatrix4x4 &modelView, const QMatrix4x4 &projection, QRect viewport )
{
  // Reimplementation of QVector3D::unproject() - see qtbase/src/gui/math3d/qvector3d.cpp
  // The only difference is that the original implementation uses tolerance 1e-5
  // (see qFuzzyIsNull()) as a protection against division by zero. For us it is however
  // common to get lower values (e.g. as low as 1e-8 when zoomed out to the whole Earth with web mercator).

  QMatrix4x4 inverse = QMatrix4x4( projection * modelView ).inverted();

  QVector4D tmp( v, 1.0f );
  tmp.setX( ( tmp.x() - float( viewport.x() ) ) / float( viewport.width() ) );
  tmp.setY( ( tmp.y() - float( viewport.y() ) ) / float( viewport.height() ) );
  tmp = tmp * 2.0f - QVector4D( 1.0f, 1.0f, 1.0f, 1.0f );

  QVector4D obj = inverse * tmp;
  if ( qgsDoubleNear( obj.w(), 0, 1e-10 ) )
    obj.setW( 1.0f );
  obj /= obj.w();
  return obj.toVector3D();
}
开发者ID:alexbruy,项目名称:QGIS,代码行数:20,代码来源:qgscameracontroller.cpp

示例7: unproject

QVector4D GLScene::unproject(const QVector3D & screen){
    GLint viewport[4];
    glGetIntegerv(GL_VIEWPORT, viewport);

    const qreal xNorm = (2.0f * ((screen.x() - viewport[0]) / (viewport[2] - viewport[0]))) - 1.0f;
    const qreal yNorm = 1.0f - (2.0f * ((screen.y() - viewport[1]) / (viewport[3] - viewport[1])));

    QMatrix4x4 pvMatrixInv = camera().projViewProduct().inverted();
    QVector4D worldPoint = pvMatrixInv * QVector4D(xNorm, yNorm, screen.z(), 1);

    if (worldPoint.w() == 0){
        return QVector4D(0,0,0,0);
    }

    worldPoint.setW(1 / worldPoint.w());
    worldPoint.setX(worldPoint.x() * worldPoint.w());
    worldPoint.setY(worldPoint.y() * worldPoint.w());

    return worldPoint;
}
开发者ID:sudnikand,项目名称:QBox2D,代码行数:20,代码来源:glscene.cpp

示例8: toString

Ogre::String toString(const QVector4D &v)
{
	Ogre::String s="<QVector4D ";
	s+="w="+Ogre::StringConverter::toString((float)v.w())+", ";
	s+="x="+Ogre::StringConverter::toString((float)v.x())+", ";
	s+="y="+Ogre::StringConverter::toString((float)v.y())+", ";
	s+="z="+Ogre::StringConverter::toString((float)v.z());
	s+=">";
	return s;

}
开发者ID:onze,项目名称:QSteelWidget,代码行数:11,代码来源:QtOgreConversions.cpp

示例9: qAbs

bool QQuickVector4DValueType::fuzzyEquals(const QVector4D &vec, qreal epsilon) const
{
    qreal absEps = qAbs(epsilon);
    if (qAbs(v.x() - vec.x()) > absEps)
        return false;
    if (qAbs(v.y() - vec.y()) > absEps)
        return false;
    if (qAbs(v.z() - vec.z()) > absEps)
        return false;
    if (qAbs(v.w() - vec.w()) > absEps)
        return false;
    return true;
}
开发者ID:Drakey83,项目名称:steamlink-sdk,代码行数:13,代码来源:qquickvaluetypes.cpp

示例10: rotateSelected

void GLWidget::rotateSelected(float x, float y, float z, float angle)
{
    obj.rotateSelected(x, y, z, angle);
    QQuaternion rotate = QQuaternion::fromAxisAndAngle(x, y, z, angle);
    QVector4D qrotate = rotate.toVector4D();
    Matrix3d mat3 = Quaterniond(qrotate.w(),qrotate.x(), qrotate.y(), qrotate.z()).toRotationMatrix();
    Matrix4d mat4 = Matrix4d::Identity();
    mat4.block(0,0,3,3) = mat3;

    pd.InterTransform(obj.getSelectVertexIds(),rotate);

    qDebug() << "update!!";
    update();
}
开发者ID:ZJUAdvancedCG,项目名称:PoissonMesh,代码行数:14,代码来源:glwidget.cpp

示例11: on_configurationTreeView_doubleClicked

void MainWindow::on_configurationTreeView_doubleClicked(const QModelIndex &index)
{
    QModelIndex &intermediateIndex = const_cast<QModelIndex &>(index);
    currentIndex = &intermediateIndex;
    if (treeModel->isFileNameItem(index)) {
        QString fileName = QFileDialog::getOpenFileName(this);
        if (!fileName.isEmpty()) {
            treeModel->setData(index, QVariant::fromValue(fileName));
            on_configurationTreeView_clicked(index);
        }
    } else if (treeModel->isPositionItem(index)) {
        QVector4D value = qvariant_cast<QVector4D>(treeModel->getItemData(index));
        QVector4D spherical = CoordinateConversions::cartesianToSpherical(value);
        SphericalDialog *editor = new SphericalDialog(this);
        editor->setValues(spherical.x(), spherical.y(), spherical.z(), spherical.w());
        editor->setModal(true);
        editor->show();
        connect(editor, SIGNAL(valueChanged(double,int,int,double)), this, SLOT(currentPositionChanged(double,int,int,double)));
    } else if (treeModel->isUniformConfigurationItem(index)) {
开发者ID:eseidinger,项目名称:glsl-editor,代码行数:19,代码来源:mainwindow.cpp

示例12: outcode

/**
 * copied from https://searchcode.com/codesearch/view/35195518/
 * qt3d /src/threed/painting/qglpainter.cpp
 * no changes in the code
 */
static inline uint outcode( QVector4D v )
{
  // For a discussion of outcodes see pg 388 Dunn & Parberry.
  // For why you can't just test if the point is in a bounding box
  // consider the case where a view frustum with view-size 1.5 x 1.5
  // is tested against a 2x2 box which encloses the near-plane, while
  // all the points in the box are outside the frustum.
  // TODO: optimise this with assembler - according to D&P this can
  // be done in one line of assembler on some platforms
  uint code = 0;
  if ( v.x() < -v.w() ) code |= 0x01;
  if ( v.x() > v.w() )  code |= 0x02;
  if ( v.y() < -v.w() ) code |= 0x04;
  if ( v.y() > v.w() )  code |= 0x08;
  if ( v.z() < -v.w() ) code |= 0x10;
  if ( v.z() > v.w() )  code |= 0x20;
  return code;
}
开发者ID:AlisterH,项目名称:Quantum-GIS,代码行数:23,代码来源:qgs3dutils.cpp

示例13: getMatrizRotacion

QMatrix4x4 iPolacion::getMatrizRotacion(QVector4D q){


    QMatrix4x4 m = QMatrix4x4((1-(2*((q.y()*q.y())+(q.z()*q.z())))),
                              ((2*q.x()*q.y())-(2*q.w()*q.z())),
                              ((2*q.w()*q.y())+(2*q.x()*q.z())),
                              0
                              ,
                              ((2*q.x()*q.y())+(2*q.w()*q.z())),
                              (1-(2*((q.x()*q.x())+(q.z()*q.z())))),
                              ((-2*q.w()*q.x())+(2*q.y()*q.z())),
                              0
                              ,
                              ((-2*q.w()*q.y())+(2*q.x()*q.z())),
                              ((2*q.w()*q.x())+(2*q.y()*q.z())),
                              (1-(2*((q.x()*q.x())+(q.y()*q.y())))),
                              0
                              ,
                              0,0,0,1);
    return m;
}
开发者ID:JavierPin,项目名称:Animacion3D,代码行数:21,代码来源:ipolacion.cpp

示例14: glLineWidth

void
ClipPlanes::drawViewportBorders(QGLViewer *viewer)
{
  int ow = viewer->width();
  int oh = viewer->height();
  float aspectRatio = viewer->aspectRatio();
  viewer->startScreenCoordinatesSystem();

  for (int i=0; i<m_clips.count(); i++)
    {
      QVector4D vp = m_clips[i]->viewport();
      // render only when textured plane and viewport active
      if (m_clips[i]->tfset() >= 0 &&
	  m_clips[i]->tfset() < Global::lutSize() &&
	  vp.x() >= 0.0)
	{
	  int vx, vy, vh, vw;
	  vx = vp.x()*ow;
	  vy = oh-vp.y()*oh;
	  vw = vp.z()*ow;
	  vh = vp.w()*oh;

	  vx+=1; vy+=1;
	  vw-=2; vh-=2;

	  glLineWidth(2);
	  if (m_clips[i]->viewportGrabbed())
	    {
	      glLineWidth(3);
	      glColor3f(0.0, 1.0, 0.3);
	    }
	  else
	    {
	      Vec clipColor = m_clips[i]->color();
	      glColor3dv(clipColor);
	    }
	  
	  glBegin(GL_LINE_STRIP);
	  glVertex2i(vx, vy);
	  glVertex2i(vx, vy-vh);
	  glVertex2i(vx+vw, vy-vh);
	  glVertex2i(vx+vw, vy);
	  glVertex2i(vx, vy);
	  glEnd();
	  if (m_clips[i]->viewportGrabbed())
	    {
	      glLineWidth(2);
	      glColor3f(0.8, 0.8, 0.8);
	    }
	  else
	    {
	      glLineWidth(1);
	      glColor3f(0.2, 0.2, 0.2);
	    }
	  glBegin(GL_LINE_STRIP);
	  glVertex2i(vx, vy);
	  glVertex2i(vx, vy-vh);
	  glVertex2i(vx+vw, vy-vh);
	  glVertex2i(vx+vw, vy);
	  glVertex2i(vx, vy);
	  glEnd();
	}
    }

  viewer->stopScreenCoordinatesSystem();
}
开发者ID:mdoube,项目名称:drishti,代码行数:66,代码来源:clipplane.cpp

示例15: convert

Ogre::Quaternion convert(const QVector4D &v)
{
	return Ogre::Quaternion(v.w(),v.x(),v.y(),v.z());
}
开发者ID:onze,项目名称:QSteelWidget,代码行数:4,代码来源:QtOgreConversions.cpp


注:本文中的QVector4D::w方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。