Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion trinity/Eve/EveSpaceSceneRenderDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,7 @@ EveSpaceSceneRenderDriver::ReflectionFaces EveSpaceSceneRenderDriver::PrepareRef
ReflectionFaces faces;

Tr2ReflectionProbe* probe = m_scene->GetReflectionProbe();
if( !probe || !probe->IsValid() || !m_scene->m_display )
if( !probe || !probe->IsValid() || !m_scene->m_display || !probe->ShouldRenderThisFrame() )
{
return faces;
}
Expand Down
10 changes: 10 additions & 0 deletions trinity/Tr2ReflectionProbe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,16 @@ bool Tr2ReflectionProbe::HasData() const
return m_hasData && m_postFilterTarget->IsValid();
}

bool Tr2ReflectionProbe::ShouldRenderThisFrame() const
{
if( m_renderFrequency != ONE_SIDE_EVERY_OTHER_FRAME || !m_onePassDone )
{
return true;
}
// Frame parity rather than a toggle, so the answer stays the same however often a frame asks
return ( Tr2Renderer::GetCurrentFrameCounter() & 1 ) == 0;
}

uint8_t Tr2ReflectionProbe::GetStartFace() const
{
if( m_renderFrequency == ALL_SIDES_PER_FRAME || !m_onePassDone )
Expand Down
8 changes: 7 additions & 1 deletion trinity/Tr2ReflectionProbe.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ BLUE_CLASS( Tr2ReflectionProbe ) :
enum ReflectionProbeRenderFrequency
{
ONE_SIDE_PER_FRAME,
ALL_SIDES_PER_FRAME
ALL_SIDES_PER_FRAME,
// Renders one face and re-filters the cube on every second frame only, so a full
// update takes 12 frames. Halves the reflection pass cost for a slower update.
ONE_SIDE_EVERY_OTHER_FRAME
};

Tr2ReflectionProbe( IRoot* lockobj = NULL );
Expand All @@ -44,6 +47,9 @@ BLUE_CLASS( Tr2ReflectionProbe ) :
bool IsHollyWoodModeOn() const;
bool ReadyForDynamicObjectReflections() const;

// False on the frames that ONE_SIDE_EVERY_OTHER_FRAME skips; the render driver then
// renders no reflection faces and the last filtered reflection stays in use.
bool ShouldRenderThisFrame() const;
uint8_t GetStartFace() const;
uint8_t GetEndFace() const;

Expand Down
1 change: 1 addition & 0 deletions trinity/Tr2ReflectionProbe_Blue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ BLUE_DEFINE( Tr2ReflectionProbe );
const Be::VarChooser RenderFrequencyChooser[] = {
{ "OneSidePerFrame", BeCast( Tr2ReflectionProbe::ONE_SIDE_PER_FRAME ), "One side per frame" },
{ "AllSidesPerFrame", BeCast( Tr2ReflectionProbe::ALL_SIDES_PER_FRAME ), "All sides per frame" },
{ "OneSideEveryOtherFrame", BeCast( Tr2ReflectionProbe::ONE_SIDE_EVERY_OTHER_FRAME ), "One side every other frame" },
{ 0 }
};

Expand Down