Undo revision 23130 which was a merge with 2.5, a messy one because I did something...
[blender.git] / source / gameengine / GamePlayer / common / GPC_RenderTools.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
30 #ifndef __GPC_RENDERTOOLS_H
31 #define __GPC_RENDERTOOLS_H
32
33 #ifdef WIN32
34 // don't show stl-warnings
35 #pragma warning (disable:4786)
36 #include <windows.h>
37 #endif // WIN32
38
39 #include "RAS_IRenderTools.h"
40
41 struct KX_ClientObjectInfo;
42 class KX_RayCast;
43
44 /* BlenderRenderTools are a set of tools to apply 2D/3D graphics effects, which
45  * are not part of the (polygon) Rasterizer. Effects like 2D text, 3D (polygon)
46  * text, lighting.
47  *
48  * Most of this code is duplicated in KX_BlenderRenderTools, so this should be
49  * moved to some common location to avoid duplication. */
50
51 class GPC_RenderTools : public RAS_IRenderTools
52 {
53         int             m_lastlightlayer;
54         bool    m_lastlighting;
55         void    *m_lastauxinfo;
56         static unsigned int m_numgllights;
57
58 // XXX  BMF_Font* m_font;
59
60 public:
61                                                 GPC_RenderTools();
62         virtual                         ~GPC_RenderTools();
63
64         void                            EndFrame(RAS_IRasterizer* rasty);
65         void                            BeginFrame(RAS_IRasterizer* rasty);
66
67         void                            EnableOpenGLLights(RAS_IRasterizer *rasty);
68         void                            DisableOpenGLLights();
69         void                            ProcessLighting(RAS_IRasterizer *rasty, bool uselights, const MT_Transform& viewmat);
70
71         /* @attention mode is ignored here */
72         void                        RenderText2D(RAS_TEXT_RENDER_MODE mode,
73                                                                          const char* text,
74                                                                          int xco,
75                                                                          int yco,
76                                                                          int width,
77                                                                          int height);
78         void                            RenderText(int mode,
79                                                                    class RAS_IPolyMaterial* polymat,
80                                                                    float v1[3],
81                                                                    float v2[3],
82                                                                    float v3[3],
83                                                                    float v4[3],
84                                                                    int glattrib);
85
86         void                            applyTransform(RAS_IRasterizer* rasty, double* oglmatrix, int objectdrawmode);
87         int                                     applyLights(int objectlayer, const MT_Transform& viewmat);
88
89         void                            PushMatrix();
90         void                            PopMatrix();
91
92         bool RayHit(KX_ClientObjectInfo* client, KX_RayCast* result, void * const data);
93         bool NeedRayCast(KX_ClientObjectInfo* client) { return true; }
94
95         virtual void MotionBlur(RAS_IRasterizer* rasterizer);
96
97         virtual void Update2DFilter(vector<STR_String>& propNames, void* gameObj, RAS_2DFilterManager::RAS_2DFILTER_MODE filtermode, int pass, STR_String& text);
98
99         virtual void Render2DFilters(RAS_ICanvas* canvas);
100
101         virtual void SetClientObject(RAS_IRasterizer *rasty, void* obj);
102 };
103
104 #endif  // __GPC_RENDERTOOLS_H
105
106
107