Function beginFrame

Synopsis

#include <Source/Falcor/Scene/Camera/Camera.h>

Changes beginFrame(bool firstFrame=false)

Description

Begin frame. Should be called once at the start of each frame. This is where we store the previous frame matrices.

Parameters:

[ in ] firstFrame - Set to true on the first frame or after switching cameras.

Source

Lines 62-103 in Source/Falcor/Scene/Camera/Camera.cpp. Line 259 in Source/Falcor/Scene/Camera/Camera.h.

Camera::Changes Camera::beginFrame(bool firstFrame)
{
    if (mJitterPattern.pGenerator)
    {
        float2 jitter = mJitterPattern.pGenerator->next();
        jitter *= mJitterPattern.scale;
        setJitterInternal(jitter.x, jitter.y);
    }
    calculateCameraParameters();
    if (firstFrame) mPrevData = mData;
    // Keep copies of the transforms used for the previous frame. We need these for computing motion vectors etc.
    mData.prevViewProjMatNoJitter = mPrevData.viewProjMatNoJitter;
    mChanges = is_set(mChanges, Changes::Movement | Changes::Frustum) ? Changes::History : Changes::None;
    if (mPrevData.posW != mData.posW) mChanges |= Changes::Movement;
    if (mPrevData.up != mData.up) mChanges |= Changes::Movement;
    if (mPrevData.target != mData.target) mChanges |= Changes::Movement;
    if (mPrevData.focalDistance != mData.focalDistance) mChanges    |= Changes::FocalDistance;
    if (mPrevData.apertureRadius != mData.apertureRadius) mChanges  |= Changes::Aperture | Changes::Exposure;
    if (mPrevData.shutterSpeed != mData.shutterSpeed) mChanges      |= Changes::Exposure;
    if (mPrevData.ISOSpeed != mData.ISOSpeed) mChanges              |= Changes::Exposure;
    if (mPrevData.focalLength != mData.focalLength) mChanges |= Changes::Frustum;
    if (mPrevData.aspectRatio != mData.aspectRatio) mChanges |= Changes::Frustum;
    if (mPrevData.nearZ != mData.nearZ)             mChanges |= Changes::Frustum;
    if (mPrevData.farZ != mData.farZ)               mChanges |= Changes::Frustum;
    if (mPrevData.frameHeight != mData.frameHeight) mChanges |= Changes::Frustum;
    if (mPrevData.frameWidth != mData.frameWidth)   mChanges |= Changes::Frustum;
    // Jitter
    if (mPrevData.jitterX != mData.jitterX) mChanges |= Changes::Jitter;
    if (mPrevData.jitterY != mData.jitterY) mChanges |= Changes::Jitter;
    mPrevData = mData;
    return getChanges();
}





Add Discussion as Guest

Log in to DocsForge