当前位置: 首页>>代码示例>>C++>>正文


C++ GLC_Matrix4x4::getData方法代码示例

本文整理汇总了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;
}
开发者ID:JasonWinston,项目名称:GLC_lib,代码行数:34,代码来源:glc_viewport.cpp

示例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;
}
开发者ID:JasonWinston,项目名称:GLC_lib,代码行数:29,代码来源:glc_viewport.cpp

示例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
}
开发者ID:JasonWinston,项目名称:GLC_lib,代码行数:14,代码来源:glc_contextshareddata.cpp

示例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);
}
开发者ID:JasonWinston,项目名称:GLC_lib,代码行数:40,代码来源:glc_uniformshaderdata.cpp

示例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;
}
开发者ID:AlessioMorale,项目名称:GLC_lib,代码行数:24,代码来源:glc_worldto3dxml.cpp


注:本文中的GLC_Matrix4x4::getData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。