Developer Documentation
PluginFunctionsViewControls.hh
1 /*===========================================================================*\
2 * *
3 * OpenFlipper *
4  * Copyright (c) 2001-2015, RWTH-Aachen University *
5  * Department of Computer Graphics and Multimedia *
6  * All rights reserved. *
7  * www.openflipper.org *
8  * *
9  *---------------------------------------------------------------------------*
10  * This file is part of OpenFlipper. *
11  *---------------------------------------------------------------------------*
12  * *
13  * Redistribution and use in source and binary forms, with or without *
14  * modification, are permitted provided that the following conditions *
15  * are met: *
16  * *
17  * 1. Redistributions of source code must retain the above copyright notice, *
18  * this list of conditions and the following disclaimer. *
19  * *
20  * 2. Redistributions in binary form must reproduce the above copyright *
21  * notice, this list of conditions and the following disclaimer in the *
22  * documentation and/or other materials provided with the distribution. *
23  * *
24  * 3. Neither the name of the copyright holder nor the names of its *
25  * contributors may be used to endorse or promote products derived from *
26  * this software without specific prior written permission. *
27  * *
28  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39 * *
40 \*===========================================================================*/
41 
42 /*===========================================================================*\
43 * *
44 * $Revision$ *
45 * $LastChangedBy$ *
46 * $Date$ *
47 * *
48 \*===========================================================================*/
49 
50 
51 
52 
53 //=============================================================================
54 //
55 // Standard Functions
56 //
57 //=============================================================================
58 
64 //
65 #ifndef PLUGINFUNCTIONS_VIEWCONTROL_HH
66 #define PLUGINFUNCTIONS_VIEWCONTROL_HH
67 
69 
71 #include <ACG/Scenegraph/DrawModes.hh>
72 #include <ACG/GL/GLState.hh>
74 
77 namespace PluginFunctions {
78 
79 const int ALL_VIEWERS = -2;
80 const int ACTIVE_VIEWER = -1;
81 
82 const int VIEW_FREE = 0;
83 const int VIEW_TOP = 1;
84 const int VIEW_BOTTOM = 2;
85 const int VIEW_LEFT = 3;
86 const int VIEW_RIGHT = 4;
87 const int VIEW_FRONT = 5;
88 const int VIEW_BACK = 6;
89 
90 //=======================================
91 // Get/set status of viewers
94 //=======================================
95 
101 DLLEXPORT
102 Viewer::ViewerProperties& viewerProperties(int _id = ACTIVE_VIEWER );
103 
107 //=======================================
108 // View settings
111 //=======================================
112 
121 DLLEXPORT
122 void allowRotation(bool _mode, int _viewer = ACTIVE_VIEWER);
123 
131 DLLEXPORT
132 bool allowRotation(int _viewer = ACTIVE_VIEWER);
133 
136 DLLEXPORT
137 void setMainGLContext();
138 
139 
148 DLLEXPORT
149 void viewingDirection(const ACG::Vec3d &_dir, const ACG::Vec3d &_up , int _viewer = ACTIVE_VIEWER);
150 
160 DLLEXPORT
161 void viewingRay(int _x, int _y,
162  ACG::Vec3d& _outOrigin, ACG::Vec3d& _outDirection);
163 
174 DLLEXPORT
175 void viewingRay(int _x, int _y,
176  ACG::Vec3d& _outOrigin, ACG::Vec3d& _outDirection, int _viewerIndex);
177 
187 DLLEXPORT
188 void lookAt(const ACG::Vec3d& _eye, const ACG::Vec3d& _center, const ACG::Vec3d& _up, int _viewer = ACTIVE_VIEWER);
189 
198 DLLEXPORT
199 void setScenePos(const ACG::Vec3d& _center, const double _radius , int _viewer = ALL_VIEWERS);
200 
211 DLLEXPORT
212 void setTrackBallCenter(const ACG::Vec3d& _center, int _viewer );
213 
214 
224 DLLEXPORT
225 const ACG::Vec3d trackBallCenter( int _viewer );
226 
237 DLLEXPORT
238 void setScenePos(const ACG::Vec3d& _center , int _viewer = ALL_VIEWERS);
239 
243 DLLEXPORT
244 const ACG::Vec3d sceneCenter( int _viewer = ALL_VIEWERS );
245 
250 DLLEXPORT
251 double sceneRadius();
252 
253 DLLEXPORT
259 double sceneRadius( int _viewer );
260 
261 DLLEXPORT
262 void setSceneRadius(double _radius , int _viewer = ALL_VIEWERS);
263 
274 DLLEXPORT
275 void translate( const ACG::Vec3d &_vector , int _viewer = ALL_VIEWERS);
276 
288 DLLEXPORT
289 void rotate(const ACG::Vec3d& _axis,
290  const double _angle,
291  const ACG::Vec3d& _center,
292  int _viewer = ALL_VIEWERS);
293 
294 
302 DLLEXPORT
303 void viewHome(int _viewer = ALL_VIEWERS);
304 
312 DLLEXPORT
313 void viewAll(int _viewer = ALL_VIEWERS);
314 
321 DLLEXPORT
322 ACG::Vec3d viewingDirection(int _viewer = ACTIVE_VIEWER);
323 
330 DLLEXPORT
331 bool isProjectionOrthographic( int _viewer = ACTIVE_VIEWER );
332 
339 DLLEXPORT
340 ACG::Vec3d eyePos(int _viewer = ACTIVE_VIEWER);
341 
348 DLLEXPORT
349 ACG::Vec3d upVector(int _viewer = ACTIVE_VIEWER);
350 
357 DLLEXPORT
358 void orthographicProjection( int _viewer = ALL_VIEWERS );
359 
364 DLLEXPORT
365 void setFOVY( double _fovy );
366 
369 DLLEXPORT
370 double fovy(int _viewer = ACTIVE_VIEWER);
371 
378 DLLEXPORT
379 void perspectiveProjection( int _viewer = ALL_VIEWERS );
380 
392 DLLEXPORT
393 void setDrawMode( const ACG::SceneGraph::DrawModes::DrawMode& _mode , int _viewer = ALL_VIEWERS);
394 
402 DLLEXPORT
403 ACG::SceneGraph::DrawModes::DrawMode drawMode( int _viewer = ACTIVE_VIEWER );
404 
405 
409 DLLEXPORT
410 void setBackColor( OpenMesh::Vec4f _color);
411 
420 DLLEXPORT
421 void setFixedView(int _mode, int _viewer = ACTIVE_VIEWER );
422 
423 
427 //=======================================
428 // Do animations in examiner viewer
431 //=======================================
432 
438 DLLEXPORT
439 void flyTo (const ACG::Vec3d &_position, const ACG::Vec3d &_center, double _time=1000.0);
440 
441 
447 DLLEXPORT
448 void flyTo (const ACG::Vec3d &_center, bool _move_back = true, double _time=1000.0);
449 
450 
453 //=======================================
454 // Provide snapshot functions
457 //=======================================
458 
468 DLLEXPORT
469 void viewerSnapshot(int _viewer, QImage& _image, int _width = 0, int _height = 0,
470  bool _alpha = false, bool _hideCoordsys = false, int _samples = 1);
471 
474 DLLEXPORT
475 void invalidatePickCaches();
476 
477 }
478 
479 #endif //PLUGINFUNCTIONS_HH
void setMainGLContext()
Set current GL Context to main context.
const ACG::Vec3d trackBallCenter(int _viewer)
Get the trackball Center.
void viewingRay(int _x, int _y, ACG::Vec3d &_outOrigin, ACG::Vec3d &_outDirection)
Retrieve a viewing ray from the active examiner that can be used for raycasting.
ACG::Vec3d upVector(int _viewer)
Get the current up vector.
void viewHome(int _viewer)
Go to home position.
const ACG::Vec3d sceneCenter(int _viewer)
Get the current scene center.
ACG::Vec3d eyePos(int _viewer)
Get the current viewer position.
#define DLLEXPORT
double sceneRadius()
Returns the current scene radius from the active examiner widget.
void translate(const ACG::Vec3d &_vector, int _viewer)
Translate viewer pos by given vector.
void setFOVY(double _fovy)
Set field of view angle.
void viewAll(int _viewer)
View the whole scene.
void flyTo(const ACG::Vec3d &_position, const ACG::Vec3d &_center, double _time)
Fly to point and viewing direction (animated).
bool isProjectionOrthographic(int _viewer)
Check if the projection is orthographic.
void viewingDirection(const ACG::Vec3d &_dir, const ACG::Vec3d &_up, int _viewer)
Set the viewing direction.
Viewer::ViewerProperties & viewerProperties(int _id)
Get the viewer properties Use this functions to get basic viewer properties such as backgroundcolor o...
void setTrackBallCenter(const ACG::Vec3d &_center, int _viewer)
Set the trackball Center.
void setFixedView(int _mode, int _viewer)
Set a fixed View for a viewer.
void orthographicProjection(int _viewer)
Switch to orthographic Projection.
void setBackColor(OpenMesh::Vec4f _color)
Set the background color of the examiner widget.
void rotate(const ACG::Vec3d &_axis, const double _angle, const ACG::Vec3d &_center, int _viewer)
Rotate Scene around axis.
void perspectiveProjection(int _viewer)
Switch to perspective Projection.
DLLEXPORT double fovy(int _viewer)
Get field of view angle.
ACG::SceneGraph::DrawModes::DrawMode drawMode(int _viewer)
Get the current draw Mode of a Viewer.
void lookAt(const ACG::Vec3d &_eye, const ACG::Vec3d &_center, const ACG::Vec3d &_up, int _viewer)
Set the look at transformation directly.
void viewerSnapshot(int _viewer, QImage &_image, int _width, int _height, bool _alpha, bool _hideCoordsys, int _samples)
Take a snapshot of a viewer.
void setScenePos(const ACG::Vec3d &_center, const double _radius, int _viewer)
Set the Scene position.
void allowRotation(bool _mode, int _viewer)
void setSceneRadius(double _radius, int _viewer)
Set the background color of the examiner widget.
void setDrawMode(const ACG::SceneGraph::DrawModes::DrawMode &_mode, int _viewer)
Set the draw Mode of a Viewer. .