Log the camera before rendering
Implement an operator<< for Cameras. Log the scene's camera.
This commit is contained in:
parent
bcf93bb4ce
commit
f99608085e
4 changed files with 62 additions and 0 deletions
|
@ -123,6 +123,14 @@ Camera::LookAt(const Vector3& pt)
|
|||
mUp *= upLength;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Camera::WriteType(std::ostream& ost)
|
||||
const
|
||||
{
|
||||
ost << "UNKNOWN";
|
||||
}
|
||||
|
||||
#pragma mark - Perspective Camera
|
||||
|
||||
PerspectiveCamera::PerspectiveCamera()
|
||||
|
@ -155,6 +163,14 @@ PerspectiveCamera::compute_primary_ray(const int x,
|
|||
return Ray(GetOrigin(), direction.normalize());
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
PerspectiveCamera::WriteType(std::ostream& ost)
|
||||
const
|
||||
{
|
||||
ost << "perspective";
|
||||
}
|
||||
|
||||
#pragma mark - Orthographic Camera
|
||||
|
||||
OrthographicCamera::OrthographicCamera()
|
||||
|
@ -195,3 +211,26 @@ OrthographicCamera::compute_primary_ray(const int x,
|
|||
y0, GetUp());
|
||||
return Ray(origin, get_direction());
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
OrthographicCamera::WriteType(std::ostream& ost)
|
||||
const
|
||||
{
|
||||
ost << "orthographic";
|
||||
}
|
||||
|
||||
|
||||
std::ostream&
|
||||
operator<<(std::ostream& ost,
|
||||
const Camera& camera)
|
||||
{
|
||||
ost << "[Camera ";
|
||||
camera.WriteType(ost);
|
||||
ost << " origin=" << camera.mOrigin
|
||||
<< " direction=" << camera.mDirection
|
||||
<< " right=" << camera.mRight
|
||||
<< " up=" << camera.mUp
|
||||
<< "]";
|
||||
return ost;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue