本文整理汇总了C++中Matrix4x4f::const_value_ptr方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix4x4f::const_value_ptr方法的具体用法?C++ Matrix4x4f::const_value_ptr怎么用?C++ Matrix4x4f::const_value_ptr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Matrix4x4f
的用法示例。
在下文中一共展示了Matrix4x4f::const_value_ptr方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: renderLightVolume
void renderLightVolume(const MVPPipeline &program, const PointLight &light)
{
Matrix4x4f modelMatrix = Matrix4x4f::identity();
modelMatrix = modelMatrix.translate(light.position);
float scale = calcPointLightScale(light);
modelMatrix = modelMatrix.scale({scale, scale, scale});
glUniformMatrix4fv(program.modelMatrix, 1, GL_FALSE, modelMatrix.const_value_ptr());
Matrix4x4f viewMatrix = camera.getMatrix();
glUniformMatrix4fv(program.viewMatrix, 1, GL_FALSE, viewMatrix.const_value_ptr());
Matrix4x4f projectionMatrix = Matrix4x4f::perspective(60.0f, WINDOW_WIDTH * 1.0f / WINDOW_HEIGHT, 1.0f, 100.0f);
glUniformMatrix4fv(program.projectionMatrix, 1, GL_FALSE, projectionMatrix.const_value_ptr());
pSphereMesh->Render();
}
示例2: renderDirectionalLightPass
void renderDirectionalLightPass()
{
glDisable(GL_DEPTH_TEST);
glDepthMask(GL_FALSE);
glCullFace(GL_FRONT);
glUseProgram(directionalLightPass.program);
Matrix4x4f identity = Matrix4x4f::identity();
glUniformMatrix4fv(directionalLightPass.modelMatrix, 1, GL_FALSE, identity.const_value_ptr());
glUniformMatrix4fv(directionalLightPass.viewMatrix, 1, GL_FALSE, identity.const_value_ptr());
glUniformMatrix4fv(directionalLightPass.projectionMatrix, 1, GL_FALSE, identity.const_value_ptr());
directionalLightPass.bindUniforms();
directionalLightPass.directionalLight.setDirectionalLight(directionalLight);
pQuadMesh->Render();
glUseProgram(0);
}
示例3: renderScene
void renderScene()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glUseProgram(geometryPass.program);
Matrix4x4f viewMatrix = camera.getMatrix();
glUniformMatrix4fv(geometryPass.viewMatrix, 1, GL_FALSE, viewMatrix.const_value_ptr());
Matrix4x4f projectionMatrix = Matrix4x4f::perspective(60.0f, WINDOW_WIDTH * 1.0f / WINDOW_HEIGHT, 1.0f, 100.0f);
glUniformMatrix4fv(geometryPass.projectionMatrix, 1, GL_FALSE, projectionMatrix.const_value_ptr());
glUniform1i(geometryPass.textureSampler, 0);
for (size_t i = 0; i < sizeof(boxPositions) / sizeof(boxPositions[0]); i++) {
Matrix4x4f modelMatrix = Matrix4x4f::identity().translate(boxPositions[i]).rotatey(m_scale);
glUniformMatrix4fv(geometryPass.modelMatrix, 1, GL_FALSE, modelMatrix.const_value_ptr());
pBoxMesh->Render();
}
glUseProgram(0);
}