Commit 39b347db authored by Kenneth Moreland's avatar Kenneth Moreland
Browse files

Fix raytrace using wrong fov with standard camera

The raytracing code has its own version of camera that maintains two
field of view (fov) parameters: one for the x direction and one for the
y. The standard vtkm::rendering::Camera contains only one fov. As is
consistent with OpenGL's gluPerspective and VTK's camera, the fov is
specified in the y direction. However, the raytracing code was
incorrectly using it in the x direction. That caused it to do a weird
rescaling when the aspect ratio was not 1.
parent 9ac466ed
......@@ -455,7 +455,7 @@ void Camera::SetHeight(const vtkm::Int32& height)
if (Height != height)
{
this->Height = height;
this->SetFieldOfView(this->FovX);
this->SetFieldOfView(this->FovY);
}
}
......@@ -475,7 +475,7 @@ void Camera::SetWidth(const vtkm::Int32& width)
if (this->Width != width)
{
this->Width = width;
this->SetFieldOfView(this->FovX);
this->SetFieldOfView(this->FovY);
}
}
......@@ -529,8 +529,8 @@ void Camera::SetFieldOfView(const vtkm::Float32& degrees)
throw vtkm::cont::ErrorBadValue("Camera feild of view must be less than 180.");
}
vtkm::Float32 newFOVY = (vtkm::Float32(this->Height) / vtkm::Float32(this->Width)) * degrees;
vtkm::Float32 newFOVX = degrees;
vtkm::Float32 newFOVY = degrees;
vtkm::Float32 newFOVX = (vtkm::Float32(this->Width) / vtkm::Float32(this->Height)) * degrees;
if (newFOVX != this->FovX)
{
this->IsViewDirty = true;
......@@ -541,13 +541,13 @@ void Camera::SetFieldOfView(const vtkm::Float32& degrees)
}
this->FovX = newFOVX;
this->FovY = newFOVY;
this->CameraView.SetFieldOfView(this->FovX);
this->CameraView.SetFieldOfView(this->FovY);
}
VTKM_CONT
vtkm::Float32 Camera::GetFieldOfView() const
{
return this->FovX;
return this->FovY;
}
VTKM_CONT
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment