improvement of 2d-filter custom shader,
[blender.git] / source / gameengine / BlenderRoutines / KX_BlenderRenderTools.h
1 /**
2  * $Id$
3  *
4  * ***** BEGIN GPL LICENSE BLOCK *****
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software Foundation,
18  * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
21  * All rights reserved.
22  *
23  * The Original Code is: all of this file.
24  *
25  * Contributor(s): none yet.
26  *
27  * ***** END GPL LICENSE BLOCK *****
28  */
29 #ifndef __KX_BLENDERRENDERTOOLS
30 #define __KX_BLENDERRENDERTOOLS
31
32 #ifdef WIN32
33 // don't show stl-warnings
34 #pragma warning (disable:4786)
35 #endif
36
37 #include "RAS_IRenderTools.h"
38
39 struct KX_ClientObjectInfo;
40
41 /**
42 BlenderRenderTools are a set of tools to apply 2D/3D graphics effects, which are not
43 part of the (polygon) Rasterizer. 
44 Effects like 2D text, 3D (polygon) text, lighting.
45 */
46
47 class KX_BlenderRenderTools  : public RAS_IRenderTools
48 {
49         bool    m_lastblenderlights;
50         void*   m_lastblenderobject;
51         int             m_lastlayer;
52         bool    m_lastlighting;
53         static unsigned int m_numgllights;
54         
55         
56 public:
57         
58                                                 KX_BlenderRenderTools();
59         virtual                         ~KX_BlenderRenderTools();       
60
61         virtual void            EndFrame(class RAS_IRasterizer* rasty);
62         virtual void            BeginFrame(class RAS_IRasterizer* rasty);
63         void                            DisableOpenGLLights();
64         void                            EnableOpenGLLights();
65         int                                     ProcessLighting(int layer);
66
67         virtual void        RenderText2D(RAS_TEXT_RENDER_MODE mode,
68                                                                          const char* text,
69                                                                          int xco,
70                                                                          int yco,
71                                                                          int width,
72                                                                          int height);
73         virtual void            RenderText(int mode,
74                                                                    class RAS_IPolyMaterial* polymat,
75                                                                    float v1[3],
76                                                                    float v2[3],
77                                                                    float v3[3],
78                                                                    float v4[3]);
79         void                            applyTransform(class RAS_IRasterizer* rasty,
80                                                                            double* oglmatrix,
81                                                                            int objectdrawmode );
82         int                                     applyLights(int objectlayer);
83         virtual void            PushMatrix();
84         virtual void            PopMatrix();
85
86         virtual class RAS_IPolyMaterial* CreateBlenderPolyMaterial(const STR_String &texname,
87                                                                         bool ba,
88                                                                         const STR_String& matname,
89                                                                         int tile,
90                                                                         int tilexrep,
91                                                                         int tileyrep,
92                                                                         int mode,
93                                                                         bool transparant,
94                                                                         bool zsort,
95                                                                         int lightlayer,
96                                                                         bool bIsTriangle,
97                                                                         void* clientobject,
98                                                                         void* tface);
99         
100         bool RayHit(KX_ClientObjectInfo* client, MT_Point3& hit_point, MT_Vector3& hit_normal, void * const data);
101
102         virtual void MotionBlur(RAS_IRasterizer* rasterizer);
103
104         virtual void Update2DFilter(vector<STR_String>& propNames, void* gameObj, RAS_2DFilterManager::RAS_2DFILTER_MODE filtermode, int pass, STR_String& text);
105
106         virtual void Render2DFilters(RAS_ICanvas* canvas);
107
108         virtual void SetClientObject(void* obj);
109
110 };
111
112 #endif //__KX_BLENDERRENDERTOOLS
113
114
115