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