Blender V2.61 - r43446

GPC_RenderTools.h

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