~gimaker/peekabot/coord-sys-default

« back to all changes in this revision

Viewing changes to src/renderer/Renderable.hh

  • Committer: Staffan Gimåker
  • Date: 2009-06-29 10:09:26 UTC
  • mfrom: (665.1.39 renderer-redux)
  • Revision ID: staffan@gimaker.se-20090629100926-ju5kx8jwzy422rwu
Merged the renderer-redux branch.

This represents a major overhaul to the rendering engine, with a less contrived
design and better performance. Both memory and CPU utilization should be 
better in general.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
 
2
 * Copyright Staffan Gimåker 2007-2008.
 
3
 *
 
4
 * ---
 
5
 *
2
6
 * This file is part of peekabot.
3
7
 *
4
8
 * peekabot is free software; you can redistribute it and/or modify
15
19
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
20
 */
17
21
 
18
 
#ifndef __PEEKABOT_RENDERER_RENDERABLE_HH
19
 
#define __PEEKABOT_RENDERER_RENDERABLE_HH
 
22
#ifndef PEEKABOT_RENDERER_RENDERABLE_HH_INCLUDED
 
23
#define PEEKABOT_RENDERER_RENDERABLE_HH_INCLUDED
20
24
 
21
25
 
22
26
#include "State.hh"
26
30
{
27
31
namespace renderer
28
32
{
29
 
    struct RenderContext;
 
33
    class RenderContext;
30
34
    
31
35
 
32
36
    /**
48
52
    class Renderable
49
53
    {
50
54
    public:
51
 
        Renderable(bool always_on_top = false, bool enable_selection_effects = true)
52
 
            : m_always_on_top(always_on_top),
53
 
              m_enable_selection_effects(enable_selection_effects) {}
 
55
        Renderable() {}
54
56
 
55
 
        Renderable(const Renderable &renderable)
56
 
            : m_state(renderable.m_state), 
57
 
              m_always_on_top(renderable.m_always_on_top),
58
 
              m_enable_selection_effects(renderable.m_enable_selection_effects) {}
 
57
        /*Renderable(const Renderable &renderable)
 
58
          : m_state(renderable.m_state) {} */
59
59
 
60
60
        virtual ~Renderable() {}
61
61
 
62
62
        /**
 
63
         * \copydoc get_state()
 
64
         */
 
65
        const State &get_state() const throw() { return m_state; }
 
66
 
 
67
        /**
63
68
         * \brief Get a reference to the renderable's rendering state.
64
69
         *
65
70
         * This is the state is applied before rendering, along with
70
75
         * \sa State
71
76
         */
72
77
        State &get_state() throw() { return m_state; }
73
 
 
74
 
        /**
75
 
         * \copydoc get_state()
76
 
         */
77
 
        const State &get_state() const throw() { return m_state; }
78
78
        
79
79
        /**
80
80
         * \brief Change the renderable's state to the state specified.
84
84
        /**
85
85
         * \brief Render the renderable.
86
86
         */
87
 
        virtual void render(RenderContext &context) throw() = 0;
 
87
        virtual void render(RenderContext &context) const = 0;
88
88
 
89
 
        inline bool is_always_on_top() const throw() { return m_always_on_top; }
 
89
        /*inline bool is_always_on_top() const throw() { return m_always_on_top; }
90
90
 
91
91
        void toggle_always_on_top(bool always_on_top) throw()
92
92
        {
101
101
        void toggle_selection_effects(bool enable_selection_effects) throw()
102
102
        {
103
103
            m_enable_selection_effects = enable_selection_effects;
104
 
        }
 
104
            }*/
105
105
 
106
106
    private:
107
107
        /**
109
109
         */
110
110
        State m_state;
111
111
 
112
 
        bool m_always_on_top:1;
113
 
        bool m_enable_selection_effects:1;
 
112
        //bool m_always_on_top:1;
 
113
        //bool m_enable_selection_effects:1;
114
114
    };
115
 
 
116
 
 
117
 
 
118
 
}
119
 
}
120
 
 
121
 
 
122
 
 
123
 
#endif // __PEEKABOT_RENDERER_RENDERABLE_HH
 
115
}
 
116
}
 
117
 
 
118
 
 
119
#endif // PEEKABOT_RENDERER_RENDERABLE_HH_INCLUDED