Currently job artifacts in CI/CD pipelines on LRZ GitLab never expire. Starting from Wed 26.1.2022 the default expiration time will be 30 days (GitLab default). Currently existing artifacts in already completed jobs will not be affected by the change. The latest artifacts for all jobs in the latest successful pipelines will be kept. More information: https://gitlab.lrz.de/help/user/admin_area/settings/continuous_integration.html#default-artifacts-expiration

campvispainter.h 4.88 KB
Newer Older
1
2
// ================================================================================================
// 
schultezub's avatar
schultezub committed
3
// This file is part of the CAMPVis Visualization Framework.
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// 
// If not explicitly stated otherwise: Copyright (C) 2012, all rights reserved,
//      Christian Schulte zu Berge (christian.szb@in.tum.de)
//      Chair for Computer Aided Medical Procedures
//      Technische Universität München
//      Boltzmannstr. 3, 85748 Garching b. München, Germany
// 
// The licensing of this softare is not yet resolved. Until then, redistribution in source or
// binary forms outside the CAMP chair is not permitted, unless explicitly stated in legal form.
// However, the names of the original authors and the above copyright notice must retain in its
// original state in any case.
// 
// Legal disclaimer provided by the BSD license:
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
// 
// ================================================================================================

schultezub's avatar
schultezub committed
29
30
#ifndef CAMPVISPAINTER_H__
#define CAMPVISPAINTER_H__
31

schultezub's avatar
schultezub committed
32
#include "sigslot/sigslot.h"
33
34
#include "tbb/include/tbb/atomic.h"
#include "tbb/include/tbb/compat/condition_variable"
35

schultezub's avatar
schultezub committed
36
#include "tgt/logmanager.h"
37
38
#include "tgt/painter.h"
#include "core/tools/runnable.h"
schultezub's avatar
schultezub committed
39
40
41

namespace tgt {
    class Shader;
42
    class QtThreadedCanvas;
schultezub's avatar
schultezub committed
43
44
}

schultezub's avatar
schultezub committed
45
namespace campvis {
schultezub's avatar
schultezub committed
46
    class VisualizationPipeline;
schultezub's avatar
schultezub committed
47
48

    /**
schultezub's avatar
schultezub committed
49
     * Painter class for CAMPVis, rendering the render target of a VisualizationPipeline.
50
51
52
53
     * This painter implements Runnable, hence, it runs in its own thread and the associated canvas
     * must be of type QtThreadedCanvas.
     * Rendering is implemented using condidional wait - hence the canvas is only updated when
     * \a pipeline emits the s_RenderTargetChanged signal.
schultezub's avatar
schultezub committed
54
     * 
55
     * \sa  Runnable, VisualizationPipeline
schultezub's avatar
schultezub committed
56
     */
57
    class TumVisPainter : public Runnable, public tgt::Painter, public sigslot::has_slots<> {
schultezub's avatar
schultezub committed
58
    public:
59
60
61
62
63
64
        /**
         * Creates a new TumVisPainter rendering the render target of \a pipeline on \a canvas.
         * \param   canvas      Canvas to render on
         * \param   pipeline    Pipeline to render
         */
        TumVisPainter(tgt::QtThreadedCanvas* canvas, VisualizationPipeline* pipeline);
schultezub's avatar
schultezub committed
65

66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
        /**
         * Destructor, stops and waits for the rendering thread if it's still running.
         */
        virtual ~TumVisPainter();

        /// \see Runnable::stop
        void stop();
        
        /**
         * Performs the rendering using conditional wait.
         * \sa Runnable::run
         */
        void run();

        /**
         * Performs the actual rendering of the pipeline's render target
         */
        virtual void paint();

        /// \see tgt::Painter::sizeChanged
86
        virtual void sizeChanged(const tgt::ivec2& size);
87
88
89
90

        /**
         * Initializes the painter, i.e. loads the OpenGL shader.
         */
schultezub's avatar
schultezub committed
91
        virtual void init();
92
93
94
95

        /**
         * Deinitializes the painter, i.e. disposes its shader.
         */
96
        virtual void deinit();
schultezub's avatar
schultezub committed
97

98
99
100
101
102
103
104
105
106
107
        /**
         * Sets the target canvas for rendering
         * \param   canvas  Canvas to render on, must be of type QtThreadedCanvas
         */
        virtual void setCanvas(tgt::GLCanvas* canvas);

        /**
         * Pipeline with the render target to render.
         * \param   pipeline    Pipeline to render
         */
schultezub's avatar
schultezub committed
108
        void setPipeline(VisualizationPipeline* pipeline);
109
110
111
112
113

        /**
         * Slot being notified when the pipeline's render target changed.
         */
        void onRenderTargetChanged();
schultezub's avatar
schultezub committed
114
115
116

    private:
        static const std::string loggerCat_;
schultezub's avatar
schultezub committed
117

118
        VisualizationPipeline* _pipeline;                   ///< Pipeline to render
schultezub's avatar
schultezub committed
119
        tgt::Shader* _copyShader;                           ///< Shader for copying the render target to the framebuffer.
120
121
        tbb::atomic<bool> _dirty;                           ///< Flag whether render result is dirty and needs to be rerendered.
        std::condition_variable _renderCondition;           ///< conditional wait condition for rendering
schultezub's avatar
schultezub committed
122
123
124
    };

}
125

schultezub's avatar
schultezub committed
126
#endif // CAMPVISPAINTER_H__