coin3d / soqt

Old Coin GUI binding for Qt, replaced by Quarter
BSD 3-Clause "New" or "Revised" License
23 stars 17 forks source link

autoclipping nearlimit is ignored for orthographic cameras #76

Open foobarbecue opened 9 months ago

foobarbecue commented 9 months ago

When you set autoclipping with an strategy like

mySoQtViewer->setAutoClippingStrategy(SoQtViewer::CONSTANT_NEAR_PLANE, 0.7)

0.7 defines the minimum near plane distance. This works well for perspective camera, but for orthographic cameras it is totally ignored. In situations where the orthographic camera is moved into the scene bounding box, the near clip value becomes negative, and objects behind the camera remain visible as the camera moves pasat them.

I'm not sure why the code was written this way, but it's clear that this->autoclipvalue is only referenced when camera isOfType SoPerspectiveCamera here:

https://github.com/coin3d/sogui/blob/243e78abedaa88a22babc3357e9dfca1b75a2a95/viewers/SoGuiViewer.cpp.in#L860-L898

It's also notable that the code handles the "all objects behind camera" case for perspective cameras but not orthographic cameras.

It's almost like someone felt that orthographic cameras should be able to see behind them? Is there any reason for that?

I might be interested in submitting a PR to fix this if there is agreement.