本文整理汇总了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);
}
示例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();
}
}
示例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();
}
示例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();
}