本文整理汇总了C++中GLC_Matrix4x4::getData方法的典型用法代码示例。如果您正苦于以下问题:C++ GLC_Matrix4x4::getData方法的具体用法?C++ GLC_Matrix4x4::getData怎么用?C++ GLC_Matrix4x4::getData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GLC_Matrix4x4
的用法示例。
在下文中一共展示了GLC_Matrix4x4::getData方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: glGetIntegerv
QList<GLC_Point2d> GLC_Viewport::project(const QList<GLC_Point3d> &points, bool useCameraMatrix) const
{
QList<GLC_Point2d> subject;
GLC_Matrix4x4 modelView;
GLC_Matrix4x4 projectionMatrix;
GLint viewport[4]= {0, 0, m_Width, m_Height};
if (useCameraMatrix)
{
modelView= m_pViewCam->modelViewMatrix();
projectionMatrix= m_ProjectionMatrix;
}
else
{
modelView= GLC_Context::current()->modelViewMatrix();
glGetIntegerv(GL_VIEWPORT, viewport);
projectionMatrix= GLC_Context::current()->projectionMatrix();
}
double x;
double y;
double z;
const int count= points.count();
for (int i= 0; i < count; ++i)
{
const GLC_Point3d point= points.at(i);
glc::gluProject(point.x(), point.y(), point.z(), modelView.getData(), projectionMatrix.getData(), viewport, &x, &y, &z);
subject.append(GLC_Point2d(x, y));
}
return subject;
}
示例2: project
GLC_Point2d GLC_Viewport::project(const GLC_Point3d &point, bool useCameraMatrix) const
{
GLC_Matrix4x4 modelView;
GLC_Matrix4x4 projectionMatrix;
GLint viewport[4]= {0, 0, m_Width, m_Height};
if (useCameraMatrix)
{
modelView= m_pViewCam->modelViewMatrix();
projectionMatrix= m_ProjectionMatrix;
}
else
{
modelView= GLC_Context::current()->modelViewMatrix();
glGetIntegerv(GL_VIEWPORT, viewport);
projectionMatrix= GLC_Context::current()->projectionMatrix();
}
double x;
double y;
double z;
glc::gluProject(point.x(), point.y(), point.z(), modelView.getData(), projectionMatrix.getData(), viewport, &x, &y, &z);
GLC_Vector2d subject;
subject.setX(x);
subject.setY(y);
return subject;
}
示例3: glcMultMatrix
void GLC_ContextSharedData::glcMultMatrix(const GLC_Matrix4x4 &matrix)
{
const GLC_Matrix4x4 current= m_MatrixStackHash.value(m_CurrentMatrixMode)->top();
m_MatrixStackHash.value(m_CurrentMatrixMode)->top()= current * matrix;
#ifdef GLC_OPENGL_ES_2
m_UniformShaderData.setModelViewProjectionMatrix(m_MatrixStackHash.value(GL_MODELVIEW)->top(), m_MatrixStackHash.value(GL_PROJECTION)->top());
#else
if (GLC_Shader::hasActiveShader())
{
m_UniformShaderData.setModelViewProjectionMatrix(m_MatrixStackHash.value(GL_MODELVIEW)->top(), m_MatrixStackHash.value(GL_PROJECTION)->top());
}
::glMultMatrixd(matrix.getData());
#endif
}
示例4: setModelViewProjectionMatrix
void GLC_UniformShaderData::setModelViewProjectionMatrix(const GLC_Matrix4x4& modelView, const GLC_Matrix4x4& projection)
{
// Set model view matrix
const double* pMvmatrixData= modelView.getData();
GLfloat mvFloatMatrix[4][4];
GLfloat* pData= &(mvFloatMatrix[0][0]);
for (int i= 0; i < 16; ++i)
{
pData[i]= static_cast<GLfloat>(pMvmatrixData[i]);
}
// Set model view projection matrix
GLC_Matrix4x4 modelViewProjectionMatrix= projection * modelView;
const double* pMvpmatrixData= modelViewProjectionMatrix.getData();
GLfloat mvpFloatMatrix[4][4];
pData= &(mvpFloatMatrix[0][0]);
for (int i= 0; i < 16; ++i)
{
pData[i]= static_cast<GLfloat>(pMvpmatrixData[i]);
}
// Set the transpose of inv model view matrix (For normal computation)
GLC_Matrix4x4 invTransposeModelView= modelView.inverted();
invTransposeModelView.transpose();
GLfloat invTmdv[3][3];
{
const double* data= invTransposeModelView.getData();
invTmdv[0][0]= static_cast<GLfloat>(data[0]); invTmdv[1][0]= static_cast<GLfloat>(data[4]); invTmdv[2][0]= static_cast<GLfloat>(data[8]);
invTmdv[0][1]= static_cast<GLfloat>(data[1]); invTmdv[1][1]= static_cast<GLfloat>(data[5]); invTmdv[2][1]= static_cast<GLfloat>(data[9]);
invTmdv[0][2]= static_cast<GLfloat>(data[2]); invTmdv[1][2]= static_cast<GLfloat>(data[6]); invTmdv[2][2]= static_cast<GLfloat>(data[10]);
}
Q_ASSERT(GLC_Shader::hasActiveShader());
GLC_Shader* pCurrentShader= GLC_Shader::currentShaderHandle();
pCurrentShader->programShaderHandle()->setUniformValue(pCurrentShader->modelViewLocationId(), mvFloatMatrix);
pCurrentShader->programShaderHandle()->setUniformValue(pCurrentShader->mvpLocationId(), mvpFloatMatrix);
pCurrentShader->programShaderHandle()->setUniformValue(pCurrentShader->invModelViewLocationId(), invTmdv);
}
示例5: spaceChar
QString GLC_WorldTo3dxml::matrixString(const GLC_Matrix4x4& matrix)
{
QString resultMatrix;
const QChar spaceChar(' ');
// Rotation
resultMatrix+= QString::number(matrix.getData()[0], 'g', 16) + spaceChar;
resultMatrix+= QString::number(matrix.getData()[1], 'g', 16) + spaceChar;
resultMatrix+= QString::number(matrix.getData()[2], 'g', 16) + spaceChar;
resultMatrix+= QString::number(matrix.getData()[4], 'g', 16) + spaceChar;
resultMatrix+= QString::number(matrix.getData()[5], 'g', 16) + spaceChar;
resultMatrix+= QString::number(matrix.getData()[6], 'g', 16) + spaceChar;
resultMatrix+= QString::number(matrix.getData()[8], 'g', 16) + spaceChar;
resultMatrix+= QString::number(matrix.getData()[9], 'g', 16) + spaceChar;
resultMatrix+= QString::number(matrix.getData()[10], 'g', 16) + spaceChar;
// Translation
resultMatrix+= QString::number(matrix.getData()[12], 'g', 16) + spaceChar;
resultMatrix+= QString::number(matrix.getData()[13], 'g', 16) + spaceChar;
resultMatrix+= QString::number(matrix.getData()[14], 'g', 16);
return resultMatrix;
}