• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ QVector3D函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中QVector3D函数的典型用法代码示例。如果您正苦于以下问题:C++ QVector3D函数的具体用法?C++ QVector3D怎么用?C++ QVector3D使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: initialize2DProperties

void MainView2D::createFixtureItem(quint32 fxID, quint16 headIndex, quint16 linkedIndex,
                                   QVector3D pos, bool mmCoords)
{
    if (isEnabled() == false)
        return;

    if (m_gridItem == NULL)
       initialize2DProperties();

    qDebug() << "[MainView2D] Creating fixture with ID" << fxID << headIndex << linkedIndex << "pos:" << pos;

    Fixture *fixture = m_doc->fixture(fxID);
    if (fixture == NULL)
        return;

    quint32 itemID = FixtureUtils::fixtureItemID(fxID, headIndex, linkedIndex);
    QLCFixtureMode *fxMode = fixture->fixtureMode();
    QQuickItem *newFixtureItem = qobject_cast<QQuickItem*>(fixtureComponent->create());
    quint32 itemFlags = m_monProps->fixtureFlags(fxID, headIndex, linkedIndex);

    newFixtureItem->setParentItem(m_gridItem);
    newFixtureItem->setProperty("itemID", itemID);

    if (itemFlags & MonitorProperties::HiddenFlag)
        newFixtureItem->setProperty("visible", false);

    if (fxMode != NULL && fixture->type() != QLCFixtureDef::Dimmer)
    {
        QLCPhysical phy = fxMode->physical();

        //qDebug() << "Current mode fixture heads:" << fxMode->heads().count();
        newFixtureItem->setProperty("headsNumber", fxMode->heads().count());

        if (fixture->channelNumber(QLCChannel::Pan, QLCChannel::MSB) != QLCChannel::invalid())
        {
            int panDeg = phy.focusPanMax();
            if (panDeg == 0) panDeg = 360;
            newFixtureItem->setProperty("panMaxDegrees", panDeg);
        }
        if (fixture->channelNumber(QLCChannel::Tilt, QLCChannel::MSB) != QLCChannel::invalid())
        {
            int tiltDeg = phy.focusTiltMax();
            if (tiltDeg == 0) tiltDeg = 270;
            newFixtureItem->setProperty("tiltMaxDegrees", tiltDeg);
        }
    }

    QPointF itemPos;
    QSizeF size = FixtureUtils::item2DDimension(fixture->type() == QLCFixtureDef::Dimmer ? NULL : fxMode,
                                                m_monProps->pointOfView());

    if (mmCoords == false && (pos.x() != 0 || pos.y() != 0))
    {
        float gridUnits = m_monProps->gridUnits() == MonitorProperties::Meters ? 1000.0 : 304.8;
        itemPos.setX((pos.x() * gridUnits) / m_cellPixels);
        itemPos.setY((pos.y() * gridUnits) / m_cellPixels);
    }

    if (m_monProps->containsItem(fxID, headIndex, linkedIndex))
    {
        itemPos = FixtureUtils::item2DPosition(m_monProps, m_monProps->pointOfView(), pos);
        newFixtureItem->setProperty("rotation",
                                    FixtureUtils::item2DRotation(m_monProps->pointOfView(),
                                                                 m_monProps->fixtureRotation(fxID, headIndex, linkedIndex)));
    }
    else
    {
        itemPos = FixtureUtils::available2DPosition(m_doc, m_monProps->pointOfView(),
                                                    QRectF(itemPos.x(), itemPos.y(), size.width(), size.height()));
        // add the new fixture to the Doc monitor properties
        QVector3D newPos = FixtureUtils::item3DPosition(m_monProps, itemPos, 1000.0);
        m_monProps->setFixturePosition(fxID, headIndex, linkedIndex, newPos);
        m_monProps->setFixtureFlags(fxID, headIndex, linkedIndex, 0);
        Tardis::instance()->enqueueAction(Tardis::FixtureSetPosition, itemID, QVariant(QVector3D(0, 0, 0)), QVariant(newPos));
    }

    newFixtureItem->setProperty("mmXPos", itemPos.x());
    newFixtureItem->setProperty("mmYPos", itemPos.y());
    newFixtureItem->setProperty("mmWidth", size.width());
    newFixtureItem->setProperty("mmHeight", size.height());
    newFixtureItem->setProperty("fixtureName", fixture->name());

    // and finally add the new item to the items map
    m_itemsMap[itemID] = newFixtureItem;

    QByteArray values;
    updateFixture(fixture, values);
}
开发者ID:exmatrikulator,项目名称:qlcplus,代码行数:88,代码来源:mainview2d.cpp


示例2: QVector3D

Vertex::Vertex()
{
    m_pos    = QVector3D(0.0f, 0.0f, 0.0f);
    m_tex    = QVector2D(0.0f, 0.0f);
    m_normal = QVector3D(0.0f, 0.0f, 0.0f);    
}
开发者ID:Imarion,项目名称:Chap10TextureEx,代码行数:6,代码来源:vertex.cpp


示例3: QGLWidget

MaterialPreview::MaterialPreview(QWidget *parent) :
    QGLWidget(parent)
{

    sphere_ = new Sphere("Preview Sphere", 0, 5, Primitive::float3(1, 1, 0), 1, 50, 50);
    camera_ = new Camera(0, Camera::PERSPECTIVE, false, QQuaternion::fromAxisAndAngle(QVector3D(1, 0, 0), 45.0f));
    camera_->zoom(7);
}
开发者ID:claudilein,项目名称:graphics_programming_lab_2,代码行数:8,代码来源:materialpreview.cpp


示例4: QVector3D

QVector2D EnvPortal::GetChildLocal(const QVector3D & p) const
{
    QVector3D local = QVector3D(p.x() - child_pos.x(), 0.0, p.z() - child_pos.z());
    return QVector2D(QVector3D::dotProduct(local, child_t), QVector3D::dotProduct(local, child_n));
}
开发者ID:jaxzin,项目名称:firebox,代码行数:5,代码来源:envportal.cpp


示例5: up

	/// Returns the vector pointing along the positive local Y axis
	const QVector3D up() const { return mRotation.rotatedVector(QVector3D(0,1,0)); }
开发者ID:splatterlinge,项目名称:Splatterlinge,代码行数:2,代码来源:AObject.hpp


示例6:

RVector RVector::rotate3d(const QQuaternion& quaternion) {
    QVector3D qv = quaternion.rotatedVector(QVector3D(x, y, z));
    *this = RVector(qv.x(), qv.y(), qv.z());
    return *this;
}
开发者ID:fallenwind,项目名称:qcad,代码行数:5,代码来源:RVector.cpp


示例7: toVector4D

/*!
    Returns the 3D form of this 2D vector, with the z coordinate set to zero.

    \sa toVector4D(), toPoint()
*/
QVector3D QVector2D::toVector3D() const
{
    return QVector3D(xp, yp, 0.0f, 1);
}
开发者ID:13W,项目名称:phantomjs,代码行数:9,代码来源:qvector2d.cpp


示例8: qFastSin

//------------------------------------------------------------------------------
QGLBuilder&  operator << ( QGLBuilder& builder, const QGLEllipsoid& ellipsoid )
{
   // Determine the number of slices and stacks to generate.
   static int const numberOfSlicesForSubdivisionDepth[] = { 8, 8, 16, 16, 32, 32, 64, 64, 128, 128 };
   static int const numberOfStacksForSubdivisionDepth[] = { 4, 8,  8, 16, 16, 32, 32, 64,  64, 128 };
   const unsigned int numberOfSlices = numberOfSlicesForSubdivisionDepth[ ellipsoid.GetSubdivisionDepth() - 1 ];
   const unsigned int numberOfStacks = numberOfStacksForSubdivisionDepth[ ellipsoid.GetSubdivisionDepth() - 1 ];

   // Precompute sin/cos values for the slices.
   const unsigned int maxSlices = 128 + 1;
   const unsigned int maxStacks = 128 + 1;
   qreal sliceSin[ maxSlices ];
   qreal sliceCos[ maxSlices ];
   for( unsigned int slice = 0;  slice < numberOfSlices;  ++slice )
   {
       const qreal angle = 2 * M_PI * (numberOfSlices - 1 - slice) / numberOfSlices;
       sliceSin[slice] = qFastSin(angle);
       sliceCos[slice] = qFastCos(angle);
   }
   // Join first and last slice.
   sliceSin[numberOfSlices] = sliceSin[0];
   sliceCos[numberOfSlices] = sliceCos[0];


   // Precompute sin/cos values for the stacks.
   qreal stackSin[ maxStacks ];
   qreal stackCos[ maxStacks ];
   for( unsigned int stack = 0;  stack <= numberOfStacks;  ++stack )
   {
       // Efficiently handle end-points which also ensure geometry comes to a point at the poles (no round-off).
       if(      stack == 0 )               { stackSin[stack] = 0.0f;  stackCos[stack] =  1.0f; }
       else if( stack == numberOfStacks )  { stackSin[stack] = 0.0f;  stackCos[stack] = -1.0f; }
       else
       {
          const qreal angle = M_PI * stack / numberOfStacks;
          stackSin[stack] = qFastSin(angle);
          stackCos[stack] = qFastCos(angle);
       }
   }

   // Half the dimensions of the ellipsoid for calculations below (centroid of ellipsoid is 0, 0, 0.)
   const qreal xRadius = 0.5 * ellipsoid.GetXDiameter();
   const qreal yRadius = 0.5 * ellipsoid.GetYDiameter();
   const qreal zRadius = 0.5 * ellipsoid.GetZDiameter();
   const qreal oneOverXRadiusSquared = 1.0 / (xRadius * xRadius);
   const qreal oneOverYRadiusSquared = 1.0 / (yRadius * yRadius);
   const qreal oneOverZRadiusSquared = 1.0 / (zRadius * zRadius);


   // Create the stacks.
   for( unsigned int stack = 0;  stack < numberOfStacks;  ++stack )
   {
      QGeometryData quadStrip;
      for( unsigned int slice = 0;  slice <= numberOfSlices; ++slice )
      {
          // Equation for ellipsoid surface is x^2/xRadius^2 + y^2/yRadius^2 + z^2/zRadius^2 = 1
          // Location of vertices can be specified in terms of "polar coordinates".
          const qreal nextx = xRadius * stackSin[stack+1] * sliceSin[slice];
          const qreal nexty = yRadius * stackSin[stack+1] * sliceCos[slice];
          const qreal nextz = zRadius * stackCos[stack+1];
          quadStrip.appendVertex( QVector3D( nextx, nexty, nextz) );

          // Equation for ellipsoid surface is  Surface = x^2/xRadius^2 + y^2/yRadius^2 + z^2/zRadius^2 - 1
          // Gradient for ellipsoid is  x/xRadius^2*Nx>  +  y/yRadius^2*Ny>  +  z/zRadius^2*Nz>
          // Gradient for sphere simplifies to  x*Nx> + y*Ny> + z*Nz>
          // const qreal nextGradientx =  stackSin[stack+1] * sliceSin[slice];
          // const qreal nextGradienty =  stackSin[stack+1] * sliceCos[slice];
          // const qreal nextGradientz =  stackCos[stack+1];
          const qreal nextGradientx = nextx * oneOverXRadiusSquared;
          const qreal nextGradienty = nexty * oneOverYRadiusSquared;
          const qreal nextGradientz = nextz * oneOverZRadiusSquared;
          const qreal nextGradientMagSquared = nextGradientx * nextGradientx + nextGradienty * nextGradienty + nextGradientz * nextGradientz;
          const qreal oneOverNextGradientMagnitude = 1.0 / sqrt( nextGradientMagSquared );
          quadStrip.appendNormal( oneOverNextGradientMagnitude * QVector3D( nextGradientx,  nextGradienty, nextGradientz ) );
          quadStrip.appendTexCoord( QVector2D(1.0f - qreal(slice) / numberOfSlices, 1.0f - qreal(stack + 1) / numberOfStacks) );

          const qreal x = xRadius * stackSin[stack] * sliceSin[slice];
          const qreal y = yRadius * stackSin[stack] * sliceCos[slice];
          const qreal z = zRadius * stackCos[stack];
          quadStrip.appendVertex( QVector3D( x, y, z) );

          // const qreal gradientx =  stackSin[stack] * sliceSin[slice];
          // const qreal gradienty =  stackSin[stack] * sliceCos[slice];
          // const qreal gradientz =  stackCos[stack];
          const qreal gradientx = x * oneOverXRadiusSquared;
          const qreal gradienty = y * oneOverYRadiusSquared;
          const qreal gradientz = z * oneOverZRadiusSquared;
          const qreal gradientMagSquared = gradientx * gradientx + gradienty * gradienty + gradientz * gradientz;
          const qreal oneOverGradientMagnitude = 1.0 / sqrt( gradientMagSquared );
          quadStrip.appendNormal( oneOverGradientMagnitude * QVector3D(  gradientx, gradienty, gradientz) );
          quadStrip.appendTexCoord( QVector2D(1.0f - qreal(slice) / numberOfSlices,  1.0f - qreal(stack) / numberOfStacks) );
      }

      // The quad strip stretches from pole to pole.
      builder.addQuadStrip( quadStrip );
   }


   return builder;
//.........这里部分代码省略.........
开发者ID:ruisebastiao,项目名称:qsim,代码行数:101,代码来源:QGLEllipsoid.cpp


示例9: QPointF

void Orientation_Widget::Init(void)
{
	Quad2d.clear();
	Quad2d.append( QPointF( 0.9192f,  0.8485f) );
	Quad2d.append( QPointF( 0.3000f,  0.2293f) );
	Quad2d.append( QPointF( 0.3000f, -0.2293f) );
	Quad2d.append( QPointF( 0.9192f, -0.8485f) );
	Quad2d.append( QPointF( 0.8485f, -0.9192f) );
	Quad2d.append( QPointF( 0.2293f, -0.3000f) );
	Quad2d.append( QPointF(-0.2293f, -0.3000f) );
	Quad2d.append( QPointF(-0.8485f, -0.9192f) );
	Quad2d.append( QPointF(-0.9192f, -0.8485f) );
	Quad2d.append( QPointF(-0.3000f, -0.2293f) );
	Quad2d.append( QPointF(-0.3000f,  0.2293f) );
	Quad2d.append( QPointF(-0.9192f,  0.8485f) );
	Quad2d.append( QPointF(-0.8485f,  0.9192f) );
	Quad2d.append( QPointF(-0.2293f,  0.3000f) );
	Quad2d.append( QPointF( 0.2293f,  0.3000f) );
	Quad2d.append( QPointF( 0.8485f,  0.9192f) );


	CenterX = CenterY = 0.0f;

	const int sourceLine[] = {		0,1, 1,2, 2,3, 3,4,
									4,5, 5,6, 6,7, 7,8,			// Top shell
									8,9, 9,10, 10,11, 11,12,
									12,13, 13,14, 14,15, 15,0,

									16,17, 17,18, 18,19, 19,20,
									20,21, 21,22, 22,23, 23,24,	// Bottom shell
									24,25, 25,26, 26,27, 27,28,
									28,29, 29,30, 30,31, 31,16,

									0,16, 1,17, 2,18, 3,19,
									4,20, 5,21, 6,22, 7,23,		// Connections between top & bottom
									8,24, 9,25, 10,26, 11,27,
									12,28, 13,29, 14,30, 15,31,

									2,5, 6,9, 10,13, 14,1,		// Connections on arms, top & bottom
									18,21, 22,25, 26,29, 30,17,

									32,33
							};

	QuadLine.clear();
	for( unsigned int i=0; i<sizeof(sourceLine)/sizeof(int); i++ ) {
		QuadLine.append( sourceLine[i] );
	}

	float cubeHeight = 0.8;
	float cubeWidth =  1.2;
	float cubeDepth =  1.2;

	QuadPt.resize(34);
	pt.resize(34);

	for(int i = 0; i < 16; i++) {
		QuadPt[i] =    QVector3D( Quad2d[i].x() * cubeWidth, -cubeHeight * 0.1f, Quad2d[i].y() * cubeDepth );
		QuadPt[i+16] = QVector3D( Quad2d[i].x() * cubeWidth, +cubeHeight * 0.1f, Quad2d[i].y() * cubeDepth );
	}

	QuadPt[32] = QVector3D( 0.0f, 0.0f, 0.3f * cubeDepth );
	QuadPt[33] = QVector3D( 0.0f, 0.0f, 0.5f * cubeDepth );

	bQuat2Valid = false;
}
开发者ID:bweir,项目名称:Flight-Controller,代码行数:66,代码来源:orientation_widget.cpp


示例10: connect

Frame3D::Frame3D()
{
    connect(&view, SIGNAL(calibrate()), this, SLOT(calibrate()));
    calibratedX = 0;
    calibratedY = 0;
    calibratedZ = 0;

    engine.registerAspect(new Qt3DRender::QRenderAspect());
    input = new Qt3DInput::QInputAspect;
    engine.registerAspect(input);

    data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast<QSurface *>(&view)));
    data.insert(QStringLiteral("eventSource"), QVariant::fromValue(&view));
    engine.setData(data);

    // Root entity
    rootEntity = new Qt3DCore::QEntity();
    rootEntity->setObjectName(QStringLiteral("rootEntity"));
    // cube
    cubeEntity = new Qt3DCore::QEntity(rootEntity);

    // cube shape data
    cube = new Qt3DRender::QCuboidMesh();

    cubeEntity->addComponent(cube);

    // cubeMesh Transform
    cubeTransforms = new Qt3DCore::QTransform();
    cubeTransforms->setTranslation(QVector3D(0.0f, 0.0f, 0.0f));
    cubeTransforms->setRotation(QQuaternion::fromAxisAndAngle(QVector3D(1, 1, 1), 0.0f));
    cubeEntity->addComponent(cubeTransforms);

    // Camera
    cameraEntity = new Qt3DCore::QCamera(rootEntity);
    cameraEntity->setObjectName(QStringLiteral("cameraEntity"));
    cameraEntity->lens()->setPerspectiveProjection(60.0f, 16.0f/9.0f, 0.1f, 1000.0f);
    cameraEntity->setPosition(QVector3D(0, 2, 2.0f));
    cameraEntity->setViewCenter(cubeTransforms->translation());
    cameraEntity->setUpVector(QVector3D(0, 1, 0));
    input->setCamera(cameraEntity);

    // FrameGraph
    frameGraph = new Qt3DRender::QFrameGraph();
    techniqueFilter = new Qt3DRender::QTechniqueFilter();
    viewport = new Qt3DRender::QViewport(techniqueFilter);
    clearBuffer = new Qt3DRender::QClearBuffer(viewport);
    cameraSelector = new Qt3DRender::QCameraSelector(clearBuffer);
    (void) new Qt3DRender::QRenderPassFilter(cameraSelector);

    // TechiqueFilter and renderPassFilter are not implement yet
    viewport->setRect(QRectF(0, 0, 1, 1));
    clearBuffer->setBuffers(Qt3DRender::QClearBuffer::ColorDepthBuffer);
    cameraSelector->setCamera(cameraEntity);
    frameGraph->setActiveFrameGraph(techniqueFilter);

    // Setting the FrameGraph
    rootEntity->addComponent(frameGraph);

    // Set root object of the scene
    engine.setRootEntity(rootEntity);
    // Show window
    view.show();
}
开发者ID:alexbourgeois,项目名称:SmartControl,代码行数:63,代码来源:frame3d.cpp


示例11: draw_line

void RenderState::draw_flat_box(QVector3D position1, QVector3D position2) {
      draw_line(QVector3D(position1.x(), position1.y(), position1.z()),
                QVector3D(position1.x(), position2.y(), position2.z()),
                this->view_matrix, QMatrix4x4(), QVector3D(1, 1, 1));
      draw_line(QVector3D(position1.x(), position1.y(), position1.z()),
                QVector3D(position2.x(), position1.y(), position2.z()),
                this->view_matrix, QMatrix4x4(), QVector3D(1, 1, 1));
      draw_line(QVector3D(position1.x(), position1.y(), position1.z()),
                QVector3D(position2.x(), position2.y(), position1.z()),
                this->view_matrix, QMatrix4x4(), QVector3D(1, 1, 1));

      draw_line(QVector3D(position2.x(), position1.y(), position1.z()),
                QVector3D(position2.x(), position2.y(), position2.z()),
                this->view_matrix, QMatrix4x4(), QVector3D(1, 1, 1));
      draw_line(QVector3D(position1.x(), position2.y(), position1.z()),
                QVector3D(position2.x(), position2.y(), position2.z()),
                this->view_matrix, QMatrix4x4(), QVector3D(1, 1, 1));
      draw_line(QVector3D(position1.x(), position1.y(), position2.z()),
                QVector3D(position2.x(), position2.y(), position2.z()),
                this->view_matrix, QMatrix4x4(), QVector3D(1, 1, 1));

}
开发者ID:Baggins800,项目名称:Low-Poly-Creator,代码行数:22,代码来源:renderstate.cpp


示例12: glDepthMask

void RenderState::paintGL() {
  this->view_matrix.setToIdentity();
  // whenever content is not loaded, load the content
  if ( !this->shader_program ) { this->load_content(); }
  // enable the scene's depth mask
  glDepthMask(GL_TRUE);
  // clear the depth z = 0.0f -> 1.0f
  glClearDepth(1.0f);
  // enable the scene's depth test
  glEnable(GL_DEPTH_TEST);
  // enable cullmode CCW (counter clockwise)
  glEnable(GL_CULL_FACE);
  // clear the background color for rendering
  glClearColor(104.0/255.0, 104.0/255.0, 104.0/255.0, 1);
  // clear the color and depth buffer
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

  // transform the camera's position with respect to the rotation matrix
  QVector3D cameraPosition = camera_transformation * QVector3D(0, 0, this->mouse_zoom);

  // define the direction of the camera's up vector
  QVector3D cameraUpDirection = camera_transformation * QVector3D(0, 1.0, 0);

  // implement and transform the camera
  this->view_matrix.lookAt(cameraPosition, QVector3D(), cameraUpDirection);
  this->view_matrix.translate(this->camera_previous);

  // return the position of the ray intersection with the y-axis
  QVector3D camara_zoom = QVector3D(- this->camera_previous.x(),
                                    - this->camera_previous.y(),
                                    - this->camera_previous.z());
  //this->view_matrix.rotate(this->prev_rotation_y, 1, 0, 0);
  //this->view_matrix.rotate(this->prev_rotation_x, 0, 1, 0);
  switch ( type_of_view ) {
   case 0 : camara_zoom.setY( camara_zoom.y() + this->mouse_zoom );
   break;
   case 1 : camara_zoom.setX( camara_zoom.x() - this->mouse_zoom );
   break;
   case 2 : camara_zoom.setZ( camara_zoom.z() + this->mouse_zoom );
   break;
   case 3 : this->view_matrix.rotate(-this->mouse_relative_y_drag, 1.0, 0, 0);
            this->view_matrix.rotate(-this->mouse_relative_x_drag, 0, 1.0, 0);
           // this->view_matrix.rotate(-45-this->mouse_y, 1, 0, 0);

   break;
  }
  QVector3D Pos  = this->intersect_plane(this->raycast_direction, camara_zoom);

  // update current position
  this->current_position->setX(Pos.x());
  this->current_position->setZ(Pos.z());
  this->current_position->setY(Pos.y());

  // draw select box
  if ( (this->mousedown_left) && (this->edit_vertex_enable) ) {
    draw_flat_box(*this->clicked_position, *this->current_position);
  }

  if ( (this->mousedown_left) && (this->translate_enable) ) {
    draw_line(*this->clicked_position,
              *this->current_position,
              this->view_matrix,
              QMatrix4x4(),
              QVector3D(1.0, 1.0, 1.0));
  }

  for (int a = 0; a < CurrentScene::mesh_count(); a++) {
    QMatrix4x4 translation;
    translation.translate(*CurrentScene::get_position(a));
    draw_model(CurrentScene::mesh_draw(a),
               this->view_matrix,
               translation,
               QMatrix4x4(),
               QVector3D(0.3, 0.0, 0.0));
    draw_model_vertices(CurrentScene::mesh_draw(a),
                        this->view_matrix,
                        translation,
                        QMatrix4x4(),
                        QVector3D(1.0, 0.0, 0.0), true);

    draw_model_vertices(CurrentScene::mesh_draw(a),
                        this->view_matrix,
                        translation,
                        QMatrix4x4(),
                        QVector3D(1.0, 1.0, 1.0), false);

  }
  draw_grid();
  if ( this->add_vertex_enable && ( this->type_of_view != 3 ) ) {
    QMatrix4x4 translation;
    translation.translate(Pos);
    draw_model(this->current_mesh,this->view_matrix,
               translation,
               QMatrix4x4(),
               QVector3D());
  }
  // release the program for this frame
  this->shader_program->release();
  // disable the cullmode for the frame
  glDisable(GL_CULL_FACE);
//.........这里部分代码省略.........
开发者ID:Baggins800,项目名称:Low-Poly-Creator,代码行数:101,代码来源:renderstate.cpp


示例13: switch

void RenderState::draw_grid() {
  const int max_lines = 32;
  for ( int x = -max_lines; x < max_lines + 1; x++ ) {
      switch ( type_of_view ) {
        case 0 :
          // draw horisontal lines
          draw_line(QVector3D(x ,0 ,-max_lines),
                    QVector3D(x ,0 ,max_lines),
                    this->view_matrix, QMatrix4x4(),
                    QVector3D(1.0, 1.0, 1.0));
          // draw vertical lines
          draw_line(QVector3D(-max_lines ,0 ,x),
                    QVector3D(max_lines ,0 ,x),
                    this->view_matrix, QMatrix4x4(),
                    QVector3D(1.0, 1.0 ,1.0));
        break;
        case 1 :
          // draw horisontal lines
          draw_line(QVector3D(0, x, -max_lines),
                    QVector3D(0, x, max_lines),
                    this->view_matrix, QMatrix4x4(),
                    QVector3D(1.0, 1.0, 1.0));
          // draw vertical lines
          draw_line(QVector3D(0, -max_lines, x),
                    QVector3D(0, max_lines, x),
                    this->view_matrix, QMatrix4x4(),
                    QVector3D(1.0, 1.0 ,1.0));
        break;
        case 2 :
          // draw horisontal lines
          draw_line(QVector3D(x, -max_lines, 0),
                    QVector3D(x, max_lines, 0),
                    this->view_matrix, QMatrix4x4(),
                    QVector3D(1.0, 1.0, 1.0));
          // draw vertical lines
          draw_line(QVector3D(-max_lines, x, 0),
                    QVector3D(max_lines, x, 0),
                    this->view_matrix, QMatrix4x4(),
                    QVector3D(1.0, 1.0 ,1.0));
        break;
      case 3 :
        // draw horisontal lines
        draw_line(QVector3D(x ,0 ,-max_lines),
                  QVector3D(x ,0 ,max_lines),
                  this->view_matrix, QMatrix4x4(),
                  QVector3D(1.0, 1.0, 1.0));
        // draw vertical lines
        draw_line(QVector3D(-max_lines ,0 ,x),
                  QVector3D(max_lines ,0 ,x),
                  this->view_matrix, QMatrix4x4(),
                  QVector3D(1.0, 1.0 ,1.0));
      break;
    }
  }
}
开发者ID:Baggins800,项目名称:Low-Poly-Creator,代码行数:55,代码来源:renderstate.cpp


示例14: QQuaternion

void GLWidget::rotateCamera(float angle) {
	QQuaternion rot = QQuaternion(cos(angle/2.0), sin(angle/2.0) * QVector3D(0.0, 1.0, 0.0));
	camera->rotate(rot);

}
开发者ID:TheSlothExperience,项目名称:SheepBattleBoats,代码行数:5,代码来源:glwidget.cpp


示例15: QVector3D

void DirectionNode::downWorld(qreal distance) {
    position += QVector3D(0, -distance, 0);
    update();
}
开发者ID:jaccen,项目名称:liblub,代码行数:4,代码来源:DirectionNode.cpp


示例16: QVector3D

QVector3D DarkMatter::outDirection(const HitRecord &, Sample, float &pdf, cv::Vec3f &brdf) const
{
    brdf = cv::Vec3f();
    pdf = 0;
    return QVector3D();
}
开发者ID:gidoca,项目名称:renderer,代码行数:6,代码来源:darkmatter.cpp


示例17: qCos

void QPaintedSphere3D::createVertices(int rings, int slices)
{
    _indexes.clear();
    _vertices.clear();
    const float dTheta = (M_PI * 2) / static_cast<float>(slices);
    const float dPhi   = M_PI / static_cast<float>(rings);
    const float du     = 1.0f / static_cast<float>(slices);
    const float dv     = 1.0f / static_cast<float>(rings);
    for(int lat = 0; lat < rings + 1; ++lat)
    {
        const float phi = M_PI_2 - static_cast<float>(lat) * dPhi;
        const float cosPhi = qCos(phi);
        const float sinPhi = qSin(phi);
        const float v = 1.0f - static_cast<float>(lat) * dv;

        for(int lon = 0; lon < slices + 1; ++lon)
        {
            const float theta = static_cast<float>(lon) * dTheta;
            const float cosTheta = qCos(theta);
            const float sinTheta = qSin(theta);
            const float u = static_cast<float>(lon) * du;
#if 0
            float vx = _d->radius() * cosTheta * cosPhi;
            float vy = _d->radius() * sinPhi;
            float vz = _d->radius() * sinTheta * cosPhi;
#else

            float vx = cosTheta * cosPhi;
            float vy = sinPhi;
            float vz = sinTheta * cosPhi;
#endif
#if 0
            float vtu = u; //texture coord
            float vtv = v;
            float vnx = cosTheta * cosPhi; //normals
            float vny = sinPhi;
            float vnz = sinTheta * cosPhi;

            float tn1 = sinTheta; //tangents
            float tn2 = 0.0f;
            float tn3 = -cosTheta;
            float tn4 = 1.0f;
#endif
            _vertices << QVector3D(vx, vy, vz);
        }
    }
    const int faces   = (slices << 1) * (rings - 1);
    const int indices = faces * 3;
    int nextRingStartIndex = slices + 1;
    for(int j = 0; j < slices; ++j)
    {
        _indexes << nextRingStartIndex + j;
        _indexes << 0;
        _indexes << nextRingStartIndex + j + 1;
    }
    for(int i = 1; i < (rings - 1); ++i)
    {
        const int ringStartIndex = i * (slices + 1);
        const int nextRingStartIndex = (i + 1) * (slices + 1);
        for(int j = 0; j < slices; ++j)
        {
            _indexes << ringStartIndex + j;
            _indexes << ringStartIndex + j + 1;
            _indexes << nextRingStartIndex + j;
            _indexes << nextRingStartIndex + j;
            _indexes << ringStartIndex + j + 1;
            _indexes << nextRingStartIndex + j + 1;
        }
    }
    const int ringStartIndex = (rings - 1) * (slices + 1);
    nextRingStartIndex = rings * (slices + 1);
    for ( int j = 0; j < slices; ++j )
    {
        _indexes << ringStartIndex + j + 1;
        _indexes << nextRingStartIndex;
        _indexes << ringStartIndex + j;
    }
}
开发者ID:megagrif,项目名称:ALGL,代码行数:78,代码来源:QPainter3D.cpp


示例18: direction

// TODO(bmonkey): This shouldn't be needed.
QMatrix4x4 DirectionNode::getViewNoTranslation() {
    QMatrix4x4 viewMatrixNoTranslation;
    viewMatrixNoTranslation.lookAt(QVector3D(0, 0, 0), direction(), up);
    return viewMatrixNoTranslation;
}
开发者ID:jaccen,项目名称:liblub,代码行数:6,代码来源:DirectionNode.cpp


示例19: left

	/// Returns the vector pointing along the positive local X axis
	const QVector3D left() const { return mRotation.rotatedVector(QVector3D(1,0,0)); }
开发者ID:splatterlinge,项目名称:Splatterlinge,代码行数:2,代码来源:AObject.hpp


示例20: direction

	/// Returns the vector pointing along the positive local Z axis
	const QVector3D direction() const { return mRotation.rotatedVector(QVector3D(0,0,1)); }
开发者ID:splatterlinge,项目名称:Splatterlinge,代码行数:2,代码来源:AObject.hpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ QVector4D函数代码示例发布时间:2022-05-30
下一篇:
C++ QVector2D函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap