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 <QtGui/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;
144 friend class HTMLBasedInterface;
146 #ifdef BALL_HAS_RTFACT
147 typedef boost::shared_ptr<RaytracingRenderer> RaytracingRendererPtr;
148 typedef boost::shared_ptr<RenderWindow> RaytracingWindowPtr;
191 Scene(
QWidget* parent_widget = 0,
const char* name = NULL, Qt::WFlags w_flags = 0);
217 virtual void clear();
247 virtual void onNotify(
Message *message);
251 virtual bool exportScene(
Renderer &er)
const;
269 virtual void initializeWidget(
MainControl& main_control);
272 virtual void fetchPreferences(
INIFile& inifile);
275 virtual void writePreferences(
INIFile& inifile);
297 virtual bool isValid()
const;
305 virtual void dump(std::ostream& s = std::cout,
Size depth = 0)
const;
307 void setInfo(
const QString& info_string);
308 bool isRecording()
const;
309 void captureCamera();
315 Vector3 mapViewportTo3D(
int x,
int y);
316 void setRubberBandGeometry(
const QRect& rect);
317 void setRubberBandVisible(
bool show);
318 void pickObjects(
const QPoint& pos, list<GeometricObject*>& objects);
319 void pickObjects(
const QPoint& pos1,
const QPoint& pos2, list<GeometricObject*>& objects);
321 std::list<AtomContainer*> getContainers();
322 void enterPickingMode();
323 void exitPickingMode();
325 void drawLine(
const QPointF& a,
const QPointF& b, QPainter* painter = 0);
326 void drawLine(
const Vector2& a,
const Vector2& b, QPainter* painter = 0);
331 void changeBondOrder();
332 void changeBondOrder(
Index delta);
333 void activatedOrderItem_(QAction* action);
334 void createMolecule_();
335 void setFormalCharge_();
337 void deselect(
bool update=
true);
338 void getClickedItems(
const QPoint& p);
350 {
return stage_settings_; }
354 {
return stage_settings_; }
358 {
return material_settings_; }
362 {
return material_settings_; }
365 void setCamera(
const Camera& camera);
369 {
return animation_points_;}
373 { animation_smoothness_ = value;}
377 {
return animation_smoothness_;}
381 {
return downsampling_factor_;}
384 void setDownsamplingFactor(
float ds_factor);
387 void setDefaultLighting(
bool update_GL =
true);
391 { mouse_sensitivity_ = sensitivity; }
395 {
return mouse_sensitivity_;}
399 { mouse_wheel_sensitivity_ = sensitivity; }
403 {
return mouse_wheel_sensitivity_;}
407 { show_light_sources_ = state;}
411 {
return show_light_sources_;}
415 {
return *gl_renderer_;}
417 #ifdef BALL_HAS_RTFACT
420 {
return *rt_renderer_;}
430 static bool stereoBufferSupportTest();
433 bool inMoveMode()
const;
436 bool exportPNG(
const String& filename);
439 virtual void setWidgetVisible(
bool state);
442 void setOffScreenRendering(
bool enabled,
Size factor);
445 virtual void paintEvent(QPaintEvent* e);
451 virtual void projectionModeChanged();
463 void rotate(
float degree_right,
float degree_up);
466 void rotateClockwise(
float degree);
481 void moveComposites(
const std::list<Composite*>& composites,
Vector3 v);
488 void rotateComposites(
const std::list<Composite*>& composites,
float degree_right,
float degree_up,
float degree_clockwise = 0);
491 bool isAnimationRunning()
const;
500 void setFullScreen(
bool state);
508 void showText(
const String& text,
Size font_size = 20);
516 void updateAllMaterials();
520 void lightsUpdated(
bool redraw =
false);
523 void setupEnvironmentMap(
const QImage& image);
529 void initializePreferencesTab(
Preferences &preferences);
532 void finalizePreferencesTab(
Preferences &preferences);
535 virtual void applyPreferences();
538 void showContextMenu(QPoint pos);
541 using QWidget::setCursor;
547 void setElementCursor(
int number);
550 virtual void addToolBarEntries(QToolBar* tb);
553 virtual void keyPressEvent(QKeyEvent* e);
558 void createCoordinateSystem();
561 void createCoordinateSystemAtOrigin();
570 void exportNextPOVRay();
576 void dumpXML3D(std::ostream& xml3ddump);
582 void showExportPNGDialog();
585 void showExportVRMLDialog();
598 virtual void switchShowWidget();
606 #ifdef BALL_HAS_RTFACT
607 void addRTfactWindow();
618 void enterActiveStereo();
621 void enterDualStereo();
624 void enterDualStereoDifferentDisplays();
627 void clearRecordedAnimation();
630 void startAnimation();
633 void stopAnimation();
636 void switchToLastMode();
639 void switchShowGrid();
645 void setupViewVolume();
648 void storeViewPoint();
651 void restoreViewPoint();
654 void startContinuousLoop();
657 void stopContinuousLoop();
660 void toggleContinuousLoop();
663 void applyStereoDefaults();
665 #ifdef BALL_HAS_RTFACT
666 RaytracingWindowPtr getWindow(WindowType aWindowType);
669 void createNewMolecule();
670 void saturateWithHydrogens();
671 void optimizeStructure();
672 void computeBondOrders();
675 void setEditElementType(
int element_number);
676 int getEditElementType();
687 virtual void showViewPoint_();
691 virtual void setViewPoint_();
694 virtual void resetCamera_();
699 virtual void resetRepresentationsForRenderer_(
RenderSetup& rs);
702 virtual void dropEvent(QDropEvent* e);
705 virtual void dragEnterEvent(QDragEnterEvent* e);
749 void renderText_(QPointF
const& point, QString
const& text,
QPaintDevice* current_dev);
756 void insert_(
int x_,
int y_,
PDBAtom &atom_);
764 void initializeMembers_();
799 virtual void paintGL();
807 virtual void resizeEvent(QResizeEvent* event);
814 virtual void customEvent(
QEvent* evt);
840 virtual void mouseMoveEvent(
QMouseEvent* qmouse_event);
846 virtual void mousePressEvent(
QMouseEvent* qmouse_event);
852 virtual void mouseReleaseEvent(
QMouseEvent* qmouse_event);
857 virtual void wheelEvent(QWheelEvent* qmouse_event);
859 virtual void mouseDoubleClickEvent(
QMouseEvent* e);
864 void rotateSystemClockwise_();
867 void selectionPressed_();
868 void selectionPressedMoved_();
870 void selectObjects_();
871 void pickParent_(QPoint p);
873 void writeLights_(
INIFile& inifile)
const;
875 void readLights_(
const INIFile& inifile);
877 void createCoordinateSystem_(
bool at_origin);
879 void registerRenderers_();
885 QAction *
no_stereo_action_, *enter_stereo_action_, *active_stereo_action_, *dual_stereo_action_, *dual_stereo_different_display_action_;
889 #ifdef BALL_HAS_RTFACT
890 QAction *toggle_continuous_loop_action_;
911 #ifdef BALL_HAS_RTFACT
913 RaytracingWindowPtr rt_window_;
936 #ifdef BALL_HAS_RTFACT
937 bool continuous_loop_;
981 virtual void run() {scene_->animate_();}
984 void mySleep(
Size msec);
1000 #endif // BALL_VIEW_WIDGETS_SCENE_H
bool useVertexBuffers() const
QAction * no_stereo_action_
QAction * optimize_action_
const StageSettings * getStageSettings() const
void setPreview(bool state)
Enable or disable model previews e.g. while rotating.
Base class for all messages concerning a Representation.
bool tracking_initialized_
QAction * add_hydrogens_action_
QAction * start_animation_action_
bool isUpdateRunning() const
MaterialSettings * getMaterialSettings()
const Stage * getStage() const
static bool only_highlighted_
static float mouse_sensitivity_
static void setVRMLNumber(Position pos)
QList< QAction * > toolbar_actions_view_controls_
QAction * bondorders_action_
const MaterialSettings * getMaterialSettings() const
static void setAnimationSmoothness(float value)
GLRenderer * gl_renderer_
Position main_renderer_
The index of the renderer responsible for the main display.
static float animation_smoothness_
static void setMouseSensitivity(float sensitivity)
static float mouse_wheel_sensitivity_
void setScene(Scene *scene)
static float getAnimationSmoothness()
static bool offscreen_rendering_
AnimationThread * animation_thread_
QToolBar * toolbar_view_controls_
InteractionModeManager mode_manager_
LightSettings * light_settings_
static void setMouseWheelSensitivity(float sensitivity)
QAction * animation_repeat_action_
vector< EditOperation > undo_
BALL_EXTERN_VARIABLE const double c
StageSettings * stage_settings_
QList< QAction * > toolbar_actions_edit_controls_
static void setScreenShotNumber(Position pos)
static bool showLightSourcesEnabled()
static float getMouseSensitivity()
static void setPOVNumber(Position pos)
void setCurrentAtom(Atom *atom)
#define BALL_EMBEDDABLE(TYPE, BASE)
GLRenderWindow * main_display_
Window into which left eye should be rendered. Indicates same window as CONTROL_WINDOW if no stereo i...
static Position screenshot_nr_
static float getMouseWheelSensitivity()
void setCurrentBond(Bond *b)
EditSettings * edit_settings_
std::list< Camera > animation_points_
void notify(Message *msg)
std::vector< boost::shared_ptr< RenderSetup > > renderers_
GLRenderer & getGLRenderer()
const Vector3 & getTurnPoint() const
std::list< Camera > & getAnimationPoints()
QToolBar * toolbar_edit_controls_
void setTurnPoint(const Vector3 &v)
static bool show_light_sources_
MaterialSettings * material_settings_
Quaternion old_trackrotation_
float getDownsamplingFactor() const
QMenu * create_coordinate_system_
StageSettings * getStageSettings()
bool usePreview() const
Returns the state of the preview mode.
static float downsampling_factor_
static void setShowLightSources(bool state)
bool want_to_use_vertex_buffer_
void setFPSEnabled(bool state)