|
Blender
V2.59
|
00001 /* 00002 * $Id: GPC_RenderTools.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 __GPC_RENDERTOOLS_H 00035 #define __GPC_RENDERTOOLS_H 00036 00037 #ifdef WIN32 00038 // don't show stl-warnings 00039 #pragma warning (disable:4786) 00040 #include <windows.h> 00041 #endif // WIN32 00042 00043 #include "RAS_IRenderTools.h" 00044 00045 struct KX_ClientObjectInfo; 00046 class KX_RayCast; 00047 00048 /* BlenderRenderTools are a set of tools to apply 2D/3D graphics effects, which 00049 * are not part of the (polygon) Rasterizer. Effects like 2D text, 3D (polygon) 00050 * text, lighting. 00051 * 00052 * Most of this code is duplicated in KX_BlenderRenderTools, so this should be 00053 * moved to some common location to avoid duplication. */ 00054 00055 class GPC_RenderTools : public RAS_IRenderTools 00056 { 00057 int m_lastlightlayer; 00058 bool m_lastlighting; 00059 void *m_lastauxinfo; 00060 static unsigned int m_numgllights; 00061 00062 // XXX BMF_Font* m_font; 00063 00064 public: 00065 GPC_RenderTools(); 00066 virtual ~GPC_RenderTools(); 00067 00068 void EndFrame(RAS_IRasterizer* rasty); 00069 void BeginFrame(RAS_IRasterizer* rasty); 00070 00071 void EnableOpenGLLights(RAS_IRasterizer *rasty); 00072 void DisableOpenGLLights(); 00073 void ProcessLighting(RAS_IRasterizer *rasty, bool uselights, const MT_Transform& viewmat); 00074 00075 void RenderText3D(int fontid, 00076 const char* text, 00077 int size, 00078 int dpi, 00079 float* color, 00080 double* mat, 00081 float aspect); 00082 /* @attention mode is ignored here */ 00083 void RenderText2D(RAS_TEXT_RENDER_MODE mode, 00084 const char* text, 00085 int xco, 00086 int yco, 00087 int width, 00088 int height); 00089 void RenderText(int mode, 00090 class RAS_IPolyMaterial* polymat, 00091 float v1[3], 00092 float v2[3], 00093 float v3[3], 00094 float v4[3], 00095 int glattrib); 00096 00097 void applyTransform(RAS_IRasterizer* rasty, double* oglmatrix, int objectdrawmode); 00098 int applyLights(int objectlayer, const MT_Transform& viewmat); 00099 00100 void PushMatrix(); 00101 void PopMatrix(); 00102 00103 bool RayHit(KX_ClientObjectInfo* client, KX_RayCast* result, void * const data); 00104 bool NeedRayCast(KX_ClientObjectInfo* client) { return true; } 00105 00106 virtual void MotionBlur(RAS_IRasterizer* rasterizer); 00107 00108 virtual void SetClientObject(RAS_IRasterizer *rasty, void* obj); 00109 }; 00110 00111 #endif // __GPC_RENDERTOOLS_H 00112 00113 00114