visualizationpipeline.h 3.45 KB
Newer Older
1
2
3
#ifndef VISUALIZATIONPIPELINE_H__
#define VISUALIZATIONPIPELINE_H__

schultezub's avatar
schultezub committed
4
#include "sigslot/sigslot.h"
5
6
#include "tgt/glcanvas.h"
#include "tgt/painter.h"
schultezub's avatar
schultezub committed
7
#include "tgt/shadermanager.h"
8
9
10
#include "tgt/event/eventlistener.h"
#include "core/eventhandlers/abstracteventhandler.h"
#include "core/pipeline/abstractpipeline.h"
schultezub's avatar
schultezub committed
11
#include "core/properties/genericproperty.h"
12
13
14
15

#include <vector>

namespace TUMVis {
schultezub's avatar
schultezub committed
16
    class ImageDataRenderTarget;
17
18
19
20
21

    /**
     * Abstract base class for TUMVis Pipelines.
     * 
     */
schultezub's avatar
schultezub committed
22
    class VisualizationPipeline : public AbstractPipeline, public tgt::EventListener, public sigslot::has_slots<> {
23
24
25
26
    public:
        /**
         * Creates a VisualizationPipeline.
         */
schultezub's avatar
schultezub committed
27
        VisualizationPipeline();
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53

        /**
         * Virtual Destructor
         **/
        virtual ~VisualizationPipeline();


        /**
         * Initializes the OpenGL context of the pipeline and its processors.
         * \note    When overwriting this method, make sure to call the base class version first.
         */
        virtual void init();

        /**
         * Execute this pipeline.
         **/
        virtual void execute() = 0;

        /**
         * Performs the event handling for the assigned canvas.
         * Default behaviour is to execute all assigned EventHandlers, may be overwritten by subclasses.
         * \param e     event parameters
         */
        virtual void onEvent(tgt::Event* e);

        /**
schultezub's avatar
schultezub committed
54
55
         * Returns the PropertyCollection of this processor.
         * \return _properties
56
         */
schultezub's avatar
schultezub committed
57
        PropertyCollection& getPropertyCollection();
58
59

        /**
schultezub's avatar
schultezub committed
60
         * Sets the size of the render target
61
62
         * \param size  New viewport dimensions
         */
schultezub's avatar
schultezub committed
63
        void setRenderTargetSize(const tgt::ivec2& size);
64
65

        /**
schultezub's avatar
schultezub committed
66
67
         * Returns the viewport size of the target canvas
         * \return _renderTargetSize
68
         */
schultezub's avatar
schultezub committed
69
        const tgt::ivec2& getRenderTargetSize() const;
70
71

        /**
schultezub's avatar
schultezub committed
72
73
74
75
76
77
         * Returns the DataHandle with the render target of this VisualizationPipeline in its current state.
         * 
         * \todo    This is not thread-safe, the object might be destroyed at any time. 
         *          Time for implementing reference counting?
         *          
         * \return  The DataHandle named _renderTargetID in the pipeline's DataContainer, 0 if no such handle exists.
78
         */
schultezub's avatar
schultezub committed
79
        const ImageDataRenderTarget* getRenderTarget() const;
80

schultezub's avatar
schultezub committed
81
        /**
schultezub's avatar
schultezub committed
82
83
84
85
         * Gets called when the data collection of this pipeline has changed and thus has notified its observers.
         * The default behaviour is to do nothing
         * \sa GenericObserver::onNotify, DataContainer
         * \param poa   DataContainerObserverArgs   ObserverArgument struct containing the emitting DataContainer and hints to its changes
schultezub's avatar
schultezub committed
86
         */
schultezub's avatar
schultezub committed
87
88
89
90
        void onDataContainerDataAdded(const std::string& name, const DataHandle* dh);


        sigslot::signal0<> s_renderTargetChanged;
schultezub's avatar
schultezub committed
91

92
    protected:
schultezub's avatar
schultezub committed
93
        GenericProperty<tgt::ivec2> _renderTargetSize;      ///< Viewport size of target canvas
schultezub's avatar
schultezub committed
94
        GenericProperty<std::string> _renderTargetID;       ///< ID of the render target image to be rendered to the canvas
95
96
97
98
99
100
101
102
        std::vector<AbstractEventHandler*> _eventHandlers;  ///< List of registered event handlers for the pipeline

        static const std::string loggerCat_;
    };

}

#endif // VISUALIZATIONPIPELINE_H__