HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HOM_Camera.h
Go to the documentation of this file.
1  /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * COMMENTS:
7  */
8 
9 #ifndef __HOM_Camera_h__
10 #define __HOM_Camera_h__
11 
12 #include "HOM_API.h"
13 #include "HOM_Defines.h"
14 #include "HOM_Errors.h"
15 #include "HOM_Module.h"
16 #include "HOM_Matrix3.h"
17 #include <UT/UT_CameraParms.h>
18 #include <UT/UT_Vector3.h>
19 #include <UT/UT_Matrix3.h>
20 #include <UT/UT_Matrix4.h>
21 
22 // make sure our user facing name is hou.Camera
24 
26 {
27 public:
28 
29  HOM_Camera();
30 
31  HOM_Camera(const HOM_Camera& camera);
32 
35  std::map<std::string, hboost::any> parms);
36 
37 
38  SWIGOUT(%ignore HOM_Camera(const UT_CameraParms &parms,
39  const UT_Matrix3D &xform,
40  const UT_Vector3D &pos);)
41 
42  HOM_Camera(const UT_CameraParms &parms,
43  const UT_Matrix3D &xform,
44  const UT_Vector3D &pos)
45  : myParms(parms), myXform(xform), myPosition(pos)
46  { HOM_CONSTRUCT_OBJECT(this) }
47 
49 
50  std::string __repr__();
51 
52 
53  /// Accessors
54  HOM_Matrix3 *transform() const;
55  HOM_Vector3 position() const;
56 
57  /// returns a dictionary of all the camera parameters
58  /// "aperture":41.42136,
59  /// "pixelaspect":1,
60  /// "clipnear": 0.001
61  /// "clipfar" :1000000,
62  /// "cropmax":[1,1],
63  /// "cropmin":[0,0],
64  /// "focal":50,
65  /// "focusdistance":10,
66  /// "fstop":22.1,
67  /// "orthozoom":1,
68  /// "guidescale": 1,
69  /// "imagingdistance": 1,
70  /// "projection":"perspective",
71  /// "resolutionx" :320,
72  /// "resolutiony" : 243,
73  /// "shutteropen" : 0
74  /// "shutterclose": 0,
75  /// "windowmax":[1,1],
76  /// "windowmin":[0,0]
77  /// "metadata": {}
78 
79  std::map<std::string, hboost::any> parms() const;
80 
81  /// returns a dictionary of the associated metadata
82  std::map<std::string, hboost::any> metadata() const;
83 
84  double aperture() const;
85  double pixelAspect() const;
86  double focal() const;
87  double focusDistance() const;
88  double imagingDistance() const;
89  double fstop() const;
90  double orthoZoom() const;
91  double guideScale() const;
92 
93  HOM_EnumValue &projection() const;
94  std::string projectionToken() const;
95  bool isOrthographic() const;
96 
97  std::vector<int64> resolution() const;
98  int64 resolutionX() const;
99  int64 resolutionY() const;
100 
101  std::vector<double> cropMin() const;
102  std::vector<double> cropMax() const;
103 
104  std::vector<double> windowMin() const;
105  std::vector<double> windowMax() const;
106 
107  std::vector<double> clippingPlanes() const;
108  double nearClippingPlane() const;
109  double farClippingPlane() const;
110 
111  std::vector<double> shutter() const;
112  double shutterOpen() const;
113  double shutterClose() const;
114 
115 
116  /// Setters
117 
118  void setTransform(HOM_Matrix3 &transform);
119  void setPosition(HOM_Vector3 &position);
120  void setParms(const std::map<std::string, hboost::any> &parms);
121 
122  void setAperture(double aperture);
123  void setPixelAspect(double aspect);
124  void setFocal(double focal);
125  void setFocusDistance(double focusdist);
126  void setImagingDistance(double imagingdist);
127  void setFstop(double fstop);
128  void setOrthoZoom(double zoom);
129  void setGuideScale(double scale);
130 
131  void setProjection(HOM_EnumValue projection);
132 
133  void setResolution(const std::vector<int64> &res);
134  void setResolutionX(int64 resx);
135  void setResolutionY(int64 resy);
136 
137  void setCropMin(const std::vector<double> &min);
138  void setCropMax(const std::vector<double> &max);
139  void setWindowMin(const std::vector<double> &min);
140  void setWindowMax(const std::vector<double> &max);
141 
142  void setClippingPlanes(const std::vector<double> &planes);
143  void setNearClippingPlane(double near);
144  void setFarClippingPlane(double far);
145 
146  void setShutter(const std::vector<double> &shutter);
147  void setShutterOpen(double sopen);
148  void setShutterClose(double sclose);
149 
150  void setMetadata(const std::map<std::string, hboost::any> &metadata);
151 
152  SWIGOUT(%ignore getUTCameraParms;)
153  const UT_CameraParms &getUTCameraParms() const { return myParms; };
154 
155  SWIGOUT(%ignore getXform;)
157  {
158  UT_Matrix4D xform(myXform);
159  xform.translate(myPosition);
160  return xform;
161  }
162 
163 private:
164  SWIGOUT(%ignore myParms;)
165  UT_CameraParms myParms;
166 
167  SWIGOUT(%ignore myXform;)
168  UT_Matrix3D myXform;
169 
170  SWIGOUT(%ignore myPosition;)
171  UT_Vector3D myPosition;
172 
173 };
174 
175 #endif
#define HOM_DESTRUCT_OBJECT(pointer)
Definition: HOM_Module.h:1398
#define SWIGOUT(x)
Definition: HOM_Defines.h:24
string __repr__(VtArray< T > const &self)
Definition: wrapArray.h:312
ImageBuf OIIO_API min(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
GLdouble far
Definition: glcorearb.h:143
Definition: Camera.h:19
GA_API const UT_StringHolder scale
#define HOM_API
Definition: HOM_API.h:13
void ignore(T const &) VULKAN_HPP_NOEXCEPT
Definition: vulkan.hpp:6508
#define HOM_CONSTRUCT_OBJECT(pointer)
Definition: HOM_Module.h:1397
long long int64
Definition: SYS_Types.h:116
HUSD_API const char * resolution()
GA_API const UT_StringHolder transform
UT_Matrix4D getXform() const
Definition: HOM_Camera.h:156
GA_API const UT_StringHolder parms
void translate(T dx, T dy, T dz=0)
Definition: UT_Matrix4.h:769
OIIO_UTIL_API bool rename(string_view from, string_view to, std::string &err)
const UT_CameraParms & getUTCameraParms() const
Definition: HOM_Camera.h:153
SIM_API const UT_StringHolder position
ImageBuf OIIO_API max(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
GU_API void xform(CE_Context &context, bool recompile, int npts, const cl::Buffer &outPos, const cl::Buffer &inPos, const cl::Buffer &surfacexform, const cl::Buffer *grp=nullptr)