CDxVTXBaseView Class Reference

#include <DxBaseClass.h>

Inheritance diagram for CDxVTXBaseView:
Inheritance graph
[legend]
Collaboration diagram for CDxVTXBaseView:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 CDxVTXBaseView ()
virtual ~CDxVTXBaseView ()
virtual void OnInitialUpdate (void)
virtual void SetState (void)
virtual void ExecRender (void)
virtual void InitObject (void)
virtual BOOL PrepareVB (void)
virtual void ReleaseVB (void)
virtual void SwitchRotation (void)
virtual void ExecRotation (void)
virtual void ExMouseWheel (void)
virtual void ExRotationAngle (void)
afx_msg void OnTimer (UINT_PTR nIDEvent)

Public Attributes

LPDIRECT3DVERTEXBUFFER9 vb
LPDIRECT3DVERTEXBUFFER9 lb
D3DXMATRIX matWorld
D3DXMATRIX matView
D3DXMATRIX matProj
D3DXMATRIX matTrans
D3DXMATRIX matTemp
D3DXMATRIX matRotate
D3DXMATRIX matRotateX
D3DXMATRIX matRotateY
D3DXMATRIX matRotateZ
D3DXVECTOR3 center
double rTime
double gTime
double lTime
double startTime
double angle
double angleX
double angleY
double angleZ
double mWheelAc
double mWheelNotch
bool rotation
bool reverseZ

Protected Member Functions

virtual void OnDraw (CDC *pDC)

Detailed Description

Definition at line 168 of file DxBaseClass.h.


Constructor & Destructor Documentation

CDxVTXBaseView (  ) 

Definition at line 190 of file DxBaseClass.cpp.

00191 {
00192     vb = lb = NULL;
00193 
00194     rotation  = false;
00195     ctrlMouse = true;
00196     reverseZ  = false;
00197 
00198     angleX = angleY = angleZ = 0.0;
00199     angle = 0.0;
00200     rTime = gTime = 0.0;
00201     lTime = 1.0;
00202     mWheelAc = 0.0;
00203     mWheelNotch = 1.0;
00204 
00205     startTime = (double)timeGetTime();
00206 
00207     D3DXMatrixIdentity(&matRotate); 
00208     D3DXMatrixIdentity(&matTrans);  
00209     D3DXMatrixIdentity(&matTemp);
00210 }

~CDxVTXBaseView (  )  [virtual]

Definition at line 214 of file DxBaseClass.cpp.

References CExView::pApp, CDxVTXBaseView::ReleaseVB(), and CAppCallBack::ViewDestructor().

00215 {
00216     //DEBUG_INFO("DESTRUCTOR: CDxVTXBaseView\n");
00217     if (pApp!=NULL) pApp->ViewDestructor(this);     // 上位アプリケーションに通知
00218 
00219     ReleaseVB();
00220 }

Here is the call graph for this function:


Member Function Documentation

virtual void ExecRender ( void   )  [inline, virtual]

Reimplemented from CDxBaseView.

Reimplemented in CDxSRenderView.

Definition at line 195 of file DxBaseClass.h.

Referenced by CDxVTXBaseView::OnDraw(), and CDxVTXBaseView::OnTimer().

00195 {}               // 描画

Here is the caller graph for this function:

void ExecRotation ( void   )  [virtual]

回転処理 この関数の外で,matTrans(平行移動)が定義されていること. DirectInput は挙動が怪しいので使いたくない....

Definition at line 243 of file DxBaseClass.cpp.

References CExView::activeWin, CDxVTXBaseView::angle, CDxVTXBaseView::angleX, CDxVTXBaseView::angleY, CDxVTXBaseView::angleZ, CExView::ctrlMouse, CDxVTXBaseView::ExMouseWheel(), CDxVTXBaseView::ExRotationAngle(), CExView::GetMousePos(), CDxVTXBaseView::gTime, CDxBaseView::lpD3DDevice, CDxBaseView::lpDMouse, CDxVTXBaseView::lTime, CDxVTXBaseView::matRotate, CDxVTXBaseView::matRotateX, CDxVTXBaseView::matRotateY, CDxVTXBaseView::matRotateZ, CDxVTXBaseView::matTemp, CDxVTXBaseView::matTrans, CDxVTXBaseView::matWorld, CDxVTXBaseView::mWheelAc, CDxVTXBaseView::mWheelNotch, CDxVTXBaseView::rotation, CDxVTXBaseView::rTime, and CDxVTXBaseView::startTime.

Referenced by CDxVTXBaseView::OnDraw(), and CDxVTXBaseView::OnTimer().

00244 {
00245     HRESULT  hr;
00246 
00247     rTime = (double)timeGetTime() - startTime;
00248 
00249     if (rotation) {
00250         angle = angle + (rTime - gTime);
00251         D3DXMatrixRotationY(&matRotateY, (float)angle/(200.0f*10));
00252         D3DXMatrixRotationX(&matRotateX, (float)angle/(100.0f*10));
00253         matRotate = matTemp*matRotateX*matRotateY;
00254     }
00255 
00256     else {
00257         DIMOUSESTATE dims;
00258         double  mwheel = 0.0;
00259 
00260         if (lpDMouse!=NULL && activeWin) {
00261             lpDMouse->Acquire();
00262             hr = lpDMouse->GetDeviceState(sizeof(DIMOUSESTATE), &dims);
00263             if (SUCCEEDED(hr)) {
00264                 if (ctrlMouse) {    // ctrlMouse: マウスによる操作が可能かどうか.
00265                     mwheel = (double)dims.lZ;           // マウス ホイール移動量
00266                     if (dims.rgbButtons[0]==0x80) { 
00267                         POINT pt = GetMousePos();
00268                         if (pt.x>=0 && pt.y>=0) {
00269                             angleX = (double)dims.lX;   // マウス X移動量
00270                             angleY = (double)dims.lY;   // マウス Y移動量
00271                             ExRotationAngle();          // 呼び出し側の都合により角度を入れ替える.
00272                             lTime  = rTime - gTime;
00273                         }
00274                         else ctrlMouse = false;
00275                     }
00276                 }
00277                 if (dims.rgbButtons[0]!=0x80 && !ctrlMouse) {
00278                     POINT pt = GetMousePos();                       // クライアント領域内で左クリックすると
00279                     if (pt.x>=0 && pt.y>=0) ctrlMouse = true;       // マウスによる操作が可能に.
00280                 }                                            
00281             }
00282         }
00283         if (mwheel!=0.0) {
00284             mWheelAc = mWheelAc - mWheelNotch*mwheel/2000.f;
00285             ExMouseWheel();
00286         }
00287 
00288         D3DXMatrixRotationX(&matRotateX, (float)(angleX/150.0*((rTime-gTime)/lTime)));
00289         D3DXMatrixRotationY(&matRotateY, (float)(angleY/150.0*((rTime-gTime)/lTime)));
00290         D3DXMatrixRotationZ(&matRotateZ, (float)(angleZ/150.0*((rTime-gTime)/lTime)));
00291         matRotate = matTemp = matRotate*matRotateX*matRotateY*matRotateZ;
00292         angle = 0.0;
00293     }
00294     gTime = rTime;
00295 
00296     matWorld = matTrans*matRotate;
00297     lpD3DDevice->SetTransform(D3DTS_WORLD, &matWorld);
00298 }

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void ExMouseWheel ( void   )  [inline, virtual]

Reimplemented in CDxSRenderView.

Definition at line 204 of file DxBaseClass.h.

Referenced by CDxVTXBaseView::ExecRotation().

00204 {}             // マウスホイールによる操作の切り替え

Here is the caller graph for this function:

virtual void ExRotationAngle ( void   )  [inline, virtual]

Reimplemented in CDxSRenderView.

Definition at line 205 of file DxBaseClass.h.

Referenced by CDxVTXBaseView::ExecRotation().

00205 {}          // 回転方向の入れ替え

Here is the caller graph for this function:

virtual void InitObject ( void   )  [inline, virtual]

Reimplemented from CDxBaseView.

Reimplemented in CDxSRenderView.

Definition at line 196 of file DxBaseClass.h.

References CDxVTXBaseView::SetState().

00196 {SetState();}    // デバイスリセット時のリソース再獲得関数

Here is the call graph for this function:

void OnDraw ( CDC *  pDC  )  [protected, virtual]

Reimplemented from CExView.

Reimplemented in CDxSRenderView, and CDx3DDirectView.

Definition at line 318 of file DxBaseClass.cpp.

References CExView::clientRect, CExView::doReSize, CDxVTXBaseView::ExecRender(), CDxVTXBaseView::ExecRotation(), CExView::ExecWindowReSize(), CExView::hasViewData, and CExView::timerID.

00319 {
00320     if (hasViewData && timerID==-1) {
00321         if (doReSize) ExecWindowReSize(clientRect.right, clientRect.bottom);
00322         else          ExecRotation();
00323         ExecRender();
00324     }
00325     else if (!hasViewData) DEBUG_ERROR("CDxVTXBaseView::OnDraw(): ERROR: 表示可能なデータがありません\n");
00326 }

Here is the call graph for this function:

virtual void OnInitialUpdate ( void   )  [inline, virtual]

Reimplemented from CDxBaseView.

Reimplemented in CDxSRenderView, and CDx3DDirectView.

Definition at line 193 of file DxBaseClass.h.

00193 {}          // 初期化

void OnTimer ( UINT_PTR  nIDEvent  ) 

Reimplemented from CExView.

Definition at line 305 of file DxBaseClass.cpp.

References CExView::clientRect, CExView::doReSize, CDxVTXBaseView::ExecRender(), CDxVTXBaseView::ExecRotation(), CExView::ExecWindowReSize(), and CExView::hasViewData.

00306 {
00307     if (hasViewData) {
00308         if (doReSize) ExecWindowReSize(clientRect.right, clientRect.bottom);
00309         else          ExecRotation();
00310         ExecRender();
00311     }
00312     else  DEBUG_ERROR("CDxVTXBaseView::OnTimer(): ERROR: 表示可能なデータがありません\n");
00313     CDxBaseView::OnTimer(nIDEvent);
00314 }

Here is the call graph for this function:

virtual BOOL PrepareVB ( void   )  [inline, virtual]

Reimplemented in CDxSRenderView.

Definition at line 198 of file DxBaseClass.h.

00198 {return TRUE;}                    // 頂点バッファのセット

virtual void ReleaseVB ( void   )  [inline, virtual]

Definition at line 199 of file DxBaseClass.h.

References DXRELEASE, CDxVTXBaseView::lb, and CDxVTXBaseView::vb.

Referenced by CDxVTXBaseView::~CDxVTXBaseView().

00199 {DXRELEASE(vb); DXRELEASE(lb);}   // 頂点バッファの開放

Here is the caller graph for this function:

virtual void SetState ( void   )  [inline, virtual]

Reimplemented from CDxBaseView.

Reimplemented in CDxSRenderView.

Definition at line 194 of file DxBaseClass.h.

Referenced by CDxVTXBaseView::InitObject().

00194 {}               // 環境設定

Here is the caller graph for this function:

void SwitchRotation ( void   )  [virtual]

Definition at line 224 of file DxBaseClass.cpp.

References CDxVTXBaseView::angleX, CDxVTXBaseView::angleY, CDxVTXBaseView::angleZ, CDxVTXBaseView::gTime, CDxVTXBaseView::rotation, CDxVTXBaseView::rTime, and CDxVTXBaseView::startTime.

00225 {
00226     if (rotation) {
00227         rotation = false;
00228     }
00229     else {
00230         gTime = rTime = (double)timeGetTime() - startTime;
00231         rotation = true;
00232     }
00233     angleX = angleY = angleZ = 0.0;
00234 }


Member Data Documentation

double angle

Definition at line 179 of file DxBaseClass.h.

Referenced by CDxVTXBaseView::ExecRotation().

double angleX
double angleY
double angleZ
D3DXVECTOR3 center

Definition at line 176 of file DxBaseClass.h.

Referenced by CDxSRenderView::OnInitialUpdate(), and CDxSRenderView::SetState().

double gTime

Definition at line 178 of file DxBaseClass.h.

Referenced by CDxVTXBaseView::ExecRotation(), and CDxVTXBaseView::SwitchRotation().

LPDIRECT3DVERTEXBUFFER9 lb

Definition at line 171 of file DxBaseClass.h.

Referenced by CDxVTXBaseView::ReleaseVB().

double lTime

Definition at line 178 of file DxBaseClass.h.

Referenced by CDxVTXBaseView::ExecRotation().

D3DXMATRIX matProj

Definition at line 173 of file DxBaseClass.h.

Referenced by CDxSRenderView::SetState().

D3DXMATRIX matRotate

Definition at line 175 of file DxBaseClass.h.

Referenced by CDxVTXBaseView::ExecRotation().

D3DXMATRIX matRotateX

Definition at line 175 of file DxBaseClass.h.

Referenced by CDxVTXBaseView::ExecRotation().

D3DXMATRIX matRotateY

Definition at line 175 of file DxBaseClass.h.

Referenced by CDxVTXBaseView::ExecRotation().

D3DXMATRIX matRotateZ

Definition at line 175 of file DxBaseClass.h.

Referenced by CDxVTXBaseView::ExecRotation().

D3DXMATRIX matTemp

Definition at line 174 of file DxBaseClass.h.

Referenced by CDxVTXBaseView::ExecRotation().

D3DXMATRIX matTrans

Definition at line 174 of file DxBaseClass.h.

Referenced by CDxVTXBaseView::ExecRotation(), and CDxSRenderView::SetState().

D3DXMATRIX matView

Definition at line 173 of file DxBaseClass.h.

Referenced by CDxSRenderView::ExMouseWheel().

D3DXMATRIX matWorld

Definition at line 173 of file DxBaseClass.h.

Referenced by CDxVTXBaseView::ExecRotation().

double mWheelAc
double mWheelNotch

Definition at line 181 of file DxBaseClass.h.

Referenced by CDxVTXBaseView::ExecRotation().

bool reverseZ

Definition at line 183 of file DxBaseClass.h.

Referenced by CDxSRenderView::OnInitialUpdate(), and CDxSRenderView::PrepareVB().

bool rotation

Definition at line 182 of file DxBaseClass.h.

Referenced by CDxVTXBaseView::ExecRotation(), and CDxVTXBaseView::SwitchRotation().

double rTime

Definition at line 178 of file DxBaseClass.h.

Referenced by CDxVTXBaseView::ExecRotation(), and CDxVTXBaseView::SwitchRotation().

double startTime

Definition at line 178 of file DxBaseClass.h.

Referenced by CDxVTXBaseView::ExecRotation(), and CDxVTXBaseView::SwitchRotation().

LPDIRECT3DVERTEXBUFFER9 vb

The documentation for this class was generated from the following files:

Generated on 15 Nov 2023 for JunkBox_Win_Lib by  doxygen 1.6.1