LookAt comments
This commit is contained in:
parent
0df6244b8b
commit
bcf93bb4ce
2 changed files with 14 additions and 0 deletions
|
@ -97,6 +97,10 @@ Camera::SetUp(const Vector3& up)
|
|||
void
|
||||
Camera::LookAt(const Vector3& pt)
|
||||
{
|
||||
/*
|
||||
* Precalulate these in order to preserve the aspect ratio and orientation
|
||||
* of the camera across the LookAt operation.
|
||||
*/
|
||||
const Double directionLength = mDirection.length();
|
||||
const Double rightLength = mRight.length();
|
||||
const Double upLength = mUp.length();
|
||||
|
@ -106,6 +110,11 @@ Camera::LookAt(const Vector3& pt)
|
|||
mDirection = (pt - mOrigin).normalize();
|
||||
/* TODO: Check for zero length direction vector. */
|
||||
|
||||
/*
|
||||
* TODO: This is always the Y vector. POV-Ray has a sky vector, which
|
||||
* specifies the vector along which LookAt pans and tilts the camera. It
|
||||
* might be worth looking into, at some point.
|
||||
*/
|
||||
mRight = Vector3::Y.cross(mDirection).normalize();
|
||||
mUp = mDirection.cross(mRight);
|
||||
|
||||
|
|
|
@ -35,6 +35,11 @@ struct Camera
|
|||
const Vector3& GetUp() const;
|
||||
void SetUp(const Vector3& up);
|
||||
|
||||
/**
|
||||
* Pan and tilt the camera towards the given point.
|
||||
*
|
||||
* @param [in] pt The point at which to face the camera
|
||||
*/
|
||||
void LookAt(const Vector3& pt);
|
||||
|
||||
virtual Ray compute_primary_ray(const int x, const int width,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue