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


C++ Mat4::get方法代码示例

本文整理汇总了C++中Mat4::get方法的典型用法代码示例。如果您正苦于以下问题:C++ Mat4::get方法的具体用法?C++ Mat4::get怎么用?C++ Mat4::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mat4的用法示例。


在下文中一共展示了Mat4::get方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

void
PhysicsRendererer::initShader()
{
    //--------------------------------------------------------------------------
    // setup the shader
    //--------------------------------------------------------------------------
    const GLchar * vertexShaderSrc =
    "attribute vec3 positionAttr;"
    ""
    "uniform mat4 projectionTransform;"
    "uniform mat4 viewTransform;"
    "uniform mat4 modelTransform;"
    ""    
    "void main() {"
    "   gl_Position = projectionTransform * viewTransform * modelTransform * vec4(positionAttr.xyz, 1.0);"
    "}";
    
    const GLchar * fragShaderSrc =
    ""
    "uniform " HIGHP " vec3 color;"
    ""
    "void main() {"
    "   gl_FragColor = vec4(color,1.0);"
    "}";
    
    _shader.setVertexShaderSrc(vertexShaderSrc);
    _shader.setFragmentShaderSrc(fragShaderSrc);
    _shader.declareAttrib("positionAttr", _positionAttrib);
    _shader.initGL();
    
    //--------------------------------------------------------------------------
    // setup the shader matrices
    //--------------------------------------------------------------------------
    _proj.makeOrtho(0, 1,   0, 1,   1, 10);
    _view.makeLookAt(0, 0, 4,    0, 0, 0,    0, 1, 0);
    _model.makeIdentity();
    
    _shader.bind();
    _shader.setUniformMat4fv("projectionTransform", _proj.get());
    _shader.setUniformMat4fv("viewTransform",       _view.get());
    _shader.setUniformMat4fv("modelTransform",      _model.get());
    _shader.unbind();
    
}
开发者ID:CaringLabs,项目名称:MediaFramework,代码行数:44,代码来源:FilterPhysics.cpp

示例2:

TEST(Math, MatrixMul1) {
	Mat4 mat1(1.0f);
	Mat4 mat2(1.0f);
	Mat4 mat = mat1*mat2;
	ASSERT_EQ(1, mat.get(0,0));	ASSERT_EQ(0, mat.get(1,0));	ASSERT_EQ(0, mat.get(2,0));	ASSERT_EQ(0, mat.get(3,0));
	ASSERT_EQ(0, mat.get(0,1));	ASSERT_EQ(1, mat.get(1,1));	ASSERT_EQ(0, mat.get(2,1));	ASSERT_EQ(0, mat.get(3,1));
	ASSERT_EQ(0, mat.get(0,2));	ASSERT_EQ(0, mat.get(1,2));	ASSERT_EQ(1, mat.get(2,2));	ASSERT_EQ(0, mat.get(3,2));
	ASSERT_EQ(0, mat.get(0,3));	ASSERT_EQ(0, mat.get(1,3));	ASSERT_EQ(0, mat.get(2,3));	ASSERT_EQ(1, mat.get(3,3));
}
开发者ID:k-a-z-u,项目名称:K3De,代码行数:9,代码来源:Math.cpp

示例3: SendMatricesToProgram

VOID RenderTargetScene::SendMatricesToProgram( GLSLProgram* pProg, const Mat4* arrMatrices, PTriMesh pMesh ) const
{
	// Get model matrix
	Mat4 matModel = Mat4(pMesh->m_matLocal.get());	
	/*if (pMesh->GetParentMesh())
	{
		Vec3 vModelPos = pMesh->m_pMatLocal.getPosition();
		PTriMesh pParent =  pMesh->GetParentMesh();
		Vec3 vParent = pParent->m_pMatLocal.getPosition();
		matModel.setPosition(vModelPos + vParent);
	}*/
	// Get view matrix
	Mat4 matView = Mat4(arrMatrices[MATRIX_VIEW_ID].get());		
	// Get Proj matrix
	Mat4 matProj = Mat4(arrMatrices[MATRIX_PROJ_ID].get());	

	pProg->SendMatrices(matModel.get(), matView.get(), matProj.get());

	UINT unfID = pProg->GetUniformLocation("depthMVP");
	if (unfID != -1)
	{
		Mat4 matDepthMVP = matModel * arrMatrices[MATRIX_VIEW_LIGHT_ID];
		m_pOpenGL->glUniformMatrix4fv(unfID, 1, GL_FALSE, matDepthMVP.get()  );
	}
	
	
	// vScreenData
	//////////////////////////////////////////////////////////////////////////
	unfID = pProg->GetUniformLocation("vScreenData");	
	if (unfID != -1)
	{
		float fTime = ENG::GetElapsedTime() * 0.015f;
		float vScreenData[4] = {ENG::SCR_WID_INV, ENG::SCR_HEI_INV, fTime, s_STEREO ? 0.0f : 1.0f };
		m_pOpenGL->glUniform4fv(unfID, 1, vScreenData);
	}
}
开发者ID:eranegrin,项目名称:EnGine_v4,代码行数:36,代码来源:RenderTargetInput.cpp

示例4: get

Mat4 Mat4::operator*(const Mat4& right) const
{
    Mat4 result;
    float value = 0.0f;

    for (int x = 0; x < 4; x++) {
        for (int y = 0; y < 4; y++) {
            value = 0.0f;

            for (int j = 0; j < 4; j++) {
                value = value + get(x, j) + right.get(j, y);
            }

            result.set(x, y, value);
        }
    }

    return result;
}
开发者ID:binhnguyentt,项目名称:OGL-Practice,代码行数:19,代码来源:Mat4.cpp

示例5: use

void ShaderProgram::setUniformMatrix4fv(const std::string &uniformName, Mat4 value)
{
    use();
    glUniformMatrix4fv( uniform( uniformName ), 1, GL_FALSE, value.get() );
    disable();
}
开发者ID:sogimu,项目名称:glRender,代码行数:6,代码来源:shaderProgram.cpp


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