CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

render3d.h

Go to the documentation of this file.
00001 /*
00002     Copyright (C) 2002 by Mårten Svanfeldt
00003                           Anders Stenberg
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Library General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 of the License, or (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Library General Public License for more details.
00014 
00015     You should have received a copy of the GNU Library General Public
00016     License along with this library; if not, write to the Free
00017     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00018 */
00019 
00020 #ifndef __CS_IVIDEO_RENDER3D_H__
00021 #define __CS_IVIDEO_RENDER3D_H__
00022 
00023 
00024 #include "csutil/scf.h"
00033 class csRect;
00034 class csReversibleTransform;
00035 class csStringSet;
00036 class csPlane3;
00037 class csVector3;
00038 
00039 class csRenderMesh;
00040 
00041 struct iClipper2D;
00042 struct iGraphics2D;
00043 struct iMaterialHandle;
00044 struct iTextureManager;
00045 struct iTextureHandle;
00046 struct iRenderBuffer;
00047 struct iRenderBufferManager;
00048 struct iLightingManager;
00049 
00050 
00053 
00054 #define CSDRAW_2DGRAPHICS   0x00000001
00055 
00056 #define CSDRAW_3DGRAPHICS   0x00000002
00057 
00058 #define CSDRAW_CLEARZBUFFER 0x00000010
00059 
00060 #define CSDRAW_CLEARSCREEN  0x00000020
00061 
00068 #define CS_CLIPPER_NONE -1
00069 
00072 #define CS_CLIPPER_OPTIONAL 0
00073 
00076 #define CS_CLIPPER_TOPLEVEL 1
00077 
00080 #define CS_CLIPPER_REQUIRED 2
00081 
00089 #define CS_CLIP_NOT 0
00090 
00095 #define CS_CLIP_NEEDED 1
00096 
00101 #define CS_CLIP_TOPLEVEL 2
00102 
00104 
00105 enum csZBufMode
00106 {
00107   // values below are sometimes used as bit masks, so don't change them!
00109   CS_ZBUF_NONE     = 0x00000000,
00111   CS_ZBUF_FILL     = 0x00000001,
00113   CS_ZBUF_TEST     = 0x00000002,
00115   CS_ZBUF_USE      = 0x00000003,
00117   CS_ZBUF_FILLONLY = 0x00000004,
00119   CS_ZBUF_EQUAL    = 0x00000005,
00121   CS_ZBUF_INVERT   = 0x00000006
00122 };
00123 
00125 enum csVertexAttrib
00126 {
00127   CS_VATTRIB_0 = 0,
00128   CS_VATTRIB_1 = 1,
00129   CS_VATTRIB_2 = 2,
00130   CS_VATTRIB_3 = 3,
00131   CS_VATTRIB_4 = 4,
00132   CS_VATTRIB_5 = 5,
00133   CS_VATTRIB_6 = 6,
00134   CS_VATTRIB_7 = 7,
00135   CS_VATTRIB_8 = 8,
00136   CS_VATTRIB_9 = 9,
00137   CS_VATTRIB_10 = 10,
00138   CS_VATTRIB_11 = 11,
00139   CS_VATTRIB_12 = 12,
00140   CS_VATTRIB_13 = 13,
00141   CS_VATTRIB_14 = 14,
00142   CS_VATTRIB_15 = 15,
00143   CS_VATTRIB_POSITION = 0,
00144   CS_VATTRIB_WEIGHT = 1,
00145   CS_VATTRIB_NORMAL = 2,
00146   CS_VATTRIB_COLOR = 3,
00147   CS_VATTRIB_PRIMARY_COLOR = 3,
00148   CS_VATTRIB_SECONDARY_COLOR = 4,
00149   CS_VATTRIB_FOGCOORD = 5,
00150   CS_VATTRIB_TEXCOORD = 8,
00151   CS_VATTRIB_TEXCOORD0 = 8,
00152   CS_VATTRIB_TEXCOORD1 = 9,
00153   CS_VATTRIB_TEXCOORD2 = 10,
00154   CS_VATTRIB_TEXCOORD3 = 11
00155 };
00156 
00160 
00161 #define CS_FX_MASK_MIXMODE 0xF0000000 
00162 
00163 #define CS_FX_COPY         0x00000000 
00164 
00165 #define CS_FX_MULTIPLY     0x10000000 
00166 
00167 #define CS_FX_MULTIPLY2    0x20000000 
00168 
00169 #define CS_FX_ADD          0x30000000 
00170 
00171 #define CS_FX_ALPHA        0x40000000 
00172 
00173 #define CS_FX_TRANSPARENT  0x50000000 
00174 
00175 #define CS_FX_DESTALPHAADD 0x60000000 
00176 
00177 #define CS_FX_KEYCOLOR     0x08000000 
00178 
00179 #define CS_FX_GOURAUD      0x04000000 
00180 
00181 #define CS_FX_TILING       0x02000000 
00182 
00183 #define CS_FX_MASK_ALPHA   0x000000FF 
00184 
00186 #define CS_FX_SETALPHA(alpha) \
00187   (CS_FX_ALPHA | uint (alpha * CS_FX_MASK_ALPHA))
00188 
00189 #define CS_FX_SETALPHA_INT(alpha) \
00190   (CS_FX_ALPHA | uint (alpha & CS_FX_MASK_ALPHA))
00191 
00199 #define CS_LIGHTPARAM_POSITION 0
00200 
00204 #define CS_LIGHTPARAM_DIFFUSE 1
00205 
00209 #define CS_LIGHTPARAM_SPECULAR 2
00210 
00214 #define CS_LIGHTPARAM_ATTENUATION 3
00215 
00225 #define CS_SHADOW_VOLUME_BEGIN 1
00226 
00230 #define CS_SHADOW_VOLUME_PASS1 2
00231 
00235 #define CS_SHADOW_VOLUME_PASS2 3
00236 
00240 #define CS_SHADOW_VOLUME_FAIL1 4
00241 
00245 #define CS_SHADOW_VOLUME_FAIL2 5
00246 
00250 #define CS_SHADOW_VOLUME_USE 6
00251 
00255 #define CS_SHADOW_VOLUME_FINISH 7
00256 
00261 
00262 enum R3D_RENDERSTATEOPTION
00263 {
00264 };
00265 
00271 /*struct csTriangle
00272 {
00273   int a, b, c;
00274 
00276   csTriangle() {}
00277 
00279   csTriangle(int _a, int _b, int _c):a(_a), b(_b), c(_c) {}
00280 };
00281 */
00282 
00283 class csRender3dCaps
00284 {
00285 };
00286 
00287 SCF_VERSION (iRender3D, 0, 0, 1);
00288 
00289 
00294 struct iRender3D : public iBase
00295 {
00297   virtual bool Open () = 0;
00298 
00300   virtual void Close () = 0;
00301 
00306   virtual iGraphics2D* GetDriver2D () = 0;
00307 
00309   virtual iTextureManager* GetTextureManager () = 0;
00310 
00315   virtual iRenderBufferManager* GetBufferManager () = 0;
00316 
00318   virtual iLightingManager* GetLightingManager () = 0;
00319 
00321   virtual bool ActivateBuffer (csVertexAttrib attrib, iRenderBuffer* buffer) = 0;
00322 
00324   virtual void DeactivateBuffer (csVertexAttrib attrib) = 0;
00325 
00327   virtual bool ActivateTexture (iTextureHandle *txthandle, int unit = 0) = 0;
00328 
00330   virtual bool ActivateTexture (iMaterialHandle *matwrapper, int layer, int unit = 0) = 0;
00331 
00333   virtual void DeactivateTexture (int unit = 0) = 0;
00334 
00336   virtual void SetDimensions (int width, int height) = 0;
00338   virtual int GetWidth () = 0;
00340   virtual int GetHeight () = 0;
00341 
00343   virtual csRender3dCaps* GetCaps () = 0;
00344 
00346   virtual void SetPerspectiveCenter (int x, int y) = 0;
00347   
00349   virtual void GetPerspectiveCenter (int& x, int& y) = 0;
00350   
00352   virtual void SetPerspectiveAspect (float aspect) = 0;
00353 
00355   virtual float GetPerspectiveAspect () = 0;
00356 
00358   virtual void SetObjectToCamera (csReversibleTransform* wvmatrix) = 0;
00359   virtual csReversibleTransform* GetWVMatrix () = 0;
00360 
00374   virtual void SetRenderTarget (iTextureHandle* handle, 
00375     bool persistent = false) = 0;
00376 
00378   virtual iTextureHandle* GetRenderTarget () = 0;
00379 
00381   virtual bool BeginDraw (int drawflags) = 0;
00382 
00384   virtual void FinishDraw () = 0;
00385 
00387   virtual void Print (csRect* area) = 0;
00388 
00390   virtual void DrawMesh (csRenderMesh* mymesh) = 0;
00391 
00393   virtual void SetWriteMask (bool red, bool green, bool blue, bool alpha) = 0;
00394 
00396   virtual void GetWriteMask (bool &red, bool &green, bool &blue, bool &alpha) = 0;
00397 
00399   virtual void EnableZOffset () = 0;
00400 
00402   virtual void DisableZOffset () = 0;
00403 
00405   virtual void SetShadowState (int state) = 0;
00406 
00408   virtual void DrawLine(const csVector3 & v1,
00409   const csVector3 & v2, float fov, int color) = 0;
00410 
00416   virtual void SetClipper (iClipper2D* clipper, int cliptype) = 0;
00417 
00421   virtual iClipper2D* GetClipper () = 0;
00422 
00426   virtual int GetClipType () = 0;
00427 
00429   virtual void SetNearPlane (const csPlane3& pl) = 0;
00430 
00432   virtual void ResetNearPlane () = 0;
00433 
00435   virtual const csPlane3& GetNearPlane () = 0;
00436 
00438   virtual bool HasNearPlane () = 0;
00439 
00441   virtual int GetMaxLights () = 0;
00442 
00444   virtual void SetLightParameter (int i, int param, csVector3 value) = 0;
00445 
00447   virtual void EnableLight (int i) = 0;
00448 
00450   virtual void DisableLight (int i) = 0;
00451 
00453   virtual void EnablePVL () = 0;
00454 
00456   virtual void DisablePVL () = 0;
00457 
00459   virtual csStringSet* GetStringContainer () = 0;
00460 
00462   virtual bool SetRenderState (R3D_RENDERSTATEOPTION op, long val) = 0;
00463 
00465   virtual long GetRenderState (R3D_RENDERSTATEOPTION op) = 0;
00466 };
00467 
00470 #endif // __CS_IVIDEO_RENDER3D_H__
00471 

Generated for Crystal Space by doxygen 1.2.14