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);
117 bool infinite_far_plane);
146 { setView(area.
x(), area.
y(), area.
w(), area.
h()); }
147 void setView(
int x,
int y,
int w,
int h);
148 void getView(
int &l,
int &
r,
int &
b,
int &
t)
const;
150 {
return myViewRight - myViewLeft + 1; }
152 {
return myViewTop - myViewBottom + 1; }
156 myViewRight, myViewTop); }
160 void viewToViewportProjectionBounds(
167 {
return myViewLeft - myViewportLeft; }
169 {
return myViewportRight - myViewRight; }
171 {
return myViewBottom - myViewportBottom; }
173 {
return myViewportTop - myViewTop; }
177 bool centre_to_origin =
false,
bool zoom_in =
false);
179 void homeRotation(axis
a);
184 void setDefaultFOV(
fpreal fov_in_degrees);
189 static void getOrientationChangeRotation(
204 void beginContinuouslyExportedOperation();
205 void endContinuouslyExportedOperation();
206 bool continuouslyExportedOperationInProgress()
const;
212 void incrementtrackball(
fpreal dx,
fpreal dy,
int finish);
213 void eulertumble(
fpreal dx,
fpreal dy,
int finish,
bool lock);
222 void worldLockedScroll(
const UT_Vector3R &locked_pos,
226 bool precise_zoom =
false,
227 bool smooth_deltas =
false);
234 void directedDolly(
const UT_Vector3R &unit_worldspace_dir,
235 fpreal dx,
bool precise_zoom =
false,
236 bool smooth_deltas =
false);
243 void zoom(
fpreal dx, GUI_ZoomItem item,
bool precise_zoom =
false);
246 void zoom(
fpreal dx, GUI_ZoomItem item,
248 bool precise_zoom =
false);
255 bool precise_zoom =
false);
258 bool precise_zoom =
false);
272 fpreal orthowidth,
bool is_ortho);
277 static void getFrustumCenter(
fpreal frustum_width,
fpreal aspect,
285 bool isDirty()
const {
return (myFlag.viewportDirty ||
286 myFlag.matrixDirty ||
287 myFlag.iMatrixDirty); }
303 *n = myView.myNearLimit;
304 *f = myView.myFarLimit;
306 void setNearClip(
fpreal near);
311 void setMaxNearClip(
bool limit,
fpreal near_max);
319 { mySelectedObjBounds=
b; }
325 static void setExtendedZBufferRangeSupport(
bool has_ext);
328 { myAllowNearFarClipAdapt = allow; }
336 updateWindowOverridesNominal();
353 updateWindowOverridesNominal();
364 {
return myWindowOverridesNominal; }
371 void getViewBoundsRelativeToNominalWindow(
382 convertViewToScreenWindow(myView.myWinX, myView.myWinY,
383 myView.myWinW, myView.myWinH,
388 convertScreenToViewWindow(l, r, b, t,
389 myView.myWinX, myView.myWinY,
390 myView.myWinW, myView.myWinH);
395 myHasSubRegion =
true;
403 myHasSubRegion =
false;
415 return myHasSubRegion;
419 static void convertScreenToViewWindow(
422 static void convertViewToScreenWindow(
433 GUI_VIEW_ADJUST_NONE = 0,
434 GUI_VIEW_ADJUST_FAR = 1,
435 GUI_VIEW_ADJUST_NEAR = 2,
436 GUI_VIEW_ADJUST_BOTH = 3
439 { myAdjustLimits = which; }
444 {
return myFlag.rotoTrackWindow; }
454 myFrustumWidthScale = xsc;
455 myFrustumHeightScale = ysc;
464 { myView.myT =
t; myFlag.matrixDirty=1; myFlag.iMatrixDirty=1;}
473 { myView.myP = p; myFlag.matrixDirty=1; myFlag.iMatrixDirty=1;}
475 static void setOrientationMode(orientation o);
476 static orientation getOrientationMode();
478 {
return getOrientationMode() ==
Y_UP; }
480 {
return getOrientationMode() ==
Z_UP; }
484 { myTumbleStyle = style; }
487 { myAltKeyViewControls = style; }
490 { myScrollStyle = style; }
498 { myView.myRotateMatrix = mat;
499 myFlag.matrixDirty = 1;
500 myFlag.iMatrixDirty = 1;
501 myFlag.rxyzDirty = 1; }
505 {
return myProjectionOverride ? *myProjectionOverride
506 : myView.myProjectionMatrix; }
508 return myTransformMatrix; }
510 return myItransformMatrix; }
522 myTransformCallback = callback;
523 myTransformCallbackData =
data;
529 int save(std::ostream &os,
530 char separator =
'\n',
531 bool for_view_copy =
false)
const;
536 const char *
className()
const {
return "GUI_ViewParameter"; }
541 { myHomeAxis = homeaxis; myFlag.rxyzDirty = 1; }
551 myCPlaneHomeRotCallback = callback;
552 myCPlaneHomeRotCallbackData =
data;
576 myView.myHApertureOffset =
h;
577 myView.myVApertureOffset =
v;
581 h = myView.myHApertureOffset;
582 v = myView.myVApertureOffset;
610 : myT(0.0, 0.0, 0.1),
613 myProjectionMatrix(1.0),
620 myFocusDistance(5.0),
626 myHApertureOffset(0.0),
627 myVApertureOffset(0.0),
663 { view_state = myView; }
667 myFlag.matrixDirty=1;
668 myFlag.iMatrixDirty=1;
672 updateWindowOverridesNominal();
675 void adjustNearFarClip();
681 GUI_ViewAdjustLimits myAdjustLimits;
703 void updateTransformMatrix();
704 void updateItransformMatrix();
705 void updateRXYZValues();
706 fpreal getDistanceToBoxCenter(
int clamp = 0)
const;
721 bool computeWorldLockedScrollAccel(
fpreal dx,
fpreal dy,
729 void updateWindowOverridesNominal()
731 myWindowOverridesNominal =
732 (myView.myWinX != myNominalWinX ||
733 myView.myWinY != myNominalWinY ||
734 myView.myWinW != myNominalWinW ||
735 myView.myWinH != myNominalWinH);
744 static orientation myOrientationMode;
745 static int myTumbleStyle;
746 static int myAltKeyViewControls;
747 static int myScrollStyle;
748 static axis myDefaultHomingStyle;
757 void *myTransformCallbackData;
760 fpreal myLastHomeDistance;
761 fpreal myLastHomePixelWidthOBSOLETE;
762 fpreal myLastHomeAdjustedBoxWidth;
763 fpreal myLastHomeOrthoWidth;
769 bool myObsoleteScrollIsActive;
775 void *myCPlaneHomeRotCallbackData;
780 class ContinuousExportCache
783 ContinuousExportCache() {}
795 typedef ContinuousExportCache ViewOpCache;
797 ViewOpCache myContinuousExportCache;
798 bool myContinuousExportInProgress;
805 bool myWindowOverridesNominal;
818 int myViewportLeft, myViewportRight;
819 int myViewportBottom, myViewportTop;
825 int myViewLeft, myViewRight;
826 int myViewBottom, myViewTop;
832 bool myHasExtendedZBufferFar;
833 bool myAllowNearFarClipAdapt;
838 bool myLimitNearClip =
false;
839 fpreal myMaxNearClip = 1.0;
843 #ifdef __DOCUMENTATION__
845 FOV can be computed from aperture and focal
length.
850 +------+------+-----------
854 Unzoomed \ | / Length
859 myFullW and myFullH are the dimensions of the plane onto which the
860 image is projected before
any adjustments
for zoom or window
parms.
861 the plane is located at
"myAdjustedNear" along the
z axis.
862 After taking the zoom and win
channels into account, myAdjustedX and
863 myAdjustedY refer to the center of the view on the same plane, and
864 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
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
UT_Vector2T< T > project(const UT_Vector2T< T > &u, const UT_Vector2T< T > &v)
The orthogonal projection of a vector u onto a vector v.
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