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