15 #ifndef __GUI_ViewParameter__
16 #define __GUI_ViewParameter__
49 void save(std::ostream &os)
const;
71 FRONT, RIGHT,
TOP, BACK, LEFT, BOTTOM, CPLANE };
79 area.
set(myViewportLeft, myViewportBottom, w,h);
81 void getViewport(
int &
l,
int &
r,
int &
b,
int &
t)
const;
85 w = myViewportRight - myViewportLeft + 1;
86 h = myViewportTop - myViewportBottom + 1;
89 {
return myViewportRight - myViewportLeft + 1; }
91 {
return myViewportTop - myViewportBottom + 1; }
94 { setViewport(r, viewarea.
x(), viewarea.
y(),
95 viewarea.
w(), viewarea.
h()); }
100 myViewportRight, myViewportTop); }
110 void getProjection(
UT_Matrix4D &proj,
bool depth_adjust=
true);
139 { setView(area.
x(), area.
y(), area.
w(), area.
h()); }
140 void setView(
int x,
int y,
int w,
int h);
141 void getView(
int &
l,
int &
r,
int &
b,
int &
t)
const;
143 {
return myViewRight - myViewLeft + 1; }
145 {
return myViewTop - myViewBottom + 1; }
149 myViewRight, myViewTop); }
153 void viewToViewportProjectionBounds(
160 {
return myViewLeft - myViewportLeft; }
162 {
return myViewportRight - myViewRight; }
164 {
return myViewBottom - myViewportBottom; }
166 {
return myViewportTop - myViewTop; }
170 bool centre_to_origin =
false,
bool zoom_in =
false);
172 void homeRotation(axis
a);
178 static void getOrientationChangeRotation(
193 void beginContinuouslyExportedOperation();
194 void endContinuouslyExportedOperation();
195 bool continuouslyExportedOperationInProgress()
const;
201 void incrementtrackball(
fpreal dx,
fpreal dy,
int finish);
202 void eulertumble(
fpreal dx,
fpreal dy,
int finish,
bool lock);
211 void worldLockedScroll(
const UT_Vector3R &locked_pos,
215 bool precise_zoom =
false,
216 bool smooth_deltas =
false);
223 void directedDolly(
const UT_Vector3R &unit_worldspace_dir,
224 fpreal dx,
bool precise_zoom =
false,
225 bool smooth_deltas =
false);
232 void zoom(
fpreal dx, GUI_ZoomItem item,
bool precise_zoom =
false);
235 void zoom(
fpreal dx, GUI_ZoomItem item,
237 bool precise_zoom =
false);
244 bool precise_zoom =
false);
247 bool precise_zoom =
false);
261 fpreal orthowidth,
bool is_ortho);
266 static void getFrustumCenter(
fpreal frustum_width,
fpreal aspect,
274 bool isDirty()
const {
return (myFlag.viewportDirty ||
275 myFlag.matrixDirty ||
276 myFlag.iMatrixDirty); }
291 *n = myView.myNearLimit;
292 *f = myView.myFarLimit;
294 void setNearClip(
fpreal near);
305 updateWindowOverridesNominal();
322 updateWindowOverridesNominal();
333 {
return myWindowOverridesNominal; }
340 void getViewBoundsRelativeToNominalWindow(
351 convertViewToScreenWindow(myView.myWinX, myView.myWinY,
352 myView.myWinW, myView.myWinH,
357 convertScreenToViewWindow(l, r, b, t,
358 myView.myWinX, myView.myWinY,
359 myView.myWinW, myView.myWinH);
362 static void convertScreenToViewWindow(
365 static void convertViewToScreenWindow(
376 GUI_VIEW_ADJUST_NONE = 0,
377 GUI_VIEW_ADJUST_FAR = 1,
378 GUI_VIEW_ADJUST_NEAR = 2,
379 GUI_VIEW_ADJUST_BOTH = 3
382 { myAdjustLimits = which; }
387 {
return myFlag.rotoTrackWindow; }
397 myFrustumWidthScale = xsc;
398 myFrustumHeightScale = ysc;
404 { myView.myT =
t; myFlag.matrixDirty=1; myFlag.iMatrixDirty=1;}
413 { myView.myP =
p; myFlag.matrixDirty=1; myFlag.iMatrixDirty=1;}
415 static void setOrientationMode(orientation o);
416 static orientation getOrientationMode();
418 {
return getOrientationMode() ==
Y_UP; }
420 {
return getOrientationMode() ==
Z_UP; }
424 { myTumbleStyle = style; }
427 { myAltKeyViewControls = style; }
430 { myScrollStyle = style; }
438 { myView.myRotateMatrix = mat;
439 myFlag.matrixDirty = 1;
440 myFlag.iMatrixDirty = 1;
441 myFlag.rxyzDirty = 1; }
445 {
return myProjectionOverride ? *myProjectionOverride
446 : myView.myProjectionMatrix; }
448 return myTransformMatrix; }
450 return myItransformMatrix; }
462 myTransformCallback = callback;
463 myTransformCallbackData =
data;
469 int save(std::ostream &os,
470 char separator =
'\n',
471 bool for_view_copy =
false)
const;
476 const char *
className()
const {
return "GUI_ViewParameter"; }
481 { myHomeAxis = homeaxis; myFlag.rxyzDirty = 1; }
491 myCPlaneHomeRotCallback = callback;
492 myCPlaneHomeRotCallbackData =
data;
516 myView.myHApertureOffset =
h;
517 myView.myVApertureOffset =
v;
521 h = myView.myHApertureOffset;
522 v = myView.myVApertureOffset;
550 : myT(0.0, 0.0, 0.1),
553 myProjectionMatrix(1.0),
560 myFocusDistance(5.0),
566 myHApertureOffset(0.0),
567 myVApertureOffset(0.0)
601 { view_state = myView; }
605 myFlag.matrixDirty=1;
606 myFlag.iMatrixDirty=1;
608 updateWindowOverridesNominal();
615 GUI_ViewAdjustLimits myAdjustLimits;
637 void updateTransformMatrix();
638 void updateItransformMatrix();
639 void updateRXYZValues();
640 fpreal getDistanceToBoxCenter(
int clamp = 0)
const;
655 bool computeWorldLockedScrollAccel(
fpreal dx,
fpreal dy,
663 void updateWindowOverridesNominal()
665 myWindowOverridesNominal =
666 (myView.myWinX != myNominalWinX ||
667 myView.myWinY != myNominalWinY ||
668 myView.myWinW != myNominalWinW ||
669 myView.myWinH != myNominalWinH);
678 static orientation myOrientationMode;
679 static int myTumbleStyle;
680 static int myAltKeyViewControls;
681 static int myScrollStyle;
682 static axis myDefaultHomingStyle;
691 void *myTransformCallbackData;
694 fpreal myLastHomeDistance;
695 fpreal myLastHomePixelWidthOBSOLETE;
696 fpreal myLastHomeAdjustedBoxWidth;
697 fpreal myLastHomeOrthoWidth;
703 bool myObsoleteScrollIsActive;
709 void *myCPlaneHomeRotCallbackData;
714 class ContinuousExportCache
717 ContinuousExportCache() {}
729 typedef ContinuousExportCache ViewOpCache;
731 ViewOpCache myContinuousExportCache;
732 bool myContinuousExportInProgress;
739 bool myWindowOverridesNominal;
746 int myViewportLeft, myViewportRight;
747 int myViewportBottom, myViewportTop;
753 int myViewLeft, myViewRight;
754 int myViewBottom, myViewTop;
763 #ifdef __DOCUMENTATION__
765 FOV can be computed from aperture and focal
length.
770 +------+------+-----------
774 Unzoomed \ | / Length
779 myFullW and myFullH are the dimensions of the plane onto which the
780 image is projected before
any adjustments
for zoom or window parms.
781 the plane is located at
"myAdjustedNear" along the
z axis.
782 After taking the zoom and win
channels into account, myAdjustedX and
783 myAdjustedY refer to the center of the view on the same plane, and
784 myAdjustedW and myAdjustedH contain the dimensions of the adjusted view.
void setLimits(fpreal n, fpreal f)
fpreal getNearClip() const
fpreal getNearLimit() const
int rotoscopeTracksWindowVals() const
bool doesWindowOverrideNominal() const
fpreal myFrustumHeightScale
void getViewportSize(int &w, int &h) const
static void setDefaultHomingStyleFlag(int style)
GLint GLint GLint GLint GLint GLint GLsizei width
GT_API const UT_StringHolder time
void setApertureOffsets(fpreal h, fpreal v)
void setWindow(fpreal x, fpreal y, fpreal w, fpreal h)
SYS_FORCE_INLINE void setT(const UT_Vector3D &t)
int getView2DVersion() const
GLboolean GLboolean GLboolean GLboolean a
GA_API const UT_StringHolder rot
int getBottomMargin() const
GLint GLint GLint GLint GLint GLint GLsizei GLsizei height
int h() const
Get width/height dimensions.
void setAperture(fpreal a)
void setCPlaneHomeRotCallback(GUI_HomeRotCallback callback, void *data)
int getApplyAspectFlag() const
static void setTumbleStyleFlag(int style)
void getLimits(fpreal *n, fpreal *f)
void setView(const UT_DimRect &area)
GLenum GLsizei GLenum GLenum const void * image
void getApertureOffsets(fpreal &h, fpreal &v) const
int getView3DVersion() const
void setFocalUnitScale(fpreal f)
void setViewport(RE_Render *r, const UT_DimRect &viewarea)
void(* GUI_HomeRotCallback)(UT_Matrix3R &, void *)
fpreal getFarLimit() const
void setScreenWindow(fpreal l, fpreal r, fpreal b, fpreal t)
fpreal getAperture() const
void setFocalLength(fpreal f)
const char * className() const
void setAdjustLimits(GUI_ViewAdjustLimits which)
fpreal getFocalLength() const
void getWindow(fpreal &x, fpreal &y, fpreal &w, fpreal &h) const
int getViewportHeight() const
void setApplyAspectFlag(int a)
SYS_FORCE_INLINE void setP(const UT_Vector3D &p)
bool any(const vbool4 &v)
GLint GLint GLint GLint GLint x
void setWindowAffectRotoscope(int v)
fpreal getFocalUnitScale() const
GLint GLint GLint GLint GLint GLint y
fpreal myFrustumWidthScale
void setHomeAxis(axis homeaxis)
GLint GLenum GLsizei GLint GLsizei const void * data
void getViewport(UT_DimRect &area) const
GLfloat GLfloat GLfloat top
GUI_ViewAdjustLimits getAdjustLimits() const
UT_Matrix4D myRotateMatrix
void set(int v1, int v2, int v3, int v4)
Set the native rect type values.
GLubyte GLubyte GLubyte GLubyte w
void setOrthoWidth(fpreal w)
static bool isOrientationZUp()
void setRotateMatrix(const UT_Matrix3D &mat)
ImageBuf OIIO_API rotate(const ImageBuf &src, float angle, string_view filtername=string_view(), float filterwidth=0.0f, bool recompute_roi=false, ROI roi={}, int nthreads=0)
GLuint GLsizei GLsizei * length
GLsizei GLsizei GLfloat distance
int getViewHeight() const
void setNominalWindow(fpreal x, fpreal y, fpreal w, fpreal h)
int getViewportWidth() const
int x() const
Get lower-left corner.
GLfloat GLfloat GLfloat GLfloat h
int w() const
Get width/height dimensions.
fpreal getZBufferFar() const
fpreal getLastHomeRadius() const
fpreal getWinSizeX() const
static int getScrollStyleFlag()
int getRightMargin() const
UT_Rect< UT_InclusiveRectImpl > UT_InclusiveRect
Integer rectangle class which stores its data as inclusive lower-left to upper-right (x1...
GT_API const UT_StringHolder version
GLdouble GLdouble GLdouble b
static axis getDefaultHomingStyleFlag()
static int getTumbleStyleFlag()
static void setScrollStyleFlag(int style)
static int getAltKeyViewControlsFlag()
void setFocusDistance(fpreal f)
const UT_Matrix4D & getTransformMatrix()
fpreal getFocusDistance() const
static void setAltKeyViewControlsFlag(int style)
void getViewState(gui_View &view_state) const
fpreal getAspectRatio() const
GLdouble GLdouble GLdouble r
static bool isOrientationYUp()
int y() const
Get lower-left corner.
void setCustomHomeRot(UT_Matrix3R &rot)
SYS_FORCE_INLINE const UT_Vector3D & getT() const
void setViewState(const gui_View &view_state)
void getNominalWindow(fpreal &x, fpreal &y, fpreal &w, fpreal &h) const
void setFrustumScale(fpreal xsc, fpreal ysc)
void setAspectRatio(fpreal a)
UT_InclusiveRect getView() const
const UT_Matrix4D & getProjectionMatrix() const
const UT_Matrix4D & getRotateMatrix() const
SYS_FORCE_INLINE const UT_Vector3D & getP() const
int getViewVersion() const
void setTransformCallback(GUI_TransformCallback callback, void *data)
fpreal getFarClip() const
fpreal getOrthoWidth() const
IMATH_INTERNAL_NAMESPACE_HEADER_ENTER Vec project(const Vec &s, const Vec &t)
const UT_Matrix3R & getCustomHomeRot() const
fpreal getWinSizeY() const
fpreal getZBufferNear() const
UT_Matrix4D myProjectionMatrix
void getScreenWindow(fpreal &l, fpreal &r, fpreal &b, fpreal &t) const
void(* GUI_TransformCallback)(UT_DMatrix4 &, fpreal time, void *)
UT_InclusiveRect getViewport() const
GA_API const UT_StringHolder area
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)
const UT_Matrix4D & getItransformMatrix()
int getLeftMargin() const