home *** CD-ROM | disk | FTP | other *** search
/ PC World 2006 July & August / PCWorld_2006-07-08_cd.bin / temacd / planearcade / planearcade.exe / Tank3.bmp / stencil.h < prev    next >
C/C++ Source or Header  |  2004-03-21  |  2KB  |  93 lines

  1.  
  2.  
  3.  
  4. #ifndef _STENCIL_H_
  5. #define _STENCIL_H_
  6.  
  7.  
  8. //----------------------------
  9. //Custom Vertex - SQUARE
  10. //----------------------------
  11. struct CUSTOMVERTEXSTENCILSQUARE
  12. {
  13.     D3DXVECTOR4 p;
  14.     D3DCOLOR    color;    
  15. };
  16.  
  17. #define D3DFVF_CUSTOMVERTEXSTENCILSQUARE (D3DFVF_XYZRHW|D3DFVF_DIFFUSE)
  18.  
  19. //----------------------------
  20. //Custom Vertex - Shadow
  21. //----------------------------
  22. struct CUSTOMVERTEXSTENCILSHADOW
  23. {
  24.     float x,y,z;
  25. };
  26.  
  27. #define D3DFVF_CUSTOMVERTEXSTENCILSHADOW (D3DFVF_XYZ)
  28.  
  29. //------------------------------
  30. //Shadow Edge
  31. //-------------------------------
  32. struct SHADOWEDGE
  33. {
  34.     VECTOR3D V1;
  35.     VECTOR3D V2;
  36. };
  37.  
  38. //------------------------------------------------------------------
  39. // Name: Stencil Class
  40. // Desc: *************
  41. //------------------------------------------------------------------
  42. class STENCIL
  43. {
  44.  
  45. private:
  46.  
  47.     //SHADOW
  48.     D3DXVECTOR3 Vertices[32000]; 
  49.     int         NumVertices;
  50.  
  51.     SHADOWEDGE  Edge[10000];
  52.     int         NumEdges;
  53.  
  54.     //BIG SQUARE
  55.     LPDIRECT3DVERTEXBUFFER9 SquareVB;
  56.     
  57. public:
  58.  
  59.     //konstruktor
  60.     STENCIL();
  61.  
  62.     //destruktor
  63.     ~STENCIL();
  64.  
  65.     //SVETLO
  66.     VECTOR3D LightPosition;
  67.  
  68.     //SHADOW
  69.     void RenderShadowQuads();
  70.     void RenderShadowBuffer();
  71.     void RenderShadowScreen();
  72.  
  73.     void RenderShadow();
  74.  
  75.  
  76.     //OTHER
  77.  
  78.     void Initialize();
  79.  
  80.     void AddEdge(VECTOR3D V1,VECTOR3D V2);
  81.     void ProcessEdge(VECTOR3D LightPos);
  82.     void AddQuad(VECTOR3D V1,VECTOR3D V2,VECTOR3D LightPos);
  83.  
  84.  
  85. };
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93. #endif  //_STENCIL_H_