|
@@ -75,7 +75,6 @@ internal class SceneRenderer : IDisposable
|
|
/*TODO:
|
|
/*TODO:
|
|
- [ ] Onion skinning
|
|
- [ ] Onion skinning
|
|
- [ ] Previews generation
|
|
- [ ] Previews generation
|
|
- - [ ] Panning doesn't rerender in cases where it should
|
|
|
|
- [ ] Rendering optimizer
|
|
- [ ] Rendering optimizer
|
|
- [?] Render thread and proper locking/synchronization
|
|
- [?] Render thread and proper locking/synchronization
|
|
*/
|
|
*/
|
|
@@ -92,7 +91,7 @@ internal class SceneRenderer : IDisposable
|
|
|
|
|
|
IReadOnlyNodeGraph finalGraph = RenderingUtils.SolveFinalNodeGraph(targetOutput, Document);
|
|
IReadOnlyNodeGraph finalGraph = RenderingUtils.SolveFinalNodeGraph(targetOutput, Document);
|
|
bool shouldRerender =
|
|
bool shouldRerender =
|
|
- ShouldRerender(renderTargetSize, targetMatrix, resolution, viewportId, targetOutput, finalGraph, previewTextures);
|
|
|
|
|
|
+ ShouldRerender(renderTargetSize, targetMatrix, resolution, viewportId, targetOutput, finalGraph, previewTextures, visibleDocumentRegion);
|
|
|
|
|
|
if (shouldRerender)
|
|
if (shouldRerender)
|
|
{
|
|
{
|
|
@@ -182,7 +181,8 @@ internal class SceneRenderer : IDisposable
|
|
private bool ShouldRerender(VecI targetSize, Matrix3X3 matrix, ChunkResolution resolution,
|
|
private bool ShouldRerender(VecI targetSize, Matrix3X3 matrix, ChunkResolution resolution,
|
|
Guid viewportId,
|
|
Guid viewportId,
|
|
string targetOutput,
|
|
string targetOutput,
|
|
- IReadOnlyNodeGraph finalGraph, Dictionary<Guid, List<PreviewRenderRequest>>? previewTextures)
|
|
|
|
|
|
+ IReadOnlyNodeGraph finalGraph, Dictionary<Guid, List<PreviewRenderRequest>>? previewTextures,
|
|
|
|
+ RectI? visibleDocumentRegion)
|
|
{
|
|
{
|
|
if (!DocumentViewModel.SceneTextures.TryGetValue(viewportId, out var cachedTexture) || cachedTexture == null ||
|
|
if (!DocumentViewModel.SceneTextures.TryGetValue(viewportId, out var cachedTexture) || cachedTexture == null ||
|
|
cachedTexture.IsDisposed)
|
|
cachedTexture.IsDisposed)
|
|
@@ -206,7 +206,8 @@ internal class SceneRenderer : IDisposable
|
|
ChunkResolution = resolution,
|
|
ChunkResolution = resolution,
|
|
HighResRendering = HighResRendering,
|
|
HighResRendering = HighResRendering,
|
|
TargetOutput = targetOutput,
|
|
TargetOutput = targetOutput,
|
|
- GraphCacheHash = finalGraph.GetCacheHash()
|
|
|
|
|
|
+ GraphCacheHash = finalGraph.GetCacheHash(),
|
|
|
|
+ VisibleDocumentRegion = (RectD?)visibleDocumentRegion ?? new RectD(0, 0, Document.Size.X, Document.Size.Y)
|
|
};
|
|
};
|
|
|
|
|
|
if (lastRenderedStates.TryGetValue(viewportId, out var lastState))
|
|
if (lastRenderedStates.TryGetValue(viewportId, out var lastState))
|
|
@@ -349,10 +350,12 @@ struct RenderState
|
|
public bool HighResRendering { get; set; }
|
|
public bool HighResRendering { get; set; }
|
|
public string TargetOutput { get; set; }
|
|
public string TargetOutput { get; set; }
|
|
public int GraphCacheHash { get; set; }
|
|
public int GraphCacheHash { get; set; }
|
|
|
|
+ public RectD VisibleDocumentRegion { get; set; }
|
|
|
|
|
|
public bool Equals(RenderState other)
|
|
public bool Equals(RenderState other)
|
|
{
|
|
{
|
|
return ChunkResolution.Equals(other.ChunkResolution) && HighResRendering == other.HighResRendering &&
|
|
return ChunkResolution.Equals(other.ChunkResolution) && HighResRendering == other.HighResRendering &&
|
|
- TargetOutput == other.TargetOutput && GraphCacheHash == other.GraphCacheHash;
|
|
|
|
|
|
+ TargetOutput == other.TargetOutput && GraphCacheHash == other.GraphCacheHash &&
|
|
|
|
+ VisibleDocumentRegion == other.VisibleDocumentRegion;
|
|
}
|
|
}
|
|
}
|
|
}
|