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 //
45 // Standard Functions
46 //
47 //=============================================================================
48
53 #pragma once
54
55 #include <OpenFlipper/common/Types.hh>
56
57 #include <ACG/Scenegraph/SceneGraph.hh>
58 #include <ACG/Scenegraph/DrawModes.hh>
59 #include <ACG/GL/GLState.hh>
60 #include <OpenFlipper/common/ViewerProperties.hh>
61
64 namespace PluginFunctions {
65
66 const int ALL_VIEWERS = -2;
67 const int ACTIVE_VIEWER = -1;
68
69 const int VIEW_FREE = 0;
70 const int VIEW_TOP = 1;
71 const int VIEW_BOTTOM = 2;
72 const int VIEW_LEFT = 3;
73 const int VIEW_RIGHT = 4;
74 const int VIEW_FRONT = 5;
75 const int VIEW_BACK = 6;
76
77 //=======================================
78 // Get/set status of viewers
81 //=======================================
82
88 DLLEXPORT
89 Viewer::ViewerProperties& viewerProperties(int _id = ACTIVE_VIEWER );
90
94 //=======================================
95 // View settings
98 //=======================================
99
108 DLLEXPORT
109 void allowRotation(bool _mode, int _viewer = ACTIVE_VIEWER);
110
118 DLLEXPORT
119 bool allowRotation(int _viewer = ACTIVE_VIEWER);
120
123 DLLEXPORT
124 void setMainGLContext();
125
126
135 DLLEXPORT
136 void viewingDirection(const ACG::Vec3d &_dir, const ACG::Vec3d &_up , int _viewer = ACTIVE_VIEWER);
137
147 DLLEXPORT
148 void viewingRay(int _x, int _y,
149 ACG::Vec3d& _outOrigin, ACG::Vec3d& _outDirection);
150
161 DLLEXPORT
162 void viewingRay(int _x, int _y,
163 ACG::Vec3d& _outOrigin, ACG::Vec3d& _outDirection, int _viewerIndex);
164
174 DLLEXPORT
175 void lookAt(const ACG::Vec3d& _eye, const ACG::Vec3d& _center, const ACG::Vec3d& _up, int _viewer = ACTIVE_VIEWER);
176
185 DLLEXPORT
186 void setScenePos(const ACG::Vec3d& _center, const double _radius , int _viewer = ALL_VIEWERS);
187
198 DLLEXPORT
199 void setTrackBallCenter(const ACG::Vec3d& _center, int _viewer );
200
201
211 DLLEXPORT
212 const ACG::Vec3d trackBallCenter( int _viewer );
213
224 DLLEXPORT
225 void setScenePos(const ACG::Vec3d& _center , int _viewer = ALL_VIEWERS);
226
230 DLLEXPORT
231 const ACG::Vec3d sceneCenter( int _viewer = ALL_VIEWERS );
232
237 DLLEXPORT
238 double sceneRadius();
239
240 DLLEXPORT
246 double sceneRadius( int _viewer );
247
248 DLLEXPORT
249 void setSceneRadius(double _radius , int _viewer = ALL_VIEWERS);
250
261 DLLEXPORT
262 void translate( const ACG::Vec3d &_vector , int _viewer = ALL_VIEWERS);
263
275 DLLEXPORT
276 void rotate(const ACG::Vec3d& _axis,
277 const double _angle,
278 const ACG::Vec3d& _center,
279 int _viewer = ALL_VIEWERS);
280
281
289 DLLEXPORT
290 void viewHome(int _viewer = ALL_VIEWERS);
291
299 DLLEXPORT
300 void viewAll(int _viewer = ALL_VIEWERS);
301
308 DLLEXPORT
309 ACG::Vec3d viewingDirection(int _viewer = ACTIVE_VIEWER);
310
317 DLLEXPORT
318 bool isProjectionOrthographic( int _viewer = ACTIVE_VIEWER );
319
326 DLLEXPORT
327 ACG::Vec3d eyePos(int _viewer = ACTIVE_VIEWER);
328
335 DLLEXPORT
336 ACG::Vec3d upVector(int _viewer = ACTIVE_VIEWER);
337
344 DLLEXPORT
345 void orthographicProjection( int _viewer = ALL_VIEWERS );
346
351 DLLEXPORT
352 void setFOVY( double _fovy );
353
356 DLLEXPORT
357 double fovy(int _viewer = ACTIVE_VIEWER);
358
365 DLLEXPORT
366 void perspectiveProjection( int _viewer = ALL_VIEWERS );
367
379 DLLEXPORT
380 void setDrawMode( const ACG::SceneGraph::DrawModes::DrawMode& _mode , int _viewer = ALL_VIEWERS);
381
389 DLLEXPORT
390 ACG::SceneGraph::DrawModes::DrawMode drawMode( int _viewer = ACTIVE_VIEWER );
391
392
396 DLLEXPORT
397 void setBackColor( OpenMesh::Vec4f _color);
398
407 DLLEXPORT
408 void setFixedView(int _mode, int _viewer = ACTIVE_VIEWER );
409
410
414 //=======================================
415 // Do animations in examiner viewer
418 //=======================================
419
425 DLLEXPORT
426 void flyTo (const ACG::Vec3d &_position, const ACG::Vec3d &_center, double _time=1000.0);
427
428
434 DLLEXPORT
435 void flyTo (const ACG::Vec3d &_center, bool _move_back = true, double _time=1000.0);
436
437
440 //=======================================
441 // Provide snapshot functions
444 //=======================================
445
455 DLLEXPORT
456 void viewerSnapshot(int _viewer, QImage& _image, int _width = 0, int _height = 0,
457 bool _alpha = false, bool _hideCoordsys = false, int _samples = 1);
458
461 DLLEXPORT
462 void invalidatePickCaches();
463
464 }
465
PluginFunctions::trackBallCenter
const ACG::Vec3d trackBallCenter(int _viewer)
Get the trackball Center.
Definition: PluginFunctions.cc:712
PluginFunctions::setSceneRadius
void setSceneRadius(double _radius, int _viewer)
Set the background color of the examiner widget.
Definition: PluginFunctions.cc:809
PluginFunctions::allowRotation
void allowRotation(bool _mode, int _viewer)
Definition: PluginFunctions.cc:653
PluginFunctions::sceneCenter
const ACG::Vec3d sceneCenter(int _viewer)
Get the current scene center.
Definition: PluginFunctions.cc:778
PluginFunctions::setFixedView
void setFixedView(int _mode, int _viewer)
Set a fixed View for a viewer.
Definition: PluginFunctions.cc:380
PluginFunctions::eyePos
ACG::Vec3d eyePos(int _viewer)
Get the current viewer position.
Definition: PluginFunctions.cc:898
Viewer::ViewerProperties
Definition: ViewerProperties.hh:107
PluginFunctions::viewHome
void viewHome(int _viewer)
Go to home position.
Definition: PluginFunctions.cc:849
ViewerProperties.hh
PluginFunctions::fovy
DLLEXPORT double fovy(int _viewer)
Get field of view angle.
Definition: PluginFunctions.cc:927
PluginFunctions::setDrawMode
void setDrawMode(const ACG::SceneGraph::DrawModes::DrawMode &_mode, int _viewer)
Set the draw Mode of a Viewer. .
Definition: PluginFunctions.cc:431
PluginFunctions::setBackColor
void setBackColor(OpenMesh::Vec4f _color)
Set the background color of the examiner widget.
Definition: PluginFunctions.cc:375
PluginFunctions::setFOVY
void setFOVY(double _fovy)
Set field of view angle.
Definition: PluginFunctions.cc:646
PluginFunctions::upVector
ACG::Vec3d upVector(int _viewer)
Get the current up vector.
Definition: PluginFunctions.cc:911
PluginFunctions::viewerProperties
Viewer::ViewerProperties & viewerProperties(int _id)
Get the viewer properties Use this functions to get basic viewer properties such as backgroundcolor o...
Definition: PluginFunctions.cc:609
PluginFunctions::translate
void translate(const ACG::Vec3d &_vector, int _viewer)
Translate viewer pos by given vector.
Definition: PluginFunctions.cc:821
PluginFunctions::setMainGLContext
void setMainGLContext()
Set current GL Context to main context.
Definition: PluginFunctions.cc:683
PluginFunctions::viewerSnapshot
void viewerSnapshot(int _viewer, QImage &_image, int _width, int _height, bool _alpha, bool _hideCoordsys, int _samples)
Take a snapshot of a viewer.
Definition: PluginFunctions.cc:1070
PluginFunctions::drawMode
ACG::SceneGraph::DrawModes::DrawMode drawMode(int _viewer)
Get the current draw Mode of a Viewer.
Definition: PluginFunctions.cc:450
PluginFunctions::orthographicProjection
void orthographicProjection(int _viewer)
Switch to orthographic Projection.
Definition: PluginFunctions.cc:634
ACG::SceneGraph::DrawModes::DrawMode
Specifies a DrawMode.
Definition: DrawModes.hh:288
PluginFunctions::flyTo
void flyTo(const ACG::Vec3d &_position, const ACG::Vec3d &_center, double _time)
Fly to point and viewing direction (animated).
Definition: PluginFunctions.cc:1055
PluginFunctions::viewingRay
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.
Definition: PluginFunctions.cc:464
Types.hh
PluginFunctions::viewAll
void viewAll(int _viewer)
View the whole scene.
Definition: PluginFunctions.cc:861
PluginFunctions::setScenePos
void setScenePos(const ACG::Vec3d &_center, const double _radius, int _viewer)
Set the Scene position.
Definition: PluginFunctions.cc:738
OpenMesh::VectorT
Definition: Vector11T.hh:83
PluginFunctions::setTrackBallCenter
void setTrackBallCenter(const ACG::Vec3d &_center, int _viewer)
Set the trackball Center.
Definition: PluginFunctions.cc:726
PluginFunctions::perspectiveProjection
void perspectiveProjection(int _viewer)
Switch to perspective Projection.
Definition: PluginFunctions.cc:622
PluginFunctions::rotate
void rotate(const ACG::Vec3d &_axis, const double _angle, const ACG::Vec3d &_center, int _viewer)
Rotate Scene around axis.
Definition: PluginFunctions.cc:833
PluginFunctions
Definition: PluginFunctions.cc:57
PluginFunctions::viewingDirection
void viewingDirection(const ACG::Vec3d &_dir, const ACG::Vec3d &_up, int _viewer)
Set the viewing direction.
Definition: PluginFunctions.cc:687
PluginFunctions::isProjectionOrthographic
bool isProjectionOrthographic(int _viewer)
Check if the projection is orthographic.
Definition: PluginFunctions.cc:886
PluginFunctions::sceneRadius
double sceneRadius()
Returns the current scene radius from the active examiner widget.
Definition: PluginFunctions.cc:792
DLLEXPORT
#define DLLEXPORT
Definition: GlobalDefines.hh:95
SceneGraph.hh
PluginFunctions::lookAt
void lookAt(const ACG::Vec3d &_eye, const ACG::Vec3d &_center, const ACG::Vec3d &_up, int _viewer)
Set the look at transformation directly.
Definition: PluginFunctions.cc:699