|
Blender
V2.59
|
00001 /* 00002 * $Id: KX_BlenderRenderTools.h 35063 2011-02-22 10:33:14Z jesterking $ 00003 * 00004 * ***** BEGIN GPL LICENSE BLOCK ***** 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public License 00008 * as published by the Free Software Foundation; either version 2 00009 * of the License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software Foundation, 00018 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 * 00020 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. 00021 * All rights reserved. 00022 * 00023 * The Original Code is: all of this file. 00024 * 00025 * Contributor(s): none yet. 00026 * 00027 * ***** END GPL LICENSE BLOCK ***** 00028 */ 00029 00034 #ifndef __KX_BLENDERRENDERTOOLS 00035 #define __KX_BLENDERRENDERTOOLS 00036 00037 #if defined(WIN32) && !defined(FREE_WINDOWS) 00038 // don't show stl-warnings 00039 #pragma warning (disable:4786) 00040 #endif 00041 00042 #include "RAS_IRenderTools.h" 00043 00044 #ifdef WITH_CXX_GUARDEDALLOC 00045 #include "MEM_guardedalloc.h" 00046 #endif 00047 00048 struct KX_ClientObjectInfo; 00049 class KX_RayCast; 00050 00051 /* BlenderRenderTools are a set of tools to apply 2D/3D graphics effects, which 00052 * are not part of the (polygon) Rasterizer. Effects like 2D text, 3D (polygon) 00053 * text, lighting. 00054 * 00055 * Most of this code is duplicated in GPC_RenderTools, so this should be 00056 * moved to some common location to avoid duplication. */ 00057 00058 class KX_BlenderRenderTools : public RAS_IRenderTools 00059 { 00060 int m_lastlightlayer; 00061 bool m_lastlighting; 00062 void *m_lastauxinfo; 00063 static unsigned int m_numgllights; 00064 00065 public: 00066 KX_BlenderRenderTools(); 00067 virtual ~KX_BlenderRenderTools(); 00068 00069 void EndFrame(RAS_IRasterizer* rasty); 00070 void BeginFrame(RAS_IRasterizer* rasty); 00071 00072 void EnableOpenGLLights(RAS_IRasterizer *rasty); 00073 void DisableOpenGLLights(); 00074 void ProcessLighting(RAS_IRasterizer *rasty, bool uselights, const MT_Transform& viewmat); 00075 00076 void RenderText3D(int fontid, 00077 const char* text, 00078 int size, 00079 int dpi, 00080 float* color, 00081 double* mat, 00082 float aspect); 00083 00084 void RenderText2D(RAS_TEXT_RENDER_MODE mode, 00085 const char* text, 00086 int xco, 00087 int yco, 00088 int width, 00089 int height); 00090 void RenderText(int mode, 00091 class RAS_IPolyMaterial* polymat, 00092 float v1[3], 00093 float v2[3], 00094 float v3[3], 00095 float v4[3], 00096 int glattrib); 00097 00098 void applyTransform(RAS_IRasterizer* rasty, double* oglmatrix, int objectdrawmode); 00099 int applyLights(int objectlayer, const MT_Transform& viewmat); 00100 00101 void PushMatrix(); 00102 void PopMatrix(); 00103 00104 bool RayHit(KX_ClientObjectInfo* client, class KX_RayCast* result, void * const data); 00105 bool NeedRayCast(KX_ClientObjectInfo*) { return true; } 00106 00107 virtual void MotionBlur(RAS_IRasterizer* rasterizer); 00108 00109 virtual void SetClientObject(RAS_IRasterizer *rasty, void* obj); 00110 00111 00112 #ifdef WITH_CXX_GUARDEDALLOC 00113 public: 00114 void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_BlenderRenderTools"); } 00115 void operator delete( void *mem ) { MEM_freeN(mem); } 00116 #endif 00117 }; 00118 00119 #endif //__KX_BLENDERRENDERTOOLS 00120 00121 00122