Merge remote-tracking branch 'origin/master' into 1.8
# Conflicts: # Flax.flaxproj
This commit is contained in:
@@ -18,6 +18,7 @@ void RenderView::Prepare(RenderContext& renderContext)
|
||||
// Check if use TAA (need to modify the projection matrix)
|
||||
Float2 taaJitter;
|
||||
NonJitteredProjection = Projection;
|
||||
IsTaaResolved = false;
|
||||
if (renderContext.List->Setup.UseTemporalAAJitter)
|
||||
{
|
||||
// Move to the next frame
|
||||
@@ -82,6 +83,18 @@ void RenderView::PrepareCache(const RenderContext& renderContext, float width, f
|
||||
MainScreenSize = mainView->ScreenSize;
|
||||
}
|
||||
|
||||
void RenderView::UpdateCachedData()
|
||||
{
|
||||
Matrix::Invert(View, IV);
|
||||
Matrix::Invert(Projection, IP);
|
||||
Matrix viewProjection;
|
||||
Matrix::Multiply(View, Projection, viewProjection);
|
||||
Frustum.SetMatrix(viewProjection);
|
||||
Matrix::Invert(viewProjection, IVP);
|
||||
CullingFrustum = Frustum;
|
||||
NonJitteredProjection = Projection;
|
||||
}
|
||||
|
||||
void RenderView::SetUp(const Matrix& viewProjection)
|
||||
{
|
||||
// Copy data
|
||||
@@ -201,3 +214,27 @@ void RenderView::GetWorldMatrix(const Transform& transform, Matrix& world) const
|
||||
const Float3 translation = transform.Translation - Origin;
|
||||
Matrix::Transformation(transform.Scale, transform.Orientation, translation, world);
|
||||
}
|
||||
|
||||
TaaJitterRemoveContext::TaaJitterRemoveContext(const RenderView& view)
|
||||
{
|
||||
if (view.IsTaaResolved)
|
||||
{
|
||||
// Cancel-out sub-pixel jitter when drawing geometry after TAA has been resolved
|
||||
_view = (RenderView*)&view;
|
||||
_prevProjection = view.Projection;
|
||||
_prevNonJitteredProjection = view.NonJitteredProjection;
|
||||
_view->Projection = _prevNonJitteredProjection;
|
||||
_view->UpdateCachedData();
|
||||
}
|
||||
}
|
||||
|
||||
TaaJitterRemoveContext::~TaaJitterRemoveContext()
|
||||
{
|
||||
if (_view)
|
||||
{
|
||||
// Restore projection
|
||||
_view->Projection = _prevProjection;
|
||||
_view->UpdateCachedData();
|
||||
_view->NonJitteredProjection = _prevNonJitteredProjection;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user