Guest User

Untitled

a guest
Aug 10th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.00 KB | None | 0 0
  1. diff --git a/source/camera/CullingManager.cpp b/source/camera/CullingManager.cpp
  2. index 4b7af2c7..55c6ec7d 100644
  3. --- a/source/camera/CullingManager.cpp
  4. +++ b/source/camera/CullingManager.cpp
  5. @@ -135,11 +135,7 @@ void CullingManager::newBashAndSplashTiles(uint32_t mode)
  6. int64_t xxRight = mWalk.getTopRightVertex().x;
  7. int64_t xxp, yyp;
  8. std::stringstream ss;
  9. - // NOTE(oyvindln): Added code to avoid shifting a negative number here, not sure if it's correct.
  10. - int64_t bb = std::max(
  11. - (std::max(std::min(mWalk.getBottomLeftVertex().y, mOldWalk.getBottomRightVertex().y), 0L)
  12. - >> VectorInt64::PRECISION_DIGITS) - 2
  13. - ,0L) << VectorInt64::PRECISION_DIGITS;
  14. + int64_t bb = ((std::min(mWalk.getBottomLeftVertex().y, mOldWalk.getBottomRightVertex().y) >> VectorInt64::PRECISION_DIGITS) - 2) << VectorInt64::PRECISION_DIGITS;
  15.  
  16. for (int64_t yy = ((std::max(mWalk.getTopLeftVertex().y, mOldWalk.getTopRightVertex().y ) >> VectorInt64::PRECISION_DIGITS) + 2) << VectorInt64::PRECISION_DIGITS; yy >= bb; yy -= VectorInt64::UNIT)
  17. {
  18. @@ -149,9 +145,8 @@ void CullingManager::newBashAndSplashTiles(uint32_t mode)
  19. xxLeftOld = mOldWalk.getCurrentXLeft(yy);
  20. xxRight = mWalk.getCurrentXRight(yy);
  21. xxRightOld = mOldWalk.getCurrentXRight(yy);
  22. + int64_t mm = ((std::min(xxLeft, xxLeftOld) >> VectorInt64::PRECISION_DIGITS) << VectorInt64::PRECISION_DIGITS) ;
  23.  
  24. - // NOTE(oyvindln): Added code to avoid shifting a negative number here, not sure if it's correct.
  25. - int64_t mm = (std::max(std::min(xxLeft, xxLeftOld),0L) >> VectorInt64::PRECISION_DIGITS) << VectorInt64::PRECISION_DIGITS;
  26. if(std::min(xxLeft, xxLeftOld) < std::max(xxRight,xxRightOld))
  27. {
  28. for (int64_t xx = mm ; xx <= std::max(xxRight,xxRightOld); xx += VectorInt64::UNIT)
  29. @@ -205,8 +200,8 @@ bool CullingManager::computeIntersectionPoints(Ogre::Camera* camera, std::vector
  30.  
  31. void CullingManager::update(Ogre::Camera* camera, const std::vector<Ogre::Vector3>& ogreVectors)
  32. {
  33. - /*if(mCullTilesFlag)
  34. - cullTiles(ogreVectors);*/
  35. + if(mCullTilesFlag)
  36. + cullTiles(ogreVectors);
  37. }
  38.  
  39. /*! \brief Sort two VectorInt64 p1 and p2 to satisfy p1 <= p2 according to
  40. diff --git a/source/camera/SlopeWalk.cpp b/source/camera/SlopeWalk.cpp
  41. index f09715ef..0ad3b94b 100644
  42. --- a/source/camera/SlopeWalk.cpp
  43. +++ b/source/camera/SlopeWalk.cpp
  44. @@ -62,13 +62,7 @@ void SlopeWalk::buildSlopes()
  45. for(int ii = mTopRightIndex; ii != mDownRightIndex ; ++ii, ii %= mVertices.mMyArray.size())
  46. {
  47. int64_t divisor = mVertices[ii].y - mVertices[ii+1].y;
  48. - // NOTE(oyvindln): Avoid divide by zero.
  49. - if(divisor == 0) {
  50. - break;
  51. - }
  52. -
  53. mRightSlopes.push_back((mVertices[ii].x - mVertices[ii+1].x) * VectorInt64::UNIT / divisor);
  54. -
  55. mRightVertices.push_back(ii);
  56.  
  57. }
  58. @@ -82,9 +76,6 @@ void SlopeWalk::buildSlopes()
  59. for(int ii = mTopLeftIndex; ii != mDownLeftIndex ; ii+=mVertices.mMyArray.size() - 1, ii%=mVertices.mMyArray.size())
  60. {
  61. int64_t divisor = mVertices[ii].y - mVertices[ii-1].y;
  62. - if(divisor == 0) {
  63. - break;
  64. - }
  65. mLeftSlopes.push_back((mVertices[ii].x - mVertices[ii-1].x) * VectorInt64::UNIT / divisor);
  66. mLeftVertices.push_back(ii);
  67. }
  68. diff --git a/source/entities/Tile.cpp b/source/entities/Tile.cpp
  69. index 897d0001..93449b1b 100644
  70. --- a/source/entities/Tile.cpp
  71. +++ b/source/entities/Tile.cpp
  72. @@ -66,7 +66,7 @@ Tile::Tile(GameMap* gameMap, int x, int y, TileType type, double fullness) :
  73. mColorCustomMesh (true),
  74. mHasBridge (false),
  75. mLocalPlayerHasVision (false),
  76. - mTileCulling (CullingType::SHOW_ALL),
  77. + mTileCulling (CullingType::HIDE),
  78. mNbWorkersClaiming(0)
  79. {
  80. computeTileVisual();
  81. diff --git a/source/gamemap/MiniMapCamera.cpp b/source/gamemap/MiniMapCamera.cpp
  82. index 3701a3f8..0cd0a4aa 100644
  83. --- a/source/gamemap/MiniMapCamera.cpp
  84. +++ b/source/gamemap/MiniMapCamera.cpp
  85. @@ -82,7 +82,7 @@ MiniMapCamera::MiniMapCamera(CEGUI::Window* miniMapWindow) :
  86. mMiniMapCam->setNearClipDistance(0.02f);
  87. mMiniMapCam->setFarClipDistance(300.0f);
  88. mMiniMapCam->setFOVy(ANGLE_CAM);
  89. -
  90. + mMiniMapCamNode->attachObject(mMiniMapCam);
  91. Ogre::RenderTarget* rt = mMiniMapOgreTexture->getBuffer()->getRenderTarget();
  92. rt->addListener(this);
  93. rt->setAutoUpdated(false);
  94. @@ -109,8 +109,8 @@ MiniMapCamera::MiniMapCamera(CEGUI::Window* miniMapWindow) :
  95. mHeight = mMiniMapWindow->getUnclippedOuterRect().get().getSize().d_height;
  96.  
  97. updateMinimapCamera();
  98. - //mCullingManager->computeIntersectionPoints(mMiniMapCam, mCameraTilesIntersections);
  99. - //mCullingManager->startTileCulling(mMiniMapCam, mCameraTilesIntersections);
  100. + mCullingManager->computeIntersectionPoints(mMiniMapCam, mCameraTilesIntersections);
  101. + mCullingManager->startTileCulling(mMiniMapCam, mCameraTilesIntersections);
  102. }
  103.  
  104. MiniMapCamera::~MiniMapCamera()
  105. @@ -157,8 +157,8 @@ void MiniMapCamera::update(Ogre::Real timeSinceLastFrame, const std::vector<Ogre
  106.  
  107. mElapsedTime = 0;
  108. updateMinimapCamera();
  109. - //mCullingManager->computeIntersectionPoints(mMiniMapCam, mCameraTilesIntersections);
  110. - //mCullingManager->update(mMiniMapCam, mCameraTilesIntersections);
  111. + mCullingManager->computeIntersectionPoints(mMiniMapCam, mCameraTilesIntersections);
  112. + mCullingManager->update(mMiniMapCam, mCameraTilesIntersections);
  113.  
  114. Ogre::RenderTarget* rt = mMiniMapOgreTexture->getBuffer()->getRenderTarget();
  115. rt->update();
  116. @@ -173,7 +173,7 @@ void MiniMapCamera::updateMinimapCamera()
  117. const Ogre::Quaternion& orientation = mCameraManager.getActiveCameraNode()->getOrientation();
  118. mMiniMapCamNode->setPosition(mCurCamPosX, mCurCamPosY, CAM_HEIGHT);
  119. mMiniMapCamNode->lookAt(Ogre::Vector3(mCurCamPosX, mCurCamPosY, 0.0),
  120. - Ogre::Node::TransformSpace::TS_LOCAL);
  121. + Ogre::Node::TransformSpace::TS_WORLD);
  122. mMiniMapCamNode->roll(orientation.getRoll());
  123. }
Add Comment
Please, Sign In to add comment