Develop and Download Open Source Software

Browse Subversion Repository

Contents of /trunk/CProfilePlugin.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 9 - (show annotations) (download) (as text)
Tue Aug 28 14:58:05 2012 UTC (11 years, 8 months ago) by okadu
File MIME type: text/x-chdr
File size: 6157 byte(s)
[okadu] Version 2.14
ニュートラル画面分割
ダイヤ停車位置の数値設定
レイアウト読み込みバグ一部修正

1 #ifndef CPROFILEPLUGIN_H_INCLUDED
2 #define CPROFILEPLUGIN_H_INCLUDED
3
4 #include "CPlugin.h"
5
6 class CScene;
7 class CQuadDumpNX;
8 class CLineDumpN;
9
10 /*
11 * デフォルト NULL で初期化されるポインタ
12 */
13 template< typename TYPE >
14 class MapPtrValue {
15 private:
16 TYPE *m_Ptr;
17 public:
18 MapPtrValue(): m_Ptr(NULL){}
19 operator TYPE*(){ return m_Ptr; }
20 TYPE* operator->(){ return m_Ptr; }
21 TYPE*& operator=(TYPE* p){ return m_Ptr = p; }
22 void SafeDelete(){ if(m_Ptr){ delete m_Ptr; m_Ptr = NULL; } }
23 };
24
25 /*
26 * 断面頂点データ
27 */
28 class CProfileVertex{
29 friend class CProfileFace;
30 friend class CProfilePlugin;
31 private:
32 bool m_IgnoreCant; // カント無視
33 bool m_ReadNormal; // 法線読込フラグ
34 bool m_ShadowDrawed; // 影描画フラグ
35 VEC2 m_Coord; // 座標
36 VEC2 m_Normal; // 法線
37 VEC3 m_TransCoord[2]; // 一時座標
38 D3DCOLOR m_Diffuse; // 頂点色
39 float m_TexU; // テクスチャ U 座標
40 public:
41 char *Read(char *, bool);
42 bool IsSame(CProfileVertex *rhs){
43 return m_IgnoreCant==rhs->m_IgnoreCant && m_Coord==rhs->m_Coord;
44 }
45 };
46
47 // 反復子
48 typedef list<CProfileVertex>::iterator IProfileVertex;
49 typedef list<CProfileVertex *>::iterator IPProfileVertex;
50
51 /*
52 * 断面辺データ
53 */
54 class CProfileFace{
55 friend class CProfilePlugin;
56 private:
57 list<CProfileVertex> m_Vertex; // 頂点
58 public:
59 char *Read(char *, bool);
60 };
61
62 // 反復子
63 typedef list<CProfileFace>::iterator IProfileFace;
64
65 /*
66 * 断面データ
67 */
68 class CProfile{
69 friend class CProfilePlugin;
70 private:
71 float m_TexMapVTemp; // マッピング位置
72 float m_TexVPerMeter; // 長さ当たり V 座標
73 bool m_UseTexture; // テクスチャ使用フラグ
74 string m_TexFileName; // テクスチャファイル名
75 LPTEX8 m_Texture; // テクスチャ
76 list<CProfileFace> m_Face; // 断面
77 map<CScene *, MapPtrValue<CQuadDumpN> > m_DumpN; // ダンパ (テクスチャなし)
78 map<CScene *, MapPtrValue<CQuadDumpNX> > m_DumpNX; // ダンパ (テクスチャあり)
79 public:
80 CProfile();
81 ~CProfile();
82 void ClearAll();
83 char *Read(char *);
84 void LoadTexture();
85 void PrepareDump();
86 };
87
88 // 反復子
89 typedef list<CProfile>::iterator IProfile;
90
91 ////////////////////////////////////////////////////////////////////////////////
92 ////////////////////////////////////////////////////////////////////////////////
93
94 /*
95 * ワイヤフレーム頂点データ
96 */
97 class CWireframeVertex{
98 friend class CProfilePlugin;
99 private:
100 bool m_IgnoreCant; // カント無視
101 VEC3 m_Coord; // 座標
102 D3DCOLOR m_Diffuse; // 頂点色
103 public:
104 char *Read(char *);
105 };
106
107 // 反復子
108 typedef list<CWireframeVertex>::iterator IWireframeVertex;
109
110 /*
111 * ワイヤフレーム直線データ
112 */
113 class CWireframeLine{
114 friend class CProfilePlugin;
115 private:
116 list<CWireframeVertex> m_Vertex; // 頂点
117 public:
118 char *Read(char *);
119 };
120
121 // 反復子
122 typedef list<CWireframeLine>::iterator IWireframeLine;
123
124 /*
125 * ワイヤフレームデータ
126 */
127 class CWireframe{
128 friend class CProfilePlugin;
129 private:
130 float m_MinInterval; // 最小間隔
131 float m_MaxInterval; // 最大間隔
132 list<CWireframeLine> m_Line; // 断面
133 map<CScene *, MapPtrValue<CLineDumpN> > m_DumpN; // ダンパ
134 public:
135 CWireframe();
136 ~CWireframe();
137 void ClearAll();
138 char *Read(char *);
139 void PrepareDump();
140 bool CheckInterval(float l){
141 return (m_MinInterval<0.0f || m_MinInterval<=l)
142 && (m_MaxInterval<0.0f || l<m_MaxInterval);
143 }
144 };
145
146 // 反復子
147 typedef list<CWireframe>::iterator IWireframe;
148
149 ////////////////////////////////////////////////////////////////////////////////
150 ////////////////////////////////////////////////////////////////////////////////
151
152 /*
153 * 等間隔配置データ
154 */
155 class CInterval{
156 friend class CProfilePlugin;
157 private:
158 bool m_IgnoreCant; // カント無視
159 float m_IntervalTemp; // 現在位置
160 float m_Interval; // 間隔
161 float m_Offset; // オフセット
162 float m_ModelScale; // モデルスケール
163 string m_ModelFileName; // モデルファイル名
164 CMesh *m_Mesh; // メッシュ
165 CObject m_Object; // オブジェクト
166 public:
167 char *Read(char *);
168 void LoadModel();
169 };
170
171 // 反復子
172 typedef list<CInterval>::iterator IInterval;
173
174 ////////////////////////////////////////////////////////////////////////////////
175 ////////////////////////////////////////////////////////////////////////////////
176
177 /*
178 * 断面プラグイン
179 */
180 class CProfilePlugin: public CPlugin{
181 protected:
182 static vector<CProfileVertex *> ms_TempIndex; // 作業用インデックスバッファ
183 list<CProfileVertex *> m_ProfileVertex; // 断面頂点リスト
184 list<CProfile> m_Profile; // 断面
185 list<CWireframe> m_Wireframe; // ワイヤフレーム
186 list<CInterval> m_Interval; // 等間隔配置
187 public:
188 CProfilePlugin(char *id): CPlugin(id){}
189 virtual ~CProfilePlugin(){}
190 virtual char *DirName() = 0;
191 virtual char *TextName2() = 0;
192 virtual bool Load() = 0;
193 virtual void SetPreview() = 0;
194 virtual bool UseTaper(){ return false; }
195 virtual float GetTaperZ(){ return 0.0f; }
196 bool HasInterval(){ return !!m_Interval.size(); }
197 char *ReadProfile(char *);
198 void LoadData();
199 void Dump(VEC3 &, VEC3 &, VEC3 &, VEC3 &, VEC3 &, VEC3 &,
200 VEC3 &, VEC3 &, VEC3 &, VEC3 &, VEC3 &, VEC3 &, float, int);
201 void Render(VEC3 &, VEC3 &, VEC3 &, VEC3 &, VEC3 &, VEC3 &, VEC3 &,
202 VEC3 &, VEC3 &, VEC3 &, VEC3 &, VEC3 &, VEC3 &, VEC3 &,
203 int, float, MAT8 *altmat = NULL);
204 virtual void BeforeDump(VEC3 &, VEC3 &, VEC3 &, VEC3 &, VEC3 &, VEC3 &){}
205 virtual void AfterDump(VEC3 &, VEC3 &, VEC3 &, VEC3 &, VEC3 &, VEC3 &, VEC3 &, VEC3 &){}
206 void ResetMapTemp();
207 void CopyMapTemp(vector<float> &);
208 void AddMapTemp(float);
209 void SetMapTemp(vector<float> &);
210 void ClearDump();
211 void ClearDumpAll();
212 void PrepareVertex();
213 void RenderAll();
214 CPLUGIN_CASTFUNC(CProfilePlugin);
215 };
216
217 /*
218 * 断面プラグインリスト
219 */
220 class CProfilePluginList: public CPluginList{
221 protected:
222 public:
223 virtual char *DirName() = 0;
224 virtual char *TextName2() = 0;
225 void ClearDump();
226 void ClearDumpAll();
227 void PrepareVertex();
228 void RenderAll();
229 virtual CPlugin *NewEntry(char *) = 0;
230 CPLUGINLIST_CASTFUNC(CProfilePlugin);
231 };
232
233 // 関数宣言
234 char *ReadMapVector(char *, char *, vector<float> &);
235 void SaveMapVector(FILE *, char *, vector<float> &);
236
237 #endif

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