Open CASCADE Technology
7.7.0
|
Forward declaration. More...
#include <Graphic3d_Camera.hxx>
Public Types | |
enum | Projection { Projection_Orthographic, Projection_Perspective, Projection_Stereo, Projection_MonoLeftEye, Projection_MonoRightEye } |
Enumerates supported monographic projections. More... | |
enum | FocusType { FocusType_Absolute, FocusType_Relative } |
Enumerates approaches to define stereographic focus. More... | |
enum | IODType { IODType_Absolute, IODType_Relative } |
Enumerates approaches to define Intraocular distance. More... | |
Public Types inherited from Standard_Transient | |
typedef void | base_type |
Returns a type descriptor about this object. More... | |
Public Member Functions | |
Graphic3d_Camera () | |
Default constructor. Initializes camera with the following properties: Eye (0, 0, -2); Center (0, 0, 0); Up (0, 1, 0); Type (Orthographic); FOVy (45); Scale (1000); IsStereo(false); ZNear (0.001); ZFar (3000.0); Aspect(1); ZFocus(1.0); ZFocusType(Relative); IOD(0.05); IODType(Relative) More... | |
Graphic3d_Camera (const Handle< Graphic3d_Camera > &theOther) | |
Copy constructor. More... | |
void | CopyMappingData (const Handle< Graphic3d_Camera > &theOtherCamera) |
Initialize mapping related parameters from other camera handle. More... | |
void | CopyOrientationData (const Handle< Graphic3d_Camera > &theOtherCamera) |
Initialize orientation related parameters from other camera handle. More... | |
void | Copy (const Handle< Graphic3d_Camera > &theOther) |
Copy properties of another camera. More... | |
Public camera properties | |
const gp_Dir & | Direction () const |
Get camera look direction. More... | |
void | SetDirectionFromEye (const gp_Dir &theDir) |
Sets camera look direction preserving the current Eye() position. WARNING! This method does NOT verify that the current Up() vector is orthogonal to the new Direction. More... | |
void | SetDirection (const gp_Dir &theDir) |
Sets camera look direction and computes the new Eye position relative to current Center. WARNING! This method does NOT verify that the current Up() vector is orthogonal to the new Direction. More... | |
const gp_Dir & | Up () const |
Get camera Up direction vector. More... | |
void | SetUp (const gp_Dir &theUp) |
Sets camera Up direction vector, orthogonal to camera direction. WARNING! This method does NOT verify that the new Up vector is orthogonal to the current Direction(). More... | |
void | OrthogonalizeUp () |
Orthogonalize up direction vector. More... | |
gp_Dir | OrthogonalizedUp () const |
Return a copy of orthogonalized up direction vector. More... | |
gp_Dir | SideRight () const |
Right side direction. More... | |
const gp_Pnt & | Eye () const |
Get camera Eye position. More... | |
void | MoveEyeTo (const gp_Pnt &theEye) |
Sets camera Eye position. Unlike SetEye(), this method only changes Eye point and preserves camera direction. More... | |
void | SetEyeAndCenter (const gp_Pnt &theEye, const gp_Pnt &theCenter) |
Sets camera Eye and Center positions. More... | |
void | SetEye (const gp_Pnt &theEye) |
Sets camera Eye position. WARNING! For backward compatibility reasons, this method also changes view direction, so that the new direction is computed from new Eye position to old Center position. More... | |
gp_Pnt | Center () const |
Get Center of the camera, e.g. the point where camera looks at. This point is computed as Eye() translated along Direction() at Distance(). More... | |
void | SetCenter (const gp_Pnt &theCenter) |
Sets Center of the camera, e.g. the point where camera looks at. This methods changes camera direction, so that the new direction is computed from current Eye position to specified Center position. More... | |
Standard_Real | Distance () const |
Get distance of Eye from camera Center. More... | |
void | SetDistance (const Standard_Real theDistance) |
Set distance of Eye from camera Center. More... | |
Standard_Real | Scale () const |
Get camera scale. More... | |
void | SetScale (const Standard_Real theScale) |
Sets camera scale. For orthographic projection the scale factor corresponds to parallel scale of view mapping (i.e. size of viewport). For perspective camera scale is converted to distance. The scale specifies equal size of the view projection in both dimensions assuming that the aspect is 1.0. The projection height and width are specified with the scale and correspondingly multiplied by the aspect. More... | |
const gp_XYZ & | AxialScale () const |
Get camera axial scale. More... | |
void | SetAxialScale (const gp_XYZ &theAxialScale) |
Set camera axial scale. More... | |
void | SetProjectionType (const Projection theProjection) |
Change camera projection type. When switching to perspective projection from orthographic one, the ZNear and ZFar are reset to default values (0.001, 3000.0) if less than 0.0. More... | |
Projection | ProjectionType () const |
Standard_Boolean | IsOrthographic () const |
Check that the camera projection is orthographic. More... | |
Standard_Boolean | IsStereo () const |
Check whether the camera projection is stereo. Please note that stereo rendering is now implemented with support of Quad buffering. More... | |
void | SetFOVy (const Standard_Real theFOVy) |
Set Field Of View (FOV) in y axis for perspective projection. Field of View in x axis is automatically scaled from view aspect ratio. More... | |
Standard_Real | FOVy () const |
Get Field Of View (FOV) in y axis. More... | |
Standard_Real | FOVx () const |
Get Field Of View (FOV) in x axis. More... | |
Standard_Real | FOV2d () const |
Get Field Of View (FOV) restriction for 2D on-screen elements; 180 degrees by default. When 2D FOV is smaller than FOVy or FOVx, 2D elements defined within offset from view corner will be extended to fit into specified 2D FOV. This can be useful to make 2D elements sharply visible, like in case of HMD normally having extra large FOVy. More... | |
void | SetFOV2d (Standard_Real theFOV) |
Set Field Of View (FOV) restriction for 2D on-screen elements. More... | |
bool | FitMinMax (const Bnd_Box &theBox, const Standard_Real theResolution, const bool theToEnlargeIfLine) |
Adjust camera to fit in specified AABB. More... | |
bool | ZFitAll (const Standard_Real theScaleFactor, const Bnd_Box &theMinMax, const Bnd_Box &theGraphicBB, Standard_Real &theZNear, Standard_Real &theZFar) const |
Estimate Z-min and Z-max planes of projection volume to match the displayed objects. The methods ensures that view volume will be close by depth range to the displayed objects. Fitting assumes that for orthogonal projection the view volume contains the displayed objects completely. For zoomed perspective view, the view volume is adjusted such that it contains the objects or their parts, located in front of the camera. More... | |
void | ZFitAll (const Standard_Real theScaleFactor, const Bnd_Box &theMinMax, const Bnd_Box &theGraphicBB) |
Change Z-min and Z-max planes of projection volume to match the displayed objects. More... | |
void | SetZRange (const Standard_Real theZNear, const Standard_Real theZFar) |
Change the Near and Far Z-clipping plane positions. For orthographic projection, theZNear, theZFar can be negative or positive. For perspective projection, only positive values are allowed. Program error exception is raised if non-positive values are specified for perspective projection or theZNear >= theZFar. More... | |
Standard_Real | ZNear () const |
Get the Near Z-clipping plane position. More... | |
Standard_Real | ZFar () const |
Get the Far Z-clipping plane position. More... | |
Standard_Boolean | IsZeroToOneDepth () const |
Return TRUE if camera should calculate projection matrix for [0, 1] depth range or for [-1, 1] range. FALSE by default. More... | |
void | SetZeroToOneDepth (Standard_Boolean theIsZeroToOne) |
Set using [0, 1] depth range or [-1, 1] range. More... | |
void | SetAspect (const Standard_Real theAspect) |
Changes width / height display ratio. More... | |
Standard_Real | Aspect () const |
Get camera display ratio. More... | |
void | SetZFocus (const FocusType theType, const Standard_Real theZFocus) |
Sets stereographic focus distance. More... | |
Standard_Real | ZFocus () const |
Get stereographic focus value. More... | |
FocusType | ZFocusType () const |
Get stereographic focus definition type. More... | |
void | SetIOD (const IODType theType, const Standard_Real theIOD) |
Sets Intraocular distance. More... | |
Standard_Real | IOD () const |
Get Intraocular distance value. More... | |
IODType | GetIODType () const |
Get Intraocular distance definition type. More... | |
const Graphic3d_CameraTile & | Tile () const |
Get current tile. More... | |
void | SetTile (const Graphic3d_CameraTile &theTile) |
Sets the Tile defining the drawing sub-area within View. Note that tile defining a region outside the view boundaries is also valid - use method Graphic3d_CameraTile::Cropped() to assign a cropped copy. More... | |
void | SetIdentityOrientation () |
Sets camera parameters to make current orientation matrix identity one. More... | |
Basic camera operations | |
void | Transform (const gp_Trsf &theTrsf) |
Transform orientation components of the camera: Eye, Up and Center points. More... | |
gp_XYZ | ViewDimensions () const |
Calculate view plane size at center (target) point and distance between ZFar and ZNear planes. More... | |
gp_XYZ | ViewDimensions (const Standard_Real theZValue) const |
Calculate view plane size at center point with specified Z offset and distance between ZFar and ZNear planes. More... | |
Standard_Real | NDC2dOffsetX () const |
Return offset to the view corner in NDC space within dimension X for 2d on-screen elements, which is normally 0.5. Can be clamped when FOVx exceeds FOV2d. More... | |
Standard_Real | NDC2dOffsetY () const |
Return offset to the view corner in NDC space within dimension X for 2d on-screen elements, which is normally 0.5. Can be clamped when FOVy exceeds FOV2d. More... | |
void | Frustum (gp_Pln &theLeft, gp_Pln &theRight, gp_Pln &theBottom, gp_Pln &theTop, gp_Pln &theNear, gp_Pln &theFar) const |
Calculate WCS frustum planes for the camera projection volume. Frustum is a convex volume determined by six planes directing inwards. The frustum planes are usually used as inputs for camera algorithms. Thus, if any changes to projection matrix calculation are necessary, the frustum planes calculation should be also touched. More... | |
Projection methods | |
gp_Pnt | Project (const gp_Pnt &thePnt) const |
Project point from world coordinate space to normalized device coordinates (mapping). More... | |
gp_Pnt | UnProject (const gp_Pnt &thePnt) const |
Unproject point from normalized device coordinates to world coordinate space. More... | |
gp_Pnt | ConvertView2Proj (const gp_Pnt &thePnt) const |
Convert point from view coordinate space to projection coordinate space. More... | |
gp_Pnt | ConvertProj2View (const gp_Pnt &thePnt) const |
Convert point from projection coordinate space to view coordinate space. More... | |
gp_Pnt | ConvertWorld2View (const gp_Pnt &thePnt) const |
Convert point from world coordinate space to view coordinate space. More... | |
gp_Pnt | ConvertView2World (const gp_Pnt &thePnt) const |
Convert point from view coordinate space to world coordinates. More... | |
Camera modification state | |
const Graphic3d_WorldViewProjState & | WorldViewProjState () const |
Standard_Size | ProjectionState () const |
Returns modification state of camera projection matrix. More... | |
Standard_Size | WorldViewState () const |
Returns modification state of camera world view transformation matrix. More... | |
Lazily-computed orientation and projection matrices derived from camera parameters | |
const Graphic3d_Mat4d & | OrientationMatrix () const |
Get orientation matrix. More... | |
const Graphic3d_Mat4 & | OrientationMatrixF () const |
Get orientation matrix of Standard_ShortReal precision. More... | |
const Graphic3d_Mat4d & | ProjectionMatrix () const |
Get monographic or middle point projection matrix used for monographic rendering and for point projection / unprojection. More... | |
const Graphic3d_Mat4 & | ProjectionMatrixF () const |
Get monographic or middle point projection matrix of Standard_ShortReal precision used for monographic rendering and for point projection / unprojection. More... | |
const Graphic3d_Mat4d & | ProjectionStereoLeft () const |
const Graphic3d_Mat4 & | ProjectionStereoLeftF () const |
const Graphic3d_Mat4d & | ProjectionStereoRight () const |
const Graphic3d_Mat4 & | ProjectionStereoRightF () const |
void | InvalidateProjection () |
Invalidate state of projection matrix. The matrix will be updated on request. More... | |
void | InvalidateOrientation () |
Invalidate orientation matrix. The matrix will be updated on request. More... | |
void | StereoProjection (Graphic3d_Mat4d &theProjL, Graphic3d_Mat4d &theHeadToEyeL, Graphic3d_Mat4d &theProjR, Graphic3d_Mat4d &theHeadToEyeR) const |
Get stereo projection matrices. More... | |
void | StereoProjectionF (Graphic3d_Mat4 &theProjL, Graphic3d_Mat4 &theHeadToEyeL, Graphic3d_Mat4 &theProjR, Graphic3d_Mat4 &theHeadToEyeR) const |
Get stereo projection matrices. More... | |
void | ResetCustomProjection () |
Unset all custom frustums and projection matrices. More... | |
bool | IsCustomStereoFrustum () const |
Return TRUE if custom stereo frustums are set. More... | |
void | SetCustomStereoFrustums (const Aspect_FrustumLRBT< Standard_Real > &theFrustumL, const Aspect_FrustumLRBT< Standard_Real > &theFrustumR) |
Set custom stereo frustums. These can be retrieved from APIs like OpenVR. More... | |
bool | IsCustomStereoProjection () const |
Return TRUE if custom stereo projection matrices are set. More... | |
void | SetCustomStereoProjection (const Graphic3d_Mat4d &theProjL, const Graphic3d_Mat4d &theHeadToEyeL, const Graphic3d_Mat4d &theProjR, const Graphic3d_Mat4d &theHeadToEyeR) |
Set custom stereo projection matrices. More... | |
bool | IsCustomMonoProjection () const |
Return TRUE if custom projection matrix is set. More... | |
void | SetCustomMonoProjection (const Graphic3d_Mat4d &theProj) |
Set custom projection matrix. More... | |
void | DumpJson (Standard_OStream &theOStream, Standard_Integer theDepth=-1) const |
Dumps the content of me into the stream. More... | |
Public Member Functions inherited from Standard_Transient | |
Standard_Transient () | |
Empty constructor. More... | |
Standard_Transient (const Standard_Transient &) | |
Copy constructor – does nothing. More... | |
Standard_Transient & | operator= (const Standard_Transient &) |
Assignment operator, needed to avoid copying reference counter. More... | |
virtual | ~Standard_Transient () |
Destructor must be virtual. More... | |
virtual void | Delete () const |
Memory deallocator for transient classes. More... | |
virtual const opencascade::handle< Standard_Type > & | DynamicType () const |
Returns a type descriptor about this object. More... | |
Standard_Boolean | IsInstance (const opencascade::handle< Standard_Type > &theType) const |
Returns a true value if this is an instance of Type. More... | |
Standard_Boolean | IsInstance (const Standard_CString theTypeName) const |
Returns a true value if this is an instance of TypeName. More... | |
Standard_Boolean | IsKind (const opencascade::handle< Standard_Type > &theType) const |
Returns true if this is an instance of Type or an instance of any class that inherits from Type. Note that multiple inheritance is not supported by OCCT RTTI mechanism. More... | |
Standard_Boolean | IsKind (const Standard_CString theTypeName) const |
Returns true if this is an instance of TypeName or an instance of any class that inherits from TypeName. Note that multiple inheritance is not supported by OCCT RTTI mechanism. More... | |
Standard_Transient * | This () const |
Returns non-const pointer to this object (like const_cast). For protection against creating handle to objects allocated in stack or call from constructor, it will raise exception Standard_ProgramError if reference counter is zero. More... | |
Standard_Integer | GetRefCount () const |
Get the reference counter of this object. More... | |
void | IncrementRefCounter () const |
Increments the reference counter of this object. More... | |
Standard_Integer | DecrementRefCounter () const |
Decrements the reference counter of this object; returns the decremented value. More... | |
Static Public Member Functions | |
static void | Interpolate (const Handle< Graphic3d_Camera > &theStart, const Handle< Graphic3d_Camera > &theEnd, const double theT, Handle< Graphic3d_Camera > &theCamera) |
Linear interpolation tool for camera orientation and position. This tool interpolates camera parameters scale, eye, center, rotation (up and direction vectors) independently. More... | |
Static Public Member Functions inherited from Standard_Transient | |
static const char * | get_type_name () |
Returns a type descriptor about this object. More... | |
static const opencascade::handle< Standard_Type > & | get_type_descriptor () |
Returns type descriptor of Standard_Transient class. More... | |
Managing projection and orientation cache | |
enum | { FrustumVert_LeftBottomNear, FrustumVert_LeftBottomFar, FrustumVert_LeftTopNear, FrustumVert_LeftTopFar, FrustumVert_RightBottomNear, FrustumVert_RightBottomFar, FrustumVert_RightTopNear, FrustumVert_RightTopFar, FrustumVerticesNB } |
Enumerates vertices of view volume. More... | |
void | FrustumPoints (NCollection_Array1< Graphic3d_Vec3d > &thePoints, const Graphic3d_Mat4d &theModelWorld=Graphic3d_Mat4d()) const |
Fill array of current view frustum corners. The size of this array is equal to FrustumVerticesNB. The order of vertices is as defined in FrustumVert_* enumeration. More... | |
Forward declaration.
Camera class provides object-oriented approach to setting up projection and orientation properties of 3D view.
anonymous enum |
Enumerates supported monographic projections.
Enumerator | |
---|---|
Projection_Orthographic | |
Projection_Perspective | |
Projection_Stereo | |
Projection_MonoLeftEye | |
Projection_MonoRightEye |
Graphic3d_Camera::Graphic3d_Camera | ( | ) |
Default constructor. Initializes camera with the following properties: Eye (0, 0, -2); Center (0, 0, 0); Up (0, 1, 0); Type (Orthographic); FOVy (45); Scale (1000); IsStereo(false); ZNear (0.001); ZFar (3000.0); Aspect(1); ZFocus(1.0); ZFocusType(Relative); IOD(0.05); IODType(Relative)
Graphic3d_Camera::Graphic3d_Camera | ( | const Handle< Graphic3d_Camera > & | theOther | ) |
Copy constructor.
theOther | [in] the camera to copy from. |
|
inline |
Get camera display ratio.
|
inline |
Get camera axial scale.
|
inline |
Get Center of the camera, e.g. the point where camera looks at. This point is computed as Eye() translated along Direction() at Distance().
Convert point from projection coordinate space to view coordinate space.
thePnt | [in] the point in NDC. |
Convert point from view coordinate space to projection coordinate space.
thePnt | [in] the point in VCS. |
Convert point from view coordinate space to world coordinates.
thePnt | [in] the 3D point in VCS. |
Convert point from world coordinate space to view coordinate space.
thePnt | [in] the 3D point in WCS. |
void Graphic3d_Camera::Copy | ( | const Handle< Graphic3d_Camera > & | theOther | ) |
Copy properties of another camera.
theOther | [in] the camera to copy from. |
void Graphic3d_Camera::CopyMappingData | ( | const Handle< Graphic3d_Camera > & | theOtherCamera | ) |
Initialize mapping related parameters from other camera handle.
void Graphic3d_Camera::CopyOrientationData | ( | const Handle< Graphic3d_Camera > & | theOtherCamera | ) |
Initialize orientation related parameters from other camera handle.
|
inline |
Get camera look direction.
|
inline |
Get distance of Eye from camera Center.
void Graphic3d_Camera::DumpJson | ( | Standard_OStream & | theOStream, |
Standard_Integer | theDepth = -1 |
||
) | const |
Dumps the content of me into the stream.
|
inline |
Get camera Eye position.
bool Graphic3d_Camera::FitMinMax | ( | const Bnd_Box & | theBox, |
const Standard_Real | theResolution, | ||
const bool | theToEnlargeIfLine | ||
) |
Adjust camera to fit in specified AABB.
|
inline |
Get Field Of View (FOV) restriction for 2D on-screen elements; 180 degrees by default. When 2D FOV is smaller than FOVy or FOVx, 2D elements defined within offset from view corner will be extended to fit into specified 2D FOV. This can be useful to make 2D elements sharply visible, like in case of HMD normally having extra large FOVy.
|
inline |
Get Field Of View (FOV) in x axis.
|
inline |
Get Field Of View (FOV) in y axis.
void Graphic3d_Camera::Frustum | ( | gp_Pln & | theLeft, |
gp_Pln & | theRight, | ||
gp_Pln & | theBottom, | ||
gp_Pln & | theTop, | ||
gp_Pln & | theNear, | ||
gp_Pln & | theFar | ||
) | const |
Calculate WCS frustum planes for the camera projection volume. Frustum is a convex volume determined by six planes directing inwards. The frustum planes are usually used as inputs for camera algorithms. Thus, if any changes to projection matrix calculation are necessary, the frustum planes calculation should be also touched.
theLeft | [out] the frustum plane for left side of view. |
theRight | [out] the frustum plane for right side of view. |
theBottom | [out] the frustum plane for bottom side of view. |
theTop | [out] the frustum plane for top side of view. |
theNear | [out] the frustum plane for near side of view. |
theFar | [out] the frustum plane for far side of view. |
void Graphic3d_Camera::FrustumPoints | ( | NCollection_Array1< Graphic3d_Vec3d > & | thePoints, |
const Graphic3d_Mat4d & | theModelWorld = Graphic3d_Mat4d() |
||
) | const |
Fill array of current view frustum corners. The size of this array is equal to FrustumVerticesNB. The order of vertices is as defined in FrustumVert_* enumeration.
|
inline |
Get Intraocular distance definition type.
|
static |
Linear interpolation tool for camera orientation and position. This tool interpolates camera parameters scale, eye, center, rotation (up and direction vectors) independently.
Eye/Center interpolation is performed through defining an anchor point in-between Center and Eye. The anchor position is defined as point near to the camera point which has smaller translation part. The main idea is to keep the distance between Center and Eye (which will change if Center and Eye translation will be interpolated independently). E.g.:
This transformation might be not in line with user expectations. In this case, application might define intermediate camera positions for interpolation or implement own interpolation logic.
theStart | [in] initial camera position |
theEnd | [in] final camera position |
theT | [in] step between initial and final positions within [0,1] range |
theCamera | [out] interpolation result |
void Graphic3d_Camera::InvalidateOrientation | ( | ) |
Invalidate orientation matrix. The matrix will be updated on request.
void Graphic3d_Camera::InvalidateProjection | ( | ) |
Invalidate state of projection matrix. The matrix will be updated on request.
|
inline |
Get Intraocular distance value.
|
inline |
Return TRUE if custom projection matrix is set.
|
inline |
Return TRUE if custom stereo frustums are set.
|
inline |
Return TRUE if custom stereo projection matrices are set.
|
inline |
Check that the camera projection is orthographic.
|
inline |
Check whether the camera projection is stereo. Please note that stereo rendering is now implemented with support of Quad buffering.
|
inline |
Return TRUE if camera should calculate projection matrix for [0, 1] depth range or for [-1, 1] range. FALSE by default.
void Graphic3d_Camera::MoveEyeTo | ( | const gp_Pnt & | theEye | ) |
|
inline |
Return offset to the view corner in NDC space within dimension X for 2d on-screen elements, which is normally 0.5. Can be clamped when FOVx exceeds FOV2d.
|
inline |
Return offset to the view corner in NDC space within dimension X for 2d on-screen elements, which is normally 0.5. Can be clamped when FOVy exceeds FOV2d.
const Graphic3d_Mat4d& Graphic3d_Camera::OrientationMatrix | ( | ) | const |
Get orientation matrix.
const Graphic3d_Mat4& Graphic3d_Camera::OrientationMatrixF | ( | ) | const |
Get orientation matrix of Standard_ShortReal precision.
gp_Dir Graphic3d_Camera::OrthogonalizedUp | ( | ) | const |
Return a copy of orthogonalized up direction vector.
void Graphic3d_Camera::OrthogonalizeUp | ( | ) |
Orthogonalize up direction vector.
Project point from world coordinate space to normalized device coordinates (mapping).
thePnt | [in] the 3D point in WCS. |
const Graphic3d_Mat4d& Graphic3d_Camera::ProjectionMatrix | ( | ) | const |
Get monographic or middle point projection matrix used for monographic rendering and for point projection / unprojection.
const Graphic3d_Mat4& Graphic3d_Camera::ProjectionMatrixF | ( | ) | const |
Get monographic or middle point projection matrix of Standard_ShortReal precision used for monographic rendering and for point projection / unprojection.
|
inline |
Returns modification state of camera projection matrix.
const Graphic3d_Mat4d& Graphic3d_Camera::ProjectionStereoLeft | ( | ) | const |
const Graphic3d_Mat4& Graphic3d_Camera::ProjectionStereoLeftF | ( | ) | const |
const Graphic3d_Mat4d& Graphic3d_Camera::ProjectionStereoRight | ( | ) | const |
const Graphic3d_Mat4& Graphic3d_Camera::ProjectionStereoRightF | ( | ) | const |
|
inline |
void Graphic3d_Camera::ResetCustomProjection | ( | ) |
Unset all custom frustums and projection matrices.
Standard_Real Graphic3d_Camera::Scale | ( | ) | const |
Get camera scale.
void Graphic3d_Camera::SetAspect | ( | const Standard_Real | theAspect | ) |
Changes width / height display ratio.
theAspect | [in] the display ratio. |
void Graphic3d_Camera::SetAxialScale | ( | const gp_XYZ & | theAxialScale | ) |
Set camera axial scale.
theAxialScale | [in] the axial scale vector. |
void Graphic3d_Camera::SetCenter | ( | const gp_Pnt & | theCenter | ) |
Sets Center of the camera, e.g. the point where camera looks at. This methods changes camera direction, so that the new direction is computed from current Eye position to specified Center position.
theCenter | [in] the point where the camera looks at. |
void Graphic3d_Camera::SetCustomMonoProjection | ( | const Graphic3d_Mat4d & | theProj | ) |
Set custom projection matrix.
void Graphic3d_Camera::SetCustomStereoFrustums | ( | const Aspect_FrustumLRBT< Standard_Real > & | theFrustumL, |
const Aspect_FrustumLRBT< Standard_Real > & | theFrustumR | ||
) |
Set custom stereo frustums. These can be retrieved from APIs like OpenVR.
void Graphic3d_Camera::SetCustomStereoProjection | ( | const Graphic3d_Mat4d & | theProjL, |
const Graphic3d_Mat4d & | theHeadToEyeL, | ||
const Graphic3d_Mat4d & | theProjR, | ||
const Graphic3d_Mat4d & | theHeadToEyeR | ||
) |
Set custom stereo projection matrices.
theProjL | [in] left eye projection matrix |
theHeadToEyeL | [in] left head to eye translation matrix |
theProjR | [in] right eye projection matrix |
theHeadToEyeR | [in] right head to eye translation matrix |
void Graphic3d_Camera::SetDirection | ( | const gp_Dir & | theDir | ) |
Sets camera look direction and computes the new Eye position relative to current Center. WARNING! This method does NOT verify that the current Up() vector is orthogonal to the new Direction.
theDir | [in] the direction. |
void Graphic3d_Camera::SetDirectionFromEye | ( | const gp_Dir & | theDir | ) |
void Graphic3d_Camera::SetDistance | ( | const Standard_Real | theDistance | ) |
Set distance of Eye from camera Center.
theDistance | [in] the distance. |
void Graphic3d_Camera::SetEye | ( | const gp_Pnt & | theEye | ) |
Sets camera Eye position. WARNING! For backward compatibility reasons, this method also changes view direction, so that the new direction is computed from new Eye position to old Center position.
theEye | [in] the location of camera's Eye. |
Sets camera Eye and Center positions.
theEye | [in] the location of camera's Eye |
theCenter | [in] the location of camera's Center |
void Graphic3d_Camera::SetFOV2d | ( | Standard_Real | theFOV | ) |
Set Field Of View (FOV) restriction for 2D on-screen elements.
void Graphic3d_Camera::SetFOVy | ( | const Standard_Real | theFOVy | ) |
Set Field Of View (FOV) in y axis for perspective projection. Field of View in x axis is automatically scaled from view aspect ratio.
theFOVy | [in] the FOV in degrees. |
void Graphic3d_Camera::SetIdentityOrientation | ( | ) |
Sets camera parameters to make current orientation matrix identity one.
void Graphic3d_Camera::SetIOD | ( | const IODType | theType, |
const Standard_Real | theIOD | ||
) |
Sets Intraocular distance.
theType | [in] the IOD definition type. IOD can be defined as absolute value or relatively to (as coefficient of) camera focal length. |
theIOD | [in] the Intraocular distance. |
void Graphic3d_Camera::SetProjectionType | ( | const Projection | theProjection | ) |
Change camera projection type. When switching to perspective projection from orthographic one, the ZNear and ZFar are reset to default values (0.001, 3000.0) if less than 0.0.
[in] | theProjection | the camera projection type. |
void Graphic3d_Camera::SetScale | ( | const Standard_Real | theScale | ) |
Sets camera scale. For orthographic projection the scale factor corresponds to parallel scale of view mapping (i.e. size of viewport). For perspective camera scale is converted to distance. The scale specifies equal size of the view projection in both dimensions assuming that the aspect is 1.0. The projection height and width are specified with the scale and correspondingly multiplied by the aspect.
theScale | [in] the scale factor. |
void Graphic3d_Camera::SetTile | ( | const Graphic3d_CameraTile & | theTile | ) |
Sets the Tile defining the drawing sub-area within View. Note that tile defining a region outside the view boundaries is also valid - use method Graphic3d_CameraTile::Cropped() to assign a cropped copy.
theTile | tile definition |
void Graphic3d_Camera::SetUp | ( | const gp_Dir & | theUp | ) |
Sets camera Up direction vector, orthogonal to camera direction. WARNING! This method does NOT verify that the new Up vector is orthogonal to the current Direction().
theUp | [in] the Up direction vector. |
|
inline |
Set using [0, 1] depth range or [-1, 1] range.
void Graphic3d_Camera::SetZFocus | ( | const FocusType | theType, |
const Standard_Real | theZFocus | ||
) |
Sets stereographic focus distance.
theType | [in] the focus definition type. Focus can be defined as absolute value or relatively to (as coefficient of) coefficient of camera focal length. |
theZFocus | [in] the focus absolute value or coefficient depending on the passed definition type. |
void Graphic3d_Camera::SetZRange | ( | const Standard_Real | theZNear, |
const Standard_Real | theZFar | ||
) |
Change the Near and Far Z-clipping plane positions. For orthographic projection, theZNear, theZFar can be negative or positive. For perspective projection, only positive values are allowed. Program error exception is raised if non-positive values are specified for perspective projection or theZNear >= theZFar.
theZNear | [in] the distance of the plane from the Eye. |
theZFar | [in] the distance of the plane from the Eye. |
|
inline |
Right side direction.
void Graphic3d_Camera::StereoProjection | ( | Graphic3d_Mat4d & | theProjL, |
Graphic3d_Mat4d & | theHeadToEyeL, | ||
Graphic3d_Mat4d & | theProjR, | ||
Graphic3d_Mat4d & | theHeadToEyeR | ||
) | const |
Get stereo projection matrices.
theProjL | [out] left eye projection matrix |
theHeadToEyeL | [out] left head to eye translation matrix |
theProjR | [out] right eye projection matrix |
theHeadToEyeR | [out] right head to eye translation matrix |
void Graphic3d_Camera::StereoProjectionF | ( | Graphic3d_Mat4 & | theProjL, |
Graphic3d_Mat4 & | theHeadToEyeL, | ||
Graphic3d_Mat4 & | theProjR, | ||
Graphic3d_Mat4 & | theHeadToEyeR | ||
) | const |
Get stereo projection matrices.
theProjL | [out] left eye projection matrix |
theHeadToEyeL | [out] left head to eye translation matrix |
theProjR | [out] right eye projection matrix |
theHeadToEyeR | [out] right head to eye translation matrix |
|
inline |
Get current tile.
void Graphic3d_Camera::Transform | ( | const gp_Trsf & | theTrsf | ) |
Transform orientation components of the camera: Eye, Up and Center points.
theTrsf | [in] the transformation to apply. |
Unproject point from normalized device coordinates to world coordinate space.
thePnt | [in] the NDC point. |
|
inline |
Get camera Up direction vector.
|
inline |
Calculate view plane size at center (target) point and distance between ZFar and ZNear planes.
gp_XYZ Graphic3d_Camera::ViewDimensions | ( | const Standard_Real | theZValue | ) | const |
Calculate view plane size at center point with specified Z offset and distance between ZFar and ZNear planes.
theZValue | [in] the distance from the eye in eye-to-center direction |
|
inline |
|
inline |
Returns modification state of camera world view transformation matrix.
|
inline |
Get the Far Z-clipping plane position.
bool Graphic3d_Camera::ZFitAll | ( | const Standard_Real | theScaleFactor, |
const Bnd_Box & | theMinMax, | ||
const Bnd_Box & | theGraphicBB, | ||
Standard_Real & | theZNear, | ||
Standard_Real & | theZFar | ||
) | const |
Estimate Z-min and Z-max planes of projection volume to match the displayed objects. The methods ensures that view volume will be close by depth range to the displayed objects. Fitting assumes that for orthogonal projection the view volume contains the displayed objects completely. For zoomed perspective view, the view volume is adjusted such that it contains the objects or their parts, located in front of the camera.
[in] | theScaleFactor | the scale factor for Z-range. The range between Z-min, Z-max projection volume planes evaluated by z fitting method will be scaled using this coefficient. Program error exception is thrown if negative or zero value is passed. |
[in] | theMinMax | applicative min max boundaries. |
[in] | theGraphicBB | real graphical boundaries (not accounting infinite flag). |
|
inline |
Change Z-min and Z-max planes of projection volume to match the displayed objects.
|
inline |
Get stereographic focus value.
|
inline |
Get stereographic focus definition type.
|
inline |
Get the Near Z-clipping plane position.