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
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085 #ifndef INC_GRE_3DTEXTUR_H
00086 #define INC_GRE_3DTEXTUR_H
00087
00088 #ifndef INC_GRE_BASE_H
00089 #include <gre/base.h>
00090 #endif
00091
00092 #ifndef INC_GRE_3DUTILS_H
00093 #include <gre/3dutils.h>
00094 #endif
00095
00096 #ifndef INC_GRE_3DSCENE_H
00097 #include <gre/3dscene.h>
00098 #endif
00099
00100 #ifndef INC_MI32_REGION2D_H
00101 #include <mi32/region2d.h>
00102 #endif
00103
00104 #ifndef INC_MI32_MGD2_H
00105 #include <mi32/mgd2.h>
00106 #endif
00107
00108 namespace GRE {
00109
00110 #ifndef GENERATING_DOXYGEN_OUTPUT
00111 class TEXTUREFILTER;
00112 class CONTROLLER;
00113 class TERRAIN;
00114 class DRAWINGCONTEXT3D;
00115 class BOUNDPARM;
00116 #endif // GENERATING_DOXYGEN_OUTPUT
00117
00118
00119 class TEXTURE {
00120 public:
00121
00122 class IMPL_FACTORY {
00123 public:
00124 virtual TEXTURE *v_ConstructImpl () = 0;
00125 };
00126
00127 #define DECLARE_TEXTURE_IMPL_FACTORY(name,model) \
00128 class TEXTURE_IMPL_FACTORY_##name : public GRE::TEXTURE::IMPL_FACTORY { \
00129 public: \
00130 TEXTURE_IMPL_FACTORY_##name ( \
00131 ) { GRE::TEXTURE::Register(this,model); } \
00132 virtual GRE::TEXTURE *v_ConstructImpl () { \
00133 return (new GRE::name); \
00134 } \
00135 }; \
00136 static TEXTURE_IMPL_FACTORY_##name s_TextureImplFactory_##name;
00137
00138 enum MODEL {
00139 MODEL_Default = 0,
00140 MODEL_SimpleRaster = 0,
00141 MODEL_Formula = 1,
00142 MODEL_Count = 2
00143 };
00144
00145 static void Register (
00146 IMPL_FACTORY* factory,
00147 const MODEL model
00148 );
00149
00150
00151
00152
00153 static const char* GetName (
00154 MODEL model
00155 );
00156
00157
00158
00159
00160 static const char* GetDescription (
00161 MODEL model
00162 );
00163
00164
00165
00166
00167 static TEXTURE* GetInstance (
00168 MODEL model
00169 );
00170
00171 virtual ~TEXTURE (
00172 );
00173
00174
00175
00176
00177 const char* GetName (
00178 ) const;
00179
00180
00181
00182
00183 const char* GetDescription (
00184 ) const;
00185
00186
00187
00188
00189 const MODEL GetModel (
00190 ) const {return m_Model; };
00191
00192
00193
00194
00195 TEXTURE* CreateInstance (
00196 ) { return v_CreateInstance(); };
00197
00198
00199
00200
00201 ERRVALUE Build (
00202 const GRE::LAYER* layer
00203 ) { return v_Build(layer); };
00204
00205
00206 void Free (
00207 ) { v_Free(); return; };
00208
00209
00210
00211
00212 bool IsBuilt (
00213 );
00214
00215
00216 void Begin (
00217 const SCENE3D& scene
00218 ) { v_Begin(scene); return; };
00219
00220
00221 void End (
00222 ) { v_End(); return; };
00223
00224
00225
00226
00227 const DRECT2D& GetExtents (
00228 ) { return v_GetExtents(); };
00229
00230
00231 void SetCoordRefSys (
00232 const SPATREF::COORDREFSYS& CoordRefSys
00233 ) { SetPedestalCoordRefSys(CoordRefSys); v_SetCoordRefSys(CoordRefSys); return; };
00234
00235
00236 const SPATREF::COORDREFSYS GetCoordRefSys (
00237 ) { return v_GetCoordRefSys(); };
00238
00239
00240
00241
00242 bool GetColor (
00243 const INT32 line,
00244 const INT32 column,
00245 const UINT8 depth,
00246 COLOR& color
00247 ) { return v_GetColor(line, column, depth, color); };
00248
00249
00250
00251
00252 bool GetColor (
00253 const DPOINT2D& point,
00254 const UINT8 depth,
00255 COLOR& color
00256 ) { return v_GetColor(point, depth, color); };
00257
00258
00259
00260
00261 UINT8 CheckDepth (
00262 const UINT8 depth
00263 ) { return v_CheckDepth(depth); };
00264
00265
00266
00267
00268 const TRANS2D_MAPGEN& GetTransformationInternalToModel (
00269 ) { return v_GetTransformationInternalToModel(); };
00270
00271
00272
00273
00274 ERRVALUE SetBoundaryWall (
00275 const SCENE3D& scene,
00276 TERRAIN* terrain
00277 );
00278
00279
00280
00281
00282 ERRVALUE DrawBoundaryWall (
00283 CONTROLLER &controller,
00284 DRAWINGCONTEXT3D& drawing,
00285 GRE::BOUNDPARM& boundparm
00286 );
00287
00288 const REGION2D& GetBoundary (
00289 ) {
00290 if (m_Boundary.IsEmpty()) v_CreateBoundary(m_Boundary);
00291 return m_Boundary;
00292 };
00293
00294
00295 void ClearPedestal (
00296 ) {
00297 m_PolyLineList.Clear();
00298 return;
00299 };
00300
00301
00302 void ClearBoundary (
00303 ) {
00304 m_Boundary.Clear();
00305 return;
00306 };
00307
00308 bool IsBoundaryChanged (
00309 ) const {
00310 return m_Boundary.IsEmpty();
00311 };
00312
00313 protected:
00314
00315 TEXTURE (
00316 const char* name,
00317 const char* desc,
00318 const MODEL model
00319 );
00320
00321
00322 void SetBuilt (
00323 const bool built
00324 );
00325
00326 private:
00327
00328 #ifndef GENERATING_DOXYGEN_OUTPUT
00329
00330 typedef SIMPLE_ARRAY<INT32> BASEINDEX;
00331 typedef MILIST<BASEINDEX> BASEINDEXLIST;
00332
00333 static IMPL_FACTORY* s_ImplFactories[MODEL_Count];
00334
00335 const char* m_Name;
00336 const char* m_Description;
00337 const MODEL m_Model;
00338
00339 bool m_Built;
00340
00341 REGION2D m_Boundary;
00342
00343 REGION2D m_FinalBoundary;
00344 POLYLINELIST m_PolyLineList;
00345 BASEINDEXLIST m_BaseIndexList;
00346 SPATREF::COORDREFSYS m_PolyLineCoordRefSys;
00347 TRIANGULATION m_Triangulation;
00348 SCENE3D *m_Scene;
00349
00350 TEXTURE (
00351 );
00352
00353 TEXTURE (
00354 const TEXTURE &rhs
00355 );
00356
00357 TEXTURE& operator= (
00358 const TEXTURE& rhs
00359 );
00360
00361 #endif // GENERATING_DOXYGEN_OUTPUT
00362
00363 void SetPedestalCoordRefSys (
00364 const SPATREF::COORDREFSYS& CoordRefSys
00365 );
00366
00367 virtual TEXTURE* v_CreateInstance (
00368 ) = 0;
00369
00370 virtual ERRVALUE v_Build (
00371 const GRE::LAYER *layer
00372 ) = 0;
00373
00374 virtual void v_Free (
00375 ) = 0;
00376
00377 virtual void v_Begin (
00378 const SCENE3D& scene
00379 ) = 0;
00380
00381 virtual void v_End (
00382 ) = 0;
00383
00384 virtual const DRECT2D& v_GetExtents (
00385 ) = 0;
00386
00387 virtual void v_CreateBoundary (
00388 REGION2D& boundary
00389 ) = 0;
00390
00391 virtual void v_SetCoordRefSys (
00392 const SPATREF::COORDREFSYS& CoordRefSys
00393 ) = 0;
00394
00395 virtual const SPATREF::COORDREFSYS v_GetCoordRefSys (
00396 ) = 0;
00397
00398 virtual bool v_GetColor (
00399 const INT32 line,
00400 const INT32 column,
00401 const UINT8 depth,
00402 COLOR& color
00403 ) = 0;
00404
00405 virtual bool v_GetColor (
00406 const DPOINT2D& point,
00407 const UINT8 depth,
00408 COLOR& color
00409 ) = 0;
00410
00411 virtual UINT8 v_CheckDepth (
00412 const UINT8 depth
00413 ) = 0;
00414
00415 virtual const TRANS2D_MAPGEN& v_GetTransformationInternalToModel (
00416 ) = 0;
00417
00418 };
00419
00420 }
00421
00422 #endif
00423
00424
00425