5 #ifndef BALL_VIEW_WIDGETS_SCENE_H 6 #define BALL_VIEW_WIDGETS_SCENE_H 8 #ifndef BALL_VIEW_KERNEL_MODULARWIDGET_H 12 #ifndef BALL_VIEW_RENDERING_RENDERERSGLRENDERER_H 16 #ifndef BALL_VIEW_KERNEL_COMMON_H 20 #ifndef BALL_VIEW_RENDERING_RENDERWINDOW_H 24 #ifndef BALL_VIEW_RENDERING_GLRENDERWINDOW_H 28 #ifndef BALL_VIEW_RENDERING_RENDERSETUP_H 32 #ifndef BALL_VIEW_DIALOGS_EDITSETTINGS_H 36 #ifndef BALL_VIEW_KERNEL_EDITOPERATION_H 40 #ifndef BALL_VIEW_KERNEL_MODES_INTERACTIONMODEMANAGER_H 44 #include <QtCore/QThread> 45 #include <QtCore/QTimer> 46 #include <QtGui/QDragEnterEvent> 47 #include <QtGui/QDropEvent> 48 #include <QtWidgets/QToolBar> 49 #include <QtGui/QFont> 50 #include <QtGui/QPicture> 52 #include <boost/shared_ptr.hpp> 54 #ifdef BALL_HAS_RTFACT 56 #ifndef BALL_VIEW_RENDERING_RAYTRACINGRENDERER_H 60 #endif // BALL_HAS_RTFACT 79 class InteractionMode;
83 class MaterialSettings;
84 class AnimationThread;
86 class CompositeMessage;
87 class ControlSelectionMessage;
88 class RepresentationMessage;
92 class TransformationEvent6D;
93 class MotionTrackingEvent;
95 class RenderToBufferFinishedEvent;
145 #ifdef BALL_HAS_RTFACT 146 typedef boost::shared_ptr<RaytracingRenderer> RaytracingRendererPtr;
147 typedef boost::shared_ptr<RenderWindow> RaytracingWindowPtr;
190 Scene(
QWidget* parent_widget = 0,
const char* name = NULL, Qt::WindowFlags w_flags = 0);
204 virtual void clear();
219 virtual void onNotify(
Message *message);
223 virtual bool exportScene(
Renderer &er)
const;
241 virtual void initializeWidget(
MainControl& main_control);
244 virtual void fetchPreferences(
INIFile& inifile);
247 virtual void writePreferences(
INIFile& inifile);
269 virtual bool isValid()
const;
277 virtual void dump(std::ostream& s = std::cout,
Size depth = 0)
const;
279 void setInfo(
const QString& info_string);
280 bool isRecording()
const;
281 void captureCamera();
287 Vector3 mapViewportTo3D(
int x,
int y);
288 void setRubberBandGeometry(
const QRect& rect);
289 void setRubberBandVisible(
bool show);
290 void pickObjects(
const QPoint& pos, list<GeometricObject*>& objects);
291 void pickObjects(
const QPoint& pos1,
const QPoint& pos2, list<GeometricObject*>& objects);
293 std::list<AtomContainer*> getContainers();
294 void enterPickingMode();
295 void exitPickingMode();
297 void drawLine(
const QPointF& a,
const QPointF& b, QPainter* painter = 0);
298 void drawLine(
const Vector2& a,
const Vector2& b, QPainter* painter = 0);
303 void changeBondOrder();
304 void changeBondOrder(
Index delta);
305 void activatedOrderItem_(QAction* action);
306 void createMolecule_();
307 void setFormalCharge_();
309 void deselect(
bool update=
true);
310 void getClickedItems(
const QPoint& p);
322 {
return stage_settings_; }
326 {
return stage_settings_; }
330 {
return material_settings_; }
334 {
return material_settings_; }
337 void setCamera(
const Camera& camera);
341 {
return animation_points_;}
345 { animation_smoothness_ = value;}
349 {
return animation_smoothness_;}
353 {
return downsampling_factor_;}
356 void setDownsamplingFactor(
float ds_factor);
359 void setDefaultLighting(
bool update_GL =
true);
375 { show_light_sources_ = state;}
379 {
return show_light_sources_;}
383 {
return *gl_renderer_;}
385 #ifdef BALL_HAS_RTFACT 388 {
return *rt_renderer_;}
398 static bool stereoBufferSupportTest();
401 bool inMoveMode()
const;
404 bool exportPNG(
const String& filename);
407 virtual void setWidgetVisible(
bool state);
410 void setOffScreenRendering(
bool enabled,
Size factor);
413 virtual void paintEvent(QPaintEvent* e);
419 virtual void projectionModeChanged();
431 void rotate(
float degree_right,
float degree_up);
434 void rotateClockwise(
float degree);
449 void moveComposites(
const std::list<Composite*>& composites,
Vector3 v);
456 void rotateComposites(
const std::list<Composite*>& composites,
float degree_right,
float degree_up,
float degree_clockwise = 0);
459 bool isAnimationRunning()
const;
468 void setFullScreen(
bool state);
476 void showText(
const String& text,
Size font_size = 20);
484 void updateAllMaterials();
488 void lightsUpdated(
bool redraw =
false);
491 void setupEnvironmentMap(
const QImage& image);
497 void initializePreferencesTab(
Preferences &preferences);
500 void finalizePreferencesTab(
Preferences &preferences);
503 virtual void applyPreferences();
506 void showContextMenu(QPoint pos);
509 using QWidget::setCursor;
515 void setElementCursor(
int number);
518 virtual void addToolBarEntries(QToolBar* tb);
521 virtual void keyPressEvent(QKeyEvent* e);
526 void createCoordinateSystem();
529 void createCoordinateSystemAtOrigin();
538 void exportNextPOVRay();
544 void showExportPNGDialog();
547 void showExportVRMLDialog();
560 virtual void switchShowWidget();
568 #ifdef BALL_HAS_RTFACT 569 void addRTfactWindow();
580 void enterActiveStereo();
583 void enterDualStereo();
586 void enterDualStereoDifferentDisplays();
589 void clearRecordedAnimation();
592 void startAnimation();
595 void stopAnimation();
598 void switchToLastMode();
601 void switchShowGrid();
607 void setupViewVolume();
610 void storeViewPoint();
613 void restoreViewPoint();
616 void startContinuousLoop();
619 void stopContinuousLoop();
622 void toggleContinuousLoop();
625 void applyStereoDefaults();
627 #ifdef BALL_HAS_RTFACT 628 RaytracingWindowPtr getWindow(
WindowType aWindowType);
631 void createNewMolecule();
632 void saturateWithHydrogens();
633 void optimizeStructure();
634 void computeBondOrders();
637 void setEditElementType(
int element_number);
638 int getEditElementType();
652 virtual void showViewPoint_();
656 virtual void setViewPoint_();
659 virtual void resetCamera_();
664 virtual void resetRepresentationsForRenderer_(
RenderSetup& rs);
667 virtual void dropEvent(QDropEvent* e);
670 virtual void dragEnterEvent(QDragEnterEvent* e);
714 void renderText_(QPointF
const& point, QString
const& text,
QPaintDevice* current_dev);
721 void insert_(
int x_,
int y_,
PDBAtom &atom_);
729 void initializeMembers_();
764 virtual void paintGL();
772 virtual void resizeEvent(QResizeEvent* event);
779 virtual void customEvent(
QEvent* evt);
805 virtual void mouseMoveEvent(
QMouseEvent* qmouse_event);
811 virtual void mousePressEvent(
QMouseEvent* qmouse_event);
817 virtual void mouseReleaseEvent(
QMouseEvent* qmouse_event);
822 virtual void wheelEvent(QWheelEvent* qmouse_event);
824 virtual void mouseDoubleClickEvent(
QMouseEvent* e);
829 void rotateSystemClockwise_();
832 void selectionPressed_();
833 void selectionPressedMoved_();
835 void selectObjects_();
836 void pickParent_(QPoint p);
838 void writeLights_(
INIFile& inifile)
const;
840 void readLights_(
const INIFile& inifile);
842 void createCoordinateSystem_(
bool at_origin);
844 void registerRenderers_();
850 QAction *
no_stereo_action_, *enter_stereo_action_, *active_stereo_action_, *dual_stereo_action_, *dual_stereo_different_display_action_;
854 #ifdef BALL_HAS_RTFACT 855 QAction *toggle_continuous_loop_action_;
876 #ifdef BALL_HAS_RTFACT 878 RaytracingWindowPtr rt_window_;
899 #ifdef BALL_HAS_RTFACT 900 bool continuous_loop_;
944 virtual void run() {scene_->animate_();}
947 void mySleep(
Size msec);
963 #endif // BALL_VIEW_WIDGETS_SCENE_H
static void setAnimationSmoothness(float value)
void setScene(Scene *scene)
static BALL_DEPRECATED float getMouseWheelSensitivity()
EditSettings * edit_settings_
static BALL_DEPRECATED float getMouseSensitivity()
MaterialSettings * material_settings_
const StageSettings * getStageSettings() const
std::vector< boost::shared_ptr< RenderSetup > > renderers_
GLRenderer * gl_renderer_
#define BALL_EMBEDDABLE(TYPE, BASE)
Base class for all messages concerning a Representation.
QList< QAction * > toolbar_actions_edit_controls_
void setPreview(bool state)
Enable or disable model previews e.g. while rotating.
QToolBar * toolbar_edit_controls_
static float downsampling_factor_
Position main_renderer_
The index of the renderer responsible for the main display.
MaterialSettings * getMaterialSettings()
std::list< Camera > animation_points_
bool useVertexBuffers() const
QList< QAction * > toolbar_actions_view_controls_
bool tracking_initialized_
const Vector3 & getTurnPoint() const
static bool only_highlighted_
static void setScreenShotNumber(Position pos)
Window into which left eye should be rendered. Indicates same window as CONTROL_WINDOW if no stereo i...
InteractionModeManager & getInteractionModeManager()
Returns a reference to the Scene's interaction mode manager.
LightSettings * light_settings_
BALL_EXTERN_VARIABLE const double c
static void setVRMLNumber(Position pos)
InteractionModeManager mode_manager_
AnimationThread * animation_thread_
static bool show_light_sources_
static float animation_smoothness_
float getDownsamplingFactor() const
void setFPSEnabled(bool state)
vector< EditOperation > undo_
bool usePreview() const
Returns the state of the preview mode.
static void setPOVNumber(Position pos)
Quaternion old_trackrotation_
const Stage * getStage() const
bool want_to_use_vertex_buffer_
GLRenderer & getGLRenderer()
void setTurnPoint(const Vector3 &v)
std::list< Camera > & getAnimationPoints()
QAction * optimize_action_
void notify(Message *msg)
QMenu * create_coordinate_system_
GLRenderWindow * main_display_
QAction * start_animation_action_
QAction * bondorders_action_
StageSettings * stage_settings_
QAction * animation_repeat_action_
QAction * add_hydrogens_action_
StageSettings * getStageSettings()
void setCurrentAtom(Atom *atom)
static BALL_DEPRECATED void setMouseSensitivity(float)
const MaterialSettings * getMaterialSettings() const
static Position screenshot_nr_
QAction * no_stereo_action_
static bool showLightSourcesEnabled()
static void setShowLightSources(bool state)
static float getAnimationSmoothness()
static bool offscreen_rendering_
static BALL_DEPRECATED void setMouseWheelSensitivity(float)
QToolBar * toolbar_view_controls_
void setCurrentBond(Bond *b)
bool isUpdateRunning() const