本文整理汇总了C++中Matrixf::makeTranslate方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrixf::makeTranslate方法的具体用法?C++ Matrixf::makeTranslate怎么用?C++ Matrixf::makeTranslate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Matrixf
的用法示例。
在下文中一共展示了Matrixf::makeTranslate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setCenterPos
/***************************************************************
* Function: setCenterPos()
***************************************************************/
void CAVEGroupReference::setCenterPos(const Vec3 ¢er)
{
mCenter = center;
Matrixf transMat;
transMat.makeTranslate(mCenter);
mMatrixTrans->setMatrix(transMat);
}
示例2: acceptCAVEGeodeShape
/***************************************************************
* Function: acceptCAVEGeodeShape()
*
* Compared with original coordinates data in 'CAVEGeodeShape',
* generated coordinates in 'CAVEGeodeIconSurface' is eaxctly the
* the same as those appeared in 'CAVEGeodeShape'. The scaling and
* translation to 'gIconCenter' effects are impletemented by its
* acendent 'PositionAltitudeTransform' object.
*
***************************************************************/
void CAVEGroupIconSurface::acceptCAVEGeodeShape(CAVEGeodeShape *shapeGeode, CAVEGeodeShape *shapeGeodeRef)
{
mCAVEGeodeShapeOriginPtr = shapeGeode;
CAVEGeometryVector &orgGeomVector = shapeGeode->getCAVEGeometryVector();
CAVEGeometryVector &refGeomVector = shapeGeodeRef->getCAVEGeometryVector();
int nGeoms = orgGeomVector.size();
if (nGeoms <= 0) return;
/* re-generate vertex coordinate list, keep normal and texcoords the same from 'CAGEGeodeShape' */
mSurfVertexArray = new Vec3Array;
mSurfNormalArray = new Vec3Array;
mSurfUDirArray = new Vec3Array;
mSurfVDirArray = new Vec3Array;
mSurfTexcoordArray = new Vec2Array;
Vec3Array* geodeVertexArray = shapeGeode->mVertexArray;
Vec3Array* geodeNormalArray = shapeGeode->mNormalArray;
Vec3Array* geodeUDirArray = shapeGeode->mUDirArray;
Vec3Array* geodeVDirArray = shapeGeode->mVDirArray;
Vec2Array* geodeTexcoordArray = shapeGeode->mTexcoordArray;
Vec3 *geodeVertexDataPtr, *geodeNormalDataPtr, *geodeUDirDataPtr, *geodeVDirDataPtr;
Vec2 *geodeTexcoordDataPtr;
/* check the valid status of all data field from 'CAVEGeodeShape' */
if (geodeVertexArray->getType() == Array::Vec3ArrayType)
geodeVertexDataPtr = (Vec3*) (geodeVertexArray->getDataPointer());
else return;
if (geodeNormalArray->getType() == Array::Vec3ArrayType)
geodeNormalDataPtr = (Vec3*) (geodeNormalArray->getDataPointer());
else return;
if (geodeUDirArray->getType() == Array::Vec3ArrayType)
geodeUDirDataPtr = (Vec3*) (geodeUDirArray->getDataPointer());
else return;
if (geodeVDirArray->getType() == Array::Vec3ArrayType)
geodeVDirDataPtr = (Vec3*) (geodeVDirArray->getDataPointer());
else return;
if (geodeTexcoordArray->getType() == Array::Vec2ArrayType)
geodeTexcoordDataPtr = (Vec2*) (geodeTexcoordArray->getDataPointer());
else return;
/* convert vertex coordinates from CAVEGeodeShape space to CAVEGeodeIcon space */
int nVerts = shapeGeode->mNumVertices;
for (int i = 0; i < nVerts; i++) mSurfVertexArray->push_back(geodeVertexDataPtr[i]);
/* preserve the same normals and texture coordinates */
int nNormals = shapeGeode->mNumNormals;
for (int i = 0; i < nNormals; i++)
{
mSurfNormalArray->push_back(geodeNormalDataPtr[i]);
mSurfUDirArray->push_back(geodeUDirDataPtr[i]);
mSurfVDirArray->push_back(geodeVDirDataPtr[i]);
}
int nTexcoords = shapeGeode->mNumTexcoords;
for (int i = 0; i < nTexcoords; i++) mSurfTexcoordArray->push_back(geodeTexcoordDataPtr[i]);
/* apply offset from 'gShapeCenter' to Vec3(0, 0, 0) on root level */
Matrixf transMat;
transMat.makeTranslate(-gShapeCenter);
mRootTrans->setMatrix(transMat);
/* copy CAVEGeometry objects into separate 'CAVEGeodeIconSurface' */
for (int i = 0; i < nGeoms; i++)
{
CAVEGeodeIconSurface *iconSurface = new CAVEGeodeIconSurface(&mSurfVertexArray, &mSurfNormalArray,
&mSurfTexcoordArray, &(orgGeomVector[i]), &(refGeomVector[i]));
/* 1) take record of 'iconSurface' in mCAVEGeodeIconVector; 2) add it to 'this' group */
mCAVEGeodeIconVector.push_back(iconSurface);
mRootTrans->addChild(iconSurface);
}
}