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 #ifndef INC_GRE_VIEWPOINT3D_H
00028 #define INC_GRE_VIEWPOINT3D_H
00029
00030 #ifndef INC_GRE_BASE_H
00031 #include <gre/base.h>
00032 #endif
00033
00034 #ifndef INC_GRE_3DSCENE_H
00035 #include <gre/3dscene.h>
00036 #endif
00037
00038 #ifndef INC_MI32_SERIALIZ_H
00039 #include <mi32/serializ.h>
00040 #endif
00041
00042 #ifndef GENERATING_DOXYGEN_OUTPUT
00043 struct SMLCONTEXT;
00044 #endif
00045
00046
00047
00048 class GRE_VIEWPOINT3D {
00049 public:
00050
00051 static ERRVALUE SerializerCB (
00052 SERIALIZER& serializer,
00053 const SERIALIZER::ITEMDEF *item,
00054 void *pvvp,
00055 SERIALIZER::ITEMDEF::ACTION action
00056 );
00057
00058
00059 static void SMLClassInstall (
00060 SMLCONTEXT *context
00061 );
00062
00063
00064 explicit GRE_VIEWPOINT3D (
00065 GRE_GROUP *group,
00066 GRE_VIEW *view = 0
00067 );
00068
00069
00070 GRE_VIEWPOINT3D (
00071 const GRE_VIEWPOINT3D& rhs
00072 );
00073
00074
00075 ~GRE_VIEWPOINT3D (
00076 );
00077
00078
00079 GRE_VIEWPOINT3D& operator= (
00080 const GRE_VIEWPOINT3D& rhs
00081 );
00082
00083 bool Calculate (
00084 );
00085
00086 void CalculateAutoCenter (
00087 );
00088
00089 void CalculateCenterPoint (
00090 );
00091
00092 void CalculateCenterFromViewPoint (
00093 );
00094
00095 void CalculateParameters (
00096 );
00097
00098 void CalculatePoint (
00099 const bool center
00100 );
00101
00102 void CalculateTransVD (
00103 MAT3X3,
00104 MAT3X3
00105 );
00106
00107 void CalculateViewDirFromAzimAngle (
00108 double angle
00109 );
00110
00111 void CalculateTransVRCToWorld (
00112 TRANS3D&
00113 );
00114
00115 void CalculateUsedRect (
00116 const DRECT2D&,
00117 const DPOINT2D&
00118 );
00119
00120 void CalculateUsedRect (
00121 double aspect
00122 );
00123
00124
00125 double GetAutoCenterDistance (
00126 ) const;
00127
00128
00129 double GetBackClipDistance (
00130 ) const;
00131
00132
00133 double GetBaseElevation (
00134 ) const;
00135
00136
00137 const DPOINT3D& GetCenterPoint (
00138 ) const;
00139
00140
00141 const DRECT2D& GetDestRect (
00142 ) const;
00143
00144
00145 double GetFrontClipDistance (
00146 ) const;
00147
00148
00149 GRE_GROUP* GetGroup (
00150 ) const;
00151
00152
00153 double GetHeading (
00154 bool FromNorth = true
00155 ) const;
00156
00157 double GetParallelProjDistance (
00158 ) const;
00159
00160
00161 double GetPitch (
00162 ) const;
00163
00164
00165
00166
00167
00168 double GetStereoDepthScale (
00169 ) const;
00170
00171 double GetStereoDistance0 (
00172 ) const;
00173
00174 double GetSunAzimuthAngle (
00175 );
00176
00177 double GetSunElevationAngle (
00178 );
00179
00180 GRE_VIEW* GetView (
00181 ) const;
00182
00183 double GetViewAngle (
00184 ) const;
00185
00186 const DPOINT3D& GetViewDirection (
00187 ) const;
00188
00189 double GetViewPlaneDistance (
00190 ) const;
00191
00192 const DPOINT3D& GetViewPosition (
00193 ) const;
00194
00195 const DRECT2D& GetViewRectUsed (
00196 ) const;
00197
00198 GRE::SCENE3D& GetScene3D (
00199 );
00200
00201 const GRE::SCENE3D& GetScene3D (
00202 ) const;
00203
00204 const DPOINT3D& GetViewUp (
00205 ) const;
00206
00207 const double GetZScale (
00208 ) const;
00209
00210 void IniRead (
00211 INIHANDLE handle,
00212 const char *inigroup
00213 );
00214
00215 void IniWrite (
00216 INIHANDLE handle,
00217 const char *inigroup
00218 );
00219
00220 bool IsAutoCentered (
00221 ) const;
00222
00223 bool IsCalculated (
00224 ) const;
00225
00226 bool IsClipBackPlane (
00227 ) const;
00228
00229 bool IsPerspective (
00230 ) const;
00231
00232 bool IsStereo (
00233 ) const;
00234
00235 void SetAutoCenter (
00236 bool AutoCenter
00237 );
00238
00239 void SetAutoCenterAzimAngle (
00240 double AzimAngle
00241 );
00242
00243 void SetAutoCenterDistance (
00244 double Distance
00245 );
00246
00247 void SetAutoCenterElevAngle (
00248 double ElevAngle
00249 );
00250
00251 void SetAutoCenterPoint (
00252 const DPOINT2D& point
00253 );
00254
00255 void SetAutoCenterPoint (
00256 const DPOINT3D& point
00257 );
00258
00259 void SetBackClipDistance (
00260 double BackClipDist
00261 );
00262
00263 void SetBaseElevation (
00264 double BaseElevation
00265 );
00266
00267 void SetClipBackPlane (
00268 bool ClipBackPlane
00269 );
00270
00271 void SetDestRect (
00272 const DRECT2D& DestRect
00273 );
00274
00275 void SetFrontClipDistance (
00276 double FrontClipDist
00277 );
00278
00279 void SetHeading (
00280 double Heading,
00281 bool FromNorth = true
00282 );
00283
00284 void SetParallelProjDistance (
00285 double ParallelProjDist
00286 );
00287
00288 void SetPerspective (
00289 bool isPerspective = true
00290 );
00291
00292 void SetPitch (
00293 double Pitch
00294 );
00295
00296
00297
00298
00299
00300 void SetStereo (
00301 bool isStereo
00302 );
00303
00304 void SetStereoDepthScale (
00305 double StereoDepthScale
00306 );
00307
00308 void SetStereoDistance0 (
00309 double StereoDistance0
00310 );
00311
00312 void SetSunAzimuthAngle (
00313 double SunAzimAngle
00314 );
00315
00316 void SetSunElevationAngle (
00317 double SunElevAngle
00318 );
00319
00320 void SetViewDirection (
00321 const DPOINT3D& ViewDir
00322 );
00323
00324 void SetViewPosition (
00325 const DPOINT2D& ViewPos
00326 );
00327
00328 void SetViewPosition (
00329 const DPOINT3D& ViewPos
00330 );
00331
00332 void SetViewPositionZ (
00333 double z
00334 );
00335
00336 void SetViewRectUsed (
00337 const DRECT2D& ViewRectUsed
00338 );
00339
00340 void SetViewPlaneDistance (
00341 double ViewPlaneDistance
00342 );
00343
00344 void SetViewUp (
00345 const DPOINT3D& ViewUp
00346 );
00347
00348 void SetZScale (
00349 double ZScale
00350 );
00351
00352 private:
00353 #ifndef GENERATING_DOXYGEN_OUTPUT
00354
00355 GRE_GROUP *m_group;
00356 GRE_VIEW *m_view;
00357 DPOINT3D m_ViewPos;
00358 DPOINT3D m_ViewDir;
00359 DPOINT3D m_ViewUp;
00360 DRECT2D m_ViewRectUsed;
00361 double m_ViewPlaneDist;
00362 double m_FrontClipDist;
00363 double m_BackClipDist;
00364 double m_ParallelProjDist;
00365 double m_StereoDistance0;
00366 double m_StereoDepthScale;
00367 DPOINT3D m_CenterPoint;
00368 double m_AzimAngle;
00369 double m_ElevAngle;
00370
00371 double m_AutoCenterDist;
00372 double m_ZScale;
00373 double m_BaseElevation;
00374 DRECT2D m_DestRect;
00375
00376 bool m_IsPerspective;
00377 bool m_ClipBackPlane;
00378 bool m_IsStereo;
00379 bool m_AutoCenter;
00380 bool m_CenterSet;
00381 UINT32 m_oldflags;
00382 double m_SunAzimAngle;
00383 double m_SunElevAngle;
00384
00385 GRE::SCENE3D m_Scene3D;
00386
00387 static ERRVALUE SerializerCB_OldFlags (
00388 SERIALIZER& serializer,
00389 const SERIALIZER::ITEMDEF *item,
00390 void *vgroup,
00391 SERIALIZER::ITEMDEF::ACTION action
00392 );
00393
00394 void CalcCVPtoD ();
00395 const TRANS3D& GetNormTrans (
00396 int vindex = 0
00397 ) const;
00398 void CalcNormTrans ();
00399
00400 #endif
00401 };
00402
00403
00404
00405
00406 #endif