15 #ifndef __GUI_ViewParameter__
16 #define __GUI_ViewParameter__
52 void save(std::ostream &os)
const;
74 FRONT, RIGHT,
TOP, BACK, LEFT, BOTTOM, CPLANE };
82 area.
set(myViewportLeft, myViewportBottom, w,h);
84 void getViewport(
int &l,
int &
r,
int &
b,
int &
t)
const;
88 w = myViewportRight - myViewportLeft + 1;
89 h = myViewportTop - myViewportBottom + 1;
92 {
return myViewportRight - myViewportLeft + 1; }
94 {
return myViewportTop - myViewportBottom + 1; }
97 { setViewport(r, viewarea.
x(), viewarea.
y(),
98 viewarea.
w(), viewarea.
h()); }
103 myViewportRight, myViewportTop); }
116 void getProjection(
UT_Matrix4D &proj,
bool depth_adjust=
true);
122 bool infinite_far_plane);
151 { setView(area.
x(), area.
y(), area.
w(), area.
h()); }
152 void setView(
int x,
int y,
int w,
int h);
153 void getView(
int &l,
int &
r,
int &
b,
int &
t)
const;
155 {
return myViewRight - myViewLeft + 1; }
157 {
return myViewTop - myViewBottom + 1; }
161 myViewRight, myViewTop); }
165 void viewToViewportProjectionBounds(
172 {
return myViewLeft - myViewportLeft; }
174 {
return myViewportRight - myViewRight; }
176 {
return myViewBottom - myViewportBottom; }
178 {
return myViewportTop - myViewTop; }
182 bool centre_to_origin =
false,
bool zoom_in =
false);
184 void homeRotation(axis
a);
189 void setDefaultFOV(
fpreal fov_in_degrees);
194 static void getOrientationChangeRotation(
209 void beginContinuouslyExportedOperation();
210 void endContinuouslyExportedOperation();
211 bool continuouslyExportedOperationInProgress()
const;
217 void incrementtrackball(
fpreal dx,
fpreal dy,
int finish);
218 void eulertumble(
fpreal dx,
fpreal dy,
int finish,
bool lock);
227 void worldLockedScroll(
const UT_Vector3R &locked_pos,
231 bool precise_zoom =
false,
232 bool smooth_deltas =
false);
239 void directedDolly(
const UT_Vector3R &unit_worldspace_dir,
240 fpreal dx,
bool precise_zoom =
false,
241 bool smooth_deltas =
false);
248 void zoom(
fpreal dx, GUI_ZoomItem item,
bool precise_zoom =
false);
251 void zoom(
fpreal dx, GUI_ZoomItem item,
253 bool precise_zoom =
false);
260 bool precise_zoom =
false);
263 bool precise_zoom =
false);
277 fpreal orthowidth,
bool is_ortho);
282 static void getFrustumCenter(
fpreal frustum_width,
fpreal aspect,
290 bool isDirty()
const {
return (myFlag.viewportDirty ||
291 myFlag.matrixDirty ||
292 myFlag.iMatrixDirty); }
308 *n = myView.myNearLimit;
309 *f = myView.myFarLimit;
311 void setNearClip(
fpreal near);
316 void setMaxNearClip(
bool limit,
fpreal near_max);
324 { mySelectedObjBounds=
b; }
330 static void setExtendedZBufferRangeSupport(
bool has_ext);
333 { myAllowNearFarClipAdapt = allow; }
341 updateWindowOverridesNominal();
358 updateWindowOverridesNominal();
369 {
return myWindowOverridesNominal; }
376 void getViewBoundsRelativeToNominalWindow(
387 convertViewToScreenWindow(myView.myWinX, myView.myWinY,
388 myView.myWinW, myView.myWinH,
393 convertScreenToViewWindow(l, r, b, t,
394 myView.myWinX, myView.myWinY,
395 myView.myWinW, myView.myWinH);
400 myHasSubRegion =
true;
408 myHasSubRegion =
false;
420 return myHasSubRegion;
424 static void convertScreenToViewWindow(
427 static void convertViewToScreenWindow(
438 GUI_VIEW_ADJUST_NONE = 0,
439 GUI_VIEW_ADJUST_FAR = 1,
440 GUI_VIEW_ADJUST_NEAR = 2,
441 GUI_VIEW_ADJUST_BOTH = 3
444 { myAdjustLimits = which; }
449 {
return myFlag.rotoTrackWindow; }
459 myFrustumWidthScale = xsc;
460 myFrustumHeightScale = ysc;
469 { myView.myT =
t; myFlag.matrixDirty=1; myFlag.iMatrixDirty=1;}
478 { myView.myP = p; myFlag.matrixDirty=1; myFlag.iMatrixDirty=1;}
480 static void setOrientationMode(orientation o);
481 static orientation getOrientationMode();
483 {
return getOrientationMode() ==
Y_UP; }
485 {
return getOrientationMode() ==
Z_UP; }
489 { myTumbleStyle = style; }
492 { myAltKeyViewControls = style; }
495 { myScrollStyle = style; }
503 { myView.myRotateMatrix = mat;
504 myFlag.matrixDirty = 1;
505 myFlag.iMatrixDirty = 1;
506 myFlag.rxyzDirty = 1; }
508 { myView.myRotateMatrix = mat;
509 myFlag.matrixDirty = 1;
510 myFlag.iMatrixDirty = 1;
511 myFlag.rxyzDirty = 1; }
515 {
return myProjectionOverride ? *myProjectionOverride
516 : myView.myProjectionMatrix; }
518 return myTransformMatrix; }
520 return myItransformMatrix; }
532 myTransformCallback = callback;
533 myTransformCallbackData =
data;
539 int save(std::ostream &os,
540 char separator =
'\n',
541 bool for_view_copy =
false)
const;
546 const char *
className()
const {
return "GUI_ViewParameter"; }
551 { myHomeAxis = homeaxis; myFlag.rxyzDirty = 1; }
561 myCPlaneHomeRotCallback = callback;
562 myCPlaneHomeRotCallbackData =
data;
586 myView.myHApertureOffset =
h;
587 myView.myVApertureOffset =
v;
591 h = myView.myHApertureOffset;
592 v = myView.myVApertureOffset;
620 : myT(0.0, 0.0, 0.1),
623 myProjectionMatrix(1.0),
630 myFocusDistance(5.0),
636 myHApertureOffset(0.0),
637 myVApertureOffset(0.0),
673 { view_state = myView; }
677 myFlag.matrixDirty=1;
678 myFlag.iMatrixDirty=1;
682 updateWindowOverridesNominal();
685 void adjustNearFarClip();
691 GUI_ViewAdjustLimits myAdjustLimits;
713 void updateTransformMatrix();
714 void updateItransformMatrix();
715 void updateRXYZValues();
716 fpreal getDistanceToBoxCenter(
int clamp = 0)
const;
731 bool computeWorldLockedScrollAccel(
fpreal dx,
fpreal dy,
739 void updateWindowOverridesNominal()
741 myWindowOverridesNominal =
742 (myView.myWinX != myNominalWinX ||
743 myView.myWinY != myNominalWinY ||
744 myView.myWinW != myNominalWinW ||
745 myView.myWinH != myNominalWinH);
754 static orientation myOrientationMode;
755 static int myTumbleStyle;
756 static int myAltKeyViewControls;
757 static int myScrollStyle;
758 static axis myDefaultHomingStyle;
767 void *myTransformCallbackData;
770 fpreal myLastHomeDistance;
771 fpreal myLastHomePixelWidthOBSOLETE;
772 fpreal myLastHomeAdjustedBoxWidth;
773 fpreal myLastHomeOrthoWidth;
779 bool myObsoleteScrollIsActive;
785 void *myCPlaneHomeRotCallbackData;
790 class ContinuousExportCache
793 ContinuousExportCache() {}
805 typedef ContinuousExportCache ViewOpCache;
807 ViewOpCache myContinuousExportCache;
808 bool myContinuousExportInProgress;
815 bool myWindowOverridesNominal;
828 int myViewportLeft, myViewportRight;
829 int myViewportBottom, myViewportTop;
835 int myViewLeft, myViewRight;
836 int myViewBottom, myViewTop;
842 bool myHasExtendedZBufferFar;
843 bool myAllowNearFarClipAdapt;
848 bool myLimitNearClip =
false;
849 fpreal myMaxNearClip = 1.0;
853 #ifdef __DOCUMENTATION__
855 FOV can be computed from aperture and focal
length.
860 +------+------+-----------
864 Unzoomed \ | / Length
869 myFullW and myFullH are the dimensions of the plane onto which the
870 image is projected before
any adjustments
for zoom or window
parms.
871 the plane is located at
"myAdjustedNear" along the
z axis.
872 After taking the zoom and win
channels into account, myAdjustedX and
873 myAdjustedY refer to the center of the view on the same plane, and
874 myAdjustedW and myAdjustedH contain the dimensions of the adjusted view.
void setRotateMatrix(const UT_Matrix4D &mat)
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
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
GLdouble GLdouble GLdouble z
int getBottomMargin() const
int h() const
Get width/height dimensions.
GLboolean GLboolean GLboolean GLboolean a
GLuint GLsizei GLsizei * length
void setAperture(fpreal a)
GLenum GLenum GLsizei void * image
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)
Temporary container for either a RV_Render and an RE_Render.
void getApertureOffsets(fpreal &h, fpreal &v) const
int getView3DVersion() const
void setFocalUnitScale(fpreal f)
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)
GLint GLsizei GLsizei height
fpreal getFocalLength() const
void getWindow(fpreal &x, fpreal &y, fpreal &w, fpreal &h) const
fpreal getMaxNearClip() 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)
void getViewport(UT_DimRect &area) const
GUI_ViewAdjustLimits getAdjustLimits() const
UT_Matrix4D myRotateMatrix
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)
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.
GLboolean GLboolean GLboolean b
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()
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
GLfloat GLfloat GLfloat GLfloat h
GA_API const UT_StringHolder parms
static axis getDefaultHomingStyleFlag()
static int getTumbleStyleFlag()
bool getSubRegion(fpreal &x, fpreal &y, fpreal &w, fpreal &h) const
static void setScrollStyleFlag(int style)
bool hasMaxNearClip() const
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)
GLdouble GLdouble GLdouble top
void setViewport(RE_RenderContext r, const UT_DimRect &viewarea)
SYS_FORCE_INLINE const UT_Vector3D & getT() const
void setViewState(const gui_View &view_state)
GLubyte GLubyte GLubyte GLubyte w
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
SIM_API const UT_StringHolder distance
void setTransformCallback(GUI_TransformCallback callback, void *data)
bool hasSubRegion() const
fpreal getFarClip() const
fpreal getOrthoWidth() const
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