コード例 #1
0
void gfx_body_render_first_person (GfxPipeline *p, bool alpha_blend)
{
    // Gbuffer stores depth from 0 to 1 (cam to far clip plane), so we could render first person
    // bodies into the gbuffer even though they have different clip planes.  However I think this
    // would have shadow artifacts.  So instead, I'll treat it as a point when lighting it, i.e.
    // sample shadow buffer at a point and intersect the camera with the point lights to determine
    // the ones that should be used to light us.

    Ogre::Frustum frustum;  // Used to calculate projection matrix.
    frustum.setFOVy(Ogre::Degree(p->getCameraOpts().fovY));
    frustum.setAspectRatio(p->getCamera()->getAspectRatio());
    frustum.setNearClipDistance(gfx_option(GFX_FIRST_PERSON_NEAR_CLIP));
    frustum.setFarClipDistance(gfx_option(GFX_FIRST_PERSON_FAR_CLIP));
    // No 3d effect on first person objects (TODO: I think that's right, need to actually verify)
    frustum.setFrustumOffset(0);
    frustum.setFocalLength(1);

    GfxShaderGlobals g =
        gfx_shader_globals_cam(p, frustum.getProjectionMatrix());

    // Render, to HDR buffer
    // TODO: receive shadow
    // TODO: instancing

    for (const auto &body : first_person_bodies) {
        body->renderFirstPerson(g, alpha_blend);
    }
}
コード例 #2
0
ファイル: gfx_decal.cpp プロジェクト: grit-engine/grit-engine
void gfx_decal_render (GfxPipeline *p)
{
    GfxShaderGlobals g = gfx_shader_globals_cam(p);

    for (GfxDecal *decal : all_decals) {
        decal->render(g);
    }
}