00001
00002
00004
00005 #include "Streamline.h"
00006 #include "Vector3D.h"
00007 #include "Point3D.h"
00008 #include "Defines.h"
00009 #include "MyCube.h"
00010 #include "TextureGenerator.h"
00011 #include "MyProgressDialog.h"
00012 #include "MyRectangle.h"
00013 #include "MyAxisCross.h"
00014 #include "MySphere.h"
00015 #include "MyHistoDialog.h"
00016
00017 #include "gl/gl.h"
00018 #include "gl/glu.h"
00019 #include "gl/glut.h"
00020
00021 #if !defined(AFX_FLOW3DVIEW_H__8D49CA2C_4BB9_4D56_A76B_282A9CF7747B__INCLUDED_)
00022 #define AFX_FLOW3DVIEW_H__8D49CA2C_4BB9_4D56_A76B_282A9CF7747B__INCLUDED_
00023
00024 #if _MSC_VER > 1000
00025 #pragma once
00026 #endif // _MSC_VER > 1000
00027
00029 class CFlow3DView : public CView
00030 {
00031 protected:
00032 CFlow3DView();
00033 DECLARE_DYNCREATE(CFlow3DView)
00034
00035
00036 public:
00037 CFlow3DDoc* GetDocument();
00038
00039
00040 public:
00041
00042 virtual ~CFlow3DView();
00043
00044
00045
00046 public:
00047 virtual void OnDraw(CDC* pDC);
00048 virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
00049 protected:
00050 virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint);
00051
00052
00053
00054
00055 private:
00057 void InitFoCoObj();
00059 void InitBlockParams();
00060
00062 void InitOldMembers();
00063
00065 void ReplaceBlTex();
00066
00068 void CreateBlTex();
00069
00071 void DrawBlock();
00072
00074 void GLInit();
00076 void InitHistoDialog(int scalarType);
00077
00079 CObList *GetPiecesList(bool &isReverse, int direction);
00081 float CalcSizePerc();
00083 void InitObjects();
00084
00086 void CenterFocus();
00087
00089 void DrawCone(CSamplePoint *sp, CStreamlineMaterial &mat,
00090 GLubyte *rgba, float base, float height);
00091
00093 void DrawVField();
00095 void SetDepthCueing();
00097 void DrawAnimSpeedBar(int xPos, int yPos, int width, GLubyte *color);
00098
00100 void DrawLegend();
00101
00103 void CalcNewSize(float &size,float &radius,float &length,
00104 float &width, float &height, CVector3D vec);
00105
00107 CPoint3D CalcNewPos(CPoint3D oldPos, CVector3D vec);
00108
00110 void RotateField();
00111
00113 void DrawLines(GLint xPos, GLint yPos, GLint length,
00114 GLint width, GLubyte opacity);
00115
00117 void DrawText(GLint xPos, GLint yPos, char* s, GLubyte *rgba);
00118
00120 void DrawAxisLegend(GLint xPos, GLint yPos, GLubyte *rgba);
00121
00123 GLubyte *CreateAlphaTable();
00124
00126 int CalcFPS();
00127
00129 void Init();
00130
00132 BOOL bSetupPixelFormat(void);
00134 void SetTextureMatrix();
00135
00137 GLubyte ModFunc(int i, int n);
00138
00140 GLubyte SinFunc(int i, int n);
00141
00143 int GetMainDirection();
00144
00146 void DrawScene();
00147
00149 void DrawStreamlines(int direction);
00150
00152 void ReplaceTextures();
00153
00155 void CreateTextures();
00156
00158 void SetRotMatrix(float *matrix);
00159
00161 static void Clamp(float &value, float min, float max, float newVal1, float newVal2);
00162
00164 static bool HasChanged(float oldVal, float val);
00165
00167 static bool HasChanged(GLubyte *oldRgba, GLubyte *rgba);
00168
00170 bool IsKeyPressed();
00171
00173 bool IsLButtonRot();
00174
00176 int m_DeIntensity;
00177
00179 CFlow3DDoc *doc;
00180
00182 MyHistoDialog m_HistoDialog;
00183
00185 float m_ZAngle;
00187 float m_YAngle;
00189 float m_XAngle;
00190
00192 int m_TheVField;
00193
00195 CPoint3D m_OldMinPos;
00196
00198 CPoint3D m_OldMaxPos;
00199
00201 int m_OldAnimSpeed;
00203 int m_OldPeriodLength;
00205 int m_OldDeIntensity;
00207 float m_ZDist;
00209 float m_OldZDist;
00211 GLubyte m_OldAbsorption;
00213 ContextProp m_OldContextProp;
00215 float m_OldBlZOffs;
00216
00218 GLfloat m_BKColor[4];
00220 GLubyte m_DepthColor[3];
00221
00223 CPoint m_RButtonDownPos;
00225 CPoint m_LButtonDownPos;
00227 CPoint m_CurrentMousePos;
00229 CPoint m_RButDblClkPos;
00230
00232 MyAxisCross m_OldSeedPCross;
00233
00235 MyObject *m_OldMagicVolume;
00236
00238 MyAxisCross m_Axis;
00240 MyAxisCross m_FoContextCross;
00241
00243 GLubyte m_Absorption;
00244
00246 CVector3D m_RotAxis;
00248 float m_RotAngle;
00249
00251 float m_GapSize;
00252
00254 int m_DepthType;
00255
00257 int m_ArPeriod;
00258
00260 int m_ArType;
00261
00263 float m_ArrowWidth;
00265 float m_ArrowLength;
00266
00267
00268 bool m_IsBusy;
00269 bool m_IsShowLegend;
00270 bool m_IsKeyPressed[DEF_KEYS_NUM];
00271
00272 bool m_RButtonDown;
00273 bool m_IsRButtonDown;
00274 bool m_IsLButtonDown;
00275
00276 bool m_IsDepthCueing;
00277 bool m_IsDrawBoundaries;
00278 bool m_IsRotating;
00279 bool m_IsAntiAliasing;
00280
00281 bool m_IsGap;
00282 bool m_HasFocus;
00283 bool m_Modified;
00284 bool m_IsTranspFunc;
00285 bool m_IsShowAxis;
00286 bool m_IsShowBlock;
00287 bool m_IsTex;
00288
00290 int m_LightType;
00292 int m_TranspFuncType;
00293
00295 float m_DiffuseCorr;
00297 float m_Glossiness;
00298
00300 GLuint m_TheStreamlines;
00301
00303 GLuint texName[DEF_REGPROP_NUM+1];
00304
00306 GLuint blTexName;
00307
00309 CVector3D m_Light;
00310
00312 CVector3D m_View;
00313
00315 CTextureGenerator m_TexGenerator;
00316
00318 CClientDC * m_pDC;
00319
00321 CRect m_oldRect;
00322
00324 static CSinTable m_SinTable;
00325
00326 #ifdef _DEBUG
00327 virtual void AssertValid() const;
00328 virtual void Dump(CDumpContext& dc) const;
00329 #endif
00330
00331 protected:
00332
00333
00334 protected:
00335
00336 afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
00337 afx_msg void OnSize(UINT nType, int cx, int cy);
00338 afx_msg void OnDestroy();
00339 afx_msg BOOL OnEraseBkgnd(CDC* pDC);
00340 afx_msg void OnShowHideBoundaries();
00341 afx_msg void OnEnableDisableDepthCueing();
00342 afx_msg void OnTimer(UINT nIDEvent);
00343 afx_msg void OnMouseMove(UINT nFlags, CPoint point);
00344 afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
00345 afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
00346 afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
00347 afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
00348 afx_msg void OnPlaceSeedPoint();
00349 afx_msg void OnSetAddInfo();
00350 afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
00351 afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
00352 afx_msg void OnSetMaterial();
00353 afx_msg void OnSetHighlight();
00354 afx_msg void OnSetDiffuseCorrection();
00355 afx_msg void OnShowHideAddInfo();
00356 afx_msg void OnSetLightType();
00357 afx_msg void OnUpdateEnableDisableDepthCueing(CCmdUI* pCmdUI);
00358 afx_msg void OnUpdatePlaceSeedPoint(CCmdUI* pCmdUI);
00359 afx_msg void OnUpdateShowHideAddInfo(CCmdUI* pCmdUI);
00360 afx_msg void OnUpdateShowHideBoundaries(CCmdUI* pCmdUI);
00361 afx_msg void OnSetLineStyle();
00362 afx_msg void OnShowHideAxis();
00363 afx_msg void OnUpdateShowHideAxis(CCmdUI* pCmdUI);
00364 afx_msg void OnStatistics();
00365 afx_msg void OnEnableDisableAnimation();
00366 afx_msg void OnUpdateEnableDisableAnimation(CCmdUI* pCmdUI);
00367 afx_msg void OnSetFocus(CWnd* pOldWnd);
00368 afx_msg void OnKillFocus(CWnd* pNewWnd);
00369 afx_msg void OnSetPerformanceOptions();
00370 afx_msg void OnShowHideMagicVolume();
00371 afx_msg void OnUpdateShowHideMagicVolume(CCmdUI* pCmdUI);
00372 afx_msg void OnSetFocusContextOptions();
00373 afx_msg void OnStartEndFocusContextMode();
00374 afx_msg void OnUpdateStartEndFocusContextMode(CCmdUI* pCmdUI);
00375 afx_msg void OnRButtonDblClk(UINT nFlags, CPoint point);
00376 afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
00377 afx_msg void OnShowHideLegend();
00378 afx_msg void OnUpdateShowHideLegend(CCmdUI* pCmdUI);
00379 afx_msg void OnSetBackground();
00380 afx_msg void OnZoomIn();
00381 afx_msg void OnResetSize();
00382 afx_msg void OnShowHistoDifOrient();
00383 afx_msg void OnShowHistoOrientX();
00384 afx_msg void OnShowHistoOrientY();
00385 afx_msg void OnShowHistoOrientZ();
00386 afx_msg void OnShowHistoPosX();
00387 afx_msg void OnShowHistoPosY();
00388 afx_msg void OnShowHistoPosZ();
00389 afx_msg void OnShowHistoVelocity();
00390 afx_msg void OnShowHistoDifVelocity();
00391 afx_msg void OnSetDepthCoding();
00392 afx_msg void OnSetAnimationOptions();
00393 afx_msg void OnSetViewDirection();
00394 afx_msg void OnSetBlockParameters();
00395 afx_msg void OnShowHideBlock();
00396 afx_msg void OnUpdateShowHideBlock(CCmdUI* pCmdUI);
00397
00398 DECLARE_MESSAGE_MAP()
00399 };
00400
00401 #ifndef _DEBUG // debug version in Flow3DView.cpp
00402 inline CFlow3DDoc* CFlow3DView::GetDocument()
00403 { return (CFlow3DDoc*)m_pDocument; }
00404 #endif
00405
00407
00408
00409
00410
00411 #endif // !defined(AFX_FLOW3DVIEW_H__8D49CA2C_4BB9_4D56_A76B_282A9CF7747B__INCLUDED_)