本文整理汇总了C++中Matrixd::ptr方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrixd::ptr方法的具体用法?C++ Matrixd::ptr怎么用?C++ Matrixd::ptr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Matrixd
的用法示例。
在下文中一共展示了Matrixd::ptr方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pushMatrix
void Camera::pushMatrix(const osg::Matrixd &mat)
{
const Matrixd m = mat * qMatrix.back();
glLoadMatrixd(m.ptr());
CHECK_GL();
qMatrix.push_back(m);
}
示例2: recordPathEntry
/***************************************************************
* Function: recordPathEntry()
*
* Write current scale and xform matrix to file with time stamp
*
***************************************************************/
void PathRecordManager::recordPathEntry(const double &scale, const Matrixd &xMat)
{
if (!mFilePtr) return;
fwrite(&mTimer,sizeof(double),1,mFilePtr);
double scaled = scale;
fwrite(&scaled,sizeof(double),1,mFilePtr);
fwrite(xMat.ptr(),16*sizeof(double),1,mFilePtr);
/*fprintf(mFilePtr, "%f %f ", mTimer, scale);
fprintf(mFilePtr, "%f %f %f %f ", xMat(0, 0), xMat(0, 1), xMat(0, 2), xMat(0, 3));
fprintf(mFilePtr, "%f %f %f %f ", xMat(1, 0), xMat(1, 1), xMat(1, 2), xMat(1, 3));
fprintf(mFilePtr, "%f %f %f %f ", xMat(2, 0), xMat(2, 1), xMat(2, 2), xMat(2, 3));
fprintf(mFilePtr, "%f %f %f %f ", xMat(3, 0), xMat(3, 1), xMat(3, 2), xMat(3, 3));
fprintf(mFilePtr, "\n");*/
}
示例3: preFrame
//.........这里部分代码省略.........
case 2:
// For Airplane movement
rx += angle[1];
ry -= angle[2];
y += velocity; // allow velocity to scale
break;
case 3:
// Old fly mode
rx += angle[1];
ry -= coord[0] * .5; // Fixes orientation
rz += angle[2];
y += velocity; // allow velocity to scale
break;
case 5:
if(node_name != NULL){
adjustNode(height, magnitude, position);
}
else cout<<"No Node Selected"<<endl;
break;
}
// Scales data by set amount
x *= transcale;
y *= transcale;
z *= transcale;
rx *= rotscale;
rz *= rotscale;
ry *= rotscale;
/*
* If newMode (which occurs when Drive and New Fly starts),
* this takes in a new headMat camera pos.
* If not, this takes in the old position, with the exception
* of the z axis, which corresponds to moving your head up and down
* to eliminate conflict between phone and head tracker movement.
*/
Matrix world2head = PluginHelper::getHeadMat();
Matrix view, mtrans;
if(useDeviceOrientationTracking){
view.makeRotate(orientation,0,0,1);
mtrans.makeTranslate(world2head.getTrans());
view = view * mtrans;
} else
view = world2head;
Vec3 campos = view.getTrans();
// Gets translation
Vec3 trans = Vec3(x, y, z);
//Test
if(useHeadTracking){
trans = (trans * view) - campos;
}else if(useDeviceOrientationTracking){
trans = (trans * view) - campos;
}
Matrix tmat;
tmat.makeTranslate(trans);
Vec3 xa = Vec3(1.0, 0.0, 0.0);
Vec3 ya = Vec3(0.0, 1.0, 0.0);
Vec3 za = Vec3(0.0, 0.0, 1.0);
//Test
if(useHeadTracking){
xa = (xa * view) - campos;
ya = (ya * view) - campos;
za = (za * view) - campos;
}else if(useDeviceOrientationTracking){
xa = (xa * view) - campos;
ya = (ya * view) - campos;
za = (za * view) - campos;
}
// Gets rotation
Matrix rot;
rot.makeRotate(rx, xa, ry, ya, rz, za);
Matrix ctrans, nctrans;
ctrans.makeTranslate(campos);
nctrans.makeTranslate(-campos);
// Calculates new objectMatrix (will send to Slaves).
//finalmat = PluginHelper::getObjectMatrix() * nctrans * rot * tmat * ctrans;
finalmat = PluginHelper::getObjectMatrix() * nctrans * rot * tmat * ctrans;
ComController::instance()->sendSlaves((char *)finalmat.ptr(), sizeof(double[16]));
PluginHelper::setObjectMatrix(finalmat);
}
else
{
ComController::instance()->readMaster((char *)finalmat.ptr(), sizeof(double[16]));
PluginHelper::setObjectMatrix(finalmat);
}
}