diff --git a/indra/llcommon/indra_constants.h b/indra/llcommon/indra_constants.h index 815145ac8..089f8ed38 100644 --- a/indra/llcommon/indra_constants.h +++ b/indra/llcommon/indra_constants.h @@ -153,6 +153,11 @@ const char LAND_LAYER_CODE = 'L'; const char WATER_LAYER_CODE = 'W'; const char WIND_LAYER_CODE = '7'; const char CLOUD_LAYER_CODE = '8'; +// Extended land layer for Aurora Sim +const char AURORA_LAND_LAYER_CODE = 'M'; +const char AURORA_WATER_LAYER_CODE = 'X'; +const char AURORA_WIND_LAYER_CODE = '9'; +const char AURORA_CLOUD_LAYER_CODE = ':'; // keys // Bit masks for various keyboard modifier keys. diff --git a/indra/llinventory/llparcel.h b/indra/llinventory/llparcel.h index 7d92d4b37..74491bd4c 100644 --- a/indra/llinventory/llparcel.h +++ b/indra/llinventory/llparcel.h @@ -70,6 +70,7 @@ const F32 PARCEL_PASS_HOURS_DEFAULT = 1.f; // Number of "chunks" in which parcel overlay data is sent // Chunk 0 = southern rows, entire width +// NOTE: NOT USABLE FOR VAR SIZED REGIONS! const S32 PARCEL_OVERLAY_CHUNKS = 4; // Bottom three bits are a color index for the land overlay diff --git a/indra/llmessage/message_prehash.cpp b/indra/llmessage/message_prehash.cpp index 892547cab..855d1cccf 100644 --- a/indra/llmessage/message_prehash.cpp +++ b/indra/llmessage/message_prehash.cpp @@ -588,6 +588,8 @@ char* _PREHASH_LastName = LLMessageStringTable::getInstance()->getString("LastNa char* _PREHASH_From = LLMessageStringTable::getInstance()->getString("From"); char* _PREHASH_RoleChange = LLMessageStringTable::getInstance()->getString("RoleChange"); char* _PREHASH_Port = LLMessageStringTable::getInstance()->getString("Port"); +char* _PREHASH_RegionSizeX = LLMessageStringTable::getInstance()->getString("RegionSizeX"); +char* _PREHASH_RegionSizeY = LLMessageStringTable::getInstance()->getString("RegionSizeY"); char* _PREHASH_MemberTitle = LLMessageStringTable::getInstance()->getString("MemberTitle"); char* _PREHASH_LogParcelChanges = LLMessageStringTable::getInstance()->getString("LogParcelChanges"); char* _PREHASH_AgentCachedTextureResponse = LLMessageStringTable::getInstance()->getString("AgentCachedTextureResponse"); diff --git a/indra/llmessage/message_prehash.h b/indra/llmessage/message_prehash.h index 4bf89e513..77cfe710a 100644 --- a/indra/llmessage/message_prehash.h +++ b/indra/llmessage/message_prehash.h @@ -588,6 +588,8 @@ extern char * _PREHASH_LastName; extern char * _PREHASH_From; extern char * _PREHASH_RoleChange; extern char * _PREHASH_Port; +extern char * _PREHASH_RegionSizeX; +extern char * _PREHASH_RegionSizeY; extern char * _PREHASH_MemberTitle; extern char * _PREHASH_LogParcelChanges; extern char * _PREHASH_AgentCachedTextureResponse; diff --git a/indra/llmessage/patch_code.cpp b/indra/llmessage/patch_code.cpp index 90fb23634..12ed19ea4 100644 --- a/indra/llmessage/patch_code.cpp +++ b/indra/llmessage/patch_code.cpp @@ -235,7 +235,7 @@ void decode_patch_group_header(LLBitPack &bitpack, LLGroupHeader *gopp) gPatchSize = gopp->patch_size; } -void decode_patch_header(LLBitPack &bitpack, LLPatchHeader *ph) +void decode_patch_header(LLBitPack &bitpack, LLPatchHeader *ph, BOOL b_large_patch) { U8 retvalu8; @@ -274,15 +274,18 @@ void decode_patch_header(LLBitPack &bitpack, LLPatchHeader *ph) #endif ph->range = retvalu16; - retvalu16 = 0; + retvalu32 = 0; #ifdef LL_BIG_ENDIAN ret = (U8 *)&retvalu16; bitpack.bitUnpack(&(ret[1]), 8); bitpack.bitUnpack(&(ret[0]), 2); #else - bitpack.bitUnpack((U8 *)&retvalu16, 10); + if (b_large_patch) + bitpack.bitUnpack((U8 *)&retvalu32, 32); + else + bitpack.bitUnpack((U8 *)&retvalu32, 10); #endif - ph->patchids = retvalu16; + ph->patchids = retvalu32; gWordBits = (ph->quant_wbits & 0xf) + 2; } diff --git a/indra/llmessage/patch_code.h b/indra/llmessage/patch_code.h index 82fa6bb62..dbfdf7059 100644 --- a/indra/llmessage/patch_code.h +++ b/indra/llmessage/patch_code.h @@ -46,7 +46,7 @@ void end_patch_coding(LLBitPack &bitpack); void init_patch_decoding(LLBitPack &bitpack); void decode_patch_group_header(LLBitPack &bitpack, LLGroupHeader *gopp); -void decode_patch_header(LLBitPack &bitpack, LLPatchHeader *ph); +void decode_patch_header(LLBitPack &bitpack, LLPatchHeader *ph, BOOL b_large_patch); void decode_patch(LLBitPack &bitpack, S32 *patches); #endif diff --git a/indra/llmessage/patch_dct.h b/indra/llmessage/patch_dct.h index 663e146a8..ba21be711 100644 --- a/indra/llmessage/patch_dct.h +++ b/indra/llmessage/patch_dct.h @@ -79,7 +79,7 @@ public: F32 dc_offset; // 4 bytes U16 range; // 2 = 7 ((S16) FP range (breaks if we need > 32K meters in 1 patch) U8 quant_wbits; // 1 = 8 (upper 4 bits is quant - 2, lower 4 bits is word bits - 2) - U16 patchids; // 2 = 10 (actually only uses 10 bits, 5 for each) + U32 patchids; // 2 = 10 (actually only uses 10 bits, 5 for each) }; // Compression routines diff --git a/indra/newview/llcloud.cpp b/indra/newview/llcloud.cpp index ca35c3711..116d227cc 100644 --- a/indra/newview/llcloud.cpp +++ b/indra/newview/llcloud.cpp @@ -437,7 +437,7 @@ void LLCloudLayer::decompress(LLBitPack &bitpack, LLGroupHeader *group_headerp) group_headerp->stride = group_headerp->patch_size; // offset required to step up one row set_group_of_patch_header(group_headerp); - decode_patch_header(bitpack, &patch_header); + decode_patch_header(bitpack, &patch_header, FALSE); decode_patch(bitpack, gBuffer); decompress_patch(mDensityp, gBuffer, &patch_header); } diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index deae4fa92..fbf7d2e34 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -1089,10 +1089,11 @@ BOOL LLPanelRegionTextureInfo::sendUpdate() llinfos << "LLPanelRegionTextureInfo::sendUpdate()" << llendl; // Make sure user hasn't chosen wacky textures. - if (!validateTextureSizes()) - { - return FALSE; - } + // -Revolution Allow 'wacky' things + //if (!validateTextureSizes()) + //{ + // return FALSE; + //} LLTextureCtrl* texture_ctrl; std::string buffer; diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp index 092fdc6b5..5da3926b7 100644 --- a/indra/newview/llglsandbox.cpp +++ b/indra/newview/llglsandbox.cpp @@ -613,7 +613,7 @@ void LLViewerParcelMgr::renderOneSegment(F32 x1, F32 y1, F32 x2, F32 y2, F32 hei return; // HACK: At edge of last region of world, we need to make sure the region // resolves correctly so we can get a height value. - const F32 BORDER = REGION_WIDTH_METERS - 0.1f; + const F32 BORDER = regionp->getWidth() - 0.1f; F32 clamped_x1 = x1; F32 clamped_y1 = y1; diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index b854358c9..b61ad580e 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -370,6 +370,8 @@ bool idle_startup() static U64 first_sim_handle = 0; static LLHost first_sim; static std::string first_sim_seed_cap; + static U32 first_sim_size_x = 256; + static U32 first_sim_size_y = 256; static LLVector3 initial_sun_direction(1.f, 0.f, 0.f); static LLVector3 agent_start_position_region(10.f, 10.f, 10.f); // default for when no space server @@ -1657,7 +1659,17 @@ bool idle_startup() U32 region_y = strtoul(region_y_str.c_str(), NULL, 10); first_sim_handle = to_region_handle(region_x, region_y); } - + + text = LLUserAuth::getInstance()->getResponse("region_size_x"); + if(!text.empty()) { + first_sim_size_x = strtoul(text.c_str(), NULL, 10); + LLViewerParcelMgr::getInstance()->init(first_sim_size_x); + } + + //region Y size is currently unused, major refactoring required. - Patrick Sapinski (2/10/2011) + text = LLUserAuth::getInstance()->getResponse("region_size_y"); + if(!text.empty()) first_sim_size_y = strtoul(text.c_str(), NULL, 10); + const std::string look_at_str = LLUserAuth::getInstance()->getResponse("look_at"); if (!look_at_str.empty()) { @@ -1946,7 +1958,7 @@ bool idle_startup() gAgent.initOriginGlobal(from_region_handle(first_sim_handle)); - LLWorld::getInstance()->addRegion(first_sim_handle, first_sim); + LLWorld::getInstance()->addRegion(first_sim_handle, first_sim, first_sim_size_x, first_sim_size_y); LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromHandle(first_sim_handle); LL_INFOS("AppInit") << "Adding initial simulator " << regionp->getOriginGlobal() << LL_ENDL; diff --git a/indra/newview/llsurface.cpp b/indra/newview/llsurface.cpp index 9d718e88c..7a46305e4 100644 --- a/indra/newview/llsurface.cpp +++ b/indra/newview/llsurface.cpp @@ -299,7 +299,7 @@ void LLSurface::initTextures() mWaterObjp = (LLVOWater *)gObjectList.createObjectViewer(LLViewerObject::LL_VO_WATER, mRegionp); gPipeline.createObject(mWaterObjp); LLVector3d water_pos_global = from_region_handle(mRegionp->getHandle()); - water_pos_global += LLVector3d(128.0, 128.0, DEFAULT_WATER_HEIGHT); + water_pos_global += LLVector3d(mRegionp->getWidth()/2, mRegionp->getWidth()/2, DEFAULT_WATER_HEIGHT); mWaterObjp->setPositionGlobal(water_pos_global); } } @@ -329,8 +329,8 @@ void LLSurface::setOriginGlobal(const LLVector3d &origin_global) // Hack! if (mWaterObjp.notNull() && mWaterObjp->mDrawable.notNull()) { - const F64 x = origin_global.mdV[VX] + 128.0; - const F64 y = origin_global.mdV[VY] + 128.0; + const F64 x = origin_global.mdV[VX] + (F64)mRegionp->getWidth()/2; + const F64 y = origin_global.mdV[VY] + (F64)mRegionp->getWidth()/2; const F64 z = mWaterObjp->getPositionGlobal().mdV[VZ]; LLVector3d water_origin_global(x, y, z); @@ -680,14 +680,22 @@ void LLSurface::decompressDCTPatch(LLBitPack &bitpack, LLGroupHeader *gopp, BOOL while (1) { - decode_patch_header(bitpack, &ph); + decode_patch_header(bitpack, &ph, b_large_patch); if (ph.quant_wbits == END_OF_PATCHES) { break; } - i = ph.patchids >> 5; - j = ph.patchids & 0x1F; + if (b_large_patch) + { + i = ph.patchids >> 16; //x + j = ph.patchids & 0xFFFF; //y + } + else + { + i = ph.patchids >> 5; //x + j = ph.patchids & 0x1F; //y + } if ((i >= mPatchesPerEdge) || (j >= mPatchesPerEdge)) { diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index d7a7566bd..0cb987908 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -3708,6 +3708,18 @@ void process_teleport_finish(LLMessageSystem* msg, void**) U32 teleport_flags; msg->getU32Fast(_PREHASH_Info, _PREHASH_TeleportFlags, teleport_flags); + U32 region_size_x = 256; + msg->getU32Fast(_PREHASH_Info, _PREHASH_RegionSizeX, region_size_x); + + U32 region_size_y = 256; + msg->getU32Fast(_PREHASH_Info, _PREHASH_RegionSizeY, region_size_y); + + //and a little hack for Second Life compatibility + if (region_size_y == 0 || region_size_x == 0) + { + region_size_x = 256; + region_size_y = 256; + } std::string seedCap; msg->getStringFast(_PREHASH_Info, _PREHASH_SeedCapability, seedCap); @@ -3727,7 +3739,7 @@ void process_teleport_finish(LLMessageSystem* msg, void**) // Viewer trusts the simulator. gMessageSystem->enableCircuit(sim_host, TRUE); - LLViewerRegion* regionp = LLWorld::getInstance()->addRegion(region_handle, sim_host); + LLViewerRegion* regionp = LLWorld::getInstance()->addRegion(region_handle, sim_host, region_size_x, region_size_y); /* // send camera update to new region @@ -4033,9 +4045,22 @@ void process_crossed_region(LLMessageSystem* msg, void**) std::string seedCap; msg->getStringFast(_PREHASH_RegionData, _PREHASH_SeedCapability, seedCap); + U32 region_size_x = 256; + msg->getU32(_PREHASH_RegionData, _PREHASH_RegionSizeX, region_size_x); + + U32 region_size_y = 256; + msg->getU32(_PREHASH_RegionData, _PREHASH_RegionSizeY, region_size_y); + + //and a little hack for Second Life compatibility + if (region_size_y == 0 || region_size_x == 0) + { + region_size_x = 256; + region_size_y = 256; + } + send_complete_agent_movement(sim_host); - LLViewerRegion* regionp = LLWorld::getInstance()->addRegion(region_handle, sim_host); + LLViewerRegion* regionp = LLWorld::getInstance()->addRegion(region_handle, sim_host, region_size_x, region_size_y); regionp->setSeedCapability(seedCap); } diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp index e68223285..1984df13c 100644 --- a/indra/newview/llviewerparcelmgr.cpp +++ b/indra/newview/llviewerparcelmgr.cpp @@ -137,7 +137,18 @@ LLViewerParcelMgr::LLViewerParcelMgr() mAgentParcel = new LLParcel(); mHoverParcel = new LLParcel(); 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. +//LLViewerParcelMgr needs to be changed so we either get an instance per region, or it handles various region sizes +//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 ); mHighlightSegments = new U8[(mParcelsPerEdge+1)*(mParcelsPerEdge+1)]; resetSegments(mHighlightSegments); @@ -145,13 +156,8 @@ LLViewerParcelMgr::LLViewerParcelMgr() mCollisionSegments = new U8[(mParcelsPerEdge+1)*(mParcelsPerEdge+1)]; resetSegments(mCollisionSegments); - // JC: Resolved a merge conflict here, eliminated - // mBlockedImage->setAddressMode(LLTexUnit::TAM_WRAP); - // because it is done in llviewertexturelist.cpp - mBlockedImage = LLViewerTextureManager::getFetchedTextureFromFile("noentrylines.j2c"); - mPassImage = LLViewerTextureManager::getFetchedTextureFromFile("noentrypasslines.j2c"); - - S32 overlay_size = mParcelsPerEdge * mParcelsPerEdge / PARCEL_OVERLAY_CHUNKS; + S32 mParcelOverLayChunks = region_size * region_size / (128 * 128); + S32 overlay_size = mParcelsPerEdge * mParcelsPerEdge / mParcelOverLayChunks; sPackedOverlay = new U8[overlay_size]; mAgentParcelOverlay = new U8[mParcelsPerEdge * mParcelsPerEdge]; @@ -1359,8 +1365,7 @@ void LLViewerParcelMgr::processParcelOverlay(LLMessageSystem *msg, void **user) return; } - S32 parcels_per_edge = LLViewerParcelMgr::getInstance()->mParcelsPerEdge; - S32 expected_size = parcels_per_edge * parcels_per_edge / PARCEL_OVERLAY_CHUNKS; + S32 expected_size = 1024; if (packed_overlay_size != expected_size) { llwarns << "Got parcel overlay size " << packed_overlay_size diff --git a/indra/newview/llviewerparcelmgr.h b/indra/newview/llviewerparcelmgr.h index 236dbcbec..43e79125c 100644 --- a/indra/newview/llviewerparcelmgr.h +++ b/indra/newview/llviewerparcelmgr.h @@ -82,6 +82,8 @@ public: LLViewerParcelMgr(); ~LLViewerParcelMgr(); + void init(F32 region_size); + static void cleanupGlobals(); BOOL selectionEmpty() const; diff --git a/indra/newview/llviewerparceloverlay.cpp b/indra/newview/llviewerparceloverlay.cpp index fc6e1b1d0..27494aba4 100644 --- a/indra/newview/llviewerparceloverlay.cpp +++ b/indra/newview/llviewerparceloverlay.cpp @@ -58,6 +58,7 @@ const U8 OVERLAY_IMG_COMPONENTS = 4; LLViewerParcelOverlay::LLViewerParcelOverlay(LLViewerRegion* region, F32 region_width_meters) : mRegion( region ), mParcelGridsPerEdge( S32( region_width_meters / PARCEL_GRID_STEP_METERS ) ), + mRegionSize(S32(region_width_meters)), mDirty( FALSE ), mTimeSinceLastUpdate(), mOverlayTextureIdx(-1), @@ -298,7 +299,8 @@ void LLViewerParcelOverlay::uncompressLandOverlay(S32 chunk, U8 *packed_overlay) { // Unpack the message data into the ownership array S32 size = mParcelGridsPerEdge * mParcelGridsPerEdge; - S32 chunk_size = size / PARCEL_OVERLAY_CHUNKS; + S32 mParcelOverLayChunks = mRegionSize * mRegionSize / (128 * 128); + S32 chunk_size = size / mParcelOverLayChunks; memcpy(mOwnership + chunk*chunk_size, packed_overlay, chunk_size); /*Flawfinder: ignore*/ diff --git a/indra/newview/llviewerparceloverlay.h b/indra/newview/llviewerparceloverlay.h index 161b7a386..97f2ec2b8 100644 --- a/indra/newview/llviewerparceloverlay.h +++ b/indra/newview/llviewerparceloverlay.h @@ -100,6 +100,7 @@ private: LLViewerRegion* mRegion; S32 mParcelGridsPerEdge; + S32 mRegionSize; LLPointer mTexture; LLPointer mImageRaw; diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 0c57c294f..4cc861b89 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -70,6 +70,11 @@ #include "stringize.h" #include "llviewercontrol.h" #include "llsdserialize.h" +#include "llviewerparcelmgr.h" + +// Viewer object cache version, change if object update +// format changes. JC +const U32 INDRA_OBJECT_CACHE_VERSION = 14; extern BOOL gNoRender; @@ -267,6 +272,8 @@ 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); } else { diff --git a/indra/newview/llvlmanager.cpp b/indra/newview/llvlmanager.cpp index 07ef26266..19ebe05fa 100644 --- a/indra/newview/llvlmanager.cpp +++ b/indra/newview/llvlmanager.cpp @@ -56,18 +56,26 @@ LLVLManager::~LLVLManager() void LLVLManager::addLayerData(LLVLData *vl_datap, const S32 mesg_size) { - if (LAND_LAYER_CODE == vl_datap->mType) + if (LAND_LAYER_CODE == vl_datap->mType || + AURORA_LAND_LAYER_CODE == vl_datap->mType) { mLandBits += mesg_size * 8; } - else if (WIND_LAYER_CODE == vl_datap->mType) + else if (WIND_LAYER_CODE == vl_datap->mType || + AURORA_WIND_LAYER_CODE == vl_datap->mType) { mWindBits += mesg_size * 8; } - else if (CLOUD_LAYER_CODE == vl_datap->mType) + else if (CLOUD_LAYER_CODE == vl_datap->mType || + AURORA_CLOUD_LAYER_CODE == vl_datap->mType) { mCloudBits += mesg_size * 8; } + else if (WATER_LAYER_CODE == vl_datap->mType || + AURORA_CLOUD_LAYER_CODE == vl_datap->mType) + { + mWaterBits += mesg_size * 8; + } else { llerrs << "Unknown layer type!" << (S32)vl_datap->mType << llendl; @@ -93,15 +101,25 @@ void LLVLManager::unpackData(const S32 num_packets) { datap->mRegionp->getLand().decompressDCTPatch(bit_pack, &goph, FALSE); } - else if (WIND_LAYER_CODE == datap->mType) + else if (AURORA_LAND_LAYER_CODE == datap->mType) + { + datap->mRegionp->getLand().decompressDCTPatch(bit_pack, &goph, TRUE); + } + else if (WIND_LAYER_CODE == datap->mType || + AURORA_WIND_LAYER_CODE == datap->mType) { datap->mRegionp->mWind.decompress(bit_pack, &goph); } - else if (CLOUD_LAYER_CODE == datap->mType) + else if (CLOUD_LAYER_CODE == datap->mType || + AURORA_CLOUD_LAYER_CODE == datap->mType) { datap->mRegionp->mCloudLayer.decompress(bit_pack, &goph); } + else if (WATER_LAYER_CODE == datap->mType || + AURORA_WATER_LAYER_CODE == datap->mType) + { + } } for (i = 0; i < mPacketData.count(); i++) diff --git a/indra/newview/llvlmanager.h b/indra/newview/llvlmanager.h index 9d64d6f24..4d7137fac 100644 --- a/indra/newview/llvlmanager.h +++ b/indra/newview/llvlmanager.h @@ -65,6 +65,7 @@ protected: U32 mLandBits; U32 mWindBits; U32 mCloudBits; + U32 mWaterBits; }; class LLVLData diff --git a/indra/newview/llvowater.cpp b/indra/newview/llvowater.cpp index 2897f98ac..49120afa5 100644 --- a/indra/newview/llvowater.cpp +++ b/indra/newview/llvowater.cpp @@ -74,7 +74,7 @@ LLVOWater::LLVOWater(const LLUUID &id, { // Terrain must draw during selection passes so it can block objects behind it. mbCanSelect = FALSE; - setScale(LLVector3(256.f, 256.f, 0.f)); // Hack for setting scale for bounding boxes/visibility. + setScale(LLVector3(mRegionp->getWidth(), mRegionp->getWidth(), 0.f)); // Hack for setting scale for bounding boxes/visibility. mUseTexture = TRUE; mIsEdgePatch = FALSE; diff --git a/indra/newview/llwind.cpp b/indra/newview/llwind.cpp index 2b0f0d969..0a2afd428 100644 --- a/indra/newview/llwind.cpp +++ b/indra/newview/llwind.cpp @@ -121,12 +121,12 @@ void LLWind::decompress(LLBitPack &bitpack, LLGroupHeader *group_headerp) set_group_of_patch_header(group_headerp); // X component - decode_patch_header(bitpack, &patch_header); + decode_patch_header(bitpack, &patch_header, FALSE); decode_patch(bitpack, buffer); decompress_patch(mVelX, buffer, &patch_header); // Y component - decode_patch_header(bitpack, &patch_header); + decode_patch_header(bitpack, &patch_header, FALSE); decode_patch(bitpack, buffer); decompress_patch(mVelY, buffer, &patch_header); diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index b1e42c084..2ec4bf015 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -78,12 +78,12 @@ const S32 WORLD_PATCH_SIZE = 16; extern LLColor4U MAX_WATER_COLOR; -const U32 LLWorld::mWidth = 256; +U32 LLWorld::mWidth = 256; // meters/point, therefore mWidth * mScale = meters per edge const F32 LLWorld::mScale = 1.f; -const F32 LLWorld::mWidthInMeters = mWidth * mScale; +F32 LLWorld::mWidthInMeters = mWidth * mScale; // // Functions @@ -138,7 +138,7 @@ void LLWorld::destroyClass() } -LLViewerRegion* LLWorld::addRegion(const U64 ®ion_handle, const LLHost &host) +LLViewerRegion* LLWorld::addRegion(const U64 ®ion_handle, const LLHost &host, const U32 ®ion_size_x, const U32 ®ion_size_y) { LLMemType mt(LLMemType::MTYPE_REGIONS); llinfos << "Add region with handle: " << region_handle << " on host " << host << llendl; @@ -171,9 +171,11 @@ LLViewerRegion* LLWorld::addRegion(const U64 ®ion_handle, const LLHost &host) U32 iindex = 0; U32 jindex = 0; + mWidth = region_size_x; + mWidthInMeters = mWidth * mScale; from_region_handle(region_handle, &iindex, &jindex); - S32 x = (S32)(iindex/mWidth); - S32 y = (S32)(jindex/mWidth); + S32 x = (S32)(iindex/256); + S32 y = (S32)(jindex/256); llinfos << "Adding new region (" << x << ":" << y << ")" << llendl; llinfos << "Host: " << host << llendl; @@ -823,7 +825,7 @@ F32 LLWorld::getLandFarClip() const void LLWorld::setLandFarClip(const F32 far_clip) { - static S32 const rwidth = (S32)REGION_WIDTH_U32; + static S32 const rwidth = (S32)getRegionWidthInMeters(); S32 const n1 = (llceil(mLandFarClip) - 1) / rwidth; S32 const n2 = (llceil(far_clip) - 1) / rwidth; bool need_water_objects_update = n1 != n2; @@ -1253,9 +1255,21 @@ void process_enable_simulator(LLMessageSystem *msg, void **user_data) // which simulator should we modify? LLHost sim(ip_u32, port); + U32 region_size_x = 256; + msg->getU32Fast(_PREHASH_SimulatorInfo, _PREHASH_RegionSizeX, region_size_x); + + U32 region_size_y = 256; + msg->getU32Fast(_PREHASH_SimulatorInfo, _PREHASH_RegionSizeY, region_size_y); + + if (region_size_y == 0 || region_size_x == 0) + { + region_size_x = 256; + region_size_y = 256; + } + // Viewer trusts the simulator. msg->enableCircuit(sim, TRUE); - LLWorld::getInstance()->addRegion(handle, sim); + LLWorld::getInstance()->addRegion(handle, sim, region_size_x, region_size_y); // give the simulator a message it can use to get ip and port llinfos << "simulator_enable() Enabling " << sim << " with code " << msg->getOurCircuitCode() << llendl; diff --git a/indra/newview/llworld.h b/indra/newview/llworld.h index ec6e45b23..b3bd661cf 100644 --- a/indra/newview/llworld.h +++ b/indra/newview/llworld.h @@ -71,7 +71,7 @@ public: LLWorld(); void destroyClass(); - LLViewerRegion* addRegion(const U64 ®ion_handle, const LLHost &host); + LLViewerRegion* addRegion(const U64 ®ion_handle, const LLHost &host, const U32 ®ion_size_x, const U32 ®ion_size_y); // safe to call if already present, does the "right thing" if // hosts are same, or if hosts are different, etc... void removeRegion(const LLHost &host); @@ -170,12 +170,12 @@ private: region_list_t mCulledRegionList; // Number of points on edge - static const U32 mWidth; + static U32 mWidth; // meters/point, therefore mWidth * mScale = meters per edge static const F32 mScale; - static const F32 mWidthInMeters; + static F32 mWidthInMeters; F32 mLandFarClip; // Far clip distance for land. LLPatchVertexArray mLandPatch;