HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
screenWindowParameters.h
Go to the documentation of this file.
1 //
2 // Copyright 2016 Pixar
3 //
4 // Licensed under the terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 //
7 #ifndef PXR_IMAGING_CAMERA_UTIL_SCREEN_WINDOW_PARAMETERS_H
8 #define PXR_IMAGING_CAMERA_UTIL_SCREEN_WINDOW_PARAMETERS_H
9 
10 #include "pxr/pxr.h"
12 #include "pxr/base/gf/camera.h"
13 
15 
16 
17 /// \class CameraUtilScreenWindowParameters
18 ///
19 /// Given a camera object, compute parameters suitable for setting up
20 /// RenderMan.
21 ///
23 {
24 public:
25  /// Constructs screenwindow parameter. The optional \p fitDirection
26  /// indicates in which direction the screenwindow will have length 2.
29  GfCamera::FOVDirection fitDirection =
31 
32  /// The vector (left, right, bottom, top) defining the rectangle in the
33  /// image plane.
34  /// Give these parameters to RiScreenWindow.
35  const GfVec4d & GetScreenWindow() const { return _screenWindow; }
36 
37  /// The field of view. More precisely, the full angle perspective field
38  /// of view (in degrees) between screen space coordinates (-1,0) and
39  /// (1,0).
40  /// Give these parameters to RiProjection as parameter after
41  /// "perspective".
42  double GetFieldOfView() const { return _fieldOfView; }
43 
44  /// Returns the inverse of the transform for a camera that is y-Up
45  /// and z-facing (vs the OpenGL camera that is (-z)-facing).
46  /// Write this transform with RiConcatTransform before
47  /// RiWorldBegin.
48  const GfMatrix4d & GetZFacingViewMatrix() const {
49  return _zFacingViewMatrix;
50  }
51 
52 private:
53  GfVec4d _screenWindow;
54  double _fieldOfView;
55  GfMatrix4d _zFacingViewMatrix;
56 };
57 
58 
60 
61 #endif // PXR_IMAGING_CAMERA_UTIL_SCREEN_WINDOW_PARAMETERS_H
CAMERAUTIL_API CameraUtilScreenWindowParameters(const GfCamera &camera, GfCamera::FOVDirection fitDirection=GfCamera::FOVHorizontal)
FOVDirection
Direction used for Field of View or orthographic size.
Definition: camera.h:42
Object-based representation of a camera.
Definition: camera.h:32
const GfVec4d & GetScreenWindow() const
Definition: vec4d.h:45
const GfMatrix4d & GetZFacingViewMatrix() const
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
#define CAMERAUTIL_API
Definition: api.h:23