HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
IMX_Layer.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  */
7 
8 #pragma once
9 
10 #include "IMX_API.h"
11 
12 #include "IMX_Buffer.h"
13 
14 #include <UT/UT_Array.h>
15 #include <UT/UT_Matrix4.h>
16 #include <UT/UT_Rect.h>
17 #include <UT/UT_SharedPtr.h>
18 #include <UT/UT_Vector3.h>
19 #include <UT/UT_Vector4.h>
20 #include <UT/UT_Options.h>
21 
22 /// This is the object read/written by IMX_Node. It is (usually) one AOV (a
23 /// Vec4f per pixel) of an image.
24 
25 class IMX_Layer;
28 
30 {
31 public:
32 
33  IMX_Layer() { setDefault(); }
34 
35  /// "copy constructor" that does not copy the buffer pixels
36  IMX_Layer(const IMX_Layer &a, bool) { copyMetadata(a); }
37 
38  /// Initialize the IMX_Buffer
40  : IMX_Buffer(width, height, storage, channels)
41  {
42  setDefault(); // Initialize metadata
43  }
44 
45  /// Construct a layer from a PXL_Raster
46  IMX_Layer(const PXL_Raster &rp)
47  : IMX_Buffer(rp) // Create the underlying buffer
48  {
49  setDefault(); // Initialize metadata
50  setDataWindow(bufferWidth(), bufferHeight());
51  setBufferToPixels();
52  }
53 
54  /// Returns true for successful save.
55  bool save(std::ostream &os) const;
56  bool saveJSON(UT_JSONWriter &w) const;
57 
58  /// Returns a newly created Layer loaded from the stream, or null
59  /// if load failure.
60  static IMX_LayerPtr load(UT_IStream &is);
61  static IMX_LayerPtr loadJSON(UT_JSONParser &p);
62 
63  /// Write our fields into the provided options:
64  /// THis does not include the stat block, nor attributes.
65  void copyMetadataToOptions(UT_Options &opt) const;
66  /// Load ourselves from the options, ignoring fields we don't know
67  void updateMetadataFromOptions(const UT_Options &opt);
68 
69  ////////////////////////////////////////////////////////////////
70  // Accessors for image data
71 
72  /// The dataWindow surrounds all the pixels
73  const UT_DimRect& dataWindow() const { return d->myDataWindow; }
74  int x() const { return d->myDataWindow.x(); }
75  int y() const { return d->myDataWindow.y(); }
76  UT_Vector2I xy() const { return UT_Vector2I(d->myDataWindow.data()); }
77  int width() const { return d->myDataWindow.width(); }
78  int height() const { return d->myDataWindow.height(); }
79  UT_Vector2I wh() const { return UT_Vector2I(d->myDataWindow.width(), d->myDataWindow.height()); }
80  int r() const { return d->myDataWindow.x2(); }
81  int t() const { return d->myDataWindow.y2(); }
82  UT_Vector2I rt() const { return UT_Vector2I(d->myDataWindow.x2(), d->myDataWindow.y2()); }
83 
84  /// Distortion in image->pixel space transform
85  fpreal64 pixelAspectRatio() const { return d->myPixelAspectRatio; }
86 
87  /// Aperture in pixels
88  const UT_Vector2D &displayWindowSize() const { return d->myDisplayWindowSize; }
89  UT_Vector2D displayWindowXY() const { return d->myImageToPixelTranslate - d->myDisplayWindowSize / 2; }
90  UT_Vector2D displayWindowRT() const { return d->myImageToPixelTranslate + d->myDisplayWindowSize / 2; }
91 
92  /// width / height of the aperture / displayWindow
94  { return d->myPixelAspectRatio * d->myDisplayWindowSize[0] / d->myDisplayWindowSize[1]; }
95 
96  /// Camera
100  fpreal64 apertureMax() const { return d->myApertureMax; }
101  fpreal64 focalLength() const { return d->myFocalLength; }
102  fpreal64 fStop() const { return d->myFStop; }
103  fpreal64 lensDiameter() const { return focalLength() * d->myFStop; }
104  const UT_Vector2D &clippingRange() const { return d->myClippingRange; }
105  fpreal64 focusDistance() const { return d->myFocusDistance; }
106  const UT_Vector3D &cameraPosition() const { return d->myCamera; }
107  fpreal64 cameraZ() const { return d->myCamera[2]; }
108  const UT_Vector2D &shutter() const { return d->myShutter; }
109 
110  /// Transform from camera space to image space.
111  UT_Matrix4D projectionXform() const;
112 
113  /// Transform from camera space to texture space for Vulkan rasterization
114  UT_Matrix4D projectionXformVk() const;
115 
116  /// Transform from image space to world space.
117  UT_Matrix4D baseTransform() const { return d->myTransform; }
118  UT_Matrix4D transform() const { return imageToWorldXform(); }
120  { UT_Matrix4D toimage = d->myTransform; toimage.prescale(d->myImagingScale); return toimage; }
121 
122  /// Transform from world space to camera space.
123  /// Equal to invert(transform()).translate(-cameraPosition())
124  UT_Matrix4D inverseCameraXform() const;
125 
126  ////////////////////////////////////////////////////////////////
127  /// Coordinate transforms
128  // translate is always done after scale
129 
130  const UT_Vector2D &imageToPixelScale() const { return d->myImageToPixelScale; }
131  const UT_Vector2D &imageToPixelTranslate() const { return d->myImageToPixelTranslate; }
132 
133  const UT_Vector2D &bufferToPixelScale() const { return myBufferToPixelScale; }
135  { return 1.0 / UT_Vector2D(bufferWidth(), bufferHeight()); }
137  { return UT_Vector2D(bufferWidth(), bufferHeight()); }
138  const UT_Vector2D &pixelScale() const { return myBufferToPixelScale; }
139  bool isPixelScale() const { return pixelScale() != UT_Vector2D(1,1); }
140  const UT_Vector2D &bufferToPixelTranslate() const { return myBufferToPixelTranslate; }
141 
143  { return d->myImageToPixelScale / myBufferToPixelScale; }
145  { return (d->myImageToPixelTranslate - myBufferToPixelTranslate) / myBufferToPixelScale; }
147  { return myBufferToPixelScale / d->myImageToPixelScale; }
148 
149  /// Image <-> Pixel
151  { return v * imageToPixelScale() + imageToPixelTranslate(); }
153  { return (v - imageToPixelTranslate()) / imageToPixelScale(); }
154 
155  /// Pixel <-> Buffer
157  { return (v - bufferToPixelTranslate()) / bufferToPixelScale(); }
159  { return v * bufferToPixelScale() + bufferToPixelTranslate(); }
160 
161  /// Image <-> Buffer
163  { return pixelToBuffer(imageToPixel(v)); }
165  { return pixelToImage(bufferToPixel(v)); }
166 
167  // Buffer <-> texture, this is not just a scale as texture goes
168  // to the corners of pixels, but buffer is to the center.
170  { return (v + 0.5f) * bufferToTextureScale(); }
172  { return v * textureToBufferScale() - 0.5f; }
173 
174  // Image <-> texture
176  { return bufferToTexture(imageToBuffer(v)); }
178  { return bufferToImage(textureToBuffer(v)); }
179 
180  // Transform point texture <-> pixel:
182  { return bufferToPixel(textureToBuffer(v)); }
184  { return bufferToTexture(pixelToBuffer(v)); }
185 
186  /// This is used to convert the layer to a volume, so the resulting
187  /// buffer coordinates will line up with the canonical "volume" space.
188  UT_Matrix4D bufferUVToWorldXform(fpreal *taper = nullptr) const;
189  /// Sets the world transform such that the given transformation becomes this
190  /// layer's UV to world.
191  void setBufferUVToWorldXform(UT_Matrix4D xform, fpreal taper);
192 
193  /// Initializes this layer from a given voxel array. Number of channels in
194  /// the image will be set to tuple size of T, and the data type will also be
195  /// set accordingly. Z-resolution of src must be 1.
196  /// If data_too is true, the data is also copied from the source array;
197  /// otherwise, this layer is only appropriate formatted and sized to match
198  /// the input.
199  template <typename T>
200  void initFromVoxels(const UT_VoxelArray<T>& src, bool data_too);
201 
202  ////////////////////////////////////////////////////////////////
203  /// Modifications to layer metadata, in approximate order you call them.
204 
205  /// reset metadata to default value
206  void setDefault();
207 
208  /// Copy everything except the buffer allocations, leaving the result dirty.
209  /// This avoids any chance that writing this layer will modify the original layer.
210  /// It also avoids shared pointer overhead and keeping buffers around longer than needed.
211  void copyMetadata(const IMX_Layer& a)
212  {
214  myBufferToPixelScale = a.myBufferToPixelScale;
215  myBufferToPixelTranslate = a.myBufferToPixelTranslate;
216  d = a.d;
217  myAttributes = a.myAttributes;
218  }
219 
220  /// Set pixel aspect ratio. This must be done before setDataWindow
221  void setPixelAspectRatio(fpreal64 pa) { wd()->myPixelAspectRatio = pa; }
222 
223  /// Set both dataWindow and displayWindow to the same rectangle
224  void setDataWindow(int w, int h) { setDataWindow(0, 0, w, h); }
225  void setDataWindow(int x, int y, int w, int h)
226  {
227  wd()->myDataWindow.set(x, y, w, h);
228  setDisplayWindow(x, y, w, h);
229  }
230 
231  /// Set dataWindow w/o changing displayWindow
232  void setDataWindowOnly(int x, int y, int w, int h) { wd()->myDataWindow.set(x, y, w, h); }
233 
234  /// Set the displayWindow w/o changing dataWindow
235  void setDisplayWindow(int w, int h) { setDisplayWindow(0, 0, w, h); }
236  void setDisplayWindow(int x, int y, int w, int h)
237  { setDisplayWindow(UT_Vector2D(x,y), UT_Vector2D(w,h)); }
238  void setDisplayWindow(const UT_Vector2D &xy, const UT_Vector2D &wh)
239  {
240  Metadata *w = wd();
241  w->myDisplayWindowSize = wh;
242  const fpreal64 pa = w->myPixelAspectRatio;
243  const fpreal64 m = (pa * wh[0] >= wh[1]) ? wh[0] / 2 : wh[1] / 2 / pa;
244  w->myImageToPixelScale.assign(m, m * pa);
245  w->myImageToPixelTranslate = xy + wh / 2;
246  }
247 
248  /// Set the aspect ratio of displayWindow exactly, centering the new displayWindow
249  /// into the old one, two sides will be unchanged, others may be non-integers.
250  void setApertureAspect(int n, int d) { setApertureAspect(fpreal64(n)/d); }
251  void setApertureAspect(fpreal64 a);
252 
253  // set up the camera. You must call these in approximately this order:
255  { if (statProjection() == p) return;
257  void setOrtho() { setProjection(IMX_Projection::IMX_ORTHOGRAPHIC); }
259  void setCameraPosition(const UT_Vector3D &p) { wdf()->myCamera = p; setBufferXforms(); }
260  void setCameraZ(fpreal64 z) { wdf()->myCamera[2] = z; setBufferXforms(); }
261  void setImagingDist(fpreal64 z);
262  void setAperture(fpreal64 mm) { wd()->myApertureMax = mm; setBufferXforms(); }
263  void setApertureOffset(const UT_Vector2D &p) { setApertureCenter(p * (2 / d->myApertureMax)); setBufferXforms(); }
264  void setApertureCenter(const UT_Vector2D &p) // same but in image units
265  { UT_Vector3D &c = wdf()->myCamera; c[0] = -p[0]; c[1] = -p[1]; setBufferXforms(); }
266  void setFocalLength(fpreal64 mm) { wdf()->myFocalLength = mm; setBufferXforms(); }
267  void setFStop(fpreal64 f) { wd()->myFStop = f; setBufferXforms(); }
268  void setLensDiameter(fpreal64 mm) { wd()->myFStop = mm / focalLength(); setBufferXforms(); }
269  void setClippingRange(const UT_Vector2D &v) { wd()->myClippingRange = v; setBufferXforms(); }
270  void setFocusDistance(fpreal64 f) { wd()->myFocusDistance = f; setBufferXforms(); }
271  void setShutter(const UT_Vector2D &v) { wd()->myShutter = v; setBufferXforms(); }
272 
273  /// set the imageToWorld transform. This can be done at any time
274  void setBaseTransform(const UT_Matrix4D& m) { wdf()->myTransform = m; setBufferXforms(); }
275  void transform(const UT_Matrix4D& m) { wdf()->myTransform *= m; setBufferXforms(); }
276  void preTransform(const UT_Matrix4D& m) { wdf()->myTransform.preMultiply(m); setBufferXforms(); }
277  /// set the inverseCameraTransform which will set the transform.
278  /// Using this avoids multiple inverts of the matrix to get the value back.
279  void setInverseCameraXform(const UT_Matrix4D& m);
280 
281  ////////////////////////////////////////////////////////////////
282  /// One of these functions *must* be called after changing the display or dataWindow.
283  /// This will correctly set up the buffer size and transformations.
284 
285  /// Directly set the buffer size. The bufferToPixel transform is set so
286  /// this rectangle is mapped to the dataWindow.
287  /// Note this overrides the IMX_Buffer method.
288  void setBufferSize(int w, int h);
289 
290  /// Set buffer size so each buffer pixel is approximately this many pixels.
291  /// Value is adjusted down so the width() and height() are an integer number of
292  /// buffer pixels. Very tiny numbers are clamped to a minimum.
293  void setPixelScale(const UT_Vector2D&);
294 
295  /// Make the buffer pixels match the pixels. Same as setPixelScale(1), or
296  /// setBufferSize(width(), height())
298  {
299  myBufferToPixelScale = 1;
300  myBufferToPixelTranslate.assign(x()+0.5f, y()+0.5f);
301  setBufferSize(width(), height());
302  setBufferXforms();
303  }
304 
305  /// Sets the buffer so isAligned(src) is true. Pretty much the same as
306  /// copying the pixelScale but this will allow the buffer edges to
307  /// not match the datawindow at all.
308  void setAligned(const IMX_Layer& src);
309 
310  /// Exactly set pixelScale, however upper-right pixels of buffer may
311  /// go outside of the dataWindow. Values outside the range 1..width() are
312  /// not recommended.
313  void setBufferToPixelScale(const UT_Vector2D &p);
314 
315  /// Adjust the transform so the lower-left corner of the dataWindow and buffer
316  /// don't match. This value is where the center of the lower-left buffer pixel
317  /// is in pixel space.
318  void setBufferToPixelTranslate(const UT_Vector2D &p);
319 
320  void setAttributes(const UT_OptionsHolder &attrib)
321  { myAttributes = attrib; }
323  { return myAttributes; }
324 
325  /// Updates the contents of the attributes, first making sure it is
326  /// unique. The provided operator should take a reference to
327  /// a UT_Options that it will update.
328  /// this->update([](UT_Options &opt) { opt.setOptionS("test", "bar"); });
329  template <typename OP>
330  void updateAttributes(const OP &op)
331  { myAttributes.update(op); }
332 
333  /// Layer registration to allow layers to be converted
334  /// to integers across HOM boundaries.
335 
336  /// Registers & returns the handle, adding the handle to the registered
337  /// list
338  static int registerLayer(IMX_LayerConstPtr layer, UT_IntArray &registered);
339  /// Unregister all layers corresponding to the provided list,
340  /// erase the list afterwards. Assertion if handle wasn't regsitered
341  static void unregisterLayers(UT_IntArray &registered);
342  /// Look up a registered layer by handle.
343  static IMX_LayerConstPtr lookupLayer(int handle);
344 
345 private:
346  void setBufferXforms();
347 
348  /// The settings of this are also stored in IMX_Buffer::setBufferXforms.
349  /// This is kept here to avoid rounding errors recovering the values
350  UT_Vector2D myBufferToPixelScale{1,1};
351  UT_Vector2D myBufferToPixelTranslate{0.5, 0.5};
352 
353  /// All info that is often identical between images is in this shared object
354  struct Metadata
355  {
356  // Default size is 1x1, no one should be leaking default sizes
357  // but instead should be getting the proper values from
358  // context options or from input data.
359  UT_DimRect myDataWindow{0, 0, 1, 1}; // overall size
360  UT_Vector2D myDisplayWindowSize{1, 1};
361  fpreal64 myPixelAspectRatio = 1.0f;
362  UT_Vector2D myImageToPixelScale{0.5, 0.5};
363  UT_Vector2D myImageToPixelTranslate{0.5, 0.5};
364 
365  // Camera:
366  // Projection is in stat.
367  fpreal64 myApertureMax = 20.955;
368  fpreal64 myFocalLength = 10.4775;
369  // camera z implicitly defines the imaging plane's distance
370  // from the camera, as our imaging plane is at zero.
371  // Camera position is in imaging space-relative World space.
372  // It thus always represents world-distance offsets, so scaling
373  // myTransform would leave camera unscaled.
374  // It is relative to the origin of the imaging space, using
375  // the space (possibly non-ortho, but normalized) defined by
376  // myTransform.
377  UT_Vector3D myCamera{0, 0, 1}; // camera pos in image-relative world space
378  // Size of imaging plane,
379  // Has to update with cameraz/focallength/aperture
380  // Could be baked into myTransform, but then we'd lose precision
381  // on updates.
382  UT_Vector3D myImagingScale{1, 1, 1};
383  // The scale sizes of the axes of the imaging space at the
384  // imaging origin (so independent of taper) This is baked
385  // into myTransform and is used to convert imagelengths to
386  // world lengths.
387  UT_Vector3D myTransformScale{1, 1, 1};
388  UT_Vector2D myClippingRange{0, 2}; // near/far in image space
389  fpreal64 myFocusDistance = 0; // relative to origin
390  fpreal64 myFStop = 0;
391  UT_Vector2D myShutter{-0.25, 0.25}; // usd default is 0,0
392 
393 
394  // lens distortion
395 
396  UT_Matrix4D myTransform{1}; // transform to world space
397  mutable UT_Matrix4D myICXform{1}; // myTransform.invert.translate(-myCamera)
398  mutable bool fixICXform = true; // myICXform is out of date
399  };
400 
402 
403  UT_OptionsHolder myAttributes;
404 
405  Metadata *wd();
406  Metadata *wdf() { Metadata *w = wd(); w->fixICXform = true; return w; }
407 };
void setAttributes(const UT_OptionsHolder &attrib)
Definition: IMX_Layer.h:320
UT_Vector2T< int64 > UT_Vector2I
void copyMetadata(const IMX_Buffer &source)
UT_Vector2I rt() const
Definition: IMX_Layer.h:82
UT_Vector2D bufferToPixel(const UT_Vector2D &v) const
Definition: IMX_Layer.h:158
UT_Vector2D textureToImage(const UT_Vector2D &v) const
Definition: IMX_Layer.h:177
UT_Vector2D imageToBuffer(const UT_Vector2D &v) const
Image <-> Buffer.
Definition: IMX_Layer.h:162
void setPerspective()
Definition: IMX_Layer.h:258
int x() const
Definition: IMX_Layer.h:74
void setCameraPosition(const UT_Vector3D &p)
Definition: IMX_Layer.h:259
fpreal64 focalLength() const
Definition: IMX_Layer.h:101
void updateAttributes(const OP &op)
Definition: IMX_Layer.h:330
const UT_Vector2D & imageToPixelTranslate() const
Definition: IMX_Layer.h:131
getFileOption("OpenEXR:storage") storage
Definition: HDK_Image.dox:276
const UT_Vector2D & pixelScale() const
Definition: IMX_Layer.h:138
void setPixelAspectRatio(fpreal64 pa)
Set pixel aspect ratio. This must be done before setDataWindow.
Definition: IMX_Layer.h:221
UT_Vector2D imageToTexture(const UT_Vector2D &v) const
Definition: IMX_Layer.h:175
const GLdouble * v
Definition: glcorearb.h:837
UT_Vector2D textureToPixel(const UT_Vector2D &v) const
Definition: IMX_Layer.h:181
UT_Vector2D bufferToTexture(const UT_Vector2D &v) const
Definition: IMX_Layer.h:169
void setBufferToPixels()
Definition: IMX_Layer.h:297
UT_Vector2T< fpreal64 > UT_Vector2D
fpreal64 focusDistance() const
Definition: IMX_Layer.h:105
GLdouble GLdouble GLdouble z
Definition: glcorearb.h:848
fpreal64 fStop() const
Definition: IMX_Layer.h:102
UT_Vector2D textureToBuffer(const UT_Vector2D &v) const
Definition: IMX_Layer.h:171
IMX_Projection
Definition: IMX_Types.h:54
void setApertureOffset(const UT_Vector2D &p)
Definition: IMX_Layer.h:263
const UT_DimRect & dataWindow() const
The dataWindow surrounds all the pixels.
Definition: IMX_Layer.h:73
GLboolean GLboolean GLboolean GLboolean a
Definition: glcorearb.h:1222
const UT_Vector2D & bufferToPixelScale() const
Definition: IMX_Layer.h:133
UT_OptionsHolder attributes() const
Definition: IMX_Layer.h:322
const UT_Vector2D & clippingRange() const
Definition: IMX_Layer.h:104
JSON reader class which handles parsing of JSON or bJSON files.
Definition: UT_JSONParser.h:87
GLint y
Definition: glcorearb.h:103
fpreal64 apertureMax() const
Definition: IMX_Layer.h:100
Class which writes ASCII or binary JSON streams.
Definition: UT_JSONWriter.h:37
IMX_Layer()
Definition: IMX_Layer.h:33
void setLensDiameter(fpreal64 mm)
Definition: IMX_Layer.h:268
IMX_Layer(const IMX_Layer &a, bool)
"copy constructor" that does not copy the buffer pixels
Definition: IMX_Layer.h:36
GLenum GLuint GLint GLint layer
Definition: glcorearb.h:1299
double fpreal64
Definition: SYS_Types.h:201
UT_Vector2D pixelToImage(const UT_Vector2D &v) const
Definition: IMX_Layer.h:152
void copyMetadata(const IMX_Layer &a)
Definition: IMX_Layer.h:211
UT_Vector2D pixelToBuffer(const UT_Vector2D &v) const
Pixel <-> Buffer.
Definition: IMX_Layer.h:156
GLint GLsizei GLsizei height
Definition: glcorearb.h:103
int t() const
Definition: IMX_Layer.h:81
GLdouble n
Definition: glcorearb.h:2008
GLfloat f
Definition: glcorearb.h:1926
const UT_Vector2D & displayWindowSize() const
Aperture in pixels.
Definition: IMX_Layer.h:88
void setFocalLength(fpreal64 mm)
Definition: IMX_Layer.h:266
UT_Vector2D imageToBufferTranslate() const
Definition: IMX_Layer.h:144
UT_Vector2D pixelToTexture(const UT_Vector2D &v) const
Definition: IMX_Layer.h:183
void setBufferSize(int width, int height)
Sets size of this buffer.
void setApertureCenter(const UT_Vector2D &p)
Definition: IMX_Layer.h:264
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
Definition: UT_SharedPtr.h:36
IMX_Projection statProjection() const
Returns the projection type.
void setDisplayWindow(const UT_Vector2D &xy, const UT_Vector2D &wh)
Definition: IMX_Layer.h:238
UT_SharedPtr< const IMX_Layer > IMX_LayerConstPtr
Definition: IMX_Layer.h:27
bool isPerspective() const
Definition: IMX_Layer.h:99
fpreal64 apertureAspect() const
width / height of the aperture / displayWindow
Definition: IMX_Layer.h:93
UT_Vector2D textureToBufferScale() const
Definition: IMX_Layer.h:136
void prescale(T sx, T sy, T sz, T sw=1)
Definition: UT_Matrix4.h:719
UT_Vector2D bufferPixelSize() const
Definition: IMX_Layer.h:146
void setAperture(fpreal64 mm)
Definition: IMX_Layer.h:262
void setBufferXforms(const UT_Vector2F &buffer_to_image_scale, const UT_Vector2F &buffer_to_image_xlate, const UT_Vector2F &buffer_from_image_scale, const UT_Vector2F &buffer_from_image_xlate, const UT_Vector2F &buffer_to_pixel_scale, const UT_Vector2F &buffer_to_pixel_xlate, const UT_Matrix4F &image_to_world, const UT_Matrix4F &world_to_image, const UT_Matrix4F &camera_to_world, const UT_Vector3F &camera_image_pos)
Set transform between image and buffer space.
void setApertureAspect(int n, int d)
Definition: IMX_Layer.h:250
int r() const
Definition: IMX_Layer.h:80
exint bufferHeight() const
Get height (number of rows) of the buffer.
Definition: IMX_Buffer.h:185
UT_Vector2D imageToPixel(const UT_Vector2D &v) const
Image <-> Pixel.
Definition: IMX_Layer.h:150
int height() const
Definition: IMX_Layer.h:78
const UT_Vector3D & cameraPosition() const
Definition: IMX_Layer.h:106
fpreal64 pixelAspectRatio() const
Distortion in image->pixel space transform.
Definition: IMX_Layer.h:85
GLint GLenum GLint x
Definition: glcorearb.h:409
fpreal64 lensDiameter() const
Definition: IMX_Layer.h:103
void setDataWindowOnly(int x, int y, int w, int h)
Set dataWindow w/o changing displayWindow.
Definition: IMX_Layer.h:232
void setDisplayWindow(int x, int y, int w, int h)
Definition: IMX_Layer.h:236
void setDataWindow(int x, int y, int w, int h)
Definition: IMX_Layer.h:225
bool isPixelScale() const
Definition: IMX_Layer.h:139
UT_Vector2D bufferToImage(const UT_Vector2D &v) const
Definition: IMX_Layer.h:164
UT_Matrix4D transform() const
Definition: IMX_Layer.h:118
int y() const
Definition: IMX_Layer.h:75
int width() const
Definition: IMX_Layer.h:77
GLfloat GLfloat GLfloat GLfloat h
Definition: glcorearb.h:2002
A map of string to various well defined value types.
Definition: UT_Options.h:84
const UT_Vector2D & shutter() const
Definition: IMX_Layer.h:108
bool isOrtho() const
Definition: IMX_Layer.h:98
IMX_Layer(const PXL_Raster &rp)
Construct a layer from a PXL_Raster.
Definition: IMX_Layer.h:46
StorageType
Definition: CE_Image.h:27
const UT_Vector2D & imageToPixelScale() const
Coordinate transforms.
Definition: IMX_Layer.h:130
fpreal64 fpreal
Definition: SYS_Types.h:278
void transform(const UT_Matrix4D &m)
Definition: IMX_Layer.h:275
void setProjection(IMX_Projection p)
Definition: IMX_Layer.h:254
void setDataWindow(int w, int h)
Set both dataWindow and displayWindow to the same rectangle.
Definition: IMX_Layer.h:224
exint bufferWidth() const
Get width (number of columns in a row) of the buffer.
Definition: IMX_Buffer.h:183
UT_Matrix4D baseTransform() const
Transform from image space to world space.
Definition: IMX_Layer.h:117
void setFocusDistance(fpreal64 f)
Definition: IMX_Layer.h:270
void preTransform(const UT_Matrix4D &m)
Definition: IMX_Layer.h:276
void setClippingRange(const UT_Vector2D &v)
Definition: IMX_Layer.h:269
GLint GLsizei width
Definition: glcorearb.h:103
void setFStop(fpreal64 f)
Definition: IMX_Layer.h:267
#define IMX_API
Definition: IMX_API.h:8
void setOrtho()
Definition: IMX_Layer.h:257
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:857
void assign(T xx=0.0f, T yy=0.0f)
Set the values of the vector components.
Definition: UT_Vector2.h:446
IMX_Layer(int width, int height, CE_Image::StorageType storage, int channels)
Initialize the IMX_Buffer.
Definition: IMX_Layer.h:39
IMX_Projection projection() const
Camera.
Definition: IMX_Layer.h:97
UT_Vector2D imageToBufferScale() const
Definition: IMX_Layer.h:142
UT_Vector2I xy() const
Definition: IMX_Layer.h:76
UT_Vector2I wh() const
Definition: IMX_Layer.h:79
void setBaseTransform(const UT_Matrix4D &m)
set the imageToWorld transform. This can be done at any time
Definition: IMX_Layer.h:274
fpreal64 cameraZ() const
Definition: IMX_Layer.h:107
void setStatProjection(IMX_Projection projection)
void setShutter(const UT_Vector2D &v)
Definition: IMX_Layer.h:271
UT_SharedPtr< IMX_Layer > IMX_LayerPtr
Definition: IMX_Layer.h:26
void setDisplayWindow(int w, int h)
Set the displayWindow w/o changing dataWindow.
Definition: IMX_Layer.h:235
UT_Matrix4D imageToWorldXform() const
Definition: IMX_Layer.h:119
ImageBuf OIIO_API channels(const ImageBuf &src, int nchannels, cspan< int > channelorder, cspan< float > channelvalues={}, cspan< std::string > newchannelnames={}, bool shuffle_channel_names=false, int nthreads=0)
UT_Vector2D bufferToTextureScale() const
Definition: IMX_Layer.h:134
const UT_Vector2D & bufferToPixelTranslate() const
Definition: IMX_Layer.h:140
void setCameraZ(fpreal64 z)
Definition: IMX_Layer.h:260
GLenum src
Definition: glcorearb.h:1793
UT_Vector2D displayWindowRT() const
Definition: IMX_Layer.h:90
UT_Vector2D displayWindowXY() const
Definition: IMX_Layer.h:89