bplayer stub update + remove some tabs
[blender-staging.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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 /** \file KX_BlenderRenderTools.h
31  *  \ingroup blroutines
32  */
33
34 #ifndef __KX_BLENDERRENDERTOOLS
35 #define __KX_BLENDERRENDERTOOLS
36
37 #if defined(WIN32) && !defined(FREE_WINDOWS)
38 // don't show stl-warnings
39 #pragma warning (disable:4786)
40 #endif
41
42 #include "RAS_IRenderTools.h"
43
44 #ifdef WITH_CXX_GUARDEDALLOC
45 #include "MEM_guardedalloc.h"
46 #endif
47
48 struct KX_ClientObjectInfo;
49 class KX_RayCast;
50
51 /* BlenderRenderTools are a set of tools to apply 2D/3D graphics effects, which
52  * are not part of the (polygon) Rasterizer. Effects like 2D text, 3D (polygon)
53  * text, lighting.
54  *
55  * Most of this code is duplicated in GPC_RenderTools, so this should be
56  * moved to some common location to avoid duplication. */
57
58 class KX_BlenderRenderTools  : public RAS_IRenderTools
59 {
60         int             m_lastlightlayer;
61         bool    m_lastlighting;
62         void    *m_lastauxinfo;
63         static unsigned int m_numgllights;
64
65 public:
66                                                 KX_BlenderRenderTools();
67         virtual                         ~KX_BlenderRenderTools();       
68
69         void                            EndFrame(RAS_IRasterizer* rasty);
70         void                            BeginFrame(RAS_IRasterizer* rasty);
71
72         void                            EnableOpenGLLights(RAS_IRasterizer *rasty);
73         void                            DisableOpenGLLights();
74         void                            ProcessLighting(RAS_IRasterizer *rasty, bool uselights, const MT_Transform& viewmat);
75
76         void                            RenderText3D(int fontid,
77                                                                          const char* text,
78                                                                          int size,
79                                                                          int dpi,
80                                                                          float* color,
81                                                                          double* mat,
82                                                                          float aspect);
83
84         void            RenderText2D(RAS_TEXT_RENDER_MODE mode,
85                                                                          const char* text,
86                                                                          int xco,
87                                                                          int yco,
88                                                                          int width,
89                                                                          int height);
90         void                            RenderText(int mode,
91                                                                    class RAS_IPolyMaterial* polymat,
92                                                                    float v1[3],
93                                                                    float v2[3],
94                                                                    float v3[3],
95                                                                    float v4[3],
96                                                                    int glattrib);
97
98         void                            applyTransform(RAS_IRasterizer* rasty, double* oglmatrix, int objectdrawmode);
99         int                                     applyLights(int objectlayer, const MT_Transform& viewmat);
100
101         void                            PushMatrix();
102         void                            PopMatrix();
103
104         bool RayHit(KX_ClientObjectInfo* client, class KX_RayCast* result, void * const data);
105         bool NeedRayCast(KX_ClientObjectInfo*) { return true; }
106
107         virtual void MotionBlur(RAS_IRasterizer* rasterizer);
108
109         virtual void SetClientObject(RAS_IRasterizer *rasty, void* obj);
110         
111         
112 #ifdef WITH_CXX_GUARDEDALLOC
113 public:
114         void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_BlenderRenderTools"); }
115         void operator delete( void *mem ) { MEM_freeN(mem); }
116 #endif
117 };
118
119 #endif //__KX_BLENDERRENDERTOOLS
120
121
122