本文整理汇总了C++中GLC_Matrix4x4::setData方法的典型用法代码示例。如果您正苦于以下问题:C++ GLC_Matrix4x4::setData方法的具体用法?C++ GLC_Matrix4x4::setData怎么用?C++ GLC_Matrix4x4::setData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GLC_Matrix4x4
的用法示例。
在下文中一共展示了GLC_Matrix4x4::setData方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: glcOrtho
void GLC_Context::glcOrtho(double left, double right, double bottom, double top, double nearVal, double farVal)
{
GLC_Matrix4x4 orthoMatrix;
double* m= orthoMatrix.setData();
const double tx= - (right + left) / (right - left);
const double ty= - (top + bottom) / (top - bottom);
const double tz= - (farVal + nearVal) / (farVal - nearVal);
m[0]= 2.0 / (right - left);
m[5]= 2.0 / (top - bottom);
m[10]= -2.0 / (farVal - nearVal);
m[12]= tx;
m[13]= ty;
m[14]= tz;
glcMultMatrix(orthoMatrix);
}
示例2: glcFrustum
void GLC_Context::glcFrustum(double left, double right, double bottom, double top, double nearVal, double farVal)
{
GLC_Matrix4x4 perspMatrix;
double* m= perspMatrix.setData();
const double a= (right + left) / (right - left);
const double b= (top + bottom) / (top - bottom);
const double c= - (farVal + nearVal) / (farVal - nearVal);
const double d= - (2.0 * farVal * nearVal) / (farVal - nearVal);
m[0]= (2.0 * nearVal) / (right - left);
m[5]= (2.0 * nearVal) / (top - bottom);
m[8]= a;
m[9]= b;
m[10]= c;
m[11]= -1.0;
m[14]= d;
m[15]= 0.0;
glcMultMatrix(perspMatrix);
}
示例3: updateAttitude
//////////////////////////////////////////////////////////////////////
// Private slots Functions
//////////////////////////////////////////////////////////////////////
void ModelViewGadgetWidget::updateAttitude()
{
AttitudeActual::DataFields data = attActual->getData(); // get attitude data
GLC_StructOccurence *rootObject = m_World.rootOccurence(); // get the full 3D model
double x = data.q3;
double y = data.q2;
double z = data.q4;
double w = data.q1;
if (w == 0.0) {
w = 1.0;
}
// create and gives the product of 2 4x4 matrices to get the rotation of the 3D model's matrix
QMatrix4x4 m1;
m1.setRow(0, QVector4D(w, z, -y, x));
m1.setRow(1, QVector4D(-z, w, x, y));
m1.setRow(2, QVector4D(y, -x, w, z));
m1.setRow(3, QVector4D(-x, -y, -z, w));
QMatrix4x4 m2;
m2.setRow(0, QVector4D(w, z, -y, -x));
m2.setRow(1, QVector4D(-z, w, x, -y));
m2.setRow(2, QVector4D(y, -x, w, -z));
m2.setRow(3, QVector4D(x, y, z, w));
QMatrix4x4 m0 = m1 * m2;
// convert QMatrix4x4 to GLC_Matrix4x4
GLC_Matrix4x4 rootObjectRotation;
{
double *newMatrixData = rootObjectRotation.setData();
double *oldMatrixData = (double *)m0.data();
for (int i = 0; i < 16; i++) {
newMatrixData[i] = oldMatrixData[i];
}
}
// sets and updates the 3D model's matrix
rootObject->structInstance()->setMatrix(rootObjectRotation);
rootObject->updateChildrenAbsoluteMatrix();
updateGL();
}