#include <scene.h>
Public Types |
|
Type definitions
|
|
enum | ModeType { ROTATE__MODE = 0, MOVE__MODE, PICKING__MODE } |
Predefined constants for the mode
types Add new enums members in derived classes, for new
modi.
More... |
|
enum | ModeAction { TRANSLATE_ACTION, ZOOM_ACTION, ROTATE_ACTION, ROTATE_CLOCKWISE_ACTION } |
Different Mouse Mode
actions. |
|
Enums
|
|
enum | WindowType { CONTROL_WINDOW = 0, LEFT_EYE_WINDOW, RIGHT_EYE_WINDOW } |
Scene may hold several windows for different renering
modes.
More... |
|
Public Member Functions |
|
Constructors and Destructor
|
|
Scene () | |
Scene (QWidget *parent_widget, const char *name=NULL, Qt::WFlags w_flags=0) | |
Default Constructor. |
|
Scene (const Scene &scene, QWidget *parent_widget=NULL, const char *name=NULL, Qt::WFlags wflags=0) | |
Copy constructor. |
|
virtual | ~Scene () |
Destructor. |
|
virtual void | clear () |
Explicit default initialization.
|
|
Assignment
|
|
void | set (const Scene &scene) |
Assignment. |
|
const Scene & | operator= (const Scene &scene) |
Assignment operator. |
|
Accessors: inspectors and mutators
|
|
virtual void | onNotify (Message *message) |
Handles messages sent by other
registered
ConnectionObject objects. |
|
virtual bool | exportScene (Renderer &er) const |
This method exports the content of
the
Scene to an external Renderer. |
|
virtual void | initializeWidget (MainControl &main_control) |
ModularWidget methods. |
|
virtual void | fetchPreferences (INIFile &inifile) |
Fetch the widgets preferences from
the INIFile. |
|
virtual void | writePreferences (INIFile &inifile) |
Writes the widgets preferences to
the INIFile. |
|
virtual void | checkMenu (MainControl &main_control) |
Menu checking method. |
|
Protected Slots |
|
Protected slots
|
|
virtual void | rotateMode_ () |
Switch to rotate mode. |
|
virtual void | pickingMode_ () |
Switch to picking mode. |
|
virtual void | moveMode_ () |
virtual void | showViewPoint_ () |
Show the viewpoint and the look at
point in the statusline of the mainwidget. |
|
virtual void | setViewPoint_ () |
Set the viewpoint. |
|
virtual void | resetCamera_ () |
Reset the camera to standard
values. |
|
virtual void | resetRepresentationsForRenderer_ (RenderSetup &rs) |
Rebuffer all representations for the
current renderer_. |
|
virtual void | dropEvent (QDropEvent *e) |
virtual void | dragEnterEvent (QDragEnterEvent *e) |
void | dummySlot () |
Friends |
|
class | AnimationThread |
class | RenderSetup |
Protected QT overridden virtual methods |
|
ModeType | current_mode_ |
ModeType | last_mode_ |
QAction * | rotate_action_ |
QAction * | picking_action_ |
QAction * | move_action_ |
QAction * | no_stereo_action_ |
QAction * | active_stereo_action_ |
QAction * | dual_stereo_action_ |
QAction * | dual_stereo_different_display_action_ |
QAction * | fullscreen_action_ |
QAction * | record_animation_action_ |
QAction * | start_animation_action_ |
QAction * | clear_animation_action_ |
QAction * | cancel_animation_action_ |
QAction * | animation_export_POV_action_ |
QAction * | animation_export_VRML_action_ |
QAction * | animation_export_PNG_action_ |
QAction * | animation_repeat_action_ |
QAction * | switch_grid_ |
QMenu * | create_coordinate_system_ |
Vector3 | system_origin_ |
Vector3 | old_trackorigin_ |
bool | tracking_initialized_ |
Quaternion | old_trackrotation_ |
bool | need_update_ |
bool | update_running_ |
Index | x_window_pos_old_ |
Index | y_window_pos_old_ |
Index | x_window_pos_new_ |
Index | y_window_pos_new_ |
Index | x_window_pick_pos_first_ |
Index | y_window_pick_pos_first_ |
Index | x_window_pick_pos_second_ |
Index | y_window_pick_pos_second_ |
bool | pick_select_ |
QRubberBand * | rb_ |
Stage * | stage_ |
Camera | stereo_camera_ |
Camera | stored_camera_ |
std::vector< RenderSetup > | renderers_ |
GLRenderer * | gl_renderer_ |
LightSettings * | light_settings_ |
StageSettings * | stage_settings_ |
MaterialSettings * | material_settings_ |
List< Camera > | animation_points_ |
AnimationThread * | animation_thread_ |
bool | stop_animation_ |
bool | want_to_use_vertex_buffer_ |
bool | mouse_button_is_pressed_ |
bool | preview_ |
bool | use_preview_ |
PreciseTime | time_ |
float | zoom_factor_ |
QPoint | info_point_ |
QByteArray | last_state_ |
list< float > | fps_ |
bool | show_fps_ |
Size | offscreen_factor_ |
String | text_ |
Size | font_size_ |
QToolBar * | toolbar_view_controls_ |
QList< QAction * > | toolbar_actions_view_controls_ |
bool | ignore_pick_ |
QActionGroup * | mode_group_ |
String | info_string_ |
GLRenderWindow * | main_display_ |
Index | stereo_left_eye_ |
Index | stereo_right_eye_ |
static float | mouse_sensitivity_ |
static float | mouse_wheel_sensitivity_ |
static bool | show_light_sources_ |
static float | animation_smoothness_ |
static Position | screenshot_nr_ |
static Position | pov_nr_ |
static Position | vrml_nr_ |
static bool | offscreen_rendering_ |
virtual void | init () |
Initialize the scene and all
predefined render setups. |
|
virtual void | paintGL () |
Render the visualization. |
|
virtual void | resizeEvent (QResizeEvent *event) |
Resize the widget. |
|
virtual void | customEvent (QEvent *evt) |
This function handles custom events
that for example are sent by the input device drivers.
|
|
virtual void | transformationEvent6D (TransformationEvent6D *evt) |
Function that interpretes the
transformation events sent to
customEvent(). |
|
virtual void | motionTrackingEvent (MotionTrackingEvent *evt) |
Function that interpretes the motion
tracker events sent to
customEvent(). |
|
virtual void | buttonPressEvent (ButtonEvent *evt) |
Function that interpretes the button
press events sent to
customEvent(). |
|
virtual void | buttonReleaseEvent (ButtonEvent *evt) |
Function that interpretes the button
release events sent to
customEvent(). |
|
virtual void | mouseMoveEvent (QMouseEvent *qmouse_event) |
Catch mouse move events, store the
actual mouse position in this scene widget and sent events
accordingly. |
|
virtual void | mousePressEvent (QMouseEvent *qmouse_event) |
Catch mouse press events, store the
actual mouse position in this scene widget and sent events
accordingly. |
|
virtual void | mouseReleaseEvent (QMouseEvent *qmouse_event) |
Catch mouse release events, store
the actual mouse position in this scene widget and sent
events accordingly. |
|
virtual void | wheelEvent (QWheelEvent *qmouse_event) |
Catch mouse wheel events and zoom
the scene accordingly. |
|
void | animate_ () |
void | processRotateModeMouseEvents_ (QMouseEvent *e) |
void | processMoveModeMouseEvents_ (QMouseEvent *e) |
void | rotateSystem_ () |
void | rotateSystemClockwise_ () |
void | translateSystem_ () |
void | zoomSystem_ () |
Index | getMoveModeAction_ (const QMouseEvent &e) |
void | selectionPressed_ () |
void | selectionPressedMoved_ () |
void | selectObjects_ () |
void | pickParent_ (QPoint p) |
void | writeLights_ (INIFile &inifile) const |
void | readLights_ (const INIFile &inifile) |
float | getXDiff_ () |
float | getYDiff_ () |
Vector3 | getTranslationVector_ (const Vector3 &v) |
void | createCoordinateSystem_ (bool at_origin) |
String | createFPSInfo_ () |
Estimate current fps and convert
into a string. |
|
Debugging and Diagnostics |
|
virtual bool | isValid () const |
Internal state and consistency
self-validation. |
|
virtual void | dump (std::ostream &s=std::cout, Size depth=0) const |
Internal value dump. |
|
Stage * | getStage () |
const Stage * | getStage () const |
void | setCamera (const Camera &camera) |
List< Camera > & | getAnimationPoints () |
void | setDefaultLighting (bool update_GL=true) |
void | initializePreferencesTab (Preferences &preferences) |
Initialize a preferences tab for the
widget (if needed). |
|
void | finalizePreferencesTab (Preferences &preferences) |
Remove the preferences tab. |
|
virtual void | applyPreferences () |
Apply the preferences of the
specific tab. |
|
GLRenderer & | getGLRenderer () |
void | setGLRenderer (GLRenderer &renderer) |
Set a new
GLRenderer. |
|
float | getMousePositionX () |
float | getMousePositionY () |
bool | exportPNG (const String &filename) |
virtual void | setWidgetVisible (bool state) |
void | setOffScreenRendering (bool enabled, Size factor) |
virtual void | paintEvent (QPaintEvent *e) |
virtual void | keyPressEvent (QKeyEvent *e) |
Catch key events. |
|
virtual void | mouseDoubleClickEvent (QMouseEvent *e) |
virtual bool | eventFilter (QObject *object, QEvent *event) |
ModeType | getMode () const |
virtual void | setMode (ModeType mode) |
void | rotate (float degree_right, float degree_up) |
void | rotateClockwise (float degree) |
void | move (Vector3 v) |
Move the view. |
|
void | moveComposites (const List< Composite * > &composites, Vector3 v) |
Move some Composites. |
|
void | rotateComposites (const List< Composite * > &composites, float degree_right, float degree_up, float degree_clockwise=0) |
Rotate some Composites. |
|
bool | isAnimationRunning () const |
void | setTurnPoint (const Vector3 &v) |
const Vector3 & | getTurnPoint () const |
void | setFullScreen (bool state) |
void | setFPSEnabled (bool state) |
void | showText (const String &text, Size font_size=20) |
Show text in the lower right corner.
|
|
virtual void | addToolBarEntries (QToolBar *tb) |
Add the widgets actions to the
(main) toolbar. |
|
bool | isUpdateRunning () const |
void | resetTracking () |
bool | inMoveMode () const |
Position | prepareGridTextures (const RegularData3D &grid, const ColorMap &map) |
void | updateGL () |
static void | setAnimationSmoothness (float value) |
static float | getAnimationSmoothness () |
static void | setMouseSensitivity (float sensitivity) |
static float | getMouseSensitivity () |
static void | setMouseWheelSensitivity (float sensitivity) |
static float | getMouseWheelSensitivity () |
static void | setShowLightSources (bool state) |
static bool | showLightSourcesEnabled () |
static bool | stereoBufferSupportTest () |
static void | setScreenShotNumber (Position pos) |
static void | setPOVNumber (Position pos) |
static void | setVRMLNumber (Position pos) |
void | createCoordinateSystem () |
Create an coordinate system at
current position. |
|
void | createCoordinateSystemAtOrigin () |
Create an coordinate system at
origin. |
|
String | exportPNG () |
Export PNG image and return the
filename. |
|
void | exportPOVRay () |
void | exportNextPOVRay () |
Export to POVRay whithout showing
file dialog. |
|
void | printScene () |
void | showExportPNGDialog () |
show an dialog to save an PNG file
to |
|
void | showExportVRMLDialog () |
opens the
VIEW/DIALOGS/GeometryExportDialog for vrml and stl
export |
|
void | setPreview (bool state) |
Enable or disable model previews
e.g. while rotating. |
|
bool | usePreview () const |
Returns the state of the preview
mode. |
|
virtual void | switchShowWidget () |
Show or hide widget (Called by menu
entry in "WINDOWS") If the
ModularWidget is not also a QWidget, this method does
nothing. |
|
void | addGlWindow () |
void | exitStereo () |
void | enterActiveStereo () |
void | enterDualStereo () |
void | enterDualStereoDifferentDisplays () |
void | clearRecordedAnimation () |
void | startAnimation () |
void | stopAnimation () |
void | switchToLastMode () |
void | switchShowGrid () |
void | showInfos () |
Popup informations for object under
mouse cursor. |
|
void | setupViewVolume () |
void | storeViewPoint () |
void | restoreViewPoint () |
To do this, the class
Scene must be a child of the
MainControl. Because the
MainControl is also the main application object a
Scene must be created with the pointer to the
MainControl as parent widget.
Scene is capable of stereo 3D view with shutter glasses and
CRT monitors. This only works, if the OpenGL-driver supports
this. NVIDIA cards need a Quad buffer, like they are used in
the "Quad" cards. For other NVIDIA cards, you can try the tool
"Rivatuner",
which tries to enable this feature for cards, which natively
dont support this. To enter and leave the stereo mode, press
ALT-Y. If your OpenGL doesnt support the stereo view, you will
see an error message in the message bar at the bottom of the
main window.
The
Scene has tree different mouse modi:
To change between the first two modi, there is a menu entry
with checkboxes in the main menu bar of the application.
In Picking mode, left mouse button selects composites and right
mouse button deselects. There are two ways to (de-)select:
Either click on single items, or draw a selection rectangle by
keeping the mouse button pressed and moving the mouse. Users
with only one mouse button can use the SHIFT button, while
pressing the mouse button to deselect.
In Rotate mode, left mouse button rotates, mid mouse button
zooms in and out and right button moves the view. Users with
only one mouse button can use the SHIFT / CONTROL button, while
pressing the mouse button.
The eye distance change mode is only available in the stereo
view mode. Here a user can press the ALT-button and move the
mouse left or right to adjust the eye distance to their desired
value.
Its possible to add new modi, to do so, derive a new class from
Scene and overload the mouse*Event methods.
Furthermore, users can create modified versions of the
GLRenderer and pass them to the
Scene with the method setGLRenderer.
Scene may hold several windows for different renering modes.
If you need to retrieve a particular window, use this enum together with Scene::getWindow() to get a reference to it.
BALL::VIEW::Scene::Scene | ( | QWidget * | parent_widget, | |
const char * | name =
NULL , |
|||
Qt::WFlags | w_flags =
0 |
|||
) |
Default Constructor.
Initialize the width and height of this scene to
600
and sets the camera position.
parent_widget | the parent widget of this scene | |
name | the name of this scene | |
w_flags | the flags the scene widget should have (See documentation of QT-library for information concerning widget flags) |
BALL::VIEW::Scene::Scene | ( | const Scene & | scene, | |
QWidget * | parent_widget =
NULL , |
|||
const char * | name =
NULL , |
|||
Qt::WFlags | wflags =
0 |
|||
) |
Copy constructor.
Initialize the width, height and camera position.
scene | the scene to be copied | |
parent_widget | the parent widget of this scene | |
name | the name of this scene | |
wflags | the flags the scene widget should have (See documentation of QT-library for information concerning widget flags) |
virtual void BALL::VIEW::Scene::addToolBarEntries | ( | QToolBar * | main_tb | ) | [virtual] |
Add the widgets actions to the (main) toolbar.
This method is needed to enable ordering the entries. It is called in Mainframe.
Reimplemented from BALL::VIEW::ModularWidget.
Reimplemented in BALL::VIEW::EditableScene.
virtual void BALL::VIEW::Scene::applyPreferences | ( | ) | [virtual] |
Apply the preferences of the specific tab.
In this method the widget can extract any changed values from its preferences tab (if required). This method is called automatically by the applyPreferencesTab from the MainControl object if the apply button in the Preferences dialog is pressed.
preferences | the Preferences dialog of the MainControl |
applyPreferencesTab
Reimplemented from BALL::VIEW::ModularWidget.
Reimplemented in BALL::VIEW::EditableScene.
virtual void BALL::VIEW::Scene::checkMenu | ( | MainControl & | main_control | ) | [virtual] |
Menu checking method.
This method is called by MainControl::checkMenus before a popup menu is shown. The menus rotate mode and picking mode each will be checked if this scene is in the corresponding mode.
main_control | the MainControl object whose menus should be checked |
checkMenus
show
Reimplemented from BALL::VIEW::ModularWidget.
Reimplemented in BALL::VIEW::EditableScene.
virtual void BALL::VIEW::Scene::clear | ( | ) | [virtual] |
Explicit default initialization.
Reset the default values of this scene to:
600
600
Vector(1,0,0)
Vector(0,0,0)
Reimplemented from BALL::VIEW::ModularWidget.
virtual void BALL::VIEW::Scene::customEvent | ( | QEvent * | evt | ) | [protected, virtual] |
This function handles custom events that for example are sent by the input device drivers.
evt | A pointer to the event that shell be processed |
virtual void BALL::VIEW::Scene::dump | ( | std::ostream & | s =
std::cout , |
|
Size | depth =
0 |
|||
) | const [virtual] |
Internal value dump.
Dump the current internal state of this scene to the output ostream s with dumping depth depth.
s | output stream where to output the internal state of this scene | |
depth | the dumping depth |
Reimplemented from BALL::VIEW::ModularWidget.
virtual void BALL::VIEW::Scene::fetchPreferences | ( | INIFile & | inifile | ) | [virtual] |
Fetch the widgets preferences from the INIFile.
This method is called automatically by MainControl::show() at the start of the application.
inifile | the INIFile that contains the needed values |
Reimplemented from BALL::VIEW::ModularWidget.
void BALL::VIEW::Scene::finalizePreferencesTab | ( | Preferences & | preferences | ) | [virtual] |
Remove the preferences tab.
This method can remove a preferences widget (if created in initializePreferencesTab) from the Preferences dialog of the MainControl. This method is called automatically by MainControl::aboutToExit() at the end of the application.
preferences | the Preferences dialog of the MainControl |
Reimplemented from BALL::VIEW::ModularWidget.
Reimplemented in BALL::VIEW::EditableScene.
void BALL::VIEW::Scene::initializePreferencesTab | ( | Preferences & | preferences | ) | [virtual] |
Initialize a preferences tab for the widget (if needed).
This method can be used to create preferences widgets that can be inserted into the Preferences dialog with the method insertTab. This method is called automatically by MainControl::show at the start of the application.
preferences | the Preferences dialog of the MainControl |
Reimplemented from BALL::VIEW::ModularWidget.
Reimplemented in BALL::VIEW::EditableScene.
virtual void BALL::VIEW::Scene::initializeWidget | ( | MainControl & | main_control | ) | [virtual] |
ModularWidget methods.
Initialize the popup menu Display and the menus of this scene:
main_control | the MainControl object to be initialized with this scene |
Reimplemented from BALL::VIEW::ModularWidget.
Reimplemented in BALL::VIEW::EditableScene.
virtual bool BALL::VIEW::Scene::isValid | ( | ) | const [virtual] |
Internal state and consistency self-validation.
A Scene is valid if it has a parent.
Reimplemented from BALL::VIEW::ConnectionObject.
virtual void BALL::VIEW::Scene::mouseMoveEvent | ( | QMouseEvent * | qmouse_event | ) | [protected, virtual] |
Catch mouse move events, store the actual mouse position in this scene widget and sent events accordingly.
e | the QT-mouse event (See QT-library for mouse events) |
Reimplemented in BALL::VIEW::EditableScene.
virtual void BALL::VIEW::Scene::mousePressEvent | ( | QMouseEvent * | qmouse_event | ) | [protected, virtual] |
Catch mouse press events, store the actual mouse position in this scene widget and sent events accordingly.
e | the QT-mouse event (See QT-library for mouse events) |
Reimplemented in BALL::VIEW::EditableScene.
virtual void BALL::VIEW::Scene::mouseReleaseEvent | ( | QMouseEvent * | qmouse_event | ) | [protected, virtual] |
Catch mouse release events, store the actual mouse position in this scene widget and sent events accordingly.
e | the QT-mouse event (See QT-library for mouse events) |
Reimplemented in BALL::VIEW::EditableScene.
void BALL::VIEW::Scene::move | ( | Vector3 | v | ) |
Move the view.
\ v.x = right \ v.y = up \ v.z = view direction
Move some Composites.
\ v.x = right \ v.y = up \ v.z = view direction
virtual void BALL::VIEW::Scene::onNotify | ( | Message * | message | ) | [virtual] |
Handles messages sent by other registered ConnectionObject objects.
Filters for SceneMessage and sets the Camera appropriate or updates the visualization.
message | the pointer to the message that should be processed |
Reimplemented from BALL::VIEW::ConnectionObject.
Reimplemented in BALL::VIEW::EditableScene.
virtual void BALL::VIEW::Scene::paintGL | ( | ) | [protected, virtual] |
Render the visualization.
Overriden qt method for rendering the visualization of this scene. This method will be called automatically every time an update is necessary. See QT-library for information concerning qglwidgets and paintGL methods and events.
virtual void BALL::VIEW::Scene::pickingMode_ | ( | ) | [protected, virtual, slot] |
Switch to picking mode.
If this method is called the mouse actions of this scene will perform object picking. This method will be called from the corresponding menu entry.
virtual void BALL::VIEW::Scene::resetRepresentationsForRenderer_ | ( | RenderSetup & | rs | ) | [protected, virtual, slot] |
Rebuffer all representations for the current renderer_.
Note: this function does not yet clear the old state of the renderer.
virtual void BALL::VIEW::Scene::resizeEvent | ( | QResizeEvent * | event | ) | [protected, virtual] |
Resize the widget.
Overridden qt method for resizing this scene. This method will be called automatically every time a rezize event is handled.
width | the new width of this scene | |
height | the new height of this scene |
void BALL::VIEW::Scene::rotateComposites | ( | const List< Composite * > & | composites, | |
float | degree_right, | |||
float | degree_up, | |||
float | degree_clockwise =
0 |
|||
) |
Rotate some Composites.
\ v.x = right \ v.y = up \ v.z = view direction
virtual void BALL::VIEW::Scene::rotateMode_ | ( | ) | [protected, virtual, slot] |
Switch to rotate mode.
If this method is called the mouse actions of this scene will perform rotation, translation and zooming the visualization. This method will be called from the corresponding menu entry.
void BALL::VIEW::Scene::set | ( | const Scene & | scene | ) |
Assignment.
Initialize the width, height and camera position.
scene | the scene to be copied |
void BALL::VIEW::Scene::setGLRenderer | ( | GLRenderer & | renderer | ) |
Set a new GLRenderer.
This method is intended for users, that what to overload the behaviour of the GLRenderer.
void BALL::VIEW::Scene::showText | ( | const String & | text, | |
Size | font_size =
20 |
|||
) |
Show text in the lower right corner.
To clear the text, call this method again with an empty string.
virtual void BALL::VIEW::Scene::wheelEvent | ( | QWheelEvent * | qmouse_event | ) | [protected, virtual] |
Catch mouse wheel events and zoom the scene accordingly.
e | the QT-mouse event (See QT-library for mouse events) |
Reimplemented in BALL::VIEW::EditableScene.
virtual void BALL::VIEW::Scene::writePreferences | ( | INIFile & | inifile | ) | [virtual] |
Writes the widgets preferences to the INIFile.
This method is called automatically by MainControl::aboutToExit at the end of the application.
inifile | the INIFile to contain the values |
Reimplemented from BALL::VIEW::ModularWidget.