There was a bug in TransformGL for perspective matrix.
The function worked as intended only if near == focal.
This commit is contained in:
parent
992a808685
commit
6d2363d10a
|
@ -147,9 +147,17 @@ static void GetFrustum(vcg::Camera<S> & intrinsics, S & sx,S & dx,S & bt,S & tp,
|
||||||
/// set the OpenGL PROJECTION matrix to match the camera (intrinsics). requires near and far plane
|
/// set the OpenGL PROJECTION matrix to match the camera (intrinsics). requires near and far plane
|
||||||
static void TransformGL(vcg::Camera<S> & camera, S nearDist, S farDist )
|
static void TransformGL(vcg::Camera<S> & camera, S nearDist, S farDist )
|
||||||
{
|
{
|
||||||
S sx,dx,bt,tp,nr,fr;
|
S sx,dx,bt,tp,nr;
|
||||||
camera.GetFrustum(sx,dx,bt,tp,nr);
|
camera.GetFrustum(sx,dx,bt,tp,nr);
|
||||||
|
|
||||||
|
if(camera.cameraType == vcg::PERSPECTIVE) {
|
||||||
|
S ratio = nearDist/nr;
|
||||||
|
sx *= ratio;
|
||||||
|
dx *= ratio;
|
||||||
|
bt *= ratio;
|
||||||
|
tp *= ratio;
|
||||||
|
}
|
||||||
|
|
||||||
assert(glGetError()==0);
|
assert(glGetError()==0);
|
||||||
|
|
||||||
switch(camera.cameraType)
|
switch(camera.cameraType)
|
||||||
|
|
Loading…
Reference in New Issue