Develop and Download Open Source Software

Browse Subversion Repository

Contents of /trunk/CShadowVolume.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (show annotations) (download) (as text)
Sun Aug 15 01:53:13 2010 UTC (13 years, 9 months ago) by okadu
File MIME type: text/x-chdr
File size: 1724 byte(s)


1 #ifndef CSHADOWVOLUME_H_INCLUDED
2 #define CSHADOWVOLUME_H_INCLUDED
3
4 #define TRI_DUMP_MAX (sv3.capsMaxPrim/3) // 三角形ダンプ最大値
5
6 // シャドウボリューム用 FVF
7 #define FVF_S (D3DFVF_XYZ)
8 typedef VEC3 VTX_S;
9
10 /*
11 * 四角形ダンプ (座標のみ)
12 */
13 class CTriDumpS{
14 private:
15 int m_TriNum; // 四角形数
16 int m_Count; // カウンタ
17 VTX_S *m_Buffer; // バッファ
18 CVertex m_Vertex; // バーテックス
19 CTriDumpS *m_Next; // 次
20 public:
21 CTriDumpS(int);
22 CTriDumpS(CTriDumpS *);
23 ~CTriDumpS();
24 int GetCount(){ return m_Count; }
25 void Feed();
26 void Add(VEC3, VEC3, VEC3);
27 void Preview(VEC3, VEC3, VEC3);
28 void PrepareVertex();
29 void Render(bool drawup);
30 };
31
32 /*
33 * エッジインデックス
34 */
35 class CEdgeIndex{
36 friend class CShadowVolume;
37 private:
38 WORD m_Index1, m_Index2; // インデックス
39 WORD m_Large, m_Small; // 大小値
40 public:
41 CEdgeIndex(WORD i1, WORD i2){
42 m_Index1 = i1; m_Index2 = i2;
43 if(m_Index1<m_Index2){
44 m_Large = m_Index2; m_Small = m_Index1;
45 }else{
46 m_Large = m_Index1; m_Small = m_Index2;
47 }
48 }
49 int Compare(const CEdgeIndex &rhs) const{
50 return m_Large==rhs.m_Large && m_Small==rhs.m_Small
51 ? (m_Index1==rhs.m_Index1 ? 1 : -1) : 0;
52 }
53 bool operator<(const CEdgeIndex &rhs) const{
54 return m_Large<rhs.m_Large || m_Large==rhs.m_Large && m_Small<rhs.m_Small;
55 }
56 };
57
58 /*
59 * シャドウボリューム
60 */
61 class CShadowVolume{
62 private:
63 vector<CEdgeIndex> m_TempIndex; // 作業用インデックスバッファ
64 CTriDumpS *m_FaceVolume; // 面用ボリュームダンパ
65 public:
66 CShadowVolume();
67 ~CShadowVolume();
68 void Reset();
69 void BuildFromMesh(CObject *, VEC3);
70 void AddFaceEdge(VEC3 &, VEC3 &, VEC3 &);
71 void Render();
72 void Draw(D3DCOLOR);
73 };
74
75 #endif

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26