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); }
305 *n = myView.myNearLimit;
306 *f = myView.myFarLimit;
308 void setNearClip(
fpreal near);
317 { mySelectedObjBounds=
b; }
323 static void setExtendedZBufferRangeSupport(
bool has_ext);
326 { myAllowNearFarClipAdapt = allow; }
338 updateWindowOverridesNominal();
355 updateWindowOverridesNominal();
366 {
return myWindowOverridesNominal; }
373 void getViewBoundsRelativeToNominalWindow(
384 convertViewToScreenWindow(myView.myWinX, myView.myWinY,
385 myView.myWinW, myView.myWinH,
390 convertScreenToViewWindow(l, r, b, t,
391 myView.myWinX, myView.myWinY,
392 myView.myWinW, myView.myWinH);
397 myHasSubRegion =
true;
405 myHasSubRegion =
false;
417 return myHasSubRegion;
421 static void convertScreenToViewWindow(
424 static void convertViewToScreenWindow(
435 GUI_VIEW_ADJUST_NONE = 0,
436 GUI_VIEW_ADJUST_FAR = 1,
437 GUI_VIEW_ADJUST_NEAR = 2,
438 GUI_VIEW_ADJUST_BOTH = 3
441 { myAdjustLimits = which; }
446 {
return myFlag.rotoTrackWindow; }
456 myFrustumWidthScale = xsc;
457 myFrustumHeightScale = ysc;
466 { myView.myT =
t; myFlag.matrixDirty=1; myFlag.iMatrixDirty=1;}
475 { myView.myP = p; myFlag.matrixDirty=1; myFlag.iMatrixDirty=1;}
477 static void setOrientationMode(orientation o);
478 static orientation getOrientationMode();
480 {
return getOrientationMode() ==
Y_UP; }
482 {
return getOrientationMode() ==
Z_UP; }
486 { myTumbleStyle = style; }
489 { myAltKeyViewControls = style; }
492 { myScrollStyle = style; }
500 { myView.myRotateMatrix = mat;
501 myFlag.matrixDirty = 1;
502 myFlag.iMatrixDirty = 1;
503 myFlag.rxyzDirty = 1; }
507 {
return myProjectionOverride ? *myProjectionOverride
508 : myView.myProjectionMatrix; }
510 return myTransformMatrix; }
512 return myItransformMatrix; }
524 myTransformCallback = callback;
525 myTransformCallbackData =
data;
531 int save(std::ostream &os,
532 char separator =
'\n',
533 bool for_view_copy =
false)
const;
538 const char *
className()
const {
return "GUI_ViewParameter"; }
543 { myHomeAxis = homeaxis; myFlag.rxyzDirty = 1; }
553 myCPlaneHomeRotCallback = callback;
554 myCPlaneHomeRotCallbackData =
data;
578 myView.myHApertureOffset =
h;
579 myView.myVApertureOffset =
v;
583 h = myView.myHApertureOffset;
584 v = myView.myVApertureOffset;
612 : myT(0.0, 0.0, 0.1),
615 myProjectionMatrix(1.0),
622 myFocusDistance(5.0),
628 myHApertureOffset(0.0),
629 myVApertureOffset(0.0),
665 { view_state = myView; }
669 myFlag.matrixDirty=1;
670 myFlag.iMatrixDirty=1;
672 updateWindowOverridesNominal();
675 void adjustNearFarClip();
681 GUI_ViewAdjustLimits myAdjustLimits;
682 bool myInfiniteFarPlane =
false;
683 bool myIsFreeCam =
true;
705 void updateTransformMatrix();
706 void updateItransformMatrix();
707 void updateRXYZValues();
708 fpreal getDistanceToBoxCenter(
int clamp = 0)
const;
723 bool computeWorldLockedScrollAccel(
fpreal dx,
fpreal dy,
731 void updateWindowOverridesNominal()
733 myWindowOverridesNominal =
734 (myView.myWinX != myNominalWinX ||
735 myView.myWinY != myNominalWinY ||
736 myView.myWinW != myNominalWinW ||
737 myView.myWinH != myNominalWinH);
746 static orientation myOrientationMode;
747 static int myTumbleStyle;
748 static int myAltKeyViewControls;
749 static int myScrollStyle;
750 static axis myDefaultHomingStyle;
759 void *myTransformCallbackData;
762 fpreal myLastHomeDistance;
763 fpreal myLastHomePixelWidthOBSOLETE;
764 fpreal myLastHomeAdjustedBoxWidth;
765 fpreal myLastHomeOrthoWidth;
771 bool myObsoleteScrollIsActive;
777 void *myCPlaneHomeRotCallbackData;
782 class ContinuousExportCache
785 ContinuousExportCache() {}
797 typedef ContinuousExportCache ViewOpCache;
799 ViewOpCache myContinuousExportCache;
800 bool myContinuousExportInProgress;
807 bool myWindowOverridesNominal;
820 int myViewportLeft, myViewportRight;
821 int myViewportBottom, myViewportTop;
827 int myViewLeft, myViewRight;
828 int myViewBottom, myViewTop;
834 bool myHasExtendedZBufferFar;
835 bool myAllowNearFarClipAdapt;
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)
bool getInfiniteFarPlane() const
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
void setInfiniteFarPlane(bool enable)
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
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()
void setIsFreeCam(bool free_cam)
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
static axis getDefaultHomingStyleFlag()
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)
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