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 
26 {
27 public:
28 
29  IMX_Layer() { setDefault(); }
30 
31  /// "copy constructor" that does not copy the buffer pixels
32  IMX_Layer(const IMX_Layer &a, bool) { copyMetadata(a); }
33 
34  /// Initialize the IMX_Buffer
36  : IMX_Buffer(width, height, storage, channels)
37  {
38  setDefault(); // Initialize metadata
39  }
40 
41  /// Construct a layer from a PXL_Raster
42  IMX_Layer(const PXL_Raster &rp)
43  : IMX_Buffer(rp) // Create the underlying buffer
44  {
45  setDefault(); // Initialize metadata
46  setDataWindow(bufferWidth(), bufferHeight());
47  }
48 
49  ////////////////////////////////////////////////////////////////
50  // Accessors for image data
51 
52  /// The name is used to populate channel selector widgets, for VDB channel names,
53  /// and may be used to distiguish multiple channels on a wire in the future.
54  void setName(const UT_StringHolder& name) { myName = name; }
55  const UT_StringHolder& getName() const { return myName; }
56 
57  /// The dataWindow surrounds all the pixels
58  const UT_DimRect& dataWindow() const { return d->myDataWindow; }
59  int x() const { return d->myDataWindow.x(); }
60  int y() const { return d->myDataWindow.y(); }
61  UT_Vector2I xy() const { return UT_Vector2I(d->myDataWindow.data()); }
62  int width() const { return d->myDataWindow.width(); }
63  int height() const { return d->myDataWindow.height(); }
64  UT_Vector2I wh() const { return UT_Vector2I(d->myDataWindow.width(), d->myDataWindow.height()); }
65  int r() const { return d->myDataWindow.x2(); }
66  int t() const { return d->myDataWindow.y2(); }
67  UT_Vector2I rt() const { return UT_Vector2I(d->myDataWindow.x2(), d->myDataWindow.y2()); }
68 
69  /// Distortion in image->pixel space transform
70  fpreal64 pixelAspectRatio() const { return d->myPixelAspectRatio; }
71 
72  /// Aperture in pixels
73  const UT_Vector2D &displayWindowSize() const { return d->myDisplayWindowSize; }
74  UT_Vector2D displayWindowXY() const { return d->myImageToPixelTranslate - d->myDisplayWindowSize / 2; }
75  UT_Vector2D displayWindowRT() const { return d->myImageToPixelTranslate + d->myDisplayWindowSize / 2; }
76 
77  /// width / height of the aperture / displayWindow
79  { return d->myPixelAspectRatio * d->myDisplayWindowSize[0] / d->myDisplayWindowSize[1]; }
80 
81  /// Camera
82  enum Projection { ORTHOGRAPHIC, PERSPECTIVE };
83  Projection projection() const { return d->myProjection; }
84  bool isOrtho() const { return d->myProjection == ORTHOGRAPHIC; }
85  bool isPerspective() const { return d->myProjection == PERSPECTIVE; }
86  fpreal64 apertureMax() const { return d->myApertureMax; }
87  UT_Vector2D apertureOffset() const { return - UT_Vector2D(d->myCamera) * d->myApertureMax / 2; }
88  fpreal64 focalLength() const { return d->myCamera[2] * d->myApertureMax / 2; }
89  fpreal64 fStop() const { return d->myFStop; }
90  fpreal64 lensDiameter() const { return focalLength() * d->myFStop; }
91  const UT_Vector2D &clippingRange() const { return d->myClippingRange; }
92  fpreal64 focusPlane() const { return d->myFocusPlane; }
93  const UT_Vector3D &cameraPosition() const { return d->myCamera; }
94  fpreal64 cameraZ() const { return d->myCamera[2]; }
95  const UT_Vector2D &shutter() const { return d->myShutter; }
96 
97  /// Transform from camera space to image space.
98  UT_Matrix4D projectionXform() const;
99 
100  /// Transform from camera space to texture space for Vulkan rasterization
101  UT_Matrix4D projectionXformVk() const;
102 
103  /// Transform from image space to world space.
104  const UT_Matrix4D &transform() const { return d->myTransform; }
105  const UT_Matrix4D &imageToWorldXform() const { return d->myTransform; }
106 
107  /// Transform from world space to camera space.
108  /// Equal to invert(transform()).translate(-cameraPosition())
109  UT_Matrix4D inverseCameraXform() const;
110 
111  ////////////////////////////////////////////////////////////////
112  /// Coordinate transforms
113  // translate is always done after scale
114 
115  const UT_Vector2D &imageToPixelScale() const { return d->myImageToPixelScale; }
116  const UT_Vector2D &imageToPixelTranslate() const { return d->myImageToPixelTranslate; }
117 
118  const UT_Vector2D &bufferToPixelScale() const { return myBufferToPixelScale; }
120  { return 1.0 / UT_Vector2D(bufferWidth(), bufferHeight()); }
122  { return UT_Vector2D(bufferWidth(), bufferHeight()); }
123  const UT_Vector2D &pixelScale() const { return myBufferToPixelScale; }
124  bool isPixelScale() const { return pixelScale() != UT_Vector2D(1,1); }
125  const UT_Vector2D &bufferToPixelTranslate() const { return myBufferToPixelTranslate; }
126 
128  { return d->myImageToPixelScale / myBufferToPixelScale; }
130  { return (d->myImageToPixelTranslate - myBufferToPixelTranslate) / myBufferToPixelScale; }
132  { return myBufferToPixelScale / d->myImageToPixelScale; }
133 
134  /// Image <-> Pixel
136  { return v * imageToPixelScale() + imageToPixelTranslate(); }
138  { return (v - imageToPixelTranslate()) / imageToPixelScale(); }
139 
140  /// Pixel <-> Buffer
142  { return (v - bufferToPixelTranslate()) / bufferToPixelScale(); }
144  { return v * bufferToPixelScale() + bufferToPixelTranslate(); }
145 
146  /// Image <-> Buffer
148  { return pixelToBuffer(imageToPixel(v)); }
150  { return pixelToImage(bufferToPixel(v)); }
151 
152  // Buffer <-> texture, this is not just a scale as texture goes
153  // to the corners of pixels, but buffer is to the center.
155  { return (v + 0.5f) * bufferToTextureScale(); }
157  { return v * textureToBufferScale() - 0.5f; }
158 
159  // Image <-> texture
161  { return bufferToTexture(imageToBuffer(v)); }
163  { return bufferToImage(textureToBuffer(v)); }
164 
165  // Transform point texture <-> pixel:
167  { return bufferToPixel(textureToBuffer(v)); }
169  { return bufferToTexture(pixelToBuffer(v)); }
170 
171  /// Transform 0,0 to lower-left of buffer in world space, 1,1 to upper-right of buffer
172  /// in world space. This is used to convert the layer to a volume.
173  UT_Matrix4D bufferUVToWorldXform() const;
174  /// Sets the world transform such that the given transformation becomes this
175  /// layer's UV to world.
176  void setBufferUVToWorldXform(UT_Matrix4D xform);
177 
178  /// Initializes this layer from a given voxel array. Number of channels in
179  /// the image will be set to tuple size of T, and the data type will also be
180  /// set accordingly. Z-resolution of src must be 1.
181  /// If data_too is true, the data is also copied from the source array;
182  /// otherwise, this layer is only appropriate formatted and sized to match
183  /// the input.
184  template <typename T>
185  void initFromVoxels(const UT_VoxelArray<T>& src, bool data_too);
186 
187  ////////////////////////////////////////////////////////////////
188  /// Modifications to layer metadata, in approximate order you call them.
189 
190  /// reset metadata to default value
191  void setDefault();
192 
193  /// Copy everything except the buffer allocations, leaving the result dirty.
194  /// This avoids any chance that writing this layer will modify the original layer.
195  /// It also avoids shared pointer overhead and keeping buffers around longer than needed.
196  void copyMetadata(const IMX_Layer& a)
197  {
199  myBufferToPixelScale = a.myBufferToPixelScale;
200  myBufferToPixelTranslate = a.myBufferToPixelTranslate;
201  myName = a.myName;
202  d = a.d;
203  myAttributes = a.myAttributes;
204  }
205 
206  /// Set pixel aspect ratio. This must be done before setDataWindow
207  void setPixelAspectRatio(fpreal64 pa) { wd()->myPixelAspectRatio = pa; }
208 
209  /// Set both dataWindow and displayWindow to the same rectangle
210  void setDataWindow(int w, int h) { setDataWindow(0, 0, w, h); }
211  void setDataWindow(int x, int y, int w, int h)
212  {
213  wd()->myDataWindow.set(x, y, w, h);
214  setDisplayWindow(x, y, w, h);
215  }
216 
217  /// Set dataWindow w/o changing displayWindow
218  void setDataWindowOnly(int x, int y, int w, int h) { wd()->myDataWindow.set(x, y, w, h); }
219 
220  /// Set the displayWindow w/o changing dataWindow
221  void setDisplayWindow(int w, int h) { setDisplayWindow(0, 0, w, h); }
222  void setDisplayWindow(int x, int y, int w, int h)
223  { setDisplayWindow(UT_Vector2D(x,y), UT_Vector2D(w,h)); }
224  void setDisplayWindow(const UT_Vector2D &xy, const UT_Vector2D &wh)
225  {
226  Metadata *w = wd();
227  w->myDisplayWindowSize = wh;
228  const fpreal64 pa = w->myPixelAspectRatio;
229  const fpreal64 m = (pa * wh[0] >= wh[1]) ? wh[0] / 2 : wh[1] / 2 / pa;
230  w->myImageToPixelScale.assign(m, m * pa);
231  w->myImageToPixelTranslate = xy + wh / 2;
232  }
233 
234  /// Set the aspect ratio of displayWindow exactly, centering the new displayWindow
235  /// into the old one, two sides will be unchanged, others may be non-integers.
236  void setApertureAspect(int n, int d) { setApertureAspect(fpreal64(n)/d); }
237  void setApertureAspect(fpreal64 a);
238 
239  // set up the camera. You must call these in approximately this order:
240  void setProjection(Projection p) { if (d->myProjection != p) wd()->myProjection = p; setBufferXforms(); }
241  void setOrtho() { setProjection(ORTHOGRAPHIC); }
242  void setPerspective() { setProjection(PERSPECTIVE); }
243  void setCameraPosition(const UT_Vector3D &p) { wdf()->myCamera = p; setBufferXforms(); }
244  void setCameraZ(fpreal64 z) { wdf()->myCamera[2] = z; setBufferXforms(); }
245  void setAperture(fpreal64 mm) { wd()->myApertureMax = mm; setBufferXforms(); }
246  void setApertureOffset(const UT_Vector2D &p) { setApertureCenter(p * (2 / d->myApertureMax)); setBufferXforms(); }
247  void setApertureCenter(const UT_Vector2D &p) // same but in image units
248  { UT_Vector3D &c = wdf()->myCamera; c[0] = -p[0]; c[1] = -p[1]; setBufferXforms(); }
249  void setFocalLength(fpreal64 mm) { wdf()->myCamera[2] = 2 * mm / d->myApertureMax; setBufferXforms(); }
250  void setFStop(fpreal64 f) { wd()->myFStop = f; setBufferXforms(); }
251  void setLensDiameter(fpreal64 mm) { wd()->myFStop = mm / focalLength(); setBufferXforms(); }
252  void setClippingRange(const UT_Vector2D &v) { wd()->myClippingRange = v; setBufferXforms(); }
253  void setFocusPlane(fpreal64 f) { wd()->myFocusPlane = f; setBufferXforms(); }
254  void setShutter(const UT_Vector2D &v) { wd()->myShutter = v; setBufferXforms(); }
255 
256  /// set the imageToWorld transform. This can be done at any time
257  void setTransform(const UT_Matrix4D& m) { wdf()->myTransform = m; setBufferXforms(); }
258  void transform(const UT_Matrix4D& m) { wdf()->myTransform *= m; setBufferXforms(); }
259  void preTransform(const UT_Matrix4D& m) { wdf()->myTransform.preMultiply(m); setBufferXforms(); }
260  /// set the inverseCameraTransform which will set the transform.
261  /// Using this avoids multiple inverts of the matrix to get the value back.
262  void setInverseCameraXform(const UT_Matrix4D& m);
263 
264  ////////////////////////////////////////////////////////////////
265  /// One of these functions *must* be called after changing the display or dataWindow.
266  /// This will correctly set up the buffer size and transformations.
267 
268  /// Directly set the buffer size. The bufferToPixel transform is set so
269  /// this rectangle is mapped to the dataWindow.
270  /// Note this overrides the IMX_Buffer method.
271  void setBufferSize(int w, int h);
272 
273  /// Set buffer size so each buffer pixel is approximately this many pixels.
274  /// Value is adjusted down so the width() and height() are an integer number of
275  /// buffer pixels. Very tiny numbers are clamped to a minimum.
276  void setPixelScale(const UT_Vector2D&);
277 
278  /// Make the buffer pixels match the pixels. Same as setPixelScale(1), or
279  /// setBufferSize(width(), height())
281  {
282  myBufferToPixelScale = 1;
283  myBufferToPixelTranslate.assign(x()+0.5f, y()+0.5f);
284  setBufferSize(width(), height());
285  setBufferXforms();
286  }
287 
288  /// Sets the buffer so isAligned(src) is true. Pretty much the same as
289  /// copying the pixelScale but this will allow the buffer edges to
290  /// not match the datawindow at all.
291  void setAligned(const IMX_Layer& src);
292 
293  /// Exactly set pixelScale, however upper-right pixels of buffer may
294  /// go outside of the dataWindow. Values outside the range 1..width() are
295  /// not recommended.
296  void setBufferToPixelScale(const UT_Vector2D &p);
297 
298  /// Adjust the transform so the lower-left corner of the dataWindow and buffer
299  /// don't match. This value is where the center of the lower-left buffer pixel
300  /// is in pixel space.
301  void setBufferToPixelTranslate(const UT_Vector2D &p);
302 
303  void setAttributes(const UT_OptionsHolder &attrib)
304  { myAttributes = attrib; }
306  { return myAttributes; }
307 
308  /// Updates the contents of the attributes, first making sure it is
309  /// unique. The provided operator should take a reference to
310  /// a UT_Options that it will update.
311  /// this->update([](UT_Options &opt) { opt.setOptionS("test", "bar"); });
312  template <typename OP>
313  void updateAttributes(const OP &op)
314  { myAttributes.update(op); }
315 
316 private:
317  void setBufferXforms();
318 
319  UT_StringHolder myName;
320 
321  /// The settings of this are also stored in IMX_Buffer::setBufferXforms.
322  /// This is kept here to avoid rounding errors recovering the values
323  UT_Vector2D myBufferToPixelScale{1,1};
324  UT_Vector2D myBufferToPixelTranslate{0.5, 0.5};
325 
326  /// All info that is often identical between images is in this shared object
327  struct Metadata
328  {
329  // Default size is 1x1, no one should be leaking default sizes
330  // but instead should be getting the proper values from
331  // context options or from input data.
332  UT_DimRect myDataWindow{0, 0, 1, 1}; // overall size
333  UT_Vector2D myDisplayWindowSize{1, 1};
334  fpreal64 myPixelAspectRatio = 1.0f;
335  UT_Vector2D myImageToPixelScale{0.5, 0.5};
336  UT_Vector2D myImageToPixelTranslate{0.5, 0.5};
337 
338  // Camera:
339  Projection myProjection = ORTHOGRAPHIC;
340  fpreal64 myApertureMax = 20.955;
341  UT_Vector3D myCamera{0, 0, 1}; // camera pos in image space
342  UT_Vector2D myClippingRange{0, 2}; // near/far in image space
343  fpreal64 myFocusPlane = 0; // relative to origin
344  fpreal64 myFStop = 0;
345  UT_Vector2D myShutter{-0.25, 0.25}; // usd default is 0,0
346  // lens distortion
347 
348  // int myFirstFrame = 0; // start of frame range
349  // unsigned myNumFrames = 1; // length of frame range
350  // fpreal64 myFPS = 30;
351 
352  UT_Matrix4D myTransform{1}; // transform to world space
353  mutable UT_Matrix4D myICXform{1}; // myTransform.invert.translate(-myCamera)
354  mutable bool fixICXform = true; // myICXform is out of date
355  };
356 
358 
359  UT_OptionsHolder myAttributes;
360 
361  Metadata *wd();
362  Metadata *wdf() { Metadata *w = wd(); w->fixICXform = true; return w; }
363 };
364 
void setAttributes(const UT_OptionsHolder &attrib)
Definition: IMX_Layer.h:303
UT_Vector2T< int64 > UT_Vector2I
void copyMetadata(const IMX_Buffer &source)
UT_Vector2I rt() const
Definition: IMX_Layer.h:67
void setProjection(Projection p)
Definition: IMX_Layer.h:240
UT_Vector2D bufferToPixel(const UT_Vector2D &v) const
Definition: IMX_Layer.h:143
UT_Vector2D textureToImage(const UT_Vector2D &v) const
Definition: IMX_Layer.h:162
UT_Vector2D imageToBuffer(const UT_Vector2D &v) const
Image <-> Buffer.
Definition: IMX_Layer.h:147
void setPerspective()
Definition: IMX_Layer.h:242
int x() const
Definition: IMX_Layer.h:59
void setCameraPosition(const UT_Vector3D &p)
Definition: IMX_Layer.h:243
fpreal64 focalLength() const
Definition: IMX_Layer.h:88
void updateAttributes(const OP &op)
Definition: IMX_Layer.h:313
const UT_Vector2D & imageToPixelTranslate() const
Definition: IMX_Layer.h:116
getFileOption("OpenEXR:storage") storage
Definition: HDK_Image.dox:276
const UT_Vector2D & pixelScale() const
Definition: IMX_Layer.h:123
void setPixelAspectRatio(fpreal64 pa)
Set pixel aspect ratio. This must be done before setDataWindow.
Definition: IMX_Layer.h:207
void setTransform(const UT_Matrix4D &m)
set the imageToWorld transform. This can be done at any time
Definition: IMX_Layer.h:257
UT_Vector2D imageToTexture(const UT_Vector2D &v) const
Definition: IMX_Layer.h:160
const GLdouble * v
Definition: glcorearb.h:837
UT_Vector2D textureToPixel(const UT_Vector2D &v) const
Definition: IMX_Layer.h:166
const UT_Matrix4D & transform() const
Transform from image space to world space.
Definition: IMX_Layer.h:104
UT_Vector2D bufferToTexture(const UT_Vector2D &v) const
Definition: IMX_Layer.h:154
void setBufferToPixels()
Definition: IMX_Layer.h:280
UT_Vector2T< fpreal64 > UT_Vector2D
GLdouble GLdouble GLdouble z
Definition: glcorearb.h:848
fpreal64 fStop() const
Definition: IMX_Layer.h:89
UT_Vector2D textureToBuffer(const UT_Vector2D &v) const
Definition: IMX_Layer.h:156
void setApertureOffset(const UT_Vector2D &p)
Definition: IMX_Layer.h:246
const UT_DimRect & dataWindow() const
The dataWindow surrounds all the pixels.
Definition: IMX_Layer.h:58
GLboolean GLboolean GLboolean GLboolean a
Definition: glcorearb.h:1222
const UT_Vector2D & bufferToPixelScale() const
Definition: IMX_Layer.h:118
UT_OptionsHolder attributes() const
Definition: IMX_Layer.h:305
const UT_Vector2D & clippingRange() const
Definition: IMX_Layer.h:91
GLint y
Definition: glcorearb.h:103
fpreal64 apertureMax() const
Definition: IMX_Layer.h:86
Projection
Camera.
Definition: IMX_Layer.h:82
IMX_Layer()
Definition: IMX_Layer.h:29
void setLensDiameter(fpreal64 mm)
Definition: IMX_Layer.h:251
const UT_StringHolder & getName() const
Definition: IMX_Layer.h:55
IMX_Layer(const IMX_Layer &a, bool)
"copy constructor" that does not copy the buffer pixels
Definition: IMX_Layer.h:32
double fpreal64
Definition: SYS_Types.h:201
int bufferHeight() const
Get height (number of rows) of the buffer.
Definition: IMX_Buffer.h:298
UT_Vector2D pixelToImage(const UT_Vector2D &v) const
Definition: IMX_Layer.h:137
void copyMetadata(const IMX_Layer &a)
Definition: IMX_Layer.h:196
UT_Vector2D pixelToBuffer(const UT_Vector2D &v) const
Pixel <-> Buffer.
Definition: IMX_Layer.h:141
GLint GLsizei GLsizei height
Definition: glcorearb.h:103
int t() const
Definition: IMX_Layer.h:66
GLdouble n
Definition: glcorearb.h:2008
GLfloat f
Definition: glcorearb.h:1926
const UT_Vector2D & displayWindowSize() const
Aperture in pixels.
Definition: IMX_Layer.h:73
void setFocalLength(fpreal64 mm)
Definition: IMX_Layer.h:249
UT_Vector2D imageToBufferTranslate() const
Definition: IMX_Layer.h:129
UT_Vector2D pixelToTexture(const UT_Vector2D &v) const
Definition: IMX_Layer.h:168
void setBufferSize(int width, int height)
Sets size of this buffer.
void setApertureCenter(const UT_Vector2D &p)
Definition: IMX_Layer.h:247
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
Definition: UT_SharedPtr.h:36
void setDisplayWindow(const UT_Vector2D &xy, const UT_Vector2D &wh)
Definition: IMX_Layer.h:224
UT_SharedPtr< const IMX_Layer > IMX_LayerConstPtr
Definition: IMX_Layer.h:366
const UT_Matrix4D & imageToWorldXform() const
Definition: IMX_Layer.h:105
bool isPerspective() const
Definition: IMX_Layer.h:85
fpreal64 apertureAspect() const
width / height of the aperture / displayWindow
Definition: IMX_Layer.h:78
UT_Vector2D textureToBufferScale() const
Definition: IMX_Layer.h:121
UT_Vector2D bufferPixelSize() const
Definition: IMX_Layer.h:131
void setAperture(fpreal64 mm)
Definition: IMX_Layer.h:245
void setApertureAspect(int n, int d)
Definition: IMX_Layer.h:236
int r() const
Definition: IMX_Layer.h:65
UT_Vector2D imageToPixel(const UT_Vector2D &v) const
Image <-> Pixel.
Definition: IMX_Layer.h:135
int height() const
Definition: IMX_Layer.h:63
GLuint const GLchar * name
Definition: glcorearb.h:786
const UT_Vector3D & cameraPosition() const
Definition: IMX_Layer.h:93
fpreal64 pixelAspectRatio() const
Distortion in image->pixel space transform.
Definition: IMX_Layer.h:70
GLint GLenum GLint x
Definition: glcorearb.h:409
fpreal64 lensDiameter() const
Definition: IMX_Layer.h:90
void setDataWindowOnly(int x, int y, int w, int h)
Set dataWindow w/o changing displayWindow.
Definition: IMX_Layer.h:218
void setDisplayWindow(int x, int y, int w, int h)
Definition: IMX_Layer.h:222
void setDataWindow(int x, int y, int w, int h)
Definition: IMX_Layer.h:211
bool isPixelScale() const
Definition: IMX_Layer.h:124
UT_Vector2D bufferToImage(const UT_Vector2D &v) const
Definition: IMX_Layer.h:149
int y() const
Definition: IMX_Layer.h:60
int width() const
Definition: IMX_Layer.h:62
GLfloat GLfloat GLfloat GLfloat h
Definition: glcorearb.h:2002
UT_Vector2D apertureOffset() const
Definition: IMX_Layer.h:87
const UT_Vector2D & shutter() const
Definition: IMX_Layer.h:95
bool isOrtho() const
Definition: IMX_Layer.h:84
fpreal64 focusPlane() const
Definition: IMX_Layer.h:92
void setFocusPlane(fpreal64 f)
Definition: IMX_Layer.h:253
IMX_Layer(const PXL_Raster &rp)
Construct a layer from a PXL_Raster.
Definition: IMX_Layer.h:42
Projection projection() const
Definition: IMX_Layer.h:83
StorageType
Definition: CE_Image.h:27
const UT_Vector2D & imageToPixelScale() const
Coordinate transforms.
Definition: IMX_Layer.h:115
void transform(const UT_Matrix4D &m)
Definition: IMX_Layer.h:258
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)
Set transform between image and buffer space.
void setDataWindow(int w, int h)
Set both dataWindow and displayWindow to the same rectangle.
Definition: IMX_Layer.h:210
void preTransform(const UT_Matrix4D &m)
Definition: IMX_Layer.h:259
void setClippingRange(const UT_Vector2D &v)
Definition: IMX_Layer.h:252
GLint GLsizei width
Definition: glcorearb.h:103
void setFStop(fpreal64 f)
Definition: IMX_Layer.h:250
#define IMX_API
Definition: IMX_API.h:8
int bufferWidth() const
Get width (number of columns in a row) of the buffer.
Definition: IMX_Buffer.h:296
void setOrtho()
Definition: IMX_Layer.h:241
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:35
UT_Vector2D imageToBufferScale() const
Definition: IMX_Layer.h:127
UT_Vector2I xy() const
Definition: IMX_Layer.h:61
void setName(const UT_StringHolder &name)
Definition: IMX_Layer.h:54
UT_Vector2I wh() const
Definition: IMX_Layer.h:64
fpreal64 cameraZ() const
Definition: IMX_Layer.h:94
void setShutter(const UT_Vector2D &v)
Definition: IMX_Layer.h:254
UT_SharedPtr< IMX_Layer > IMX_LayerPtr
Definition: IMX_Layer.h:365
void setDisplayWindow(int w, int h)
Set the displayWindow w/o changing dataWindow.
Definition: IMX_Layer.h:221
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:119
const UT_Vector2D & bufferToPixelTranslate() const
Definition: IMX_Layer.h:125
void setCameraZ(fpreal64 z)
Definition: IMX_Layer.h:244
GLenum src
Definition: glcorearb.h:1793
UT_Vector2D displayWindowRT() const
Definition: IMX_Layer.h:75
UT_Vector2D displayWindowXY() const
Definition: IMX_Layer.h:74