34 static constexpr
UT_StringLit theCameraMetadataKey =
"camera_metadata";
58 bool save(std::ostream &os)
const;
68 void copyMetadataToOptions(
UT_Options &opt)
const;
70 void updateMetadataFromOptions(
const UT_Options &opt);
77 int x()
const {
return d->myDataWindow.x(); }
78 int y()
const {
return d->myDataWindow.y(); }
80 int width()
const {
return d->myDataWindow.width(); }
81 int height()
const {
return d->myDataWindow.height(); }
83 int r()
const {
return d->myDataWindow.x2(); }
84 int t()
const {
return d->myDataWindow.y2(); }
100 {
return d->myPixelAspectRatio * d->myDisplayWindowSize[0] / d->myDisplayWindowSize[1]; }
166 {
return d->myImageToPixelScale / myBufferToPixelScale; }
168 {
return (d->myImageToPixelTranslate - myBufferToPixelTranslate) / myBufferToPixelScale; }
170 {
return myBufferToPixelScale / d->myImageToPixelScale; }
174 {
return v * imageToPixelScale() + imageToPixelTranslate(); }
176 {
return (v - imageToPixelTranslate()) / imageToPixelScale(); }
180 {
return (v - bufferToPixelTranslate()) / bufferToPixelScale(); }
182 {
return v * bufferToPixelScale() + bufferToPixelTranslate(); }
186 {
return pixelToBuffer(imageToPixel(v)); }
188 {
return pixelToImage(bufferToPixel(v)); }
193 {
return (v + 0.5
f) * bufferToTextureScale(); }
195 {
return v * textureToBufferScale() - 0.5f; }
199 {
return bufferToTexture(imageToBuffer(v)); }
201 {
return bufferToImage(textureToBuffer(v)); }
205 {
return bufferToPixel(textureToBuffer(v)); }
207 {
return bufferToTexture(pixelToBuffer(v)); }
220 {
return UT_Vector3D(v * imageToBufferScale() * bufferToLocalScale()); }
222 {
return UT_Vector2D(v) / bufferToLocalScale() / imageToBufferScale(); }
225 UT_Vector3D s(imageToBufferScale() * bufferToLocalScale());
231 UT_Vector3D s(imageToBufferScale() * bufferToLocalScale());
238 {
return image3ToWorld(localToImage3(v)); }
240 {
return image3ToLocal(worldToImage3(v)); }
257 template <
typename T>
276 myBufferToPixelScale = a.myBufferToPixelScale;
277 myBufferToPixelTranslate = a.myBufferToPixelTranslate;
279 myProperties = a.myProperties;
289 wd()->myDataWindow.set(x, y, w, h);
290 setDisplayWindow(x, y, w, h);
303 w->myDisplayWindowSize = wh;
304 const fpreal64 pa = w->myPixelAspectRatio;
305 const fpreal64 m = (pa * wh[0] >= wh[1]) ? wh[0] / 2 : wh[1] / 2 / pa;
306 w->myImageToPixelScale.
assign(m, m * pa);
307 w->myImageToPixelTranslate = xy + wh / 2;
312 setDisplayWindow(rect.
x(), rect.
y(), rect.
w(), rect.
h());
323 w->myDataWindow.setX(w->myDataWindow.x()+dx);
324 w->myDataWindow.setY(w->myDataWindow.y()+dy);
389 myBufferToPixelScale = 1;
390 myBufferToPixelTranslate.assign(
x()+0.5
f,
y()+0.5
f);
408 void setBufferToPixelTranslate(
const UT_Vector2D &p);
411 { myProperties =
props; }
413 {
return myProperties; }
419 template <
typename OP>
421 { myProperties.update(op); }
431 static void unregisterLayers(
UT_IntArray ®istered);
444 fpreal64 computeMin(
int channel = 0)
const;
445 fpreal64 computeMax(
int channel = 0)
const;
448 fpreal64 computeAverage(
int channel = 0)
const;
449 exint computeMinI(
int channel = 0)
const;
450 exint computeMaxI(
int channel = 0)
const;
509 mutable bool fixICXform =
true;
517 Metadata *wdf() { Metadata *
w = wd(); w->fixICXform =
true;
return w; }
519 bool myIsMetadataOnly =
false;
UT_Vector2T< int64 > UT_Vector2I
void copyMetadata(const IMX_Buffer &source)
bool SYSisEqual(const UT_Vector2T< T > &a, const UT_Vector2T< T > &b, S tol)
Componentwise equality.
UT_Vector2D bufferToPixel(const UT_Vector2D &v) const
UT_Vector2D textureToImage(const UT_Vector2D &v) const
UT_Vector2D imageToBuffer(const UT_Vector2D &v) const
Image <-> Buffer.
void setCameraPosition(const UT_Vector3D &p)
bool isMetadataOnly() const
fpreal64 focalLength() const
void updateProperties(const OP &op)
const UT_Vector2D & imageToPixelTranslate() const
getFileOption("OpenEXR:storage") storage
const UT_Vector2D & pixelScale() const
void setPixelAspectRatio(fpreal64 pa)
Set pixel aspect ratio. This must be done before setDataWindow.
UT_Vector2D imageToTexture(const UT_Vector2D &v) const
UT_Vector2D textureToPixel(const UT_Vector2D &v) const
UT_Vector2D bufferToTexture(const UT_Vector2D &v) const
UT_Vector3D imageToWorld(const UT_Vector2D &v) const
UT_Vector2T< fpreal64 > UT_Vector2D
fpreal64 focusDistance() const
GLdouble GLdouble GLdouble z
UT_Vector2D textureToBuffer(const UT_Vector2D &v) const
constexpr SYS_FORCE_INLINE T & z() noexcept
void setApertureOffset(const UT_Vector2D &p)
const UT_DimRect & dataWindow() const
The dataWindow surrounds all the pixels.
UT_Vector3D localToImage3(const UT_Vector3D &v) const
int h() const
Get width/height dimensions.
GLboolean GLboolean GLboolean GLboolean a
UT_Vector3D imagingScale() const
const UT_Vector2D & bufferToPixelScale() const
const UT_Vector2D & clippingRange() const
JSON reader class which handles parsing of JSON or bJSON files.
void setIsMetadataOnly(bool v)
GLenum GLenum GLsizei void * image
fpreal64 apertureMax() const
Class which writes ASCII or binary JSON streams.
void setLensDiameter(fpreal64 mm)
UT_Vector3D worldToLocal(const UT_Vector3D &v) const
IMX_Layer(const IMX_Layer &a, bool)
"copy constructor" that does not copy the buffer pixels
GLenum GLuint GLint GLint layer
constexpr SYS_FORCE_INLINE T & x() noexcept
UT_Vector2D pixelToImage(const UT_Vector2D &v) const
void copyMetadata(const IMX_Layer &a)
UT_Vector2D pixelToBuffer(const UT_Vector2D &v) const
Pixel <-> Buffer.
GA_API const UT_StringHolder scale
GLint GLsizei GLsizei height
const UT_Vector2D & displayWindowSize() const
Aperture in pixels.
void setFocalLength(fpreal64 mm)
UT_Vector2D imageToBufferTranslate() const
UT_Vector2D pixelToTexture(const UT_Vector2D &v) const
void setBufferSize(int width, int height)
Sets size of this buffer.
void setApertureCenter(const UT_Vector2D &p)
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
IMX_Projection statProjection() const
Returns the projection type.
void setDisplayWindow(const UT_Vector2D &xy, const UT_Vector2D &wh)
void setProperties(const UT_OptionsHolder &props)
UT_SharedPtr< const IMX_Layer > IMX_LayerConstPtr
bool isPerspective() const
fpreal64 apertureAspect() const
width / height of the aperture / displayWindow
void setDisplayWindow(const UT_DimRect &rect)
void setGuideScale(fpreal64 scale)
UT_Vector2D textureToBufferScale() const
void prescale(T sx, T sy, T sz, T sw=1)
UT_Vector3D localToWorld(const UT_Vector3D &v) const
UT_Vector2D bufferPixelSize() const
void translatePixelOrigin(int dx, int dy)
void setAperture(fpreal64 mm)
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.
int x() const
Get lower-left corner.
void setApertureAspect(int n, int d)
UT_Vector3T< fpreal64 > UT_Vector3D
exint bufferHeight() const
Get height (number of rows) of the buffer.
UT_Vector2D imageToPixel(const UT_Vector2D &v) const
Image <-> Pixel.
int w() const
Get width/height dimensions.
const UT_Vector3D & cameraPosition() const
fpreal64 imagingDist() const
UT_Vector3D image3ToLocal(const UT_Vector3D &v) const
fpreal64 pixelAspectRatio() const
Distortion in image->pixel space transform.
fpreal64 lensDiameter() const
void setDataWindowOnly(int x, int y, int w, int h)
Set dataWindow w/o changing displayWindow.
void setDisplayWindow(int x, int y, int w, int h)
void setDataWindow(int x, int y, int w, int h)
bool isPixelScale() const
UT_Vector2D bufferToImage(const UT_Vector2D &v) const
UT_Matrix4D transform() const
GLfloat GLfloat GLfloat GLfloat h
A map of string to various well defined value types.
const UT_Vector2D & shutter() const
IMX_Layer(const PXL_Raster &rp)
Construct a layer from a PXL_Raster.
const UT_Vector2D & imageToPixelScale() const
Coordinate transforms.
void transform(const UT_Matrix4D &m)
UT_OptionsHolder properties() const
void setProjection(IMX_Projection p)
void setDataWindow(int w, int h)
Set both dataWindow and displayWindow to the same rectangle.
UT_Vector2D worldToImage(const UT_Vector3D &v) const
fpreal64 guideScale() const
exint bufferWidth() const
Get width (number of columns in a row) of the buffer.
UT_Matrix4D baseTransform() const
Transform from image space to world space.
void setFocusDistance(fpreal64 f)
void preTransform(const UT_Matrix4D &m)
int y() const
Get lower-left corner.
void setClippingRange(const UT_Vector2D &v)
void setFStop(fpreal64 f)
UT_Vector3D imageToLocal(const UT_Vector2D &v) const
GLubyte GLubyte GLubyte GLubyte w
void assign(T xx=0.0f, T yy=0.0f)
Set the values of the vector components.
IMX_Layer(int width, int height, CE_Image::StorageType storage, int channels)
Initialize the IMX_Buffer.
IMX_Projection projection() const
Camera.
UT_Vector2D imageToBufferScale() const
constexpr SYS_FORCE_INLINE T & y() noexcept
UT_Vector2D localToImage(const UT_Vector3D &v) const
void setBaseTransform(const UT_Matrix4D &m)
set the imageToWorld transform. This can be done at any time
void setStatProjection(IMX_Projection projection)
void setShutter(const UT_Vector2D &v)
UT_SharedPtr< IMX_Layer > IMX_LayerPtr
void setDisplayWindow(int w, int h)
Set the displayWindow w/o changing dataWindow.
constexpr SYS_FORCE_INLINE T & y() noexcept
UT_Vector2D bufferToLocalScale() const
UT_Matrix4D imageToWorldXform() const
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
const UT_Vector2D & bufferToPixelTranslate() const
void setCameraZ(fpreal64 z)
GLenum GLuint GLsizei const GLenum * props
constexpr SYS_FORCE_INLINE T & x() noexcept
UT_Vector2D displayWindowRT() const
UT_Vector2D displayWindowXY() const