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


C++ Matrix4x4f::const_value_ptr方法代码示例

本文整理汇总了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();
}
开发者ID:cntoplolicon,项目名称:grape,代码行数:16,代码来源:deferred_shading.cpp

示例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);
}
开发者ID:cntoplolicon,项目名称:grape,代码行数:19,代码来源:deferred_shading.cpp

示例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);
}
开发者ID:cntoplolicon,项目名称:grape,代码行数:21,代码来源:deferred_shading.cpp


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