AcGsRenderProgressMonitor Interface

AcGsRenderProgressMonitor is an interface to be implemented by hosts of RenderToImage(). It provides the following functionality:

It is best to implement this interface for the class from which you will be calling this function, and pass in the this pointer to the RenderToImage() call.

The AcGsRenderProgressMonitor::OnProgress() callback returns the current rendering phase and the progress percentage of that phase. This function will be called approximately once per second during the render operation. An implementation of this function should return false to continue rendering, or true to abort. When aborted, the value returned by ShouldReuseDatabase() is ignored, and the render database is not saved.

The OnTile() function provides preview image tiles of the render during the process. This function is called twice per tile; once before and once after the render. The pixel data is null on the first call, and contains the rendered tile on the second call. This can be used to provide preview tiles while the render is in progress. Note that the pixel data returned by this function is in BGRA bottom-up format, while AutoCAD’s viewport display uses a BGRA top-down format.

When the rendering is completed, the renderer returns statistics through SetStatistics(). The information is returned in an AcGsRenderStatistics object. It contains the time to render, memory usage, and number of materials, lights, and triangles.

After the operation is completed, the ShouldReuseDatabase() function is called to determine whether the renderer should reuse it’s database on the next call. Reusing the database improves the speed of the rendering when the same scene is being rendered with different camera settings. If this function returns true, the renderer caches the previous geometry, lights, and materials. Only the camera is translated on the next call to RenderToImage(). This flag is not honored if the call to RenderToImage() was aborted by returning false in AcGsRenderProgressMonitor::OnProgress().