ATLAS Offline Software
Loading...
Searching...
No Matches
VP1CameraHelper.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
6// //
7// Header file for class VP1CameraHelper //
8// //
9// Author: Thomas Kittelmann <Thomas.Kittelmann@cern.ch> //
10// //
11// Initial version: July 2007 //
12// //
14
15#ifndef VP1CAMERAHELPER_H
16#define VP1CAMERAHELPER_H
17
18#include <QObject>
19#include <Inventor/C/errors/debugerror.h>
20#include <Inventor/SbVec3f.h>
21
22// fwd declarations
23class SoQtRenderArea;
25class SoCamera;
26class SoNode;
27class SbBox3f;
28class SoGroup;
29class SoPath;
30
31class VP1CameraHelper : public QObject {
32
33 Q_OBJECT
34
35public:
36
37 static void abortAnyCurrentZoom( SoCamera * camera );
38
39 //Returned pointers are only for the case where you want to catch
40 //one of the signals that are emitted when the animation finishes.
41
42 //NB: For the vector arguments below, the special value of
43 //SbVec3f(999,999,999) means that the cameras current value will be
44 //used!!
45
46 //For zoom to persistified camera states:
47 static VP1CameraHelper * animatedZoomToCameraState( SoCamera * camera, SoGroup * sceneroot,
48 const QByteArray& camstate,
49 double duration_in_secs = 1.0, double clipVolPercent=100.0, double lastClipVolPercent=100.0, bool varySpeed=true,
50 bool forceCircular = false );
51
52 //Imitate the zoom towards a point (similar to the ones initiated by the user in an examiner viewer):
53 static VP1CameraHelper * animatedZoomToPoint( SoCamera * camera, SoGroup * sceneroot,
54 SbVec3f, double duration_in_secs = 1.0, double clipVolPercent=100.0, bool varySpeed=true,
55 bool forceCircular = false );
56
57 //For the next three methods, slack < 1.0 gives tighter zoom and slack > 1.0 gives looser zoom.
58 //The first two are more reliable:
59 static VP1CameraHelper * animatedZoomToPath( SoCamera * camera, SoGroup * sceneroot,
60 SoPath * path, double duration_in_secs = 1.0, double clipVolPercent=100.0, double slack = 1.0,
61 const SbVec3f& lookat = SbVec3f(999,999,999),
62 const SbVec3f& upvec = SbVec3f(999,999,999), bool varySpeed=true,
63 bool forceCircular = false );
64
65 static VP1CameraHelper * animatedZoomToBBox( SoCamera * camera, SoGroup * sceneroot,
66 const SbBox3f& box,double duration_in_secs = 1.0, double clipVolPercent=100.0, double slack = 1.0,
67 const SbVec3f& lookat = SbVec3f(999,999,999),
68 const SbVec3f& upvec = SbVec3f(999,999,999),bool varySpeed=true,
69 bool forceCircular = false );
70
71 //Dont use the following if subtreeroot appears multiple times in your scenegraph:
72 static VP1CameraHelper * animatedZoomToSubTree( SoCamera * camera, SoGroup * sceneroot,
73 SoNode*subtreeroot,double duration_in_secs = 1.0, double clipVolPercent=100.0, double lastClipVolPercent=100.0, double slack = 1.0,
74 const SbVec3f& lookat = SbVec3f(999,999,999),
75 const SbVec3f& upvec = SbVec3f(999,999,999), bool varySpeed=true,
76 bool forceCircular = false );
77
78 //For outputting off-screen rendered frames to image files:
79// void setOutputImagesMode(SoQtRenderArea * ra,
81 const QString& outputdir,
82 int width = 1024,
83 int height = 768,
84 double fps = 24,
85 const QString& prefix = "vp1_frame");
86
87 static void getLastAndNextFrameFileNames( const QString& outputdir,const QString& prefix,
88 QString& lastOfExistingFiles,//=> returned as empty string if no existing files
89 QString& nextAvailableFile );
90
91 //Force premature end:
92 void forceAbort();
93
94signals:
95 void animationFinished();//If Bob's your uncle and everything went as expected.
96 void animationFinishedAbnormally();//If e.g. the camera was deleted by someone else during animation.
97 void clipVolumePercentageOfATLAS(double);//The percentage of the ATLAS vol corresponding the clipping volume
98
99private:
100 VP1CameraHelper( SoCamera *, SoGroup * );
101 virtual ~VP1CameraHelper();
102 class Imp;
104};
105
106#endif
const double width
void animationFinishedAbnormally()
static VP1CameraHelper * animatedZoomToPath(SoCamera *camera, SoGroup *sceneroot, SoPath *path, double duration_in_secs=1.0, double clipVolPercent=100.0, double slack=1.0, const SbVec3f &lookat=SbVec3f(999, 999, 999), const SbVec3f &upvec=SbVec3f(999, 999, 999), bool varySpeed=true, bool forceCircular=false)
static VP1CameraHelper * animatedZoomToSubTree(SoCamera *camera, SoGroup *sceneroot, SoNode *subtreeroot, double duration_in_secs=1.0, double clipVolPercent=100.0, double lastClipVolPercent=100.0, double slack=1.0, const SbVec3f &lookat=SbVec3f(999, 999, 999), const SbVec3f &upvec=SbVec3f(999, 999, 999), bool varySpeed=true, bool forceCircular=false)
void setOutputImagesMode(VP1ExaminerViewer *ra, const QString &outputdir, int width=1024, int height=768, double fps=24, const QString &prefix="vp1_frame")
static void getLastAndNextFrameFileNames(const QString &outputdir, const QString &prefix, QString &lastOfExistingFiles, QString &nextAvailableFile)
static VP1CameraHelper * animatedZoomToCameraState(SoCamera *camera, SoGroup *sceneroot, const QByteArray &camstate, double duration_in_secs=1.0, double clipVolPercent=100.0, double lastClipVolPercent=100.0, bool varySpeed=true, bool forceCircular=false)
void animationFinished()
static VP1CameraHelper * animatedZoomToBBox(SoCamera *camera, SoGroup *sceneroot, const SbBox3f &box, double duration_in_secs=1.0, double clipVolPercent=100.0, double slack=1.0, const SbVec3f &lookat=SbVec3f(999, 999, 999), const SbVec3f &upvec=SbVec3f(999, 999, 999), bool varySpeed=true, bool forceCircular=false)
static VP1CameraHelper * animatedZoomToPoint(SoCamera *camera, SoGroup *sceneroot, SbVec3f, double duration_in_secs=1.0, double clipVolPercent=100.0, bool varySpeed=true, bool forceCircular=false)
static void abortAnyCurrentZoom(SoCamera *camera)
void clipVolumePercentageOfATLAS(double)
VP1CameraHelper(SoCamera *, SoGroup *)