From 6b60fe40c694a1dbcf61496bd92f279a73928a07 Mon Sep 17 00:00:00 2001 From: Siana Gearz Date: Thu, 18 Aug 2011 22:15:04 +0200 Subject: [PATCH] Crude port of megaregion mem corruption fix, by Rev --- indra/newview/llsurface.cpp | 1 + indra/newview/llviewerparcelmgr.cpp | 5 +---- indra/newview/llviewerregion.cpp | 12 ++++++------ indra/newview/llvlcomposition.cpp | 2 +- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/indra/newview/llsurface.cpp b/indra/newview/llsurface.cpp index 7a46305e4..6d40b57ab 100644 --- a/indra/newview/llsurface.cpp +++ b/indra/newview/llsurface.cpp @@ -176,6 +176,7 @@ void LLSurface::create(const S32 grids_per_edge, mNumberOfPatches = mPatchesPerEdge * mPatchesPerEdge; mMetersPerGrid = width / ((F32)(mGridsPerEdge - 1)); mMetersPerEdge = mMetersPerGrid * (mGridsPerEdge - 1); + sTextureSize = width; mOriginGlobal.setVec(origin_global); diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp index 1984df13c..fa216df28 100644 --- a/indra/newview/llviewerparcelmgr.cpp +++ b/indra/newview/llviewerparcelmgr.cpp @@ -139,9 +139,6 @@ LLViewerParcelMgr::LLViewerParcelMgr() mCollisionParcel = new LLParcel(); mBlockedImage = LLViewerTextureManager::getFetchedTextureFromFile("noentrylines.j2c"); mPassImage = LLViewerTextureManager::getFetchedTextureFromFile("noentrypasslines.j2c"); - - init(256); - } //moved this stuff out of the constructor and into a function that we can call again after we get the region size. @@ -149,7 +146,7 @@ LLViewerParcelMgr::LLViewerParcelMgr() //on a single grid properly - Patrick Sapinski (2/10/2011) void LLViewerParcelMgr::init(F32 region_size) { - mParcelsPerEdge = S32( REGION_WIDTH_METERS / PARCEL_GRID_STEP_METERS ); + mParcelsPerEdge = S32( region_size / PARCEL_GRID_STEP_METERS ); mHighlightSegments = new U8[(mParcelsPerEdge+1)*(mParcelsPerEdge+1)]; resetSegments(mHighlightSegments); diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index c4cbffdba..51a02a053 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -242,9 +242,9 @@ LLViewerRegion::LLViewerRegion(const U64 &handle, mCacheLoaded(FALSE), mCacheDirty(FALSE), mReleaseNotesRequested(FALSE), - mCapabilitiesReceived(false) + mCapabilitiesReceived(false), + mWidth(region_width_meters) { - mWidth = region_width_meters; mImpl->mOriginGlobal = from_region_handle(handle); updateRenderMatrix(); @@ -256,7 +256,7 @@ LLViewerRegion::LLViewerRegion(const U64 &handle, mImpl->mCompositionp = new LLVLComposition(mImpl->mLandp, grids_per_region_edge, - region_width_meters / grids_per_region_edge); + mWidth / grids_per_region_edge); mImpl->mCompositionp->setSurface(mImpl->mLandp); // Create the surfaces @@ -269,9 +269,9 @@ LLViewerRegion::LLViewerRegion(const U64 &handle, if (!gNoRender) { - mParcelOverlay = new LLViewerParcelOverlay(this, region_width_meters); - //Re-init the parcel mgr for this sim - LLViewerParcelMgr::getInstance()->init(region_width_meters); + mParcelOverlay = new LLViewerParcelOverlay(this, mWidth); + //Re-init the parcel mgr for this sim + LLViewerParcelMgr::getInstance()->init(mWidth); } else { diff --git a/indra/newview/llvlcomposition.cpp b/indra/newview/llvlcomposition.cpp index fa5970a7b..7b70548b8 100644 --- a/indra/newview/llvlcomposition.cpp +++ b/indra/newview/llvlcomposition.cpp @@ -163,7 +163,7 @@ BOOL LLVLComposition::generateHeights(const F32 x, const F32 y, const F32 xyScaleInv = (1.f / xyScale); const F32 zScaleInv = (1.f / zScale); - const F32 inv_width = 1.f/mWidth; + const F32 inv_width = 1.f/256.f; // OK, for now, just have the composition value equal the height at the point. for (S32 j = y_begin; j < y_end; j++)