Blender V2.61 - r43446

RAS_IRenderTools.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 __RAS_IRENDERTOOLS
00033 #define __RAS_IRENDERTOOLS
00034 
00035 #include "MT_Transform.h"
00036 #include "RAS_IRasterizer.h"
00037 #include "RAS_2DFilterManager.h"
00038 
00039 #include <vector>
00040 #include <algorithm>
00041 
00042 #ifdef WITH_CXX_GUARDEDALLOC
00043 #include "MEM_guardedalloc.h"
00044 #endif
00045 
00046 class       RAS_IPolyMaterial;
00047 struct      RAS_LightObject;
00048 
00049 
00050 class RAS_IRenderTools
00051 {
00052 
00053 protected:
00054     void*   m_clientobject;
00055     void*   m_auxilaryClientInfo;
00056 
00057     std::vector<struct  RAS_LightObject*> m_lights;
00058     
00059     RAS_2DFilterManager m_filtermanager;
00060 
00061 public:
00062     enum RAS_TEXT_RENDER_MODE {
00063         RAS_TEXT_RENDER_NODEF = 0,
00064         RAS_TEXT_NORMAL,
00065         RAS_TEXT_PADDED,
00066         RAS_TEXT_MAX
00067     };
00068 
00069     RAS_IRenderTools(
00070     ) :
00071         m_clientobject(NULL)
00072     {
00073     };
00074 
00075     virtual 
00076     ~RAS_IRenderTools(
00077     ) {};
00078 
00079     virtual 
00080         void    
00081     BeginFrame(
00082         RAS_IRasterizer* rasty
00083     )=0;
00084 
00085     virtual 
00086         void    
00087     EndFrame(
00088         RAS_IRasterizer* rasty
00089     )=0;
00090 
00091     // the following function was formerly called 'Render'
00092     // by it doesn't render anymore
00093     // It only sets the transform for the rasterizer
00094     // so must be renamed to 'applyTransform' or something
00095 
00096     virtual 
00097         void    
00098     applyTransform(
00099         class RAS_IRasterizer* rasty,
00100         double* oglmatrix,
00101         int drawingmode
00102     )=0;
00103 
00114     virtual 
00115         void    
00116     RenderText3D(int fontid,
00117                  const char* text,
00118                  int size,
00119                  int dpi,
00120                  float* color,
00121                  double* mat,
00122                  float aspect
00123     ) = 0;
00124 
00125 
00135     virtual 
00136         void    
00137     RenderText2D(
00138         RAS_TEXT_RENDER_MODE mode,
00139         const char* text,
00140         int xco,
00141         int yco,
00142         int width,
00143         int height
00144     ) = 0;
00145 
00146     // 3d text, mapped on polygon
00147     virtual 
00148         void    
00149     RenderText(
00150         int mode,
00151         RAS_IPolyMaterial* polymat,
00152         float v1[3],
00153         float v2[3],
00154         float v3[3],
00155         float v4[3],
00156         int glattrib
00157     )=0;
00158 
00159     virtual 
00160         void        
00161     ProcessLighting(
00162         RAS_IRasterizer *rasty,
00163         bool uselights,
00164         const MT_Transform& trans
00165     )=0;
00166 
00167     virtual
00168         void    
00169     SetClientObject(
00170         RAS_IRasterizer* rasty,
00171         void* obj
00172     );
00173 
00174         void    
00175     SetAuxilaryClientInfo(
00176         void* inf
00177     );
00178 
00179     virtual 
00180         void    
00181     PushMatrix(
00182     )=0;
00183 
00184     virtual 
00185         void    
00186     PopMatrix(
00187     )=0;
00188 
00189     virtual 
00190         void        
00191     AddLight(
00192         struct  RAS_LightObject* lightobject
00193     );
00194 
00195     virtual 
00196         void        
00197     RemoveLight(
00198         struct RAS_LightObject* lightobject
00199     );
00200 
00201     virtual
00202         void
00203     MotionBlur(RAS_IRasterizer* rasterizer)=0;
00204         
00205         
00206 #ifdef WITH_CXX_GUARDEDALLOC
00207 public:
00208     void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:RAS_IRenderTools"); }
00209     void operator delete( void *mem ) { MEM_freeN(mem); }
00210 #endif
00211 };
00212 
00213 #endif //__RAS_IRENDERTOOLS
00214 
00215 
00216