#include <3dvisView.h>
Public Methods | |
CMy3dvisDoc * | GetDocument () |
BOOL | InitGL () |
void | RenderScene () |
virtual void | OnDraw (CDC *pDC) |
virtual BOOL | PreCreateWindow (CREATESTRUCT &cs) |
virtual | ~CMy3dvisView () |
Public Attributes | |
HGLRC | m_hRC |
CDC * | m_pDC |
bool | m_bRendermode |
Protected Methods | |
CMy3dvisView () | |
afx_msg int | OnCreate (LPCREATESTRUCT lpCreateStruct) |
afx_msg void | OnSize (UINT nType, int cx, int cy) |
afx_msg void | OnDestroy () |
afx_msg void | OnTimer (UINT nIDEvent) |
afx_msg void | OnFileSaveImage () |
afx_msg void | OnRenderVolume () |
Private Methods | |
BOOL | SetupWindow () |
BOOL | SetupPixelFormat () |
Private Attributes | |
UINT | m_nTimerID |
int | m_width |
int | m_height |
|
Definition at line 50 of file 3dvisView.cpp.
00051 {
00052 // TODO: add construction code here
00053 }
|
|
Definition at line 55 of file 3dvisView.cpp.
00055 { 00056 } |
|
Definition at line 91 of file 3dvisView.h. Referenced by OnDraw().
00092 { return (CMy3dvisDoc*)m_pDocument; } |
|
Definition at line 160 of file 3dvisView.cpp. References m_nTimerID, and SetupWindow(). Referenced by OnCreate().
00160 { 00161 00162 if (!SetupWindow()) 00163 return FALSE; 00164 00165 00166 ::glClearColor(0.0f, 0.0f, 0.0f, 1.0f); 00167 00168 ::glClearDepth(1.0f); 00169 00170 ::glEnable(GL_DEPTH_TEST); 00171 00172 00173 m_nTimerID = SetTimer(1, 50, NULL); 00174 00175 ASSERT(m_nTimerID != NULL); 00176 00177 return TRUE; 00178 } |
|
Definition at line 217 of file 3dvisView.cpp. References InitGL().
00218 { 00219 if (CView::OnCreate(lpCreateStruct) == -1) 00220 return -1; 00221 00222 // TODO: Add your specialized creation code here 00223 InitGL(); 00224 00225 00226 return 0; 00227 } |
|
Definition at line 255 of file 3dvisView.cpp. References m_pDC.
00256 { 00257 CView::OnDestroy(); 00258 00259 // TODO: Add your message handler code here 00260 00261 if(::wglMakeCurrent (0,0) == FALSE) { 00262 MessageBox("Could not make RC non-current"); 00263 } 00264 00265 if(::wglDeleteContext (m_hRC)==FALSE) { 00266 MessageBox("Could not delete RC"); 00267 } 00268 00269 if(m_pDC) { 00270 delete m_pDC; 00271 } 00272 00273 m_pDC = NULL; 00274 00275 } |
|
Definition at line 72 of file 3dvisView.cpp. References GetDocument(), m_pDC, and RenderScene().
00073 { 00074 CMy3dvisDoc* pDoc = GetDocument(); 00075 ASSERT_VALID(pDoc); 00076 // TODO: add draw code for native data here 00077 00078 ::glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); 00079 00080 RenderScene(); 00081 00082 ::glFinish(); 00083 00084 ::SwapBuffers( m_pDC->GetSafeHdc() ); 00085 } |
|
Definition at line 289 of file 3dvisView.cpp. References _ImageData::cColorInfo, _ImageData::dBpp, _ImageData::dHeight, _ImageData::dSize, _ImageData::dWidth, Raycaster::GetScreenShotImage(), Slice::GetScreenShotImage(), _ImageData::pcImageData, raycaster, CTGALoader::SaveTgaImage(), and slice.
00290 { 00291 // TODO: Add your command handler code here 00292 if (!slice && !raycaster) 00293 return; 00294 00295 ImageData_t dat; 00296 dat.dBpp = 3; 00297 dat.cColorInfo = 0; 00298 00299 00300 if (!((CMy3dvisApp *)AfxGetApp())->m_bRenderVolume) 00301 dat.pcImageData = (unsigned char *)slice->GetScreenShotImage(dat.dWidth, dat.dHeight); 00302 else if (((CMy3dvisApp *)AfxGetApp())->m_bRenderVolume) 00303 dat.pcImageData = (unsigned char *)raycaster->GetScreenShotImage(dat.dWidth, dat.dHeight); 00304 00305 00306 dat.dSize = dat.dWidth * dat.dHeight * 3; 00307 00308 00309 CTGALoader screenShot; 00310 if (!screenShot.SaveTgaImage(((CMy3dvisApp *)AfxGetApp())->programPath, &dat)) 00311 MessageBox("couldn't take screenshot"); 00312 else 00313 MessageBox("screenshot saved"); 00314 } |
|
|
|
Definition at line 229 of file 3dvisView.cpp. References m_height, and m_width.
00230 { 00231 CView::OnSize(nType, cx, cy); 00232 00233 // TODO: Add your message handler code here 00234 if (cy == 0) { 00235 cy = 1; 00236 } 00237 00238 ::glViewport(0, 0, cx, cy); 00239 00240 00241 ::glMatrixMode(GL_PROJECTION); 00242 ::glLoadIdentity(); 00243 00244 // ::gluPerspective(45.0f, (GLfloat)cx/(GLfloat)cy, 0.1f, 100.0f); 00245 ::glOrtho(0.0f, cx, 0.0f, cy, -1.0, 1.0); 00246 00247 ::glMatrixMode(GL_MODELVIEW); 00248 ::glLoadIdentity(); 00249 00250 m_width = cx; 00251 m_height = cy; 00252 } |
|
Definition at line 277 of file 3dvisView.cpp. References m_pDC, and RenderScene().
00278 { 00279 // TODO: Add your message handler code here and/or call default 00280 ::glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); 00281 RenderScene(); 00282 ::glFinish(); 00283 ::SwapBuffers(m_pDC->GetSafeHdc()); 00284 00285 CView::OnTimer(nIDEvent); 00286 } |
|
Definition at line 59 of file 3dvisView.cpp.
00060 { 00061 // TODO: Modify the Window class or styles here by modifying 00062 // the CREATESTRUCT cs 00063 cs.style |= WS_CLIPSIBLINGS | WS_CLIPCHILDREN; 00064 00065 00066 return CView::PreCreateWindow(cs); 00067 } |
|
Definition at line 182 of file 3dvisView.cpp. References Slice::DrawSlice(), raycaster, Raycaster::Render(), and slice. Referenced by OnDraw(), and OnTimer().
00182 { 00183 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 00184 glLoadIdentity(); 00185 00186 if (!((CMy3dvisApp *)AfxGetApp())->m_bRenderVolume && slice) 00187 slice->DrawSlice(m_width, m_height); 00188 else if (((CMy3dvisApp *)AfxGetApp())->m_bRenderVolume && raycaster) 00189 raycaster->Render(m_width, m_height); 00190 } |
|
Definition at line 120 of file 3dvisView.cpp. References m_pDC. Referenced by SetupWindow().
00120 { 00121 static PIXELFORMATDESCRIPTOR pfd = { 00122 sizeof(PIXELFORMATDESCRIPTOR), 00123 1, 00124 PFD_DRAW_TO_WINDOW | 00125 PFD_SUPPORT_OPENGL | 00126 PFD_DOUBLEBUFFER, 00127 PFD_TYPE_RGBA, 00128 24, 00129 0, 0, 0, 0, 0, 0, 00130 0, 00131 0, 00132 0, 00133 0, 0, 0, 0, 00134 16, 00135 0, 00136 0, 00137 PFD_MAIN_PLANE, 00138 0, 00139 0, 0, 0 00140 }; 00141 00142 00143 int m_nPixelFormat = ::ChoosePixelFormat(m_pDC->GetSafeHdc(), &pfd); 00144 00145 if(m_nPixelFormat == 0) { 00146 return FALSE; 00147 } 00148 00149 if(::SetPixelFormat(m_pDC->GetSafeHdc(), m_nPixelFormat, &pfd) == FALSE) { 00150 return FALSE; 00151 } 00152 00153 return TRUE; 00154 } |
|
Definition at line 92 of file 3dvisView.cpp. References m_hRC, m_pDC, and SetupPixelFormat(). Referenced by InitGL().
00092 { 00093 m_pDC = new CClientDC(this); 00094 00095 if(m_pDC == NULL) { 00096 MessageBox("Error Obtaining DC"); 00097 return FALSE; 00098 } 00099 00100 if(!SetupPixelFormat()) { 00101 return FALSE; 00102 } 00103 00104 m_hRC = ::wglCreateContext(m_pDC->GetSafeHdc()); 00105 00106 if(m_hRC == 0) { 00107 MessageBox("Error Creating RC"); 00108 return FALSE; 00109 } 00110 00111 if(::wglMakeCurrent(m_pDC->GetSafeHdc(), m_hRC) == FALSE) { 00112 MessageBox("Error making RC Current"); 00113 return FALSE; 00114 } 00115 00116 return TRUE; 00117 } |
|
Definition at line 55 of file 3dvisView.h. |
|
Definition at line 32 of file 3dvisView.h. Referenced by OnSize(). |
|
Definition at line 47 of file 3dvisView.h. Referenced by SetupWindow(). |
|
Definition at line 26 of file 3dvisView.h. Referenced by InitGL(). |
|
Definition at line 48 of file 3dvisView.h. Referenced by OnDestroy(), OnDraw(), OnTimer(), SetupPixelFormat(), and SetupWindow(). |
|
Definition at line 31 of file 3dvisView.h. Referenced by OnSize(). |