15 #ifndef __GUI_ViewState__
16 #define __GUI_ViewState__
35 virtual bool isDefaultToken(
const char *token) = 0;
36 virtual bool parseDefaultOption(
const char *token,
UT_IStream &is) = 0;
38 virtual bool save(std::ostream &os) = 0;
44 class GUI_SnapshotImage;
62 { myView.setViewport(r, x, y, w, h); }
64 { myView.setProjection(r); }
71 fpreal minh = getDisplayOptionRef().common()
73 myView.homeToBox(w, h, minh, box,
rot,
75 myLeftView.homeToBox(w, h, minh, box,
rot,
77 myRightView.homeToBox(w, h, minh, box,
rot,
81 { myView.getViewport(l, r, b, t); }
84 { myView.getView(l, r, b, t); }
90 {
return myView.getItransformMatrix();}
92 {
return myView.getTransformMatrix(); }
94 {
return myView.getProjectionMatrix();}
96 {
return myView.getRotateMatrix(); }
98 { myView.setRotateMatrix(mat); }
104 myView.setOrthoFlag(onoff);
105 myLeftView.setOrthoFlag(onoff);
106 myRightView.setOrthoFlag(onoff);
111 { myView.setApplyAspectFlag(onoff); }
113 {
return myView.getApplyAspectFlag(); }
115 { myView.setAspectRatio(value); }
117 {
return myView.getAspectRatio(); }
119 { myView.setDefaultFOV(value); }
121 {
return myView.getDefaultFOV(); }
123 { myView.setLimits(n, f); }
127 myView.rotate(axis, dx);
128 myLeftView.rotate(axis, dx);
129 myRightView.rotate(axis, dx);
133 myView.rotate(axis, dx);
134 myLeftView.rotate(axis, dx);
135 myRightView.rotate(axis, dx);
140 myLeftView.rotate(quat);
141 myRightView.rotate(quat);
145 myView.trackball(dx, dy);
146 myLeftView.trackball(dx, dy);
147 myRightView.trackball(dx, dy);
151 myView.dotumble(dx, dy, changed);
152 myLeftView.dotumble(dx, dy, changed);
153 myRightView.dotumble(dx, dy, changed);
157 myView.scroll(dx, dy);
158 myLeftView.scroll(dx, dy);
159 myRightView.scroll(dx, dy);
164 myView.scroll(dx, dy, viewport);
165 myLeftView.scroll(dx, dy, viewport);
166 myRightView.scroll(dx, dy, viewport);
185 myView.worldLockedScroll(
189 myView.getT() - old_t;
191 myView.getP() - old_p;
193 myLeftView.getT() + delta_t);
195 myLeftView.getP() + delta_p);
197 myLeftView.getT() + delta_t);
199 myLeftView.getP() + delta_p);
202 bool precise_zoom =
false,
203 bool smooth_dolly =
false)
205 myView.dolly(dx, precise_zoom,
207 myLeftView.dolly(dx, precise_zoom,
209 myRightView.dolly(dx, precise_zoom,
214 bool precise_zoom =
false,
215 bool smooth_dolly =
false)
217 myView.directedDolly(
218 unit_worldspace_dir, dx,
221 myLeftView.directedDolly(
222 unit_worldspace_dir, dx,
225 myRightView.directedDolly(
226 unit_worldspace_dir, dx,
231 bool precise_zoom =
false)
233 myView.zoom(dx, item, precise_zoom);
234 myLeftView.zoom(dx, item, precise_zoom);
235 myRightView.zoom(dx, item,precise_zoom);
239 bool precise_zoom =
false)
241 myView.zoom(dx, item, viewport,
243 myLeftView.zoom(dx, item, viewport,
245 myRightView.zoom(dx, item, viewport,
250 bool precise_zoom =
false)
252 myView.offsetZoom(sx, sy, dx, item,
254 myLeftView.offsetZoom(sx, sy, dx, item,
256 myRightView.offsetZoom(sx, sy, dx, item,
262 bool precise_zoom =
false)
264 myView.offsetZoom(sx, sy, dx, item,
267 myLeftView.offsetZoom(sx, sy, dx, item,
270 myRightView.offsetZoom(sx, sy, dx, item,
276 { myView.boxZoom(frstx,frsty,lastx,lasty, distance); }
280 myView.screenScroll(dx, dy);
281 myLeftView.screenScroll(dx, dy);
282 myRightView.screenScroll(dx, dy);
286 { myOption.common().primMask(m); }
288 {
return myOption.common().primMask(); }
302 if( view_type == GUI_MAIN )
304 if( view_type == GUI_LEFT )
306 if( view_type == GUI_RIGHT )
308 if( view_type == GUI_IMAGE )
317 myRightView = myView;
323 { getViewParameter(vt).setViewport(r, x, y, w, h); }
326 { getViewParameter(vt).setProjection(r); }
330 void alignPlaneWithView(
UT_Plane *plane);
332 const char *className()
const;
339 static void overridePrefFile(
const char *
filename);
341 void saveAsDefault();
342 void resetToDefaults();
349 void setSnapshotImageFrame(
int frame );
350 int getSnapshotImageFrame()
const;
353 void setSnapshotFactor(
float alpha);
354 float getSnapshotFactor()
const;
360 void setHideSnapshotAtSourceFrame(
bool flag );
361 bool getHideSnapshotAtSourceFrame()
const;
369 static void getDefaultNearFarLimits(
fpreal &near_limit,
fpreal &far_limit);
374 myView.allowNearFarClipAdapt(allow);
375 myLeftView.allowNearFarClipAdapt(
false);
376 myRightView.allowNearFarClipAdapt(
false);
381 myView.setSceneBounds(bbox);
382 myLeftView.setSceneBounds(bbox);
383 myRightView.setSceneBounds(bbox);
388 myView.setSelectedObjectBounds(bbox);
389 myLeftView.setSelectedObjectBounds(bbox);
390 myRightView.setSelectedObjectBounds(bbox);
394 return myView.getSceneBounds();
400 {
return externalDefaultValues[for_lops?1:0]; }
403 { externalDefaultValues[for_lops?1:0] = cb; }
405 static void ensureDefaultsLoaded(
bool is_lops);
429 GUI_SnapshotImage *mySnapshotImage;
const GUI_DisplayOption & getDisplayOptionRef() const
GUI_ViewParameter & getViewParameterRef()
virtual ~GUI_ExternalDefaultCB()
GT_API const UT_StringHolder filename
void dotumble(fpreal dx, fpreal dy, int changed)
const UT_Matrix4D & getRotateMatrix() const
void setDefaultFOV(fpreal value)
void screenScroll(fpreal dx, fpreal dy)
const UT_Matrix4D & getProjectionMatrix() const
GA_API const UT_StringHolder rot
void scroll(fpreal dx, fpreal dy, const UT_InclusiveRect &viewport)
void allowNearFarClipAdapt(bool allow)
void setSceneBounds(const UT_BoundingBoxD &bbox)
void setPrimitiveMask(GA_PrimCompat::TypeMask m)
Temporary container for either a RV_Render and an RE_Render.
void dolly(fpreal dx, bool precise_zoom=false, bool smooth_dolly=false)
void directedDolly(const UT_Vector3R &unit_worldspace_dir, fpreal dx, bool precise_zoom=false, bool smooth_dolly=false)
GUI_DisplayOption & getDisplayOptionRef()
const UT_Matrix4D & getTransformMatrix()
int getApplyAspectFlag() const
void setSelectedObjectBounds(const UT_BoundingBoxD &bbox)
void setProjection(GUI_ViewState::GUI_ViewType vt, RE_RenderContext r)
void setRotateMatrix(const UT_Matrix3R &mat)
void scroll(fpreal dx, fpreal dy)
void setViewport(GUI_ViewState::GUI_ViewType vt, RE_RenderContext r, int x, int y, int w, int h)
GLfloat GLfloat GLfloat alpha
void rotate(const UT_Vector3R &axis, fpreal dx)
void worldLockedScroll(const UT_Vector3R &locked_pos, fpreal dx, fpreal dy)
UT_DimRect getViewport() const
const GUI_ViewParameter & getViewParameterRef() const
void offsetZoom(fpreal sx, fpreal sy, fpreal dx, GUI_ViewParameter::GUI_ZoomItem item, const UT_InclusiveRect &viewport, bool precise_zoom=false)
GLboolean GLboolean GLboolean b
UT_DimRect getView() const
void getView(int &l, int &r, int &b, int &t) const
void zoom(fpreal dx, GUI_ViewParameter::GUI_ZoomItem item, const UT_InclusiveRect &viewport, bool precise_zoom=false)
fpreal getAspectRatio() const
void setOrthoFlag(int onoff)
GUI_ViewParameter & getViewParameter(GUI_ViewState::GUI_ViewType view_type)
void zoom(fpreal dx, GUI_ViewParameter::GUI_ZoomItem item, bool precise_zoom=false)
GLfloat GLfloat GLfloat GLfloat h
void setTumbling(bool tumble)
void rotate(const UT_Quaternion &quat)
fpreal getDefaultFOV() const
int getViewHeight() const
LeafData & operator=(const LeafData &)=delete
void setLimits(fpreal n, fpreal f)
const UT_Matrix4D & getItransformMatrix()
void rotate(UT_Axis3::axis axis, fpreal dx)
static GUI_ExternalDefaultCB * getExternalDefaultCB(bool for_lops)
void trackball(fpreal dx, fpreal dy)
GLubyte GLubyte GLubyte GLubyte w
void setAspectRatio(fpreal value)
void homeToBox(int w, int h, UT_BoundingBox &box, const UT_Matrix3R *rot=NULL, bool centred=false, bool zoom_in=false)
SIM_API const UT_StringHolder distance
static void setExternalDefaultCB(GUI_ExternalDefaultCB *cb, bool for_lops)
void offsetZoom(fpreal sx, fpreal sy, fpreal dx, GUI_ViewParameter::GUI_ZoomItem item, bool precise_zoom=false)
void boxZoom(fpreal frstx, fpreal frsty, fpreal lastx, fpreal lasty, fpreal distance)
void getViewport(int &l, int &r, int &b, int &t) const
GA_PrimCompat::TypeMask getPrimitiveMask() const
void setApplyAspectFlag(int onoff)
void setProjection(RE_RenderContext r)
void setViewport(RE_RenderContext r, int x, int y, int w, int h)
UT_BoundingBox getSceneBounds() const