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