~siretart/ubuntu/utopic/blender/libav10

« back to all changes in this revision

Viewing changes to source/gameengine/GamePlayer/common/GPC_Canvas.h

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2014-02-19 11:24:23 UTC
  • mfrom: (14.2.23 sid)
  • Revision ID: package-import@ubuntu.com-20140219112423-rkmaz2m7ha06d4tk
Tags: 2.69-3ubuntu1
* Merge with Debian; remaining changes:
  - Configure without OpenImageIO on armhf, as it is not available on
    Ubuntu.

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
 
48
48
class GPC_Canvas : public RAS_ICanvas
49
49
{
50
 
public:
51
 
        /**
52
 
         * Used to position banners in the canvas.
53
 
         */
54
 
        typedef enum {
55
 
                alignTopLeft,
56
 
                alignBottomRight
57
 
        } TBannerAlignment;
58
 
 
59
 
        typedef int TBannerId;
60
 
 
61
50
protected:
62
 
        /** 
63
 
         * Used to store info for banners drawn on top of the canvas.
64
 
         */
65
 
        typedef struct {
66
 
                /** Where the banner will be displayed. */
67
 
                TBannerAlignment alignment;
68
 
                /** Banner display enabled. */
69
 
                bool enabled;
70
 
                /** Banner display width. */
71
 
                unsigned int displayWidth;
72
 
                /** Banner display height. */
73
 
                unsigned int displayHeight;
74
 
                /** Banner image width. */
75
 
                unsigned int imageWidth;
76
 
                /** Banner image height. */
77
 
                unsigned int imageHeight;
78
 
                /** Banner image data. */
79
 
                unsigned char* imageData;
80
 
                /** Banner OpenGL texture name. */
81
 
                unsigned int textureName;
82
 
        } TBannerData;
83
 
        typedef std::map<TBannerId, TBannerData> TBannerMap;
84
51
 
85
52
        /** Width of the context. */
86
53
        int m_width;
92
59
 
93
60
        int m_viewport[4];
94
61
 
95
 
        /** Storage for the banners to display. */
96
 
        TBannerMap m_banners;
97
 
        /** State of banner display. */
98
 
        bool m_bannersEnabled;
99
 
 
100
62
public:
101
63
 
102
64
        GPC_Canvas(int width, int height);
152
114
         */
153
115
                void 
154
116
        EndFrame(
155
 
        );
 
117
        ) {};
156
118
        
157
119
        void SetViewPort(int x1, int y1, int x2, int y2);
158
120
        void UpdateViewPort(int x1, int y1, int x2, int y2);
178
140
        virtual void MakeScreenShot(const char* filename);
179
141
 
180
142
        void ClearBuffer(int type);
181
 
 
182
 
        /**
183
 
         * \section Services provided by this class.
184
 
         */
185
 
 
186
 
        /**
187
 
         * Enables display of a banner.
188
 
         * The image data is copied inside.
189
 
         * \param bannerWidth           Display width of the banner.
190
 
         * \param bannerHeight          Display height of the banner.
191
 
         * \param imageWidth            Width of the banner image in pixels.
192
 
         * \param imageHeight           Height of the banner image in pixels.
193
 
         * \param imageData                     Pointer to the pixels of the image to display.
194
 
         * \param alignment             Where the banner will be positioned on the canvas.
195
 
         * \param enabled                       Whether the banner will be displayed initially.
196
 
         * \return A banner id.
197
 
         */
198
 
        TBannerId AddBanner(
199
 
                unsigned int bannerWidth, unsigned int bannerHeight,
200
 
                unsigned int imageWidth, unsigned int imageHeight,
201
 
                unsigned char* imageData, TBannerAlignment alignment = alignTopLeft, 
202
 
                bool enabled = true);
203
 
 
204
 
        /**
205
 
         * Disposes a banner.
206
 
         * \param id Banner to be disposed.
207
 
         */
208
 
        void DisposeBanner(TBannerId id);
209
 
 
210
 
        /**
211
 
         * Disposes all the banners.
212
 
         */
213
 
        void DisposeAllBanners();
214
 
 
215
 
        /**
216
 
         * Enables or disables display of a banner.
217
 
         * \param id            Banner id of the banner to be enabled/disabled.
218
 
         * \param enabled       New state of the banner.
219
 
         */
220
 
        void SetBannerEnabled(TBannerId id, bool enabled = true);
221
 
 
222
 
        /**
223
 
         * Enables or disables display of all banners.
224
 
         * \param enabled       New state of the banners.
225
 
         */
226
 
        void SetBannerDisplayEnabled(bool enabled = true);
227
 
 
228
 
protected:
229
 
        /**
230
 
         * Disposes a banner.
231
 
         * \param it Banner to be disposed.
232
 
         */
233
 
        void DisposeBanner(TBannerData& banner);
234
 
 
235
 
        /**
236
 
         * Draws all the banners enabled.
237
 
         */
238
 
        void DrawAllBanners(void);
239
 
 
240
 
        /**
241
 
         * Draws a banner.
242
 
         */
243
 
        void DrawBanner(TBannerData& banner);
244
 
 
245
 
        struct CanvasRenderState {
246
 
                int oldLighting;
247
 
                int oldDepthTest;
248
 
                int oldFog;
249
 
                int oldTexture2D;
250
 
                int oldBlend;
251
 
                int oldBlendSrc;
252
 
                int oldBlendDst;
253
 
                float oldColor[4];
254
 
                int oldWriteMask;
255
 
        };
256
 
 
257
 
                void
258
 
        PushRenderState(
259
 
                CanvasRenderState & render_state
260
 
        );
261
 
                void
262
 
        PopRenderState(
263
 
                const CanvasRenderState & render_state
264
 
        );
265
 
 
266
 
        /** 
267
 
         * Set up an orthogonal viewing,model and texture matrix
268
 
         * for banners and progress bars.
269
 
         */
270
 
                void
271
 
        SetOrthoProjection(
272
 
        );
273
 
        
274
 
        static TBannerId s_bannerId;
275
143
};
276
144
 
277
145
#endif  /* __GPC_CANVAS_H__ */