Camera FitIntoView is slow (200 ms)
#4
I have analyzed the code in FitIntoView and optimized the slowest part of the code so that this is now around 50% faster. 

But even without the optimization, this should not take so long as in your case.

After some additional checks, I see that the probable reason for a long time is that the FitIntoView code also calls Ab3d.Utilities.LinesUpdater.Instance.Refresh() method. In case when no DXEngine is used, this method regenerated all 3D lines - regenerates the geometry for all 3D lines. This can take quite some time when there are a lot of 3D lines in the scene. This call is needed to update the lines before the FitIntoView is called.

If you would use Ab3d.DXEngine than LinesUpdater.Instance.Refresh call would be a no-op. Also, rendering 3D lines is greatly accelerated and does not require costly geometry build on the CPU - you can render millions of 3D lines and still have high FPS (on a modern GPU).

To avoid calling LinesUpdater.Instance.Refresh method, you can also call camera.GetFitIntoViewDistanceOrCameraWidth (this is also called inside FitIntoView method) and the set the camera's Distance / CameraWidth based on the result of this method. But this will just postone the regeneration of lines.
Andrej Benedik
  


Messages In This Thread
RE: Camera FitIntoView is slow (200 ms) - by abenedik - 03-12-2021, 12:53 PM

Forum Jump:


Users browsing this thread:
1 Guest(s)