Developer Documentation
Loading...
Searching...
No Matches
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
56
58#include <ACG/Scenegraph/DrawModes.hh>
59#include <ACG/GL/GLState.hh>
61
64namespace PluginFunctions {
65
66const int ALL_VIEWERS = -2;
67const int ACTIVE_VIEWER = -1;
68
69const int VIEW_FREE = 0;
70const int VIEW_TOP = 1;
71const int VIEW_BOTTOM = 2;
72const int VIEW_LEFT = 3;
73const int VIEW_RIGHT = 4;
74const int VIEW_FRONT = 5;
75const int VIEW_BACK = 6;
76
77//=======================================
78// Get/set status of viewers
81//=======================================
82
89Viewer::ViewerProperties& viewerProperties(int _id = ACTIVE_VIEWER );
90
94//=======================================
95// View settings
98//=======================================
99
109void allowRotation(bool _mode, int _viewer = ACTIVE_VIEWER);
110
119bool allowRotation(int _viewer = ACTIVE_VIEWER);
120
124void setMainGLContext();
125
126
136void viewingDirection(const ACG::Vec3d &_dir, const ACG::Vec3d &_up , int _viewer = ACTIVE_VIEWER);
137
148void viewingRay(int _x, int _y,
149 ACG::Vec3d& _outOrigin, ACG::Vec3d& _outDirection);
150
162void viewingRay(int _x, int _y,
163 ACG::Vec3d& _outOrigin, ACG::Vec3d& _outDirection, int _viewerIndex);
164
175void lookAt(const ACG::Vec3d& _eye, const ACG::Vec3d& _center, const ACG::Vec3d& _up, int _viewer = ACTIVE_VIEWER);
176
186void setScenePos(const ACG::Vec3d& _center, const double _radius , int _viewer = ALL_VIEWERS);
187
199void setTrackBallCenter(const ACG::Vec3d& _center, int _viewer );
200
201
212const ACG::Vec3d trackBallCenter( int _viewer );
213
225void setScenePos(const ACG::Vec3d& _center , int _viewer = ALL_VIEWERS);
226
231const ACG::Vec3d sceneCenter( int _viewer = ALL_VIEWERS );
232
238double sceneRadius();
239
246double sceneRadius( int _viewer );
247
249void setSceneRadius(double _radius , int _viewer = ALL_VIEWERS);
250
262void translate( const ACG::Vec3d &_vector , int _viewer = ALL_VIEWERS);
263
276void rotate(const ACG::Vec3d& _axis,
277 const double _angle,
278 const ACG::Vec3d& _center,
279 int _viewer = ALL_VIEWERS);
280
281
290void viewHome(int _viewer = ALL_VIEWERS);
291
300void viewAll(int _viewer = ALL_VIEWERS);
301
309ACG::Vec3d viewingDirection(int _viewer = ACTIVE_VIEWER);
310
318bool isProjectionOrthographic( int _viewer = ACTIVE_VIEWER );
319
327ACG::Vec3d eyePos(int _viewer = ACTIVE_VIEWER);
328
336ACG::Vec3d upVector(int _viewer = ACTIVE_VIEWER);
337
345void orthographicProjection( int _viewer = ALL_VIEWERS );
346
352void setFOVY( double _fovy );
353
357double fovy(int _viewer = ACTIVE_VIEWER);
358
366void perspectiveProjection( int _viewer = ALL_VIEWERS );
367
380void setDrawMode( const ACG::SceneGraph::DrawModes::DrawMode& _mode , int _viewer = ALL_VIEWERS);
381
390ACG::SceneGraph::DrawModes::DrawMode drawMode( int _viewer = ACTIVE_VIEWER );
391
392
397void setBackColor( OpenMesh::Vec4f _color);
398
408void setFixedView(int _mode, int _viewer = ACTIVE_VIEWER );
409
410
414//=======================================
415// Do animations in examiner viewer
418//=======================================
419
426void flyTo (const ACG::Vec3d &_position, const ACG::Vec3d &_center, double _time=1000.0);
427
428
435void flyTo (const ACG::Vec3d &_center, bool _move_back = true, double _time=1000.0);
436
437
440//=======================================
441// Provide snapshot functions
444//=======================================
445
456void viewerSnapshot(int _viewer, QImage& _image, int _width = 0, int _height = 0,
457 bool _alpha = false, bool _hideCoordsys = false, int _samples = 1);
458
462void invalidatePickCaches();
463
464}
465
#define DLLEXPORT
void translate(const ACG::Vec3d &_vector, int _viewer)
Translate viewer pos by given vector.
void perspectiveProjection(int _viewer)
Switch to perspective Projection.
void setSceneRadius(double _radius, int _viewer)
Set the background color of the examiner widget.
ACG::Vec3d eyePos(int _viewer)
Get the current viewer position.
double sceneRadius()
Returns the current scene radius from the active examiner widget.
void viewerSnapshot(int _viewer, QImage &_image, int _width, int _height, bool _alpha, bool _hideCoordsys, int _samples)
Take a snapshot of a viewer.
Viewer::ViewerProperties & viewerProperties(int _id)
Get the viewer properties Use this functions to get basic viewer properties such as backgroundcolor o...
void viewingDirection(const ACG::Vec3d &_dir, const ACG::Vec3d &_up, int _viewer)
Set the viewing direction.
void viewHome(int _viewer)
Go to home position.
void setBackColor(OpenMesh::Vec4f _color)
Set the background color of the examiner widget.
void setTrackBallCenter(const ACG::Vec3d &_center, int _viewer)
Set the trackball Center.
DLLEXPORT double fovy(int _viewer)
Get field of view angle.
void orthographicProjection(int _viewer)
Switch to orthographic Projection.
void setScenePos(const ACG::Vec3d &_center, const double _radius, int _viewer)
Set the Scene position.
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 rotate(const ACG::Vec3d &_axis, const double _angle, const ACG::Vec3d &_center, int _viewer)
Rotate Scene around axis.
void setFixedView(int _mode, int _viewer)
Set a fixed View for a viewer.
ACG::SceneGraph::DrawModes::DrawMode drawMode(int _viewer)
Get the current draw Mode of a Viewer.
void setFOVY(double _fovy)
Set field of view angle.
bool isProjectionOrthographic(int _viewer)
Check if the projection is orthographic.
void setDrawMode(const ACG::SceneGraph::DrawModes::DrawMode &_mode, int _viewer)
Set the draw Mode of a Viewer. .
void flyTo(const ACG::Vec3d &_position, const ACG::Vec3d &_center, double _time)
Fly to point and viewing direction (animated).
void allowRotation(bool _mode, int _viewer)
void setMainGLContext()
Set current GL Context to main context.
const ACG::Vec3d trackBallCenter(int _viewer)
Get the trackball Center.
void lookAt(const ACG::Vec3d &_eye, const ACG::Vec3d &_center, const ACG::Vec3d &_up, int _viewer)
Set the look at transformation directly.
const ACG::Vec3d sceneCenter(int _viewer)
Get the current scene center.
void viewAll(int _viewer)
View the whole scene.