HDK
|
Object-based representation of a camera. More...
#include <camera.h>
Public Types | |
enum | Projection { Perspective = 0, Orthographic } |
Projection type. More... | |
enum | FOVDirection { FOVHorizontal = 0, FOVVertical } |
Direction used for Field of View or orthographic size. More... | |
Static Public Attributes | |
static GF_API const double | APERTURE_UNIT |
static GF_API const double | FOCAL_LENGTH_UNIT |
The unit for focal length. Similar to APERTURE_UNIT. More... | |
static GF_API const double | DEFAULT_HORIZONTAL_APERTURE |
static GF_API const double | DEFAULT_VERTICAL_APERTURE |
Object-based representation of a camera.
This class provides a thin wrapper on the camera data model, with a small number of computations.
enum GfCamera::Projection |
GF_API GfCamera::GfCamera | ( | const GfMatrix4d & | transform = GfMatrix4d(1.0) , |
Projection | projection = Perspective , |
||
float | horizontalAperture = DEFAULT_HORIZONTAL_APERTURE , |
||
float | verticalAperture = DEFAULT_VERTICAL_APERTURE , |
||
float | horizontalApertureOffset = 0.0 , |
||
float | verticalApertureOffset = 0.0 , |
||
float | focalLength = 50.0 , |
||
const GfRange1f & | clippingRange = GfRange1f(1, 1000000) , |
||
const std::vector< GfVec4f > & | clippingPlanes = std::vector< GfVec4f >() , |
||
float | fStop = 0.0 , |
||
float | focusDistance = 0.0 |
||
) |
Returns additional clipping planes.
GF_API float GfCamera::GetFieldOfView | ( | FOVDirection | direction | ) | const |
Returns the horizontal or vertical field of view in degrees.
Returns the focal length in tenths of a world unit (e.g., mm if the world unit is assumed to be cm).
Returns the computed, world-space camera frustum. The frustum will always be that of a Y-up, -Z-looking camera.
Returns the width of the projector aperture in tenths of a world unit (e.g., mm if the world unit is assumed to be cm).
Returns the horizontal offset of the projector aperture in tenths of a world unit (e.g., mm if the world unit is assumed to be cm). In particular, an offset is necessary when writing out a stereo camera with finite convergence distance as two cameras.
GF_API Projection GfCamera::GetProjection | ( | ) | const |
Returns the projection type.
GF_API GfMatrix4d GfCamera::GetTransform | ( | ) | const |
Returns the transform of the filmback in world space. This is exactly the transform specified via SetTransform().
Returns the height of the projector aperture in tenths of a world unit (e.g., mm if the world unit is assumed to be cm).
Returns the vertical offset of the projector aperture in tenths of a world unit (e.g., mm if the world unit is assumed to be cm).
GF_API bool GfCamera::operator!= | ( | const GfCamera & | other | ) | const |
Equality operator. true iff all parts match.
Sets additional arbitrarily oriented clipping planes. A vector (a,b,c,d) encodes a clipping plane that clips off points (x,y,z) with
a * x + b * y + c * z + d * 1 < 0
where (x,y,z) are the coordinates in the camera's space.
Sets the clipping range in world units.
These are the values actually stored in the class and they correspond to measurements of an actual physical camera (in mm). Together with the clipping range, they determine the camera frustum. Sets the focal length in tenths of a world unit (e.g., mm if the world unit is assumed to be cm).
GF_API void GfCamera::SetFromViewAndProjectionMatrix | ( | const GfMatrix4d & | viewMatrix, |
const GfMatrix4d & | projMatix, | ||
const float | focalLength = 50.0 |
||
) |
Sets the camera from a view and projection matrix.
Note that the projection matrix does only determine the ratio of aperture to focal length, so there is a choice which defaults to 50mm (or more accurately, 50 tenths of a world unit).
Sets the width of the projector aperture in tenths of a world unit (e.g., mm if the world unit is assumed to be cm).
Sets the horizontal offset of the projector aperture in tenths of a world unit (e.g., mm if the world unit is assumed to be cm).
GF_API void GfCamera::SetOrthographicFromAspectRatioAndSize | ( | float | aspectRatio, |
float | orthographicSize, | ||
FOVDirection | direction | ||
) |
Sets the frustum to be orthographic such that it has the given aspectRatio
and such that the orthographic width, respectively, orthographic height (in cm) is equal to orthographicSize
(depending on direction).
GF_API void GfCamera::SetPerspectiveFromAspectRatioAndFieldOfView | ( | float | aspectRatio, |
float | fieldOfView, | ||
FOVDirection | direction, | ||
float | horizontalAperture = DEFAULT_HORIZONTAL_APERTURE |
||
) |
Sets the frustum to be projective with the given aspectRatio
and horizontal, respectively, vertical field of view fieldOfView
(similar to gluPerspective when direction = FOVVertical).
Do not pass values for horionztalAperture
unless you care about DepthOfField.
GF_API void GfCamera::SetProjection | ( | const Projection & | val | ) |
Sets the projection type.
GF_API void GfCamera::SetTransform | ( | const GfMatrix4d & | val | ) |
Sets the transform of the filmback in world space to val
.
Sets the height of the projector aperture in tenths of a world unit (e.g., mm if the world unit is assumed to be cm).
Sets the vertical offset of the projector aperture in tenths of a world unit (e.g., mm if the world unit is assumed to be cm).