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


C++ Matrix4d::setTranslation方法代码示例

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


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

示例1: Board

Board2::Board2() : Board()
{
  setSize(5.0, 20.0);
  
  //player 0 bas
  Matrix4d pt;
  pt.setTranslation(Point3d(0.0, -9.5, 0.0));
  mPlayerTransformations.push_back(pt);
  //player 1 haut
  pt = getRotationMatrix(180 * kDegreeToRadian,
    Vector3d(0.0, 0.0, 1.0));
  pt.setTranslation(Point3d(0.0, 9.5, 0.0));
  mPlayerTransformations.push_back(pt);

  //net 0 bas
  Matrix4d nt;
  nt.setTranslation(Point3d(0.0, -10.0, 0.0));
  mNetTransformations.push_back(nt);
  //net 1 haut
  nt = getRotationMatrix(180 * kDegreeToRadian,
    Vector3d(0.0, 0.0, 1.0));
  nt.setTranslation(Point3d(0.0, 10.0, 0.0));
  mNetTransformations.push_back(nt);
}
开发者ID:realisim,项目名称:realisim,代码行数:24,代码来源:GameWindow.cpp

示例2: addCollision

void GameWindow::addCollision(const Vector3d& p, const Vector3d& n)
{
  Collision* c = 0;
  for(unsigned int i = 0; i < cMaxCollisions; ++i)
    if(mCollisions[i]->isDone())
    { c = mCollisions[i]; break; }

  if(c)
  {
    Matrix4d m;
    m.setTranslation(toPoint(p));
    c->setTransformationToGlobal(m);
    double a = atan2(n.getY(), n.getX());
    c->setAngle(a);
    c->setNormal(n);
    c->animate();
  }
}
开发者ID:realisim,项目名称:realisim,代码行数:18,代码来源:GameWindow.cpp

示例3: startGame

void GameWindow::startGame() 
{
  //initialize collision object
  for(unsigned int i = 0; i < cMaxCollisions; ++i)
  {
    mCollisions[i] = new Collision();
    mCollisions[i]->setTexture(mGameAssets, QRect(264, 168, 72, 960));
  }
  
  //add balls
  mBalls.push_back(new Ball());
  //load textured object
  for(unsigned int i = 0; i < mBalls.size(); ++i)
    mBalls[i]->setTexture(mGameAssets, QRect(12, 12, 48, 48));
    
  //create the static board game
  mpBoard = new Board2();
  
  //init player position and orientation, define the local player.
  for(unsigned int i = 0; i < mPlayers.size(); ++i)
  {
    mPlayers[i]->setTransformationToGlobal(mpBoard->getPlayerTransformation(i));
    mNets[i]->setTransformationToGlobal(mpBoard->getNetTransformation(i));
  }
  
  mpLocalPlayer = mPlayers[0];
  mpLocalPlayer->setType(Player::tHuman);
  Camera c = getCamera();
  Matrix4d cm = mpLocalPlayer->getTransformationToGlobal();
  cm.setTranslation(Point3d(0.0));
  c.setTransformationToGlobal(cm);
  setCamera(c);
  
  //init chipMunk and physics
  cpInitChipmunk();
  mpPhysics = new Physics(this, *mpBoard, mBalls, mNets, mPlayers);
  resumeGame();
}
开发者ID:realisim,项目名称:realisim,代码行数:38,代码来源:GameWindow.cpp

示例4: spin_value_changed

  void spin_value_changed (int axis)
  {
    Shape *shape;
    TreeObject *object;

    if (m_inhibit_update)
      return;
    if (!m_view->get_selected_stl(object, shape))
      return;
    if (!object && !shape)
      return;

    double val = m_xyz[axis]->get_value();
    Matrix4d *mat;
    if (!shape)
        mat = &object->transform3D.transform;
    else
        mat = &shape->transform3D.transform;
    Vector3d trans = mat->getTranslation();
    trans.xyz[axis] = val;
    mat->setTranslation (trans);
    m_view->get_model()->CalcBoundingBoxAndCenter();
  }
开发者ID:,项目名称:,代码行数:23,代码来源:


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