|
HDK
|
#include <ImathFrustum.h>
Public Types | |
| using | BaseType = T |
| using | value_type = T |
Public Member Functions | |
Constructors and Assignment | |
| IMATH_HOSTDEVICE IMATH_CONSTEXPR14 | Frustum () IMATH_NOEXCEPT |
| IMATH_HOSTDEVICE IMATH_CONSTEXPR14 | Frustum (const Frustum &) IMATH_NOEXCEPT |
| Copy constructor. More... | |
| IMATH_HOSTDEVICE IMATH_CONSTEXPR14 | Frustum (T nearPlane, T farPlane, T left, T right, T top, T bottom, bool ortho=false) IMATH_NOEXCEPT |
| Initialize to specific values. More... | |
| IMATH_HOSTDEVICE IMATH_CONSTEXPR14 | Frustum (T nearPlane, T farPlane, T fovx, T fovy, T aspect) IMATH_NOEXCEPT |
| Initialize with fov and aspect. More... | |
| virtual | ~Frustum () IMATH_NOEXCEPT |
| Destructor. More... | |
| IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Frustum & | operator= (const Frustum &) IMATH_NOEXCEPT |
| Component-wise assignment. More... | |
Comparison | |
| IMATH_HOSTDEVICE constexpr bool | operator== (const Frustum< T > &src) const IMATH_NOEXCEPT |
| Equality. More... | |
| IMATH_HOSTDEVICE constexpr bool | operator!= (const Frustum< T > &src) const IMATH_NOEXCEPT |
| Inequality. More... | |
Query | |
| IMATH_HOSTDEVICE constexpr bool | orthographic () const IMATH_NOEXCEPT |
| Return true if the frustum is orthographic, false if perspective. More... | |
| IMATH_HOSTDEVICE constexpr T | nearPlane () const IMATH_NOEXCEPT |
| Return the near clipping plane. More... | |
| IMATH_HOSTDEVICE constexpr T | hither () const IMATH_NOEXCEPT |
| Return the near clipping plane. More... | |
| IMATH_HOSTDEVICE constexpr T | farPlane () const IMATH_NOEXCEPT |
| Return the far clipping plane. More... | |
| IMATH_HOSTDEVICE constexpr T | yon () const IMATH_NOEXCEPT |
| Return the far clipping plane. More... | |
| IMATH_HOSTDEVICE constexpr T | left () const IMATH_NOEXCEPT |
| Return the left of the frustum. More... | |
| IMATH_HOSTDEVICE constexpr T | right () const IMATH_NOEXCEPT |
| Return the right of the frustum. More... | |
| IMATH_HOSTDEVICE constexpr T | bottom () const IMATH_NOEXCEPT |
| Return the bottom of the frustum. More... | |
| IMATH_HOSTDEVICE constexpr T | top () const IMATH_NOEXCEPT |
| Return the top of the frustum. More... | |
| IMATH_HOSTDEVICE constexpr T | fovx () const IMATH_NOEXCEPT |
| Return the field of view in X. More... | |
| IMATH_HOSTDEVICE constexpr T | fovy () const IMATH_NOEXCEPT |
| Return the field of view in Y. More... | |
| IMATH_HOSTDEVICE IMATH_CONSTEXPR14 T | aspect () const IMATH_NOEXCEPT |
| Return the aspect ratio. More... | |
| IMATH_CONSTEXPR14 T | aspectExc () const |
| IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix44< T > | projectionMatrix () const IMATH_NOEXCEPT |
| Return the project matrix that the frustum defines. More... | |
| IMATH_CONSTEXPR14 Matrix44< T > | projectionMatrixExc () const |
| IMATH_HOSTDEVICE constexpr bool | degenerate () const IMATH_NOEXCEPT |
| Return true if the frustum is degenerate. More... | |
Set Value | |
| IMATH_HOSTDEVICE void | set (T nearPlane, T farPlane, T left, T right, T top, T bottom, bool ortho=false) IMATH_NOEXCEPT |
| Set functions change the entire state of the Frustum. More... | |
| IMATH_HOSTDEVICE void | set (T nearPlane, T farPlane, T fovx, T fovy, T aspect) IMATH_NOEXCEPT |
| void | setExc (T nearPlane, T farPlane, T fovx, T fovy, T aspect) |
| IMATH_HOSTDEVICE void | modifyNearAndFar (T nearPlane, T farPlane) IMATH_NOEXCEPT |
| Set the near and far clipping planes. More... | |
| IMATH_HOSTDEVICE void | setOrthographic (bool) IMATH_NOEXCEPT |
| Set the ortographic state. More... | |
| IMATH_HOSTDEVICE void | planes (Plane3< T > p[6]) const IMATH_NOEXCEPT |
| IMATH_HOSTDEVICE void | planes (Plane3< T > p[6], const Matrix44< T > &M) const IMATH_NOEXCEPT |
| IMATH_HOSTDEVICE IMATH_CONSTEXPR14 IMATH_HOSTDEVICE Frustum< T > | window (T left, T right, T top, T bottom) const IMATH_NOEXCEPT |
Utility Methods | |
| IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Line3< T > | projectScreenToRay (const Vec2< T > &) const IMATH_NOEXCEPT |
| Project a point in screen spaced to 3d ray. More... | |
| IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Vec2< T > | projectPointToScreen (const Vec3< T > &) const IMATH_NOEXCEPT |
| Project a 3D point into screen coordinates. More... | |
| IMATH_CONSTEXPR14 Vec2< T > | projectPointToScreenExc (const Vec3< T > &) const |
| IMATH_HOSTDEVICE IMATH_CONSTEXPR14 T | ZToDepth (long zval, long min, long max) const IMATH_NOEXCEPT |
| Map a z value to its depth in the frustum. More... | |
| IMATH_CONSTEXPR14 T | ZToDepthExc (long zval, long min, long max) const |
| Map a z value to its depth in the frustum. More... | |
| IMATH_HOSTDEVICE IMATH_CONSTEXPR14 T | normalizedZToDepth (T zval) const IMATH_NOEXCEPT |
| Map a normalized z value to its depth in the frustum. More... | |
| IMATH_CONSTEXPR14 T | normalizedZToDepthExc (T zval) const |
| IMATH_HOSTDEVICE IMATH_CONSTEXPR14 long | DepthToZ (T depth, long zmin, long zmax) const IMATH_NOEXCEPT |
| Map depth to z value. More... | |
| IMATH_CONSTEXPR14 long | DepthToZExc (T depth, long zmin, long zmax) const |
| Map depth to z value. Throw an exception on error. More... | |
| IMATH_HOSTDEVICE IMATH_CONSTEXPR14 T | worldRadius (const Vec3< T > &p, T radius) const IMATH_NOEXCEPT |
| Compute worldRadius. More... | |
| IMATH_CONSTEXPR14 T | worldRadiusExc (const Vec3< T > &p, T radius) const |
| Compute worldRadius. Throw an exception on error. More... | |
| IMATH_HOSTDEVICE IMATH_CONSTEXPR14 T | screenRadius (const Vec3< T > &p, T radius) const IMATH_NOEXCEPT |
| Compute screen radius. More... | |
| IMATH_CONSTEXPR14 T | screenRadiusExc (const Vec3< T > &p, T radius) const |
| Compute screen radius. Throw an exception on error. More... | |
Protected Member Functions | |
| IMATH_HOSTDEVICE constexpr Vec2< T > | screenToLocal (const Vec2< T > &) const IMATH_NOEXCEPT |
| Map point from screen space to local space. More... | |
| IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Vec2< T > | localToScreen (const Vec2< T > &) const IMATH_NOEXCEPT |
| Map point from local space to screen space. More... | |
| IMATH_CONSTEXPR14 Vec2< T > | localToScreenExc (const Vec2< T > &) const |
Template class Frustum<T>
The frustum is always located with the eye point at the origin facing down -Z. This makes the Frustum class compatable with OpenGL (or anything that assumes a camera looks down -Z, hence with a right-handed coordinate system) but not with RenderMan which assumes the camera looks down +Z. Additional functions are provided for conversion from and from various camera coordinate spaces.
nearPlane/farPlane: near/far are keywords used by Microsoft's compiler, so we use nearPlane/farPlane instead to avoid issues.
Definition at line 39 of file ImathFrustum.h.
| using Frustum< T >::value_type = T |
Definition at line 43 of file ImathFrustum.h.
Initialize with default values: near=0.1, far=1000.0, left=-1.0, right=1.0, top=1.0, bottom=-1.0, ortho=false
Definition at line 301 of file ImathFrustum.h.
Copy constructor.
Definition at line 307 of file ImathFrustum.h.
|
inline |
Initialize to specific values.
Definition at line 313 of file ImathFrustum.h.
|
inline |
Initialize with fov and aspect.
Definition at line 320 of file ImathFrustum.h.
Destructor.
Definition at line 326 of file ImathFrustum.h.
Return the aspect ratio.
Definition at line 497 of file ImathFrustum.h.
Return the aspect ratio. Throw an exception if the aspect ratio is undefined.
Definition at line 479 of file ImathFrustum.h.
|
inline |
Return the bottom of the frustum.
Definition at line 135 of file ImathFrustum.h.
Return true if the frustum is degenerate.
Definition at line 641 of file ImathFrustum.h.
| IMATH_CONSTEXPR14 long Frustum< T >::DepthToZ | ( | T | depth, |
| long | zmin, | ||
| long | zmax | ||
| ) | const |
Map depth to z value.
Definition at line 872 of file ImathFrustum.h.
| IMATH_CONSTEXPR14 long Frustum< T >::DepthToZExc | ( | T | depth, |
| long | zmin, | ||
| long | zmax | ||
| ) | const |
Map depth to z value. Throw an exception on error.
Definition at line 822 of file ImathFrustum.h.
|
inline |
Return the far clipping plane.
Definition at line 114 of file ImathFrustum.h.
Return the field of view in X.
Definition at line 465 of file ImathFrustum.h.
Return the field of view in Y.
Definition at line 472 of file ImathFrustum.h.
|
inline |
Return the near clipping plane.
Definition at line 108 of file ImathFrustum.h.
|
inline |
Return the left of the frustum.
Definition at line 126 of file ImathFrustum.h.
|
inlineprotected |
Map point from local space to screen space.
Definition at line 695 of file ImathFrustum.h.
|
inlineprotected |
Map point from local space to screen space. Throw an exception on error.
Definition at line 670 of file ImathFrustum.h.
Set the near and far clipping planes.
Definition at line 375 of file ImathFrustum.h.
|
inline |
Return the near clipping plane.
Definition at line 102 of file ImathFrustum.h.
Map a normalized z value to its depth in the frustum.
Definition at line 802 of file ImathFrustum.h.
Map a normalized z value to its depth in the frustum. Throw an exception on error.
Definition at line 772 of file ImathFrustum.h.
Inequality.
Definition at line 355 of file ImathFrustum.h.
|
inline |
Component-wise assignment.
Definition at line 331 of file ImathFrustum.h.
Equality.
Definition at line 346 of file ImathFrustum.h.
|
inline |
Return true if the frustum is orthographic, false if perspective.
Definition at line 96 of file ImathFrustum.h.
Set the planes in p to be the six bounding planes of the frustum, in the following order: top, right, bottom, left, near, far. Note that the planes have normals that point out of the frustum.
Definition at line 967 of file ImathFrustum.h.
Set the planes in p to be the six bounding planes of the frustum, in the following order: top, right, bottom, left, near, far. Note that the planes have normals that point out of the frustum. Apply the given matrix to transform the frustum before setting the planes.
Definition at line 1000 of file ImathFrustum.h.
Return the project matrix that the frustum defines.
Definition at line 596 of file ImathFrustum.h.
|
inline |
Return the project matrix that the frustum defines. Throw an exception if the frustum is degenerate.
Definition at line 506 of file ImathFrustum.h.
| IMATH_CONSTEXPR14 Vec2< T > Frustum< T >::projectPointToScreen | ( | const Vec3< T > & | point | ) | const |
Project a 3D point into screen coordinates.
Definition at line 732 of file ImathFrustum.h.
| IMATH_CONSTEXPR14 Vec2< T > Frustum< T >::projectPointToScreenExc | ( | const Vec3< T > & | point | ) | const |
Project a 3D point into screen coordinates. Throw an exception if the point cannot be projected.
Definition at line 721 of file ImathFrustum.h.
|
inline |
Project a point in screen spaced to 3d ray.
Definition at line 708 of file ImathFrustum.h.
|
inline |
Return the right of the frustum.
Definition at line 129 of file ImathFrustum.h.
| IMATH_CONSTEXPR14 T Frustum< T >::screenRadius | ( | const Vec3< T > & | p, |
| T | radius | ||
| ) | const |
Compute screen radius.
Definition at line 927 of file ImathFrustum.h.
| IMATH_CONSTEXPR14 T Frustum< T >::screenRadiusExc | ( | const Vec3< T > & | p, |
| T | radius | ||
| ) | const |
Compute screen radius. Throw an exception on error.
Definition at line 899 of file ImathFrustum.h.
|
inlineprotected |
Map point from screen space to local space.
Definition at line 661 of file ImathFrustum.h.
|
inline |
Set functions change the entire state of the Frustum.
Definition at line 362 of file ImathFrustum.h.
|
inline |
Set functions change the entire state of the Frustum using field of view and aspect ratio
Definition at line 439 of file ImathFrustum.h.
|
inline |
Set functions change the entire state of the Frustum using field of view and aspect ratio. Throw an exception if fovx and/or fovy are invalid.
Definition at line 411 of file ImathFrustum.h.
Set the ortographic state.
Definition at line 404 of file ImathFrustum.h.
|
inline |
Return the top of the frustum.
Definition at line 141 of file ImathFrustum.h.
|
inline |
Takes a rectangle in the screen space (i.e., -1 <= left <= right <= 1 and -1 <= bottom <= top <= 1) of this Frustum, and returns a new Frustum whose near clipping-plane window is that rectangle in local space.
Definition at line 648 of file ImathFrustum.h.
| IMATH_CONSTEXPR14 T Frustum< T >::worldRadius | ( | const Vec3< T > & | p, |
| T | radius | ||
| ) | const |
Compute worldRadius.
Definition at line 960 of file ImathFrustum.h.
| IMATH_CONSTEXPR14 T Frustum< T >::worldRadiusExc | ( | const Vec3< T > & | p, |
| T | radius | ||
| ) | const |
Compute worldRadius. Throw an exception on error.
Definition at line 944 of file ImathFrustum.h.
|
inline |
Return the far clipping plane.
Definition at line 120 of file ImathFrustum.h.
| IMATH_CONSTEXPR14 T Frustum< T >::ZToDepth | ( | long | zval, |
| long | min, | ||
| long | max | ||
| ) | const |
Map a z value to its depth in the frustum.
Definition at line 760 of file ImathFrustum.h.
| IMATH_CONSTEXPR14 T Frustum< T >::ZToDepthExc | ( | long | zval, |
| long | min, | ||
| long | max | ||
| ) | const |
Map a z value to its depth in the frustum.
Definition at line 743 of file ImathFrustum.h.