#include <DxSRenderView.h>
Public Member Functions | |
virtual void | SetState () |
virtual BOOL | PrepareVB () |
virtual void | ExecRender () |
virtual void | ClearObject () |
virtual void | InitObject () |
virtual void | ExRotationAngle () |
virtual void | ExMouseWheel () |
int | GetValidVoxelNum () |
virtual void | OnInitialUpdate () |
Public Attributes | |
RBound< int > | Rbound |
CProgressBarDLG * | pCounter |
int | xsize |
int | ysize |
int | zsize |
int | msize |
int | datano |
BOOL | volumeColor |
Protected Member Functions | |
CDxSRenderView () | |
virtual void | OnDraw (CDC *pDC) |
virtual | ~CDxSRenderView () |
virtual void | AssertValid () const |
virtual void | Dump (CDumpContext &dc) const |
Definition at line 51 of file DxSRenderView.h.
CDxSRenderView | ( | ) | [protected] |
CDxSRenderView クラス (サーフェイスレンダリング)
CDxVTXBaseViewクラスからの継承クラス 対応する Document の msGraph (pDoc->msGraph) からデータを受け取り(cmnHeadではないので注意), (簡易)サーフェイスレンダリングを行い,DirectXの機能を使って 3D表示する.
3D表示する場合の色は,ボクセルの輝度値(16bit)に対して,ARGB16(各4bit) と解釈する.輝度値(16bit)の設定には uWord ARGB2Word(uWord a, uWord r, uWord g, uWord b) (要 include "Gdata.h") uWord RGBA2Word(uWord r, uWord g, uWord b, uWord a) (要 include "Gdata.h") uWord RGB2Word (uWord r, uWord g, uWord b) (要 include "Gdata.h") を使用すると良い.因みに逆の関数は D3DCOLOR Dx9Word2RGBA(uWord pp) (要 include "Dx9.h") D3DCOLOR Dx9Word2ARGB(uWord pp) (要 include "Dx9.h") D3DCOLOR Dx9Word2RGB (uWord pp) (要 include "Dx9.h")
Definition at line 46 of file DxSRenderView.cpp.
00047 { 00048 cnstXYRate = true; 00049 // rotation = true; 00050 pCounter = NULL; 00051 volumeColor = TRUE; 00052 }
~CDxSRenderView | ( | ) | [protected, virtual] |
Definition at line 56 of file DxSRenderView.cpp.
void AssertValid | ( | ) | const [protected, virtual] |
Reimplemented from CExView.
Definition at line 88 of file DxSRenderView.cpp.
00089 { 00090 CDxVTXBaseView::AssertValid(); 00091 }
void ClearObject | ( | void | ) | [virtual] |
Reimplemented from CDxBaseView.
Definition at line 484 of file DxSRenderView.cpp.
References CExView::hasViewData.
00485 { 00486 hasViewData = FALSE; 00487 // TimerStop(); 00488 }
void Dump | ( | CDumpContext & | dc | ) | const [protected, virtual] |
Reimplemented from CExView.
Definition at line 94 of file DxSRenderView.cpp.
00095 { 00096 CDxVTXBaseView::Dump(dc); 00097 }
void ExecRender | ( | void | ) | [virtual] |
Reimplemented from CDxVTXBaseView.
Definition at line 258 of file DxSRenderView.cpp.
References CDxBaseView::d3dParam, CDxSRenderView::datano, jbxwl::Dx9DrawPrimitive(), IDS_STR_FAIL_RESTR_DX9DEV, CDxBaseView::lpD3DDevice, CExView::pFrame, jbxwl::ResetDx9Device(), and CDxVTXBaseView::vb.
00259 { 00260 HRESULT hr; 00261 00262 // 画面のクリア 00263 hr = lpD3DDevice->Clear(0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0,0,96), 1.0f, 0); 00264 if (FAILED(hr)) { DEBUG_ERROR("CDxSRenderView::ExecRender(): ERROR: 画面クリアに失敗しました\n"); return;} 00265 00266 // シーンの描画開始 00267 hr = lpD3DDevice->BeginScene(); 00268 if (FAILED(hr)) { DEBUG_ERROR("CDxSRenderView::ExecRender(): ERROR: シーンの開始に失敗しました\n"); return;} 00269 00270 hr = lpD3DDevice->SetStreamSource(0, vb, 0, sizeof(SVERTEXV)); 00271 if (FAILED(hr)) { DEBUG_ERROR("CDxSRenderView::ExecRender(): ERROR: ストリームの設定に失敗しました\n"); lpD3DDevice->EndScene(); return;} 00272 00273 hr = Dx9DrawPrimitive(lpD3DDevice, D3DPT_POINTLIST, 1, datano); 00274 if (FAILED(hr)) { DEBUG_ERROR("CDxSRenderView::ExecRender(): ERROR: プリミティブ描画に失敗しました\n"); lpD3DDevice->EndScene(); return;} 00275 00276 hr = lpD3DDevice->EndScene(); 00277 if (FAILED(hr)) { DEBUG_ERROR("CDxSRenderView::ExecRender(): ERROR: シーンの終了に失敗しました\n"); return;} 00278 // シーンの描画終了 00279 00280 // 画面表示 00281 hr = lpD3DDevice->Present(NULL, NULL, NULL, NULL); 00282 if (FAILED(hr)) { // デバイスチェック 00283 // DEBUG_INFO("CDxSRenderView:ExecRender(): Resetting Device ....\n"); 00284 hr = ResetDx9Device(lpD3DDevice, &d3dParam, this); 00285 if (FAILED(hr)) { 00286 CString mesg; 00287 mesg.LoadString(IDS_STR_FAIL_RESTR_DX9DEV); 00288 MessageBox(_T("CDxSRenderView::ExecRender():\n\n") + mesg); 00289 pFrame->SendMessage(WM_CLOSE); 00290 //GetParentFrame()->DestroyWindow(); 00291 } 00292 } 00293 }
void ExMouseWheel | ( | void | ) | [virtual] |
Reimplemented from CDxVTXBaseView.
Definition at line 244 of file DxSRenderView.cpp.
References CDxBaseView::lpD3DDevice, CDxVTXBaseView::matView, CDxVTXBaseView::mWheelAc, and CExView::sizeFac.
Referenced by CDxSRenderView::SetState().
00245 { 00246 if (Xabs(mWheelAc)<1.0) mWheelAc = Sign(mWheelAc); 00247 00248 // カメラの制御: カメラの位置,物体の位置,カメラの上方向の傾き() 00249 D3DXMatrixLookAtLH(&matView, &D3DXVECTOR3(0.0f, (float)mWheelAc, 0.0f), &D3DXVECTOR3(0,0,0), &D3DXVECTOR3(0,0,1)); 00250 lpD3DDevice->SetTransform(D3DTS_VIEW, &matView); 00251 00252 double pointsize = sizeFac/Xabs(mWheelAc)*1000.0; 00253 lpD3DDevice->SetRenderState(D3DRS_POINTSIZE, *((DWORD*)&pointsize)); 00254 }
void ExRotationAngle | ( | void | ) | [virtual] |
Reimplemented from CDxVTXBaseView.
Definition at line 475 of file DxSRenderView.cpp.
References CDxVTXBaseView::angleX, CDxVTXBaseView::angleY, and CDxVTXBaseView::angleZ.
int GetValidVoxelNum | ( | ) |
Definition at line 501 of file DxSRenderView.cpp.
References CProgressBarDLG::isCanceled(), CExView::msGraph, CDxSRenderView::pCounter, and CProgressBarDLG::SetPos().
Referenced by CDxSRenderView::PrepareVB().
00502 { 00503 int i, j, k; 00504 int ii, jj, kk; 00505 int is, js, ks; 00506 int ie, je, ke; 00507 int cnt = 0; 00508 00509 for (k=0; k<msGraph.zs; k++) { 00510 for (j=0; j<msGraph.ys; j++) { 00511 for (i=0; i<msGraph.xs; i++) { 00512 bool chk = false; 00513 if (msGraph.point(i, j, k)!=0) { 00514 is = js = ks = -1; 00515 ie = je = ke = 1; 00516 00517 if (i==0 || i==msGraph.xs-1 || 00518 j==0 || j==msGraph.ys-1 || 00519 k==0 || k==msGraph.zs-1 ) chk = true; 00520 else { 00521 for (kk=ks; kk<=ke; kk++) 00522 for (jj=js; jj<=je; jj++) 00523 for (ii=is; ii<=ie; ii++) { 00524 if (msGraph.point(i+ii, j+jj, k+kk)==0) chk = true; 00525 } 00526 } 00527 } 00528 if (chk) cnt++; 00529 } 00530 } 00531 if (pCounter!=NULL) { 00532 pCounter->SetPos((k+1)*msGraph.xs*msGraph.ys); 00533 if (pCounter->isCanceled()) return -1; 00534 } 00535 } 00536 return cnt; 00537 }
void InitObject | ( | void | ) | [virtual] |
Reimplemented from CDxVTXBaseView.
Definition at line 492 of file DxSRenderView.cpp.
References CExView::hasViewData, and CDxSRenderView::SetState().
00493 { 00494 SetState(); 00495 // TimerStart(); 00496 hasViewData = TRUE; 00497 }
virtual void OnDraw | ( | CDC * | pDC | ) | [inline, protected, virtual] |
void OnInitialUpdate | ( | void | ) | [virtual] |
Reimplemented from CDxVTXBaseView.
Definition at line 106 of file DxSRenderView.cpp.
References CDxVTXBaseView::center, CExFrame::doneErrorMessage, jbxwl::Dx9ReverseZMode, CExView::hasViewData, IDS_STR_FAIL_GET_DX9DEV, CDxBaseView::InitDevice(), MSG_DEFAULT_WINDOW_SIZE, CExDocument::msGraph, CExView::msGraph, CDxSRenderView::msize, CExView::origXSize, CExView::origYSize, CExView::pDoc, CExView::pFrame, CDxSRenderView::PrepareVB(), CExDocument::preTitle, CExDocument::pstTitle, CDxSRenderView::Rbound, CDxVTXBaseView::reverseZ, CDxSRenderView::SetState(), CExView::SetTitle(), CExView::SetWindowSize(), CExView::sizeFac, CExView::sizeXYRate, CExDocument::Title, CExView::Title, CDxSRenderView::xsize, CDxSRenderView::ysize, and CDxSRenderView::zsize.
00107 { 00108 // CDxVTXBaseView::OnInitialUpdate(); 00109 00110 msGraph = pDoc->msGraph; 00111 if (msGraph.isNull()) return; 00112 00113 double rzxy = msGraph.RZxy; 00114 if (rzxy==0.0) rzxy = 1.0; 00115 00116 Rbound.xmax = msGraph.xs; 00117 Rbound.ymax = msGraph.ys; 00118 Rbound.zmax = (int)(msGraph.zs/rzxy+0.5); 00119 Rbound.xmin = Rbound.ymin = Rbound.zmin = 0; 00120 00121 center = D3DXVECTOR3((Rbound.xmax + Rbound.xmin)/2.f, 00122 (Rbound.ymax + Rbound.ymin)/2.f, 00123 (Rbound.zmax + Rbound.zmin)/2.f); 00124 xsize = Rbound.xmax - Rbound.xmin + 1; 00125 ysize = Rbound.ymax - Rbound.ymin + 1; 00126 zsize = Rbound.zmax - Rbound.zmin + 1; 00127 msize = Max(xsize, ysize); 00128 msize = Max(msize, zsize); 00129 00130 sizeFac = Min(sizeFac, 1.0/msize); 00131 00132 int dxsize = msize; 00133 if (dxsize<MSG_DEFAULT_WINDOW_SIZE) dxsize = MSG_DEFAULT_WINDOW_SIZE; 00134 if (Dx9ReverseZMode) reverseZ = true; 00135 else reverseZ = false; 00136 00137 BOOL rslt = InitDevice(dxsize, dxsize); 00138 if (!rslt) { 00139 CString mesg; 00140 mesg.LoadString(IDS_STR_FAIL_GET_DX9DEV); 00141 MessageBox(_T("CDxSRenderView::OnInitialUpdate():\n\n") + mesg); 00142 pFrame->doneErrorMessage = TRUE; 00143 return; 00144 } 00145 00146 if (!PrepareVB()) return; 00147 SetState(); 00148 00149 origXSize = MSG_DEFAULT_WINDOW_SIZE; 00150 origYSize = MSG_DEFAULT_WINDOW_SIZE; 00151 sizeXYRate = origYSize/(double)origXSize; 00152 00153 //DEBUG_INFO("CDxSRenderView::OnInitialUpdate():\n"); 00154 SetWindowSize(MSG_DEFAULT_WINDOW_SIZE, MSG_DEFAULT_WINDOW_SIZE); 00155 hasViewData = TRUE; 00156 00157 Title = pDoc->preTitle + pDoc->Title + pDoc->pstTitle; 00158 this->SetTitle(Title); 00159 00160 return; 00161 }
BOOL PrepareVB | ( | void | ) | [virtual] |
Reimplemented from CDxVTXBaseView.
Definition at line 298 of file DxSRenderView.cpp.
References CExFrame::cancelOperation, CDxSRenderView::datano, jbxwl::deleteNull(), CExFrame::doneErrorMessage, jbxwl::Dx9Word2ARGB(), jbxwl::Dx9Word2RGB(), jbxwl::Dx9Word2RGBA(), DXRELEASE, FVF_SVERTEXV, CDxSRenderView::GetValidVoxelNum(), IDD_PROGBAR, IDS_STR_CANCEL, IDS_STR_CANCEL_VERTEX_BUF_SET1, IDS_STR_CANCEL_VERTEX_BUF_SET2, IDS_STR_ERR_VERTEX_NUM, IDS_STR_ERROR, IDS_STR_FAIL_GET_VERTEX_BUF, IDS_STR_INFO, IDS_STR_INFO_VERTEX_ZERO, IDS_STR_PROC_VERTEX_BUF, CProgressBarDLG::isCanceled(), CDxBaseView::lpD3DDevice, CExView::msGraph, CDxSRenderView::pCounter, CExView::pFrame, CDxVTXBaseView::reverseZ, CProgressBarDLG::SetPos(), CExView::sizeFac, CProgressBarDLG::Start(), CProgressBarDLG::Stop(), jbxwl::ts2mbs(), CDxVTXBaseView::vb, and CDxSRenderView::volumeColor.
Referenced by CDxSRenderView::OnInitialUpdate().
00299 { 00300 int i, j, k; 00301 int x, y, z; 00302 int ii, jj, kk; 00303 int is, js, ks; 00304 int ie, je, ke; 00305 double rzxy; 00306 00307 // 新しいカウンタ 00308 pCounter = new CProgressBarDLG(IDD_PROGBAR, NULL, TRUE); 00309 if (pCounter!=NULL) { 00310 CString mesg; 00311 mesg.LoadString(IDS_STR_PROC_VERTEX_BUF); 00312 char* mbstr = ts2mbs(mesg); 00313 pCounter->Start(msGraph.xs*msGraph.ys*msGraph.zs*2, mbstr); 00314 ::free(mbstr); 00315 } 00316 00317 datano = GetValidVoxelNum(); 00318 if (datano<=0) { 00319 if (pCounter!=NULL) { 00320 pCounter->Stop(); 00321 deleteNull(pCounter); 00322 pFrame->cancelOperation = TRUE; 00323 pFrame->doneErrorMessage = TRUE; 00324 } 00325 CString mesg, noti; 00326 if (datano==-1) { 00327 mesg.LoadString(IDS_STR_CANCEL_VERTEX_BUF_SET1); 00328 noti.LoadString(IDS_STR_CANCEL); 00329 MessageBox(_T("CDxSRenderView::PrepareVB():\n\n") + mesg, noti); 00330 } 00331 else if (datano==0) { 00332 mesg.LoadString(IDS_STR_INFO_VERTEX_ZERO); 00333 noti.LoadString(IDS_STR_INFO); 00334 MessageBox(_T("CDxSRenderView::PrepareVB():\n\n") + mesg, noti); 00335 } 00336 else { 00337 mesg.LoadString(IDS_STR_ERR_VERTEX_NUM); 00338 noti.LoadString(IDS_STR_ERROR); 00339 MessageBox(_T("CDxSRenderView::PrepareVB():\n\n") + mesg, noti); 00340 } 00341 return FALSE; 00342 } 00343 00344 lpD3DDevice->CreateVertexBuffer(sizeof(SVERTEXV)*datano, 0, FVF_SVERTEXV, D3DPOOL_MANAGED, &vb, NULL); 00345 if (vb==NULL) { 00346 if (pCounter!=NULL) { 00347 pCounter->Stop(); 00348 deleteNull(pCounter); 00349 } 00350 CString mesg, noti; 00351 mesg.LoadString(IDS_STR_FAIL_GET_VERTEX_BUF); 00352 noti.LoadString(IDS_STR_ERROR); 00353 MessageBox(_T("CDxSRenderView::PrepareVB():\n\n") + mesg, noti); 00354 return FALSE; 00355 } 00356 00357 SVERTEXV *v; 00358 vb->Lock(0, 0, (void **)&v, 0); 00359 00360 rzxy = msGraph.RZxy; 00361 if (rzxy==0.0) rzxy = 1.0; 00362 00363 int cnt= 0; 00364 for (k=0; k<msGraph.zs; k++) { 00365 for (j=0; j<msGraph.ys; j++) { 00366 for (i=0; i<msGraph.xs; i++) { 00367 x = y = z = 0; 00368 bool chk = false; 00369 if (msGraph.point(i, j, k)!=0) { 00370 is = js = ks = -1; 00371 ie = je = ke = 1; 00372 00373 // 境界 00374 if (i==0) { is = 0; x = -10; chk = true;} // -9-1 00375 if (i==msGraph.xs-1) { ie = 0; x = 10; chk = true;} // 9+1 00376 if (j==0) { js = 0; y = -10; chk = true;} 00377 if (j==msGraph.ys-1) { je = 0; y = 10; chk = true;} 00378 if (k==0) { ks = 0; z = -10; chk = true;} 00379 if (k==msGraph.zs-1) { ke = 0; z = 10; chk = true; if (msGraph.zs==1) z = -10;} 00380 00381 // サーフェイスの判定 00382 for (kk=ks; kk<=ke; kk++) 00383 for (jj=js; jj<=je; jj++) 00384 for (ii=is; ii<=ie; ii++) { 00385 if (msGraph.point(i+ii, j+jj, k+kk)==0) { 00386 x = x + ii; 00387 y = y + jj; 00388 z = z + kk; 00389 chk = true; 00390 } 00391 } 00392 00393 // サーフェイス 00394 if (chk) { 00395 // 00396 v[cnt].ps = 3.5f; 00397 v[cnt].x = i*(float)sizeFac; 00398 v[cnt].y = j*(float)sizeFac; 00399 00400 if (reverseZ) v[cnt].z = -(msGraph.zs-1-k)*(float)(sizeFac/rzxy); // Z軸の反転 00401 else v[cnt].z = -k*(float)(sizeFac/rzxy); 00402 00403 int n2 = x*x + y*y + z*z; 00404 if (n2!=0) { 00405 float nn = (float)sqrt((double)n2); 00406 00407 v[cnt].nx = x/nn; 00408 v[cnt].ny = y/nn; 00409 00410 if (reverseZ) v[cnt].nz = z/nn; // Z軸の反転 00411 else v[cnt].nz = -z/nn; 00412 } 00413 // 00414 else { 00415 v[cnt].nx = -1.0f; 00416 v[cnt].ny = 1.0f; 00417 v[cnt].nz = 1.0f; 00418 } 00419 00420 if (volumeColor) { 00421 if (msGraph.color == GRAPH_COLOR_R4G4B4A4 || msGraph.color == GRAPH_COLOR_RGBA16) { 00422 v[cnt].color = Dx9Word2RGBA((uWord)msGraph.point(i, j, k)); 00423 } 00424 else if (msGraph.color == GRAPH_COLOR_A4R4G4B4 || msGraph.color == GRAPH_COLOR_ARGB16) { 00425 v[cnt].color = Dx9Word2ARGB((uWord)msGraph.point(i, j, k)); 00426 } 00427 else { 00428 v[cnt].color = Dx9Word2RGB((uWord)msGraph.point(i, j, k)); 00429 } 00430 } 00431 else { 00432 v[cnt].color = D3DCOLOR_RGBA(192, 192, 192, 192); 00433 } 00434 cnt++; 00435 } 00436 } 00437 } 00438 } 00439 00440 // カウンタ 00441 if (pCounter!=NULL) { 00442 pCounter->SetPos(msGraph.xs*msGraph.ys*msGraph.zs + (k+1)*msGraph.xs*msGraph.ys); 00443 if (pCounter->isCanceled()) { 00444 pCounter->Stop(); 00445 deleteNull(pCounter); 00446 vb->Unlock(); 00447 DXRELEASE(vb); 00448 00449 CString mesg, noti; 00450 mesg.LoadString(IDS_STR_CANCEL_VERTEX_BUF_SET2); 00451 mesg.LoadString(IDS_STR_CANCEL); 00452 MessageBox(_T("CDxSRenderView::PrepareVB():\n\n") + mesg, noti); 00453 00454 pFrame->cancelOperation = TRUE; 00455 pFrame->doneErrorMessage = TRUE; 00456 return FALSE; 00457 } 00458 } 00459 } 00460 00461 datano = cnt; 00462 vb->Unlock(); 00463 00464 if (pCounter!=NULL) { 00465 pCounter->Stop(); 00466 deleteNull(pCounter); 00467 } 00468 return TRUE; 00469 }
void SetState | ( | void | ) | [virtual] |
Reimplemented from CDxVTXBaseView.
Definition at line 165 of file DxSRenderView.cpp.
References CDxVTXBaseView::center, CDxSRenderView::ExMouseWheel(), FVF_SVERTEXV, CDxBaseView::lpD3DDevice, CDxVTXBaseView::matProj, CDxVTXBaseView::matTrans, CDxSRenderView::msize, CDxVTXBaseView::mWheelAc, and CExView::sizeFac.
Referenced by CDxSRenderView::InitObject(), and CDxSRenderView::OnInitialUpdate().
00166 { 00167 D3DLIGHT9 m_light; 00168 D3DXVECTOR3 mVecDir; 00169 // D3DMATERIAL9 m_material; 00170 D3DCAPS9 caps; 00171 00172 lpD3DDevice->GetDeviceCaps(&caps); 00173 // if (!(caps.FVFCaps & D3DFVFCAPS_PSIZE)) { 00174 // MessageBox("CDxSRenderView::SetState\n\nD3DFVF_PSIZE をサポートしていない"); 00175 // double pointsize = 3.0; 00176 // double pointsize = 4.0; 00177 // lpD3DDevice->SetRenderState(D3DRS_POINTSIZE, *((DWORD*)&pointsize)); 00178 // } 00179 00180 // Z バッファ有効化 00181 lpD3DDevice->SetRenderState(D3DRS_ZENABLE, TRUE); 00182 00183 // アルファブレンディング無効化 00184 lpD3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE); 00185 00186 // ポリゴンの両面を描画 00187 lpD3DDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE); 00188 00189 // フィルタ設定 00190 lpD3DDevice->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR); 00191 00192 // レンダリング時の色の計算方法の設定 00193 lpD3DDevice->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE); 00194 00195 // ライト 00196 lpD3DDevice->SetRenderState(D3DRS_LIGHTING, TRUE); 00197 ZeroMemory(&m_light, sizeof(D3DLIGHT9)); 00198 m_light.Type = D3DLIGHT_DIRECTIONAL; 00199 m_light.Diffuse.r = 1.0f; 00200 m_light.Diffuse.g = 1.0f; 00201 m_light.Diffuse.b = 1.0f; 00202 00203 // ライト0 の方向 00204 // mVecDir = D3DXVECTOR3(1.0f, -1.0f, -2.0f); 00205 mVecDir = D3DXVECTOR3(1.0f, -2.0f, -1.0f); 00206 // mVecDir = D3DXVECTOR3(1.0f, 2.0f, 1.0f); 00207 D3DXVec3Normalize((D3DXVECTOR3*)&m_light.Direction, &mVecDir); 00208 lpD3DDevice->SetLight(0, &m_light); 00209 lpD3DDevice->LightEnable(0, TRUE); 00210 00211 // ライト1 の方向 00212 // mVecDir = D3DXVECTOR3(1.0, 1.0, 1.0); 00213 // D3DXVec3Normalize((D3DXVECTOR3*)&m_light.Direction, &mVecDir); 00214 // lpD3DDevice->SetLight(1, &m_light); 00215 // lpD3DDevice->LightEnable(1, TRUE); 00216 // 00217 // ライト2 の方向 00218 // mVecDir = D3DXVECTOR3(-1.0, 1.0, -1.0); 00219 // D3DXVec3Normalize((D3DXVECTOR3*)&m_light.Direction, &mVecDir); 00220 // lpD3DDevice->SetLight(2, &m_light); 00221 // lpD3DDevice->LightEnable(2, TRUE); 00222 00223 // プロジェクション行列を設定: 視界 60度,近くの限界 0.1,遠くの限界 10*msize*sizeFac 00224 //D3DXMatrixPerspectiveFovLH(&matProj, (float)(60.0*PI/180.0), 1.0f, 0.1f, (float)(10.0*msize*sizeFac)); 00225 D3DXMatrixPerspectiveFovLH(&matProj, (float)(PI/3.0), 1.0f, 0.1f, (float)(10.0*msize*sizeFac)); 00226 lpD3DDevice->SetTransform(D3DTS_PROJECTION, &matProj); 00227 00228 // カメラの制御: カメラの位置,物体の位置,カメラの上方向の傾き() 00229 // D3DXMatrixLookAtLH(&matView, &D3DXVECTOR3(0,0,1.5f*msize*sizeFac), &D3DXVECTOR3(0,0,0), &D3DXVECTOR3(0,1,0)); 00230 // D3DXMatrixLookAtLH(&matView, &D3DXVECTOR3(0,-1.5f*msize*sizeFac,0), &D3DXVECTOR3(0,0,0), &D3DXVECTOR3(0,0,-1)); 00231 // lpD3DDevice->SetTransform(D3DTS_VIEW, &matView); 00232 if (mWheelAc==0.0) mWheelAc = 1.5*msize*sizeFac; 00233 ExMouseWheel(); 00234 00235 // 頂点フォーマット設定 00236 lpD3DDevice->SetFVF(FVF_SVERTEXV); 00237 00238 D3DXMatrixTranslation(&matTrans, -(float)(center.x*sizeFac), -(float)(center.y*sizeFac), (float)(center.z*sizeFac)); 00239 lpD3DDevice->SetTransform(D3DTS_WORLD, &matTrans); 00240 }
int datano |
Definition at line 67 of file DxSRenderView.h.
Referenced by CDxSRenderView::ExecRender(), and CDxSRenderView::PrepareVB().
int msize |
Definition at line 65 of file DxSRenderView.h.
Referenced by CDxSRenderView::OnInitialUpdate(), and CDxSRenderView::SetState().
Definition at line 60 of file DxSRenderView.h.
Referenced by CDxSRenderView::GetValidVoxelNum(), and CDxSRenderView::PrepareVB().
RBound<int> Rbound |
Definition at line 59 of file DxSRenderView.h.
Referenced by CDxSRenderView::OnInitialUpdate().
BOOL volumeColor |
Definition at line 69 of file DxSRenderView.h.
Referenced by CDxSRenderView::PrepareVB().
int xsize |
Reimplemented from CExView.
Definition at line 62 of file DxSRenderView.h.
Referenced by CDxSRenderView::OnInitialUpdate().
int ysize |
Reimplemented from CExView.
Definition at line 63 of file DxSRenderView.h.
Referenced by CDxSRenderView::OnInitialUpdate().
int zsize |
Reimplemented from CExView.
Definition at line 64 of file DxSRenderView.h.
Referenced by CDxSRenderView::OnInitialUpdate().