Camera.resize doesn't respect fixAspect for parallel projection

Camera.resize has an if to update the frustum to the new canvas size only if it’s not in parallel projection:



if (fixAspect && !parallelProjection){

frustumRight = frustumTop * ((float)width / height);

frustumLeft = -frustumRight;

onFrustumChange();

}



Is there a reason for it to be set only when in perspective? When I change it to “if (fixAspect){”, it seems to work fine.

You’re right it does fix it. However I don’t know what people use parallel projection for, I am not sure if it is appropriate to make this fix.

Parallel projection is very useful for things like house plans, technical drawings or CAD like apps. There is this first person builder video that demonstrates switching projections http://hub.jmonkeyengine.org/2008/07/24/first-person-builder/. In this context, if someone resizes the canvas, on the perspective projection the image will keep the aspect ratio, and on the parallel projection it will distort the image, which is inconsitent in my opinion.



Some days ago I was studying a bit more about frustum to make my canvas display the same area when switching projections, and it is actually simpler than I first thought. In this case, when the canvas size changes, top and button planes are kept constant and right and left planes are adjusted to the new scale so that the image is not distorted. It is valid for both projections.



Also, the method signature is “resize(int width, int height, boolean fixAspect)”, so when I pass true to fixAspect I expect it to keep the aspect, no matter the projection. If I didn’t want to keep the aspect I would have passed false instead of true… If it is going to be like this though, it would be nice to document it, so people know the fixAspect only takes effect for perspective projections by design and that changing the aspect ratio when in parallel projection is not a bug. And with a quick explanation for this behavior it would be even better.