00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067 #ifndef INC_GRE_3DTEXTUR_H
00068 #define INC_GRE_3DTEXTUR_H
00069
00070 #ifndef INC_GRE_3DUTILS
00071 #include <gre/3dutils.h>
00072 #endif
00073
00074 #ifndef INC_GRE_3DSCENE
00075 #include <gre/3dscene.h>
00076 #endif
00077
00078 #ifndef INC_MI32_MGD2
00079 #include <mi32/mgd2.h>
00080 #endif
00081
00082 #ifndef GENERATING_DOXYGEN_OUTPUT
00083 class GRE_LAYER;
00084 #endif // GENERATING_DOXYGEN_OUTPUT
00085
00086 namespace GRE {
00087
00088 #ifndef GENERATING_DOXYGEN_OUTPUT
00089 class TEXTUREFILTER;
00090 class CONTROLLER;
00091 class TERRAIN;
00092 class DRAWINGCONTEXT3D;
00093 class BOUNDPARM;
00094 #endif // GENERATING_DOXYGEN_OUTPUT
00095
00096
00097 class TEXTURE {
00098 public:
00099
00100 enum MODEL {
00101 MODEL_Default = 0,
00102 MODEL_SimpleRaster = 0,
00103 MODEL_Formula = 1,
00104 MODEL_Count = 2
00105 };
00106
00107
00108
00109
00110 static const char* GetName (
00111 MODEL model
00112 );
00113
00114
00115
00116
00117 static const char* GetDescription (
00118 MODEL model
00119 );
00120
00121
00122
00123
00124 static TEXTURE* GetInstance (
00125 MODEL model
00126 );
00127
00128 virtual ~TEXTURE (
00129 );
00130
00131
00132
00133
00134 const char* GetName (
00135 ) const;
00136
00137
00138
00139
00140 const char* GetDescription (
00141 ) const;
00142
00143
00144
00145
00146 const MODEL GetModel (
00147 ) const {return m_Model; };
00148
00149
00150
00151
00152 TEXTURE* CreateInstance (
00153 ) { return v_CreateInstance(); };
00154
00155
00156
00157
00158 ERRVALUE Build (
00159 const GRE_LAYER* layer
00160 ) { return v_Build(layer); };
00161
00162
00163 void Free (
00164 ) { v_Free(); return; };
00165
00166
00167
00168
00169 bool IsBuilt (
00170 );
00171
00172
00173 void Begin (
00174 const SCENE3D& scene
00175 ) { v_Begin(scene); return; };
00176
00177
00178 void End (
00179 ) { v_End(); return; };
00180
00181
00182
00183
00184 const DRECT2D& GetExtents (
00185 ) { return v_GetExtents(); };
00186
00187
00188 void SetCoordRefSys (
00189 const SPATREF::COORDREFSYS& CoordRefSys
00190 ) { SetPedestalCoordRefSys(CoordRefSys); v_SetCoordRefSys(CoordRefSys); return; };
00191
00192
00193
00194
00195 const SPATREF::COORDREFSYS GetCoordRefSys (
00196 ) { return v_GetCoordRefSys(); };
00197
00198
00199
00200
00201 bool GetColor (
00202 const INT32 line,
00203 const INT32 column,
00204 const UINT8 depth,
00205 COLOR& color
00206 ) { return v_GetColor(line, column, depth, color); };
00207
00208
00209
00210
00211 bool GetColor (
00212 const DPOINT2D& point,
00213 const UINT8 depth,
00214 COLOR& color
00215 ) { return v_GetColor(point, depth, color); };
00216
00217
00218
00219
00220 UINT8 CheckDepth (
00221 const UINT8 depth
00222 ) { return v_CheckDepth(depth); };
00223
00224
00225
00226
00227 const TRANS2D_MAPGEN& GetTransformationInternalToModel (
00228 ) { return v_GetTransformationInternalToModel(); };
00229
00230
00231
00232
00233 ERRVALUE SetBoundaryWall (
00234 const SCENE3D& scene,
00235 TERRAIN* terrain
00236 );
00237
00238
00239
00240
00241 ERRVALUE DrawBoundaryWall (
00242 CONTROLLER &controller,
00243 DRAWINGCONTEXT3D& drawing,
00244 GRE::BOUNDPARM& boundparm
00245 );
00246
00247 const REGION2D& GetBoundary (
00248 ) {
00249 if (m_Boundary.IsEmpty()) v_CreateBoundary(m_Boundary);
00250 return m_Boundary;
00251 };
00252
00253
00254 void ClearPedestal (
00255 ) {
00256 m_PolyLineList.Clear();
00257 return;
00258 };
00259
00260
00261 void ClearBoundary (
00262 ) {
00263 m_Boundary.Clear();
00264 return;
00265 };
00266
00267 bool IsBoundaryChanged (
00268 ) const {
00269 return m_Boundary.IsEmpty();
00270 };
00271
00272 protected:
00273
00274
00275 static void Register (
00276 TEXTURE* texture
00277 );
00278
00279 TEXTURE (
00280 const char* name,
00281 const char* desc,
00282 const MODEL model
00283 );
00284
00285
00286 void SetBuilt (
00287 const bool built
00288 );
00289
00290 private:
00291
00292 #ifndef GENERATING_DOXYGEN_OUTPUT
00293
00294 typedef SIMPLE_ARRAY<INT32> BASEINDEX;
00295 typedef MILIST<BASEINDEX> BASEINDEXLIST;
00296
00297 static TEXTURE* s_TextureModels[MODEL_Count];
00298
00299 const char* m_Name;
00300 const char* m_Description;
00301 const MODEL m_Model;
00302
00303 bool m_Built;
00304
00305 REGION2D m_Boundary;
00306
00307 REGION2D m_FinalBoundary;
00308 POLYLINELIST m_PolyLineList;
00309 BASEINDEXLIST m_BaseIndexList;
00310 SPATREF::COORDREFSYS m_PolyLineCoordRefSys;
00311 TRIANGULATION m_Triangulation;
00312 SCENE3D *m_Scene;
00313
00314 TEXTURE (
00315 );
00316
00317 TEXTURE (
00318 const TEXTURE &rhs
00319 );
00320
00321 TEXTURE& operator= (
00322 const TEXTURE& rhs
00323 );
00324
00325 #endif // GENERATING_DOXYGEN_OUTPUT
00326
00327 void SetPedestalCoordRefSys (
00328 const SPATREF::COORDREFSYS& CoordRefSys
00329 );
00330
00331 virtual TEXTURE* v_CreateInstance (
00332 ) = 0;
00333
00334 virtual ERRVALUE v_Build (
00335 const GRE_LAYER *layer
00336 ) = 0;
00337
00338 virtual void v_Free (
00339 ) = 0;
00340
00341 virtual void v_Begin (
00342 const SCENE3D& scene
00343 ) = 0;
00344
00345 virtual void v_End (
00346 ) = 0;
00347
00348 virtual const DRECT2D& v_GetExtents (
00349 ) = 0;
00350
00351 virtual void v_CreateBoundary (
00352 REGION2D& boundary
00353 ) = 0;
00354
00355 virtual void v_SetCoordRefSys (
00356 const SPATREF::COORDREFSYS& CoordRefSys
00357 ) = 0;
00358
00359 virtual const SPATREF::COORDREFSYS v_GetCoordRefSys (
00360 ) = 0;
00361
00362 virtual bool v_GetColor (
00363 const INT32 line,
00364 const INT32 column,
00365 const UINT8 depth,
00366 COLOR& color
00367 ) = 0;
00368
00369 virtual bool v_GetColor (
00370 const DPOINT2D& point,
00371 const UINT8 depth,
00372 COLOR& color
00373 ) = 0;
00374
00375 virtual UINT8 v_CheckDepth (
00376 const UINT8 depth
00377 ) = 0;
00378
00379 virtual const TRANS2D_MAPGEN& v_GetTransformationInternalToModel (
00380 ) = 0;
00381
00382 };
00383
00384 }
00385
00386 #endif
00387
00388
00389