How to reset the view transforms
FH
9/11/2015 8:23 PM
|
---|
Following along with one of the OpenGL examples I have a small viewer that displays my model and allows rotation/pan etc. Now I want to implement a "Reset View" function so user can reset everything back to the original view when opening ( ie after they've rotated,zoomed and panned into oblivion). I do it as follows:
public void ViewReset()
{
_modelbounds.Reset();
BoundsCalculator boundsCalculator = new BoundsCalculator(_modelbounds);
boundsCalculator.GetBounds(_model, Matrix4D.Identity);
// the following reset triggers event to CalculateModelViewAndProjection
transformationProvider.ResetTransforms(_modelbounds);
}
It almost works - rotation and positioning are restored. The remaining issue is that the "zoom" factor is not restored.
The transformProvider.worldtransform is reset but the canonicalprojection is different than after initialization ( ie before any manipulation ). It seems to maintain the current zoom factor.
Is there a better/recommended way to do this?
Thanks
|
FH
9/15/2015 8:27 PM
|
---|
Issue resolved:
Need to set transformProvider.ViewScaling back to 1.0 before resetting transforms.
|