copy over pthread dll to the install dir with cross compiling,
[blender.git] / source / gameengine / Rasterizer / RAS_2DFilterManager.h
1 /**
2  * ***** BEGIN GPL LICENSE BLOCK *****
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software Foundation,
16  * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
17  *
18  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
19  * All rights reserved.
20  *
21  * The Original Code is: all of this file.
22  *
23  * Contributor(s): none yet.
24  *
25  * ***** END GPL LICENSE BLOCK *****
26  */
27
28 #ifndef __RAS_I2DFILTER
29 #define __RAS_I2DFILTER
30
31 #define MAX_RENDER_PASS 100
32
33 class RAS_2DFilterManager
34 {
35 private:
36         unsigned int    CreateShaderProgram(const char* shadersource);
37         unsigned int    CreateShaderProgram(int filtermode);
38         void            AnalyseShader(int passindex, vector<STR_String>& propNames);
39         void                    StartShaderProgram(int passindex);
40         void                    EndShaderProgram();
41         void                    PrintShaderErrors(unsigned int shader, const char *task, const char *code);
42
43         void SetupTextures(bool depth, bool luminance);
44         void FreeTextures();
45
46         void UpdateOffsetMatrix(RAS_ICanvas* canvas);
47
48         float                   textureoffsets[18];
49         float                   view[4];
50         /* texname[0] contains render to texture, texname[1] contains depth texture,  texname[2] contains luminance texture*/
51         unsigned int    texname[3]; 
52         int                             texturewidth;
53         int                             textureheight;
54         int                             canvaswidth;
55         int                             canvasheight;
56         int                             numberoffilters;
57         /* bit 0: enable/disable depth texture
58          * bit 1: enable/disable luminance texture*/
59         short                   texflag[MAX_RENDER_PASS];
60
61         bool                    isshadersupported;
62         bool                    errorprinted;
63
64         unsigned int    m_filters[MAX_RENDER_PASS];
65         short           m_enabled[MAX_RENDER_PASS];
66
67         // stores object properties to send to shaders in each pass
68         vector<STR_String>      m_properties[MAX_RENDER_PASS];
69         void* m_gameObjects[MAX_RENDER_PASS];
70 public:
71         enum RAS_2DFILTER_MODE {
72                 RAS_2DFILTER_ENABLED = -2,
73                 RAS_2DFILTER_DISABLED = -1,
74                 RAS_2DFILTER_NOFILTER = 0,
75                 RAS_2DFILTER_MOTIONBLUR,
76                 RAS_2DFILTER_BLUR,
77                 RAS_2DFILTER_SHARPEN,
78                 RAS_2DFILTER_DILATION,
79                 RAS_2DFILTER_EROSION,
80                 RAS_2DFILTER_LAPLACIAN,
81                 RAS_2DFILTER_SOBEL,
82                 RAS_2DFILTER_PREWITT,
83                 RAS_2DFILTER_GRAYSCALE,
84                 RAS_2DFILTER_SEPIA,
85                 RAS_2DFILTER_INVERT,
86                 RAS_2DFILTER_CUSTOMFILTER,
87                 RAS_2DFILTER_NUMBER_OF_FILTERS
88         };
89
90         RAS_2DFilterManager();
91
92         ~RAS_2DFilterManager();
93
94         void RenderFilters(RAS_ICanvas* canvas);
95
96         void EnableFilter(vector<STR_String>& propNames, void* gameObj, RAS_2DFILTER_MODE mode, int pass, STR_String& text);
97 };
98 #endif