15 #ifndef __GUI_ViewState__
16 #define __GUI_ViewState__
34 virtual bool isDefaultToken(
const char *token) = 0;
35 virtual bool parseDefaultOption(
const char *token,
UT_IStream &is) = 0;
37 virtual bool save(std::ostream &os) = 0;
43 class GUI_SnapshotImage;
61 { myView.setViewport(r, x, y, w, h); }
63 { myView.setProjection(r); }
70 fpreal minh = getDisplayOptionRef().common()
72 myView.homeToBox(w, h, minh, box,
rot,
74 myLeftView.homeToBox(w, h, minh, box,
rot,
76 myRightView.homeToBox(w, h, minh, box,
rot,
80 { myView.getViewport(l, r, b, t); }
83 { myView.getView(l, r, b, t); }
89 {
return myView.getItransformMatrix();}
91 {
return myView.getTransformMatrix(); }
93 {
return myView.getProjectionMatrix();}
95 {
return myView.getRotateMatrix(); }
97 { myView.setRotateMatrix(mat); }
103 myView.setOrthoFlag(onoff);
104 myLeftView.setOrthoFlag(onoff);
105 myRightView.setOrthoFlag(onoff);
110 { myView.setApplyAspectFlag(onoff); }
112 {
return myView.getApplyAspectFlag(); }
114 { myView.setAspectRatio(value); }
116 {
return myView.getAspectRatio(); }
118 { myView.setDefaultFOV(value); }
120 {
return myView.getDefaultFOV(); }
122 { myView.setLimits(n, f); }
126 myView.rotate(axis, dx);
127 myLeftView.rotate(axis, dx);
128 myRightView.rotate(axis, dx);
132 myView.rotate(axis, dx);
133 myLeftView.rotate(axis, dx);
134 myRightView.rotate(axis, dx);
139 myLeftView.rotate(quat);
140 myRightView.rotate(quat);
144 myView.trackball(dx, dy);
145 myLeftView.trackball(dx, dy);
146 myRightView.trackball(dx, dy);
150 myView.dotumble(dx, dy, changed);
151 myLeftView.dotumble(dx, dy, changed);
152 myRightView.dotumble(dx, dy, changed);
156 myView.scroll(dx, dy);
157 myLeftView.scroll(dx, dy);
158 myRightView.scroll(dx, dy);
163 myView.scroll(dx, dy, viewport);
164 myLeftView.scroll(dx, dy, viewport);
165 myRightView.scroll(dx, dy, viewport);
184 myView.worldLockedScroll(
188 myView.getT() - old_t;
190 myView.getP() - old_p;
192 myLeftView.getT() + delta_t);
194 myLeftView.getP() + delta_p);
196 myLeftView.getT() + delta_t);
198 myLeftView.getP() + delta_p);
201 bool precise_zoom =
false,
202 bool smooth_dolly =
false)
204 myView.dolly(dx, precise_zoom,
206 myLeftView.dolly(dx, precise_zoom,
208 myRightView.dolly(dx, precise_zoom,
213 bool precise_zoom =
false,
214 bool smooth_dolly =
false)
216 myView.directedDolly(
217 unit_worldspace_dir, dx,
220 myLeftView.directedDolly(
221 unit_worldspace_dir, dx,
224 myRightView.directedDolly(
225 unit_worldspace_dir, dx,
230 bool precise_zoom =
false)
232 myView.zoom(dx, item, precise_zoom);
233 myLeftView.zoom(dx, item, precise_zoom);
234 myRightView.zoom(dx, item,precise_zoom);
238 bool precise_zoom =
false)
240 myView.zoom(dx, item, viewport,
242 myLeftView.zoom(dx, item, viewport,
244 myRightView.zoom(dx, item, viewport,
249 bool precise_zoom =
false)
251 myView.offsetZoom(sx, sy, dx, item,
253 myLeftView.offsetZoom(sx, sy, dx, item,
255 myRightView.offsetZoom(sx, sy, dx, item,
261 bool precise_zoom =
false)
263 myView.offsetZoom(sx, sy, dx, item,
266 myLeftView.offsetZoom(sx, sy, dx, item,
269 myRightView.offsetZoom(sx, sy, dx, item,
275 { myView.boxZoom(frstx,frsty,lastx,lasty, distance); }
279 myView.screenScroll(dx, dy);
280 myLeftView.screenScroll(dx, dy);
281 myRightView.screenScroll(dx, dy);
285 { myOption.common().primMask(m); }
287 {
return myOption.common().primMask(); }
301 if( view_type == GUI_MAIN )
303 if( view_type == GUI_LEFT )
305 if( view_type == GUI_RIGHT )
307 if( view_type == GUI_IMAGE )
316 myRightView = myView;
322 { getViewParameter(vt).setViewport(r, x, y, w, h); }
324 { getViewParameter(vt).setProjection(r); }
328 void alignPlaneWithView(
UT_Plane *plane);
330 const char *className()
const;
337 static void overridePrefFile(
const char *
filename);
339 void saveAsDefault();
340 void resetToDefaults();
347 void setSnapshotImageFrame(
int frame );
348 int getSnapshotImageFrame()
const;
351 void setSnapshotFactor(
float alpha);
352 float getSnapshotFactor()
const;
358 void setHideSnapshotAtSourceFrame(
bool flag );
359 bool getHideSnapshotAtSourceFrame()
const;
367 static void getDefaultNearFarLimits(
fpreal &near_limit,
fpreal &far_limit);
372 myView.allowNearFarClipAdapt(allow);
373 myLeftView.allowNearFarClipAdapt(
false);
374 myRightView.allowNearFarClipAdapt(
false);
379 myView.setSceneBounds(bbox);
380 myLeftView.setSceneBounds(bbox);
381 myRightView.setSceneBounds(bbox);
386 myView.setSelectedObjectBounds(bbox);
387 myLeftView.setSelectedObjectBounds(bbox);
388 myRightView.setSelectedObjectBounds(bbox);
392 return myView.getSceneBounds();
398 {
return externalDefaultValues[for_lops?1:0]; }
401 { externalDefaultValues[for_lops?1:0] = cb; }
403 static void ensureDefaultsLoaded(
bool is_lops);
427 GUI_SnapshotImage *mySnapshotImage;
const GUI_DisplayOption & getDisplayOptionRef() const
GLboolean GLboolean GLboolean b
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 setProjection(GUI_ViewState::GUI_ViewType vt, RE_Render *r)
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)
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()
GLubyte GLubyte GLubyte GLubyte w
const UT_Matrix4D & getTransformMatrix()
int getApplyAspectFlag() const
void setSelectedObjectBounds(const UT_BoundingBoxD &bbox)
void setProjection(RE_Render *r)
void setViewport(GUI_ViewState::GUI_ViewType vt, RE_Render *r, int x, int y, int w, int h)
void setRotateMatrix(const UT_Matrix3R &mat)
GLsizei GLsizei GLfloat distance
void setViewport(RE_Render *r, int x, int y, int w, int h)
void scroll(fpreal dx, fpreal dy)
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)
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)
GLsizei const GLint box[]
void rotate(const UT_Quaternion &quat)
fpreal getDefaultFOV() const
int getViewHeight() const
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)
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)
static void setExternalDefaultCB(GUI_ExternalDefaultCB *cb, bool for_lops)
GLfloat GLfloat GLfloat alpha
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)
UT_BoundingBox getSceneBounds() const