private void StartSegments() { Segments = new RenderSegment[CoreCount]; int remainder = (EndFrame + 1 - StartFrame) % (CoreCount); int framesPerWorker = (EndFrame + 1 - StartFrame) / (CoreCount); int currentStartFrame = StartFrame; for (int core = 0; core < CoreCount; core++) { RenderSegment segment = new RenderSegment(); segment.BlendFile = BlendFile; segment.StartFrame = currentStartFrame; segment.EndFrame = currentStartFrame + framesPerWorker - 1; segment.OutputDirectory = WorkDirectory; segment.OnComplete = new ProcessComplete(OnSegmentComplete); segment.OnFrameRendered = new FrameRendered(OnFrameRendered); if (core == CoreCount - 1) segment.EndFrame += remainder; currentStartFrame = currentStartFrame + framesPerWorker; segment.Render(); Segments[core] = segment; } }
private void OnFrameRendered(RenderSegment segment) { OnJobProgress(this); }