Changeset 709
- Timestamp:
- 08/21/07 15:12:28 (16 months ago)
- Location:
- trunk
- Files:
-
- 2 removed
- 7 modified
-
common/algebra.h (modified) (1 diff)
-
common/lc_camera.cpp (modified) (2 diffs)
-
common/project.cpp (modified) (18 diffs)
-
common/tr.cpp (deleted)
-
common/tr.h (deleted)
-
common/view.cpp (modified) (3 diffs)
-
common/view.h (modified) (1 diff)
-
win/Cadview.cpp (modified) (4 diffs)
-
win/Terrwnd.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/common/algebra.h
r694 r709 769 769 Matrix44 CreateLookAtMatrix(const Vector3& Eye, const Vector3& Target, const Vector3& Up); 770 770 Matrix44 CreatePerspectiveMatrix(float FoVy, float Aspect, float Near, float Far); 771 Matrix44 CreateOrthoMatrix 44(float Left, float Right, float Bottom, float Top, float Near, float Far);771 Matrix44 CreateOrthoMatrix(float Left, float Right, float Bottom, float Top, float Near, float Far); 772 772 773 773 // ============================================================================ -
trunk/common/lc_camera.cpp
r700 r709 39 39 m_FOV = 30.0f; // TODO: animate FOV 40 40 41 SetOrtho(IsSide()); 41 42 SetVisible(CameraType == LC_CAMERA_USER); 42 43 } … … 340 341 void lcCamera::LoadProjection(float Aspect) 341 342 { 342 // FIXME: tiled rendering 343 // if (m_pTR != NULL) 344 // m_pTR->BeginTile(); 345 // else 346 { 347 glMatrixMode(GL_PROJECTION); 348 glLoadIdentity(); 349 350 if (IsOrtho()) 351 { 352 float ymax, ymin, xmin, xmax, znear, zfar; 353 Vector3 frontvec = Vector3(m_ViewWorld[2]);//m_Target - m_Eye; // FIXME: free ortho cameras = crash 354 ymax = (frontvec.Length())*sinf(DTOR*m_FOV/2); 355 ymin = -ymax; 356 xmin = ymin * Aspect; 357 xmax = ymax * Aspect; 358 znear = m_NearDist; 359 zfar = m_FarDist; 360 glOrtho(xmin, xmax, ymin, ymax, znear, zfar); 361 } 362 else 363 { 364 gluPerspective(m_FOV, Aspect, m_NearDist, m_FarDist); 365 } 343 glMatrixMode(GL_PROJECTION); 344 glLoadIdentity(); 345 346 if (IsOrtho()) 347 { 348 float ymax, ymin, xmin, xmax, znear, zfar; 349 Vector3 frontvec = Vector3(m_ViewWorld[2]);//m_Target - m_Eye; // FIXME: free ortho cameras = crash 350 ymax = (frontvec.Length())*sinf(DTOR*m_FOV/2); 351 ymin = -ymax; 352 xmin = ymin * Aspect; 353 xmax = ymax * Aspect; 354 znear = m_NearDist; 355 zfar = m_FarDist; 356 glOrtho(xmin, xmax, ymin, ymax, znear, zfar); 357 } 358 else 359 { 360 gluPerspective(m_FOV, Aspect, m_NearDist, m_FarDist); 366 361 } 367 362 -
trunk/common/project.cpp
r708 r709 1560 1560 RenderBackground(view); 1561 1561 1562 // Load the camera. 1563 float w = (float)view->GetWidth(); 1564 float h = (float)view->GetHeight(); 1565 float ratio = w/h; 1566 1567 view->GetCamera()->LoadProjection(ratio); 1562 // Setup the projection and camera matrices. 1563 Matrix44 Projection = view->GetProjectionMatrix(); 1564 1565 glMatrixMode(GL_PROJECTION); 1566 glLoadMatrixf(Projection); 1567 1568 glMatrixMode(GL_MODELVIEW); 1569 glLoadMatrixf(view->GetCamera()->m_WorldView); 1568 1570 1569 1571 // Render 3D objects. … … 1800 1802 1801 1803 Matrix44 ModelView = Camera->m_WorldView; 1802 Matrix44 Projection = CreatePerspectiveMatrix(Camera->m_FOV, Aspect, Camera->m_NearDist, Camera->m_FarDist);1804 Matrix44 Projection = view->GetProjectionMatrix(); 1803 1805 1804 1806 // Unproject edge center points to world space. 1805 int Viewport[4] = { 0, 0, view->GetWidth(), view->GetHeight() }, i;1806 1807 1807 Vector3 Points[10] = 1808 1808 { 1809 Vector3(0, (float) Viewport[3] / 2, 0),1810 Vector3(0, (float) Viewport[3] / 2, 1),1811 Vector3((float) Viewport[2] / 2, 0, 0),1812 Vector3((float) Viewport[2] / 2, 0, 1),1813 Vector3((float) Viewport[2], (float)Viewport[3] / 2, 0),1814 Vector3((float) Viewport[2], (float)Viewport[3] / 2, 1),1815 Vector3((float) Viewport[2] / 2, (float)Viewport[3], 0),1816 Vector3((float) Viewport[2] / 2, (float)Viewport[3], 1),1817 Vector3((float) Viewport[2] / 2, (float)Viewport[3] / 2, 0),1818 Vector3((float) Viewport[2] / 2, (float)Viewport[3] / 2, 1),1809 Vector3(0, (float)view->m_Viewport[3] / 2, 0), 1810 Vector3(0, (float)view->m_Viewport[3] / 2, 1), 1811 Vector3((float)view->m_Viewport[2] / 2, 0, 0), 1812 Vector3((float)view->m_Viewport[2] / 2, 0, 1), 1813 Vector3((float)view->m_Viewport[2], (float)view->m_Viewport[3] / 2, 0), 1814 Vector3((float)view->m_Viewport[2], (float)view->m_Viewport[3] / 2, 1), 1815 Vector3((float)view->m_Viewport[2] / 2, (float)view->m_Viewport[3], 0), 1816 Vector3((float)view->m_Viewport[2] / 2, (float)view->m_Viewport[3], 1), 1817 Vector3((float)view->m_Viewport[2] / 2, (float)view->m_Viewport[3] / 2, 0), 1818 Vector3((float)view->m_Viewport[2] / 2, (float)view->m_Viewport[3] / 2, 1), 1819 1819 }; 1820 1820 1821 UnprojectPoints(Points, 10, ModelView, Projection, Viewport);1821 UnprojectPoints(Points, 10, ModelView, Projection, view->m_Viewport); 1822 1822 1823 1823 // Intersect lines with base plane. 1824 1824 Vector3 Intersections[5]; 1825 int i; 1825 1826 1826 1827 for (i = 0; i < 5; i++) … … 2584 2585 GLdouble ScreenX, ScreenY, ScreenZ; 2585 2586 GLdouble ModelMatrix[16], ProjMatrix[16]; 2586 GLint Vp[4];2587 2587 2588 2588 glGetDoublev(GL_MODELVIEW_MATRIX, ModelMatrix); 2589 2589 glGetDoublev(GL_PROJECTION_MATRIX, ProjMatrix); 2590 glGetIntegerv(GL_VIEWPORT, Vp); 2591 2592 gluProject(0, 0, 0, ModelMatrix, ProjMatrix, Vp, &ScreenX, &ScreenY, &ScreenZ); 2590 2591 gluProject(0, 0, 0, ModelMatrix, ProjMatrix, m_ActiveView->m_Viewport, &ScreenX, &ScreenY, &ScreenZ); 2593 2592 2594 2593 glMatrixMode(GL_PROJECTION); 2595 2594 glPushMatrix(); 2596 2595 glLoadIdentity(); 2597 glOrtho( 0, Vp[2], 0, Vp[3], -1, 1);2596 glOrtho(m_ActiveView->m_Viewport[0], m_ActiveView->m_Viewport[2], m_ActiveView->m_Viewport[1], m_ActiveView->m_Viewport[3], -1, 1); 2598 2597 glMatrixMode(GL_MODELVIEW); 2599 2598 glPushMatrix(); … … 2614 2613 glBegin(GL_QUADS); 2615 2614 glColor3f(0.8f, 0.8f, 0.0f); 2616 m_pScreenFont->PrintText((float)ScreenX - Vp[0] - (cx / 2), (float)ScreenY - Vp[1] + (cy / 2), 0.0f, buf);2615 m_pScreenFont->PrintText((float)ScreenX - m_ActiveView->m_Viewport[0] - (cx / 2), (float)ScreenY - m_ActiveView->m_Viewport[1] + (cy / 2), 0.0f, buf); 2617 2616 glEnd(); 2618 2617 … … 6368 6367 GLdouble px, py, pz, rx, ry, rz; 6369 6368 GLdouble modelMatrix[16], projMatrix[16]; 6370 GLint viewport[4];6371 6369 6372 6370 m_ActiveView->LoadViewportProjection(); 6373 6371 glGetDoublev(GL_MODELVIEW_MATRIX,modelMatrix); 6374 6372 glGetDoublev(GL_PROJECTION_MATRIX,projMatrix); 6375 glGetIntegerv(GL_VIEWPORT,viewport);6376 6373 6377 6374 // Unproject the selected point against both the front and the back clipping plane 6378 gluUnProject(x, y, 0, modelMatrix, projMatrix, viewport, &px, &py, &pz);6379 gluUnProject(x, y, 1, modelMatrix, projMatrix, viewport, &rx, &ry, &rz);6375 gluUnProject(x, y, 0, modelMatrix, projMatrix, m_ActiveView->m_Viewport, &px, &py, &pz); 6376 gluUnProject(x, y, 1, modelMatrix, projMatrix, m_ActiveView->m_Viewport, &rx, &ry, &rz); 6380 6377 6381 6378 ClickRay.Start = Vector3((float)px, (float)py, (float)pz); … … 7336 7333 GLdouble modelMatrix[16], projMatrix[16], p1[3], p2[3], p3[3]; 7337 7334 float ax, ay; 7338 GLint viewport[4];7339 7335 7340 7336 glGetDoublev(GL_MODELVIEW_MATRIX, modelMatrix); 7341 7337 glGetDoublev(GL_PROJECTION_MATRIX, projMatrix); 7342 glGetIntegerv(GL_VIEWPORT, viewport); 7343 gluUnProject( 5, 5, 0.1, modelMatrix,projMatrix,viewport,&p1[0],&p1[1],&p1[2]); 7344 gluUnProject(10, 5, 0.1, modelMatrix,projMatrix,viewport,&p2[0],&p2[1],&p2[2]); 7345 gluUnProject( 5,10, 0.1, modelMatrix,projMatrix,viewport,&p3[0],&p3[1],&p3[2]); 7338 gluUnProject( 5, 5, 0.1, modelMatrix, projMatrix, m_ActiveView->m_Viewport, &p1[0], &p1[1], &p1[2]); 7339 gluUnProject(10, 5, 0.1, modelMatrix, projMatrix, m_ActiveView->m_Viewport, &p2[0], &p2[1], &p2[2]); 7340 gluUnProject( 5,10, 0.1, modelMatrix, projMatrix, m_ActiveView->m_Viewport, &p3[0], &p3[1], &p3[2]); 7346 7341 7347 7342 Vector3 vx = Normalize(Vector3((float)(p2[0] - p1[0]), (float)(p2[1] - p1[1]), 0));//p2[2] - p1[2] }; … … 7412 7407 { 7413 7408 GLdouble modelMatrix[16], projMatrix[16], point[3]; 7414 GLint viewport[4];7415 7409 7416 7410 if (m_nTracking != LC_TRACK_NONE) … … 7430 7424 glGetDoublev(GL_MODELVIEW_MATRIX, modelMatrix); 7431 7425 glGetDoublev(GL_PROJECTION_MATRIX, projMatrix); 7432 glGetIntegerv(GL_VIEWPORT, viewport); 7433 7434 gluUnProject(x, y, 0.9, modelMatrix, projMatrix, viewport, &point[0], &point[1], &point[2]); 7426 7427 gluUnProject(x, y, 0.9, modelMatrix, projMatrix, m_ActiveView->m_Viewport, &point[0], &point[1], &point[2]); 7435 7428 m_fTrack[0] = (float)point[0]; m_fTrack[1] = (float)point[1]; m_fTrack[2] = (float)point[2]; 7436 7429 … … 7605 7598 7606 7599 double tmp[3]; 7607 gluUnProject(x+1, y-1, 0.9, modelMatrix, projMatrix, viewport, &tmp[0], &tmp[1], &tmp[2]);7600 gluUnProject(x+1, y-1, 0.9, modelMatrix, projMatrix, m_ActiveView->m_Viewport, &tmp[0], &tmp[1], &tmp[2]); 7608 7601 7609 7602 StartTracking(LC_TRACK_START_LEFT); … … 7625 7618 { 7626 7619 double tmp[3]; 7627 gluUnProject(x+1, y-1, 0.9, modelMatrix, projMatrix, viewport, &tmp[0], &tmp[1], &tmp[2]);7620 gluUnProject(x+1, y-1, 0.9, modelMatrix, projMatrix, m_ActiveView->m_Viewport, &tmp[0], &tmp[1], &tmp[2]); 7628 7621 SelectAndFocusNone(false); 7629 7622 StartTracking(LC_TRACK_START_LEFT); … … 7694 7687 { 7695 7688 GLdouble modelMatrix[16], projMatrix[16], point[3]; 7696 GLint viewport[4];7697 7689 7698 7690 if (SetActiveView(view)) … … 7702 7694 glGetDoublev(GL_MODELVIEW_MATRIX, modelMatrix); 7703 7695 glGetDoublev(GL_PROJECTION_MATRIX, projMatrix); 7704 glGetIntegerv(GL_VIEWPORT, viewport);7705 7696 7706 7697 // why this is here ? 7707 gluUnProject(x, y, 0.9, modelMatrix, projMatrix, viewport, &point[0], &point[1], &point[2]);7698 gluUnProject(x, y, 0.9, modelMatrix, projMatrix, m_ActiveView->m_Viewport, &point[0], &point[1], &point[2]); 7708 7699 m_fTrack[0] = (float)point[0]; m_fTrack[1] = (float)point[1]; m_fTrack[2] = (float)point[2]; 7709 7700 … … 7759 7750 { 7760 7751 GLdouble modelMatrix[16], projMatrix[16], point[3]; 7761 GLint viewport[4];7762 7752 7763 7753 if (StopTracking(false)) … … 7774 7764 glGetDoublev(GL_MODELVIEW_MATRIX, modelMatrix); 7775 7765 glGetDoublev(GL_PROJECTION_MATRIX, projMatrix); 7776 glGetIntegerv(GL_VIEWPORT, viewport); 7777 7778 gluUnProject(x, y, 0.9, modelMatrix, projMatrix, viewport, &point[0], &point[1], &point[2]); 7766 7767 gluUnProject(x, y, 0.9, modelMatrix, projMatrix, m_ActiveView->m_Viewport, &point[0], &point[1], &point[2]); 7779 7768 m_fTrack[0] = (float)point[0]; m_fTrack[1] = (float)point[1]; m_fTrack[2] = (float)point[2]; 7780 7769 … … 7827 7816 7828 7817 GLdouble modelMatrix[16], projMatrix[16], tmp[3]; 7829 GLint viewport[4];7830 7818 float ptx, pty, ptz; 7831 7819 … … 7833 7821 glGetDoublev(GL_MODELVIEW_MATRIX, modelMatrix); 7834 7822 glGetDoublev(GL_PROJECTION_MATRIX, projMatrix); 7835 glGetIntegerv(GL_VIEWPORT, viewport); 7836 7837 gluUnProject(x, y, 0.9, modelMatrix, projMatrix, viewport, &tmp[0], &tmp[1], &tmp[2]); 7823 7824 gluUnProject(x, y, 0.9, modelMatrix, projMatrix, m_ActiveView->m_Viewport, &tmp[0], &tmp[1], &tmp[2]); 7838 7825 ptx = (float)tmp[0]; pty = (float)tmp[1]; ptz = (float)tmp[2]; 7839 7826 … … 7844 7831 int ptx = x, pty = y; 7845 7832 7846 if (ptx >= viewport[0] + viewport[2])7847 ptx = viewport[0] + viewport[2] - 1;7848 else if (ptx <= viewport[0])7849 ptx = viewport[0] + 1;7850 7851 if (pty >= viewport[1] + viewport[3])7852 pty = viewport[1] + viewport[3] - 1;7853 else if (pty <= viewport[1])7854 pty = viewport[1] + 1;7833 if (ptx >= m_ActiveView->m_Viewport[0] + m_ActiveView->m_Viewport[2]) 7834 ptx = m_ActiveView->m_Viewport[0] + m_ActiveView->m_Viewport[2] - 1; 7835 else if (ptx <= m_ActiveView->m_Viewport[0]) 7836 ptx = m_ActiveView->m_Viewport[0] + 1; 7837 7838 if (pty >= m_ActiveView->m_Viewport[1] + m_ActiveView->m_Viewport[3]) 7839 pty = m_ActiveView->m_Viewport[1] + m_ActiveView->m_Viewport[3] - 1; 7840 else if (pty <= m_ActiveView->m_Viewport[1]) 7841 pty = m_ActiveView->m_Viewport[1] + 1; 7855 7842 7856 7843 m_fTrack[0] = (float)ptx; … … 8497 8484 GLdouble px, py, pz, rx, ry, rz; 8498 8485 GLdouble ModelMatrix[16], ProjMatrix[16]; 8499 GLint Viewport[4];8500 8486 8501 8487 m_ActiveView->LoadViewportProjection(); 8502 8488 glGetDoublev(GL_MODELVIEW_MATRIX, ModelMatrix); 8503 8489 glGetDoublev(GL_PROJECTION_MATRIX, ProjMatrix); 8504 glGetIntegerv(GL_VIEWPORT, Viewport);8505 8490 8506 8491 // Unproject the mouse point against both the front and the back clipping planes. 8507 gluUnProject(x, y, 0, ModelMatrix, ProjMatrix, Viewport, &px, &py, &pz);8508 gluUnProject(x, y, 1, ModelMatrix, ProjMatrix, Viewport, &rx, &ry, &rz);8492 gluUnProject(x, y, 0, ModelMatrix, ProjMatrix, m_ActiveView->m_Viewport, &px, &py, &pz); 8493 gluUnProject(x, y, 1, ModelMatrix, ProjMatrix, m_ActiveView->m_Viewport, &rx, &ry, &rz); 8509 8494 8510 8495 Vector3 SegStart((float)rx, (float)ry, (float)rz); -
trunk/common/view.cpp
r708 r709 146 146 GLWindow::OnSize(cx, cy); 147 147 148 m_Viewport[0] = 0; 149 m_Viewport[1] = 0; 150 m_Viewport[2] = cx; 151 m_Viewport[3] = cy; 152 148 153 UpdateOverlayScale(); 154 } 155 156 Matrix44 View::GetProjectionMatrix() const 157 { 158 if (!m_Camera) 159 return IdentityMatrix44(); 160 161 float Aspect = (float)m_nWidth/(float)m_nHeight; 162 163 if (m_Camera->IsOrtho()) 164 { 165 float ymax, ymin, xmin, xmax, znear, zfar; 166 Vector3 frontvec = Vector3(m_Camera->m_ViewWorld[2]);//m_Target - m_Eye; // FIXME: free ortho cameras = crash 167 ymax = (frontvec.Length())*sinf(DTOR*m_Camera->m_FOV/2); 168 ymin = -ymax; 169 xmin = ymin * Aspect; 170 xmax = ymax * Aspect; 171 znear = m_Camera->m_NearDist; 172 zfar = m_Camera->m_FarDist; 173 return CreateOrthoMatrix(xmin, xmax, ymin, ymax, znear, zfar); 174 } 175 else 176 return CreatePerspectiveMatrix(m_Camera->m_FOV, Aspect, m_Camera->m_NearDist, m_Camera->m_FarDist); 149 177 } 150 178 … … 163 191 GLdouble ScreenX, ScreenY, ScreenZ, PointX, PointY, PointZ; 164 192 GLdouble ModelMatrix[16], ProjMatrix[16]; 165 GLint Viewport[4];166 193 167 194 LoadViewportProjection(); 168 195 glGetDoublev(GL_MODELVIEW_MATRIX, ModelMatrix); 169 196 glGetDoublev(GL_PROJECTION_MATRIX, ProjMatrix); 170 glGetIntegerv(GL_VIEWPORT, Viewport);171 197 172 198 const Vector3& Center = m_Project->GetOverlayCenter(); … … 174 200 // Calculate the scaling factor by projecting the center to the front plane then 175 201 // projecting a point close to it back. 176 gluProject(Center[0], Center[1], Center[2], ModelMatrix, ProjMatrix, Viewport, &ScreenX, &ScreenY, &ScreenZ);177 gluUnProject(ScreenX + 10.0f, ScreenY, ScreenZ, ModelMatrix, ProjMatrix, Viewport, &PointX, &PointY, &PointZ);202 gluProject(Center[0], Center[1], Center[2], ModelMatrix, ProjMatrix, m_Viewport, &ScreenX, &ScreenY, &ScreenZ); 203 gluUnProject(ScreenX + 10.0f, ScreenY, ScreenZ, ModelMatrix, ProjMatrix, m_Viewport, &PointX, &PointY, &PointZ); 178 204 179 205 Vector3 Dist((float)PointX - Center[0], (float)PointY - Center[1], (float)PointZ - Center[2]); -
trunk/common/view.h
r673 r709 35 35 void SetCamera(lcCamera* cam); 36 36 void UpdateCamera(); 37 Matrix44 GetProjectionMatrix() const; 37 38 38 39 public: 39 40 float m_OverlayScale; 40 41 41 protected: 42 Project* m_Project; 43 42 int m_Viewport[4]; 44 43 lcCamera* m_Camera; 45 44 String m_CameraName; 45 46 Project* m_Project; // TODO: remove m_Project. 46 47 }; 47 48 -
trunk/win/Cadview.cpp
r678 r709 231 231 int tw = pw, th = ph; // tile size 232 232 233 MEMORYSTATUS MemStat; 234 MemStat.dwLength = sizeof(MEMORYSTATUS); 235 GlobalMemoryStatus(&MemStat); 236 237 if (DWORD(pw*ph*3) > MemStat.dwTotalPhys) 238 { 239 tw = 512; 240 th = 512; 241 } 233 if (tw > 1024 || th > 1024) 234 tw = th = 1024; 242 235 243 236 HDC hMemDC = CreateCompatibleDC(GetDC()->m_hDC); … … 310 303 if (tw != pw) 311 304 { 312 /* FIXME tiled rendering 313 lcCamera* pCam = view.GetCamera(); 314 pCam->StartTiledRendering(tw, th, pw, ph, viewaspect); 315 do 305 lcCamera* Camera = view.GetCamera(); 306 307 int CurrentTile = 0; 308 int TileWidth = tw; 309 int TileHeight = th; 310 int ImageWidth = pw; 311 int ImageHeight = ph; 312 int Columns = (ImageWidth + TileWidth - 1) / TileWidth; 313 int Rows = (ImageHeight + TileHeight - 1) / TileHeight; 314 float xmin, xmax, ymin, ymax; 315 ymax = Camera->m_NearDist * tan(Camera->m_FOV * 3.14159265f / 360.0f); 316 ymin = -ymax; 317 xmin = ymin * viewaspect; 318 xmax = ymax * viewaspect; 319 320 for (;;) 316 321 { 317 project->Render(&view, false, false); 322 int CurrentTileWidth, CurrentTileHeight; 323 324 // which tile (by row and column) we're about to render 325 int CurrentRow = CurrentTile / Columns; 326 int CurrentColumn = CurrentTile % Columns; 327 328 // Compute actual size of this tile with border 329 if (CurrentRow < Rows-1) 330 CurrentTileHeight = TileHeight; 331 else 332 CurrentTileHeight = ImageHeight - (Rows-1) * (TileHeight); 333 334 if (CurrentColumn < Columns-1) 335 CurrentTileWidth = TileWidth; 336 else 337 CurrentTileWidth = ImageWidth - (Columns-1) * (TileWidth); 338 339 glViewport(0, 0, CurrentTileWidth, CurrentTileHeight); 340 341 project->RenderBackground(&view); 342 343 float left, right, bottom, top; 344 345 glMatrixMode(GL_PROJECTION); 346 glLoadIdentity(); 347 348 // Compute projection parameters. 349 left = xmin + (xmax - xmin) * (CurrentColumn * TileWidth) / ImageWidth; 350 right = left + (xmax - xmin) * CurrentTileWidth / ImageWidth; 351 bottom = ymin + (ymax - ymin) * (CurrentRow * TileHeight) / ImageHeight; 352 top = bottom + (ymax - ymin) * CurrentTileHeight / ImageHeight; 353 354 glFrustum(left, right, bottom, top, Camera->m_NearDist, Camera->m_FarDist); 355 356 glMatrixMode(GL_MODELVIEW); 357 glLoadMatrixf(view.GetCamera()->m_WorldView); 358 359 project->RenderScene(&view); 318 360 glFinish(); 319 int tr, tc, ctw, cth; 320 pCam->GetTileInfo(&tr, &tc, &ctw, &cth); 361 362 int ctw = CurrentTileWidth; 363 int cth = CurrentTileHeight; 364 int tr = Rows - CurrentRow - 1; 365 int tc = CurrentColumn; 321 366 322 367 lpbi = (LPBITMAPINFOHEADER)GlobalLock(MakeDib(hBm, 24)); … … 327 372 328 373 pDC->SetStretchBltMode(COLORONCOLOR); 329 StretchDIBits(pDC->m_hDC, rc.left+1+(w*c)+mx + tc*tw, rc.top+1+(h*r)+my + tr*th , ctw, cth, 0, 0, ctw, cth,374 StretchDIBits(pDC->m_hDC, rc.left+1+(w*c)+mx + tc*tw, rc.top+1+(h*r)+my + tr*th+th-cth, ctw, cth, 0, 0, ctw, cth, 330 375 (LPBYTE) lpbi + lpbi->biSize + lpbi->biClrUsed * sizeof(RGBQUAD), &bi, DIB_RGB_COLORS, SRCCOPY); 331 376 if (lpbi) GlobalFreePtr(lpbi); 332 } while (pCam->EndTile()); 333 */ 377 378 // Increment tile counter. 379 CurrentTile++; 380 if (CurrentTile >= Rows * Columns) 381 break; 382 } 334 383 } 335 384 else … … 347 396 if (lpbi) GlobalFreePtr(lpbi); 348 397 } 349 350 // OpenGL Rendering351 // CCamera* pOld = pDoc->GetActiveCamera();352 // pDoc->m_ViewCameras[pDoc->m_nActiveViewport] = pDoc->GetCamera(CAMERA_MAIN);353 // pDoc->m_ViewCameras[pDoc->m_nActiveViewport] = pOld;354 398 355 399 DWORD dwPrint = theApp.GetProfileInt("Settings","Print", PRINT_NUMBERS|PRINT_BORDER); -
trunk/win/Terrwnd.cpp
r681 r709 83 83 glViewport(0, 0, m_szView.cx, m_szView.cy); 84 84 85 m_pCamera->LoadProjection(aspect); 85 Matrix44 Projection = CreatePerspectiveMatrix(m_pCamera->m_FOV, aspect, m_pCamera->m_NearDist, m_pCamera->m_FarDist); 86 87 glMatrixMode(GL_PROJECTION); 88 glLoadMatrixf(Projection); 89 90 glMatrixMode(GL_MODELVIEW); 91 glLoadMatrixf(m_pCamera->m_WorldView); 86 92 87 93 m_pTerrain->Render(m_pCamera, aspect);
