15 #ifndef __GUI_ViewParameter__
16 #define __GUI_ViewParameter__
50 void save(std::ostream &os)
const;
72 FRONT, RIGHT,
TOP, BACK, LEFT, BOTTOM, CPLANE };
80 area.
set(myViewportLeft, myViewportBottom, w,h);
82 void getViewport(
int &
l,
int &
r,
int &
b,
int &
t)
const;
86 w = myViewportRight - myViewportLeft + 1;
87 h = myViewportTop - myViewportBottom + 1;
90 {
return myViewportRight - myViewportLeft + 1; }
92 {
return myViewportTop - myViewportBottom + 1; }
95 { setViewport(r, viewarea.
x(), viewarea.
y(),
96 viewarea.
w(), viewarea.
h()); }
101 myViewportRight, myViewportTop); }
111 void getProjection(
UT_Matrix4D &proj,
bool depth_adjust=
true);
140 { setView(area.
x(), area.
y(), area.
w(), area.
h()); }
141 void setView(
int x,
int y,
int w,
int h);
142 void getView(
int &
l,
int &
r,
int &
b,
int &
t)
const;
144 {
return myViewRight - myViewLeft + 1; }
146 {
return myViewTop - myViewBottom + 1; }
150 myViewRight, myViewTop); }
154 void viewToViewportProjectionBounds(
161 {
return myViewLeft - myViewportLeft; }
163 {
return myViewportRight - myViewRight; }
165 {
return myViewBottom - myViewportBottom; }
167 {
return myViewportTop - myViewTop; }
171 bool centre_to_origin =
false,
bool zoom_in =
false);
173 void homeRotation(axis
a);
178 void setDefaultFOV(
fpreal fov_in_degrees);
183 static void getOrientationChangeRotation(
198 void beginContinuouslyExportedOperation();
199 void endContinuouslyExportedOperation();
200 bool continuouslyExportedOperationInProgress()
const;
206 void incrementtrackball(
fpreal dx,
fpreal dy,
int finish);
207 void eulertumble(
fpreal dx,
fpreal dy,
int finish,
bool lock);
216 void worldLockedScroll(
const UT_Vector3R &locked_pos,
220 bool precise_zoom =
false,
221 bool smooth_deltas =
false);
228 void directedDolly(
const UT_Vector3R &unit_worldspace_dir,
229 fpreal dx,
bool precise_zoom =
false,
230 bool smooth_deltas =
false);
237 void zoom(
fpreal dx, GUI_ZoomItem item,
bool precise_zoom =
false);
240 void zoom(
fpreal dx, GUI_ZoomItem item,
242 bool precise_zoom =
false);
249 bool precise_zoom =
false);
252 bool precise_zoom =
false);
266 fpreal orthowidth,
bool is_ortho);
271 static void getFrustumCenter(
fpreal frustum_width,
fpreal aspect,
279 bool isDirty()
const {
return (myFlag.viewportDirty ||
280 myFlag.matrixDirty ||
281 myFlag.iMatrixDirty); }
296 *n = myView.myNearLimit;
297 *f = myView.myFarLimit;
299 void setNearClip(
fpreal near);
308 { mySelectedObjBounds=
b; }
314 static void setExtendedZBufferRangeSupport(
bool has_ext);
317 { myAllowNearFarClipAdapt = allow; }
325 updateWindowOverridesNominal();
342 updateWindowOverridesNominal();
353 {
return myWindowOverridesNominal; }
360 void getViewBoundsRelativeToNominalWindow(
371 convertViewToScreenWindow(myView.myWinX, myView.myWinY,
372 myView.myWinW, myView.myWinH,
377 convertScreenToViewWindow(l, r, b, t,
378 myView.myWinX, myView.myWinY,
379 myView.myWinW, myView.myWinH);
384 myHasSubRegion =
true;
392 myHasSubRegion =
false;
404 return myHasSubRegion;
407 static void convertScreenToViewWindow(
410 static void convertViewToScreenWindow(
421 GUI_VIEW_ADJUST_NONE = 0,
422 GUI_VIEW_ADJUST_FAR = 1,
423 GUI_VIEW_ADJUST_NEAR = 2,
424 GUI_VIEW_ADJUST_BOTH = 3
427 { myAdjustLimits = which; }
432 {
return myFlag.rotoTrackWindow; }
442 myFrustumWidthScale = xsc;
443 myFrustumHeightScale = ysc;
452 { myView.myT =
t; myFlag.matrixDirty=1; myFlag.iMatrixDirty=1;}
461 { myView.myP =
p; myFlag.matrixDirty=1; myFlag.iMatrixDirty=1;}
463 static void setOrientationMode(orientation o);
464 static orientation getOrientationMode();
466 {
return getOrientationMode() ==
Y_UP; }
468 {
return getOrientationMode() ==
Z_UP; }
472 { myTumbleStyle = style; }
475 { myAltKeyViewControls = style; }
478 { myScrollStyle = style; }
486 { myView.myRotateMatrix = mat;
487 myFlag.matrixDirty = 1;
488 myFlag.iMatrixDirty = 1;
489 myFlag.rxyzDirty = 1; }
493 {
return myProjectionOverride ? *myProjectionOverride
494 : myView.myProjectionMatrix; }
496 return myTransformMatrix; }
498 return myItransformMatrix; }
510 myTransformCallback = callback;
511 myTransformCallbackData =
data;
517 int save(std::ostream &os,
518 char separator =
'\n',
519 bool for_view_copy =
false)
const;
524 const char *
className()
const {
return "GUI_ViewParameter"; }
529 { myHomeAxis = homeaxis; myFlag.rxyzDirty = 1; }
539 myCPlaneHomeRotCallback = callback;
540 myCPlaneHomeRotCallbackData =
data;
564 myView.myHApertureOffset =
h;
565 myView.myVApertureOffset =
v;
569 h = myView.myHApertureOffset;
570 v = myView.myVApertureOffset;
598 : myT(0.0, 0.0, 0.1),
601 myProjectionMatrix(1.0),
608 myFocusDistance(5.0),
614 myHApertureOffset(0.0),
615 myVApertureOffset(0.0),
651 { view_state = myView; }
655 myFlag.matrixDirty=1;
656 myFlag.iMatrixDirty=1;
658 updateWindowOverridesNominal();
661 void adjustNearFarClip();
667 GUI_ViewAdjustLimits myAdjustLimits;
689 void updateTransformMatrix();
690 void updateItransformMatrix();
691 void updateRXYZValues();
692 fpreal getDistanceToBoxCenter(
int clamp = 0)
const;
707 bool computeWorldLockedScrollAccel(
fpreal dx,
fpreal dy,
715 void updateWindowOverridesNominal()
717 myWindowOverridesNominal =
718 (myView.myWinX != myNominalWinX ||
719 myView.myWinY != myNominalWinY ||
720 myView.myWinW != myNominalWinW ||
721 myView.myWinH != myNominalWinH);
730 static orientation myOrientationMode;
731 static int myTumbleStyle;
732 static int myAltKeyViewControls;
733 static int myScrollStyle;
734 static axis myDefaultHomingStyle;
743 void *myTransformCallbackData;
746 fpreal myLastHomeDistance;
747 fpreal myLastHomePixelWidthOBSOLETE;
748 fpreal myLastHomeAdjustedBoxWidth;
749 fpreal myLastHomeOrthoWidth;
755 bool myObsoleteScrollIsActive;
761 void *myCPlaneHomeRotCallbackData;
766 class ContinuousExportCache
769 ContinuousExportCache() {}
781 typedef ContinuousExportCache ViewOpCache;
783 ViewOpCache myContinuousExportCache;
784 bool myContinuousExportInProgress;
791 bool myWindowOverridesNominal;
804 int myViewportLeft, myViewportRight;
805 int myViewportBottom, myViewportTop;
811 int myViewLeft, myViewRight;
812 int myViewBottom, myViewTop;
818 bool myHasExtendedZBufferFar;
819 bool myAllowNearFarClipAdapt;
827 #ifdef __DOCUMENTATION__
829 FOV can be computed from aperture and focal
length.
834 +------+------+-----------
838 Unzoomed \ | / Length
843 myFullW and myFullH are the dimensions of the plane onto which the
844 image is projected before
any adjustments
for zoom or window parms.
845 the plane is located at
"myAdjustedNear" along the
z axis.
846 After taking the zoom and win
channels into account, myAdjustedX and
847 myAdjustedY refer to the
center of the view on the same plane, and
848 myAdjustedW and myAdjustedH contain the dimensions of the adjusted view.
GLfloat GLfloat GLfloat top
void setLimits(fpreal n, fpreal f)
fpreal getNearClip() const
GLboolean GLboolean GLboolean b
fpreal getNearLimit() const
int rotoscopeTracksWindowVals() const
bool doesWindowOverrideNominal() const
fpreal myFrustumHeightScale
void getViewportSize(int &w, int &h) const
void setSelectedObjectBounds(const UT_BoundingBoxD &b)
static void setDefaultHomingStyleFlag(int style)
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
GA_API const UT_StringHolder rot
int getBottomMargin() const
int h() const
Get width/height dimensions.
GLenum GLsizei GLenum GLenum const void * image
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)
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
GLubyte GLubyte GLubyte GLubyte w
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)
void setWindowAffectRotoscope(int v)
fpreal getFocalUnitScale() const
fpreal myFrustumWidthScale
void setHomeAxis(axis homeaxis)
GLsizei GLsizei GLfloat distance
void getViewport(UT_DimRect &area) const
GUI_ViewAdjustLimits getAdjustLimits() const
UT_Matrix4D myRotateMatrix
GLboolean GLboolean GLboolean GLboolean a
void set(int v1, int v2, int v3, int v4)
Set the native rect type values.
void setOrthoWidth(fpreal w)
static bool isOrientationZUp()
void setRotateMatrix(const UT_Matrix3D &mat)
GLdouble GLdouble GLdouble z
int getViewHeight() const
void setNominalWindow(fpreal x, fpreal y, fpreal w, fpreal h)
int getViewportWidth() const
int x() const
Get lower-left corner.
void allowNearFarClipAdapt(bool allow)
int w() const
Get width/height dimensions.
fpreal getZBufferFar() const
fpreal getLastHomeRadius() const
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)
fpreal getWinSizeX() const
static int getScrollStyleFlag()
GLint GLsizei GLsizei height
int getRightMargin() const
UT_Rect< UT_InclusiveRectImpl > UT_InclusiveRect
Integer rectangle class which stores its data as inclusive lower-left to upper-right (x1...
fpreal getDefaultFOV() const
GT_API const UT_StringHolder version
const UT_BoundingBoxD & getSceneBounds() const
GLuint GLsizei GLsizei * length
GLfloat GLfloat GLfloat GLfloat h
static axis getDefaultHomingStyleFlag()
GLsizei const GLint box[]
static int getTumbleStyleFlag()
bool getSubRegion(fpreal &x, fpreal &y, fpreal &w, fpreal &h) const
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
void setSubRegion(fpreal x, fpreal y, fpreal w, fpreal h)
fpreal getAspectRatio() const
static bool isOrientationYUp()
int y() const
Get lower-left corner.
void setSceneBounds(const UT_BoundingBoxD &b)
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)
fpreal32 getExtendedZBufferFar() const
const UT_Matrix4D & getItransformMatrix()
int getLeftMargin() const