diff --git a/indra/llcommon/indra_constants.h b/indra/llcommon/indra_constants.h index 3f0e8dd6c..ea8c91155 100644 --- a/indra/llcommon/indra_constants.h +++ b/indra/llcommon/indra_constants.h @@ -149,6 +149,14 @@ const char WATER_LAYER_CODE = 'W'; const char WIND_LAYER_CODE = '7'; const char CLOUD_LAYER_CODE = '8'; +// Aurora Sim +// 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 = ':'; +// Aurora Sim + // keys // Bit masks for various keyboard modifier keys. const MASK MASK_NONE = 0x0000; diff --git a/indra/llmessage/message_prehash.cpp b/indra/llmessage/message_prehash.cpp index e279f781d..8544b37e1 100644 --- a/indra/llmessage/message_prehash.cpp +++ b/indra/llmessage/message_prehash.cpp @@ -37,8 +37,6 @@ F32 const gPrehashVersionNumber = 2.000f; char const* const _PREHASH_X = LLMessageStringTable::getInstance()->getString("X"); char const* const _PREHASH_Y = LLMessageStringTable::getInstance()->getString("Y"); char const* const _PREHASH_Z = LLMessageStringTable::getInstance()->getString("Z"); -char const* const _PREHASH_SizeX = LLMessageStringTable::getInstance()->getString("SizeX"); -char const* const _PREHASH_SizeY = LLMessageStringTable::getInstance()->getString("SizeY"); char const* const _PREHASH_AddFlags = LLMessageStringTable::getInstance()->getString("AddFlags"); char const* const _PREHASH_FailureInfo = LLMessageStringTable::getInstance()->getString("FailureInfo"); char const* const _PREHASH_MapData = LLMessageStringTable::getInstance()->getString("MapData"); @@ -1386,3 +1384,10 @@ char const* const _PREHASH_GroupAVSounds = LLMessageStringTable::getInstance()-> char const* const _PREHASH_AppearanceData = LLMessageStringTable::getInstance()->getString("AppearanceData"); char const* const _PREHASH_AppearanceVersion = LLMessageStringTable::getInstance()->getString("AppearanceVersion"); char const* const _PREHASH_CofVersion = LLMessageStringTable::getInstance()->getString("CofVersion"); + +// Aurora Sim +char const* const _PREHASH_RegionSizeX = LLMessageStringTable::getInstance()->getString("RegionSizeX"); +char const* const _PREHASH_RegionSizeY = LLMessageStringTable::getInstance()->getString("RegionSizeY"); +char const* const _PREHASH_SizeX = LLMessageStringTable::getInstance()->getString("SizeX"); +char const* const _PREHASH_SizeY = LLMessageStringTable::getInstance()->getString("SizeY"); +// Aurora Sim diff --git a/indra/llmessage/message_prehash.h b/indra/llmessage/message_prehash.h index 1c1d6e224..7c5046fe2 100644 --- a/indra/llmessage/message_prehash.h +++ b/indra/llmessage/message_prehash.h @@ -1386,4 +1386,11 @@ extern char const* const _PREHASH_GroupAVSounds; extern char const* const _PREHASH_AppearanceData; extern char const* const _PREHASH_AppearanceVersion; extern char const* const _PREHASH_CofVersion; + +// Aurora Sim +extern char const* const _PREHASH_RegionSizeX; +extern char const* const _PREHASH_RegionSizeY; +extern char const* const _PREHASH_SizeX; +extern char const* const _PREHASH_SizeY; +// Aurora Sim #endif diff --git a/indra/llmessage/patch_code.cpp b/indra/llmessage/patch_code.cpp index e5d7f1944..6ab3a6e11 100644 --- a/indra/llmessage/patch_code.cpp +++ b/indra/llmessage/patch_code.cpp @@ -229,7 +229,10 @@ void decode_patch_group_header(LLBitPack &bitpack, LLGroupHeader *gopp) gPatchSize = gopp->patch_size; } -void decode_patch_header(LLBitPack &bitpack, LLPatchHeader *ph) +// Aurora Sim +//void decode_patch_header(LLBitPack &bitpack, LLPatchHeader *ph) +void decode_patch_header(LLBitPack &bitpack, LLPatchHeader *ph, BOOL b_large_patch) +// Aurora Sim { U8 retvalu8; @@ -268,15 +271,41 @@ void decode_patch_header(LLBitPack &bitpack, LLPatchHeader *ph) #endif ph->range = retvalu16; - retvalu16 = 0; +// Aurora Sim + //retvalu16 = 0; + retvalu32 = 0; #ifdef LL_BIG_ENDIAN - ret = (U8 *)&retvalu16; - bitpack.bitUnpack(&(ret[1]), 8); - bitpack.bitUnpack(&(ret[0]), 2); +// Aurora Sim + //ret = (U8 *)&retvalu16; + if(b_large_patch) + { + //todo test + ret = (U8 *)&retvalu32; + bitpack.bitUnpack(&(ret[3]), 8); + bitpack.bitUnpack(&(ret[2]), 8); + bitpack.bitUnpack(&(ret[1]), 8); + bitpack.bitUnpack(&(ret[0]), 8); + } + else + { + ret = (U8 *)&retvalu32; + bitpack.bitUnpack(&(ret[1]), 8); + bitpack.bitUnpack(&(ret[0]), 2); + } + // Aurora Sim #else - bitpack.bitUnpack((U8 *)&retvalu16, 10); +// Aurora Sim + //bitpack.bitUnpack((U8 *)&retvalu16, 10); + if(b_large_patch) + bitpack.bitUnpack((U8 *)&retvalu32, 32); + else + bitpack.bitUnpack((U8 *)&retvalu32, 10); +// Aurora Sim #endif - ph->patchids = retvalu16; +// Aurora Sim + //ph->patchids = retvalu16; + ph->patchids = retvalu32; +// Aurora Sim gWordBits = (ph->quant_wbits & 0xf) + 2; } diff --git a/indra/llmessage/patch_code.h b/indra/llmessage/patch_code.h index 4c87c9808..0b9091f43 100644 --- a/indra/llmessage/patch_code.h +++ b/indra/llmessage/patch_code.h @@ -40,7 +40,10 @@ 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); +// Aurora Sim +//void decode_patch_header(LLBitPack &bitpack, LLPatchHeader *ph); +void decode_patch_header(LLBitPack &bitpack, LLPatchHeader *ph, BOOL b_large_patch); +// Aurora Sim void decode_patch(LLBitPack &bitpack, S32 *patches); #endif diff --git a/indra/llmessage/patch_dct.h b/indra/llmessage/patch_dct.h index 101231ec8..d9c3ec7a5 100644 --- a/indra/llmessage/patch_dct.h +++ b/indra/llmessage/patch_dct.h @@ -73,7 +73,10 @@ 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) +// Aurora Sim + //U16 patchids; // 2 = 10 (actually only uses 10 bits, 5 for each) + U32 patchids; +// Aurora Sim }; // Compression routines diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index f42739b20..ea3aa6145 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -2319,7 +2319,10 @@ void LLAgent::setStartPosition( U32 location_id ) // this simulator. Clamp it to the region the agent is // in, a little bit in on each side. const F32 INSET = 0.5f; //meters - const F32 REGION_WIDTH = LLWorld::getInstance()->getRegionWidthInMeters(); +// Aurora Sim + //const F32 REGION_WIDTH = LLWorld::getInstance()->getRegionWidthInMeters(); + const F32 REGION_WIDTH = getRegion()->getWidth(); +// Aurora Sim LLVector3 agent_pos = getPositionAgent(); @@ -4233,8 +4236,10 @@ void LLAgent::doTeleportViaLocation(const LLVector3d& pos_global) (F32)(pos_global.mdV[VX] - region_origin.mdV[VX]), (F32)(pos_global.mdV[VY] - region_origin.mdV[VY]), (F32)(pos_global.mdV[VZ])); - pos_local += offset; - teleportRequest(handle, pos_local); +// Aurora-sim var region teleports + //teleportRequest(handle, pos_local); + teleportRequest(info->getHandle(), pos_local); +// } else if(regionp && teleportCore(regionp->getHandle() == to_region_handle_global((F32)pos_global.mdV[VX], (F32)pos_global.mdV[VY]))) @@ -4289,6 +4294,13 @@ void LLAgent::doTeleportViaLocationLookAt(const LLVector3d& pos_global) mbTeleportKeepsLookAt = true; gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE); // detach camera form avatar, so it keeps direction U64 region_handle = to_region_handle(pos_global); +// Aurora-sim var region teleports + LLSimInfo* simInfo = LLWorldMap::instance().simInfoFromHandle(region_handle); + if (simInfo) + { + region_handle = simInfo->getHandle(); + } +// LLVector3 pos_local = (LLVector3)(pos_global - from_region_handle(region_handle)); teleportRequest(region_handle, pos_local, getTeleportKeepsLookAt()); } diff --git a/indra/newview/llcloud.cpp b/indra/newview/llcloud.cpp index fcdfbecd4..ebe6460dd 100644 --- a/indra/newview/llcloud.cpp +++ b/indra/newview/llcloud.cpp @@ -441,7 +441,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/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp index 808191294..24f11cbfc 100644 --- a/indra/newview/llfloaterworldmap.cpp +++ b/indra/newview/llfloaterworldmap.cpp @@ -700,8 +700,14 @@ void LLFloaterWorldMap::trackLocation(const LLVector3d& pos_global) } std::string sim_name = sim_info->getName(); - F32 region_x = (F32)fmod( pos_global.mdV[VX], (F64)REGION_WIDTH_METERS ); - F32 region_y = (F32)fmod( pos_global.mdV[VY], (F64)REGION_WIDTH_METERS ); +// Aurora-sim var region teleports + //F32 region_x = (F32)fmod( pos_global.mdV[VX], (F64)REGION_WIDTH_METERS ); + //F32 region_y = (F32)fmod( pos_global.mdV[VY], (F64)REGION_WIDTH_METERS ); + U32 locX, locY; + from_region_handle(sim_info->getHandle(), &locX, &locY); + F32 region_x = pos_global.mdV[VX] - locX; + F32 region_y = pos_global.mdV[VY] - locY; +// std::string full_name = llformat("%s (%d, %d, %d)", sim_name.c_str(), llround(region_x), @@ -754,17 +760,27 @@ void LLFloaterWorldMap::updateTeleportCoordsDisplay( const LLVector3d& pos ) { // if we're going to update their value, we should also enable them enableTeleportCoordsDisplay( true ); - + // convert global specified position to a local one F32 region_local_x = (F32)fmod( pos.mdV[VX], (F64)REGION_WIDTH_METERS ); F32 region_local_y = (F32)fmod( pos.mdV[VY], (F64)REGION_WIDTH_METERS ); F32 region_local_z = (F32)llclamp( pos.mdV[VZ], 0.0, 8192.0/*(F64)REGION_HEIGHT_METERS*/ ); + LLSimInfo* sim_info = LLWorldMap::getInstance()->simInfoFromPosGlobal(pos); + if (sim_info) // Singu Note: Aurora var region support + { + U32 locX, locY; + from_region_handle(sim_info->getHandle(), &locX, &locY); + region_local_x = pos.mdV[VX] - locX; + region_local_y = pos.mdV[VY] - locY; + region_local_z = (F32)pos.mdV[VZ]; + // write in the values childSetValue("spin x", region_local_x ); childSetValue("spin y", region_local_y ); childSetValue("spin z", region_local_z ); } +} void LLFloaterWorldMap::updateLocation() { @@ -812,7 +828,10 @@ void LLFloaterWorldMap::updateLocation() // Figure out where user is // Set the current SLURL - mSLURL = LLSLURL(agent_sim_name, gAgent.getPositionGlobal()); +// Aurora-sim var region teleports + //mSLURL = LLSLURL(agent_sim_name, gAgent.getPositionGlobal()); + mSLURL = LLSLURL(agent_sim_name, gAgent.getPositionAgent()); +// } } diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp index b40e3d471..3da03923c 100644 --- a/indra/newview/llglsandbox.cpp +++ b/indra/newview/llglsandbox.cpp @@ -297,7 +297,10 @@ void LLWind::renderVectors() S32 i,j; F32 x,y; - F32 region_width_meters = LLWorld::getInstance()->getRegionWidthInMeters(); +// Aurora Sim + //F32 region_width_meters = LLWorld::getInstance()->getRegionWidthInMeters(); + F32 region_width_meters = gAgent.getRegion()->getWidth(); +// Aurora Sim gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.pushMatrix(); @@ -505,7 +508,10 @@ 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; +// Aurora Sim + //const F32 BORDER = REGION_WIDTH_METERS - 0.1f; + const F32 BORDER = regionp->getWidth() - 0.1f; +// Aurora Sim F32 clamped_x1 = x1; F32 clamped_y1 = y1; diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp index 0f3c9a32b..045c08015 100644 --- a/indra/newview/llnetmap.cpp +++ b/indra/newview/llnetmap.cpp @@ -157,7 +157,10 @@ void LLNetMap::setScale( F32 scale ) F32 height = (F32)(getRect().getHeight()); F32 diameter = sqrt(width * width + height * height); F32 region_widths = diameter / mScale; - F32 meters = region_widths * LLWorld::getInstance()->getRegionWidthInMeters(); +// Aurora Sim + //F32 meters = region_widths * LLWorld::getInstance()->getRegionWidthInMeters(); + F32 meters = region_widths * REGION_WIDTH_METERS; +// Aurora Sim F32 num_pixels = (F32)mObjectImagep->getWidth(); mObjectMapTPM = num_pixels / meters; mObjectMapPixels = diameter; @@ -256,12 +259,15 @@ void LLNetMap::draw() LLColor4 this_region_color = gColors.getColor( "NetMapThisRegion" ); LLColor4 live_region_color = gColors.getColor( "NetMapLiveRegion" ); LLColor4 dead_region_color = gColors.getColor( "NetMapDeadRegion" ); +// Aurora Sim + //S32 region_width = llround(LLWorld::getInstance()->getRegionWidthInMeters()); + S32 region_width = llround(REGION_WIDTH_METERS); +// Aurora Sim for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); iter != LLWorld::getInstance()->getRegionList().end(); ++iter) { LLViewerRegion* regionp = *iter; - S32 region_width = llround(regionp->getWidth()); // Find x and y position relative to camera's center. LLVector3 origin_agent = regionp->getOriginAgent(); LLVector3 rel_region_pos = origin_agent - gAgentCamera.getCameraPositionAgent(); @@ -271,8 +277,12 @@ void LLNetMap::draw() // background region rectangle F32 bottom = relative_y; F32 left = relative_x; - F32 top = bottom + mScale ; - F32 right = left + mScale ; +// Aurora Sim + //F32 top = bottom + mScale ; + //F32 right = left + mScale ; + F32 top = bottom + (regionp->getWidth() / region_width) * mScale ; + F32 right = left + (regionp->getWidth() / region_width) * mScale ; +// Aurora Sim gGL.color4fv(regionp == gAgent.getRegion() ? this_region_color.mV : live_region_color.mV); if (!regionp->isAlive()) @@ -479,7 +489,10 @@ void LLNetMap::draw() dot_width); // Draw frustum - F32 meters_to_pixels = mScale/ LLWorld::getInstance()->getRegionWidthInMeters(); +// Aurora Sim + //F32 meters_to_pixels = mScale/ LLWorld::getInstance()->getRegionWidthInMeters(); + F32 meters_to_pixels = mScale/ REGION_WIDTH_METERS; +// Aurora Sim F32 horiz_fov = LLViewerCamera::getInstance()->getView() * LLViewerCamera::getInstance()->getAspect(); F32 far_clip_meters = LLViewerCamera::getInstance()->getFar(); @@ -551,6 +564,9 @@ LLVector3 LLNetMap::globalPosToView(const LLVector3d& global_pos, BOOL rotated) LLVector3 pos_local; pos_local.setVec(relative_pos_global); // convert to floats from doubles +// Aurora Sim + mPixelsPerMeter = mScale / REGION_WIDTH_METERS; +// Aurora Sim pos_local.mV[VX] *= mPixelsPerMeter; pos_local.mV[VY] *= mPixelsPerMeter; // leave Z component in meters @@ -609,7 +625,10 @@ LLVector3d LLNetMap::viewPosToGlobal( S32 x, S32 y, BOOL rotated ) pos_local.rotVec( rot ); } - pos_local *= ( LLWorld::getInstance()->getRegionWidthInMeters() / mScale ); +// Aurora Sim + //pos_local *= ( LLWorld::getInstance()->getRegionWidthInMeters() / mScale ); + pos_local *= ( REGION_WIDTH_METERS / mScale ); +// Aurora Sim LLVector3d pos_global; pos_global.setVec( pos_local ); diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 77d6b9e6e..bcbc34cf3 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -309,7 +309,10 @@ void init_start_screen(S32 location_id); void release_start_screen(); void reset_login(); void apply_udp_blacklist(const std::string& csv); -bool process_login_success_response(std::string &password); +// Aurora Sim +//bool process_login_success_response(); +bool process_login_success_response(std::string& password, U32 &first_sim_size_x, U32 &first_sim_size_y); +// Aurora Sim void transition_back_to_login_panel(const std::string& emsg); void callback_cache_name(const LLUUID& id, const std::string& full_name, bool is_group) @@ -397,6 +400,10 @@ bool idle_startup() static std::vector requested_options; static std::string redirect_uri; +// Aurora Sim + static U32 first_sim_size_x = 256; + static U32 first_sim_size_y = 256; +// Aurora Sim 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 @@ -1543,7 +1550,7 @@ bool idle_startup() if (successful_login) { // unpack login data needed by the application - if(process_login_success_response(password)) + if(process_login_success_response(password, first_sim_size_x, first_sim_size_y)) { std::string name = firstname; if (!gHippoGridManager->getCurrentGrid()->isSecondLife() || @@ -1662,7 +1669,10 @@ bool idle_startup() gAgent.initOriginGlobal(from_region_handle(gFirstSimHandle)); display_startup(); - LLWorld::getInstance()->addRegion(gFirstSimHandle, gFirstSim); +// Aurora Sim + //LLWorld::getInstance()->addRegion(gFirstSimHandle, gFirstSim); +LLWorld::getInstance()->addRegion(gFirstSimHandle, gFirstSim, first_sim_size_x, first_sim_size_y); +// Aurora Sim display_startup(); LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromHandle(gFirstSimHandle); @@ -3844,7 +3854,7 @@ void apply_udp_blacklist(const std::string& csv) } -bool process_login_success_response(std::string& password) +bool process_login_success_response(std::string& password, U32 &first_sim_size_x, U32 &first_sim_size_y) { LLSD response = LLUserAuth::getInstance()->getResponse(); @@ -3985,6 +3995,17 @@ bool process_login_success_response(std::string& password) gFirstSimHandle = to_region_handle(region_x, region_y); } +// Aurora Sim + text = response["region_size_x"].asString(); + 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 = response["region_size_y"].asString(); + if(!text.empty()) first_sim_size_y = strtoul(text.c_str(), NULL, 10); +// Aurora Sim const std::string look_at_str = response["look_at"]; if (!look_at_str.empty()) { diff --git a/indra/newview/llsurface.cpp b/indra/newview/llsurface.cpp index ca4c37eff..f6485e0d9 100644 --- a/indra/newview/llsurface.cpp +++ b/indra/newview/llsurface.cpp @@ -172,6 +172,9 @@ void LLSurface::create(const S32 grids_per_edge, mNumberOfPatches = mPatchesPerEdge * mPatchesPerEdge; mMetersPerGrid = width / ((F32)(mGridsPerEdge - 1)); mMetersPerEdge = mMetersPerGrid * (mGridsPerEdge - 1); +// Aurora Sim + sTextureSize = width; +// Aurora Sim mOriginGlobal.setVec(origin_global); @@ -295,7 +298,31 @@ 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); +// Aurora Sim + //water_pos_global += LLVector3d(128.0, 128.0, DEFAULT_WATER_HEIGHT); // region doesn't have a valid water height yet + water_pos_global += LLVector3d(mRegionp->getWidth()/2, mRegionp->getWidth()/2, DEFAULT_WATER_HEIGHT); + mWaterObjp->setPositionGlobal(water_pos_global); + } +} + +void LLSurface::rebuildWater() +{ + BOOL renderwater = gSavedSettings.getBOOL("RenderWater"); + BOOL prev_renderwater = !mWaterObjp.isNull(); + + if(prev_renderwater && !renderwater) + { + gObjectList.killObject(mWaterObjp); + } + + if (!prev_renderwater && renderwater) + { + createWaterTexture(); + 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(mRegionp->getWidth()/2, mRegionp->getWidth()/2, DEFAULT_WATER_HEIGHT); +// Aurora Sim mWaterObjp->setPositionGlobal(water_pos_global); } } @@ -325,8 +352,12 @@ 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; +// Aurora Sim + //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; +// Aurora Sim const F64 z = mWaterObjp->getPositionGlobal().mdV[VZ]; LLVector3d water_origin_global(x, y, z); @@ -364,15 +395,52 @@ void LLSurface::connectNeighbor(LLSurface *neighborp, U32 direction) { S32 i; LLSurfacePatch *patchp, *neighbor_patchp; +// Aurora Sim + S32 neighborPatchesPerEdge = neighborp->mPatchesPerEdge; +// Aurora Sim mNeighbors[direction] = neighborp; neighborp->mNeighbors[gDirOpposite[direction]] = this; +// Aurora Sim + S32 ppe[2]; + S32 own_offset[2] = {0, 0}; + S32 neighbor_offset[2] = {0, 0}; + U32 own_xpos, own_ypos, neighbor_xpos, neighbor_ypos; + + ppe[0] = (mPatchesPerEdge < neighborPatchesPerEdge) ? mPatchesPerEdge : neighborPatchesPerEdge; // used for x + ppe[1] = ppe[0]; // used for y + + from_region_handle(mRegionp->getHandle(), &own_xpos, &own_ypos); + from_region_handle(neighborp->getRegion()->getHandle(), &neighbor_xpos, &neighbor_ypos); + + if(own_ypos >= neighbor_ypos) { + neighbor_offset[1] = (own_ypos - neighbor_ypos) / mGridsPerPatchEdge; + ppe[1] = llmin(mPatchesPerEdge, neighborPatchesPerEdge-neighbor_offset[1]); + } + else { + own_offset[1] = (neighbor_ypos - own_ypos) / mGridsPerPatchEdge; + ppe[1] = llmin(mPatchesPerEdge-own_offset[1], neighborPatchesPerEdge); + } + + if(own_xpos >= neighbor_xpos) { + neighbor_offset[0] = (own_xpos - neighbor_xpos) / mGridsPerPatchEdge; + ppe[0] = llmin(mPatchesPerEdge, neighborPatchesPerEdge-neighbor_offset[0]); + } + else { + own_offset[0] = (neighbor_xpos - own_xpos) / mGridsPerPatchEdge; + ppe[0] = llmin(mPatchesPerEdge-own_offset[0], neighborPatchesPerEdge); + } +// Aurora Sim + // Connect patches if (NORTHEAST == direction) { patchp = getPatch(mPatchesPerEdge - 1, mPatchesPerEdge - 1); - neighbor_patchp = neighborp->getPatch(0, 0); +// Aurora Sim + //neighbor_patchp = neighborp->getPatch(0, 0); + neighbor_patchp = neighborp->getPatch(neighbor_offset[0], neighbor_offset[1]); +// Aurora Sim patchp->connectNeighbor(neighbor_patchp, direction); neighbor_patchp->connectNeighbor(patchp, gDirOpposite[direction]); @@ -382,8 +450,14 @@ void LLSurface::connectNeighbor(LLSurface *neighborp, U32 direction) } else if (NORTHWEST == direction) { +// Aurora Sim + S32 off = mPatchesPerEdge + neighbor_offset[1] - own_offset[1]; +// Aurora Sim patchp = getPatch(0, mPatchesPerEdge - 1); - neighbor_patchp = neighborp->getPatch(mPatchesPerEdge - 1, 0); +// Aurora Sim + //neighbor_patchp = neighborp->getPatch(mPatchesPerEdge - 1, 0); + neighbor_patchp = neighborp->getPatch(neighbor_offset[0] - 1, off); //neighborPatchesPerEdge - 1 +// Aurora Sim patchp->connectNeighbor(neighbor_patchp, direction); neighbor_patchp->connectNeighbor(patchp, gDirOpposite[direction]); @@ -391,18 +465,31 @@ void LLSurface::connectNeighbor(LLSurface *neighborp, U32 direction) else if (SOUTHWEST == direction) { patchp = getPatch(0, 0); - neighbor_patchp = neighborp->getPatch(mPatchesPerEdge - 1, mPatchesPerEdge - 1); +// Aurora Sim + //neighbor_patchp = neighborp->getPatch(mPatchesPerEdge - 1, mPatchesPerEdge - 1); + neighbor_patchp = neighborp->getPatch(neighbor_offset[0] - 1, neighbor_offset[1] - 1); +// Aurora Sim patchp->connectNeighbor(neighbor_patchp, direction); neighbor_patchp->connectNeighbor(patchp, gDirOpposite[direction]); - neighbor_patchp->updateNorthEdge(); // Only update one of north or east. +// Aurora Sim + //neighbor_patchp->updateNorthEdge(); // Only update one of north or east. + neighbor_patchp->updateEastEdge(); // Only update one of north or east. +// Aurora Sim neighbor_patchp->dirtyZ(); } else if (SOUTHEAST == direction) { +// Aurora Sim + S32 off = mPatchesPerEdge + neighbor_offset[0] - own_offset[0]; +// Aurora Sim + patchp = getPatch(mPatchesPerEdge - 1, 0); - neighbor_patchp = neighborp->getPatch(0, mPatchesPerEdge - 1); +// Aurora Sim + //neighbor_patchp = neighborp->getPatch(0, mPatchesPerEdge - 1); + neighbor_patchp = neighborp->getPatch(off, neighbor_offset[1] - 1); //0 +// Aurora Sim patchp->connectNeighbor(neighbor_patchp, direction); neighbor_patchp->connectNeighbor(patchp, gDirOpposite[direction]); @@ -410,10 +497,17 @@ void LLSurface::connectNeighbor(LLSurface *neighborp, U32 direction) else if (EAST == direction) { // Do east/west connections, first - for (i = 0; i < (S32)mPatchesPerEdge; i++) +// Aurora Sim + //for (i = 0; i < (S32)mPatchesPerEdge; i++) + for (i = 0; i < ppe[1]; i++) +// Aurora Sim { - patchp = getPatch(mPatchesPerEdge - 1, i); - neighbor_patchp = neighborp->getPatch(0, i); +// Aurora Sim + //patchp = getPatch(mPatchesPerEdge - 1, i); + //neighbor_patchp = neighborp->getPatch(0, i); + patchp = getPatch(mPatchesPerEdge - 1, i + own_offset[1]); + neighbor_patchp = neighborp->getPatch(0, i + neighbor_offset[1]); +// Aurora Sim patchp->connectNeighbor(neighbor_patchp, direction); neighbor_patchp->connectNeighbor(patchp, gDirOpposite[direction]); @@ -423,19 +517,33 @@ void LLSurface::connectNeighbor(LLSurface *neighborp, U32 direction) } // Now do northeast/southwest connections - for (i = 0; i < (S32)mPatchesPerEdge - 1; i++) +// Aurora Sim + //for (i = 0; i < (S32)mPatchesPerEdge - 1; i++) + for (i = 0; i < ppe[1] - 1; i++) +// Aurora Sim { - patchp = getPatch(mPatchesPerEdge - 1, i); - neighbor_patchp = neighborp->getPatch(0, i+1); +// Aurora Sim + //patchp = getPatch(mPatchesPerEdge - 1, i); + //neighbor_patchp = neighborp->getPatch(0, i+1); + patchp = getPatch(mPatchesPerEdge - 1, i + own_offset[1]); + neighbor_patchp = neighborp->getPatch(0, i+1 + neighbor_offset[1]); +// Aurora Sim patchp->connectNeighbor(neighbor_patchp, NORTHEAST); neighbor_patchp->connectNeighbor(patchp, SOUTHWEST); } // Now do southeast/northwest connections - for (i = 1; i < (S32)mPatchesPerEdge; i++) +// Aurora Sim + //for (i = 1; i < (S32)mPatchesPerEdge; i++) + for (i = 1; i < ppe[1]; i++) +// Aurora Sim { - patchp = getPatch(mPatchesPerEdge - 1, i); - neighbor_patchp = neighborp->getPatch(0, i-1); +// Aurora Sim + //patchp = getPatch(mPatchesPerEdge - 1, i); + //neighbor_patchp = neighborp->getPatch(0, i-1); + patchp = getPatch(mPatchesPerEdge - 1, i + own_offset[1]); + neighbor_patchp = neighborp->getPatch(0, i-1 + neighbor_offset[1]); +// Aurora Sim patchp->connectNeighbor(neighbor_patchp, SOUTHEAST); neighbor_patchp->connectNeighbor(patchp, NORTHWEST); @@ -444,10 +552,17 @@ void LLSurface::connectNeighbor(LLSurface *neighborp, U32 direction) else if (NORTH == direction) { // Do north/south connections, first - for (i = 0; i < (S32)mPatchesPerEdge; i++) +// Aurora Sim + //for (i = 0; i < (S32)mPatchesPerEdge; i++) + for (i = 0; i < ppe[0]; i++) +// Aurora Sim { - patchp = getPatch(i, mPatchesPerEdge - 1); - neighbor_patchp = neighborp->getPatch(i, 0); +// Aurora Sim + //patchp = getPatch(i, mPatchesPerEdge - 1); + //neighbor_patchp = neighborp->getPatch(i, 0); + patchp = getPatch(i + own_offset[0], mPatchesPerEdge - 1); + neighbor_patchp = neighborp->getPatch(i + neighbor_offset[0], 0); +// Aurora Sim patchp->connectNeighbor(neighbor_patchp, direction); neighbor_patchp->connectNeighbor(patchp, gDirOpposite[direction]); @@ -457,19 +572,33 @@ void LLSurface::connectNeighbor(LLSurface *neighborp, U32 direction) } // Do northeast/southwest connections - for (i = 0; i < (S32)mPatchesPerEdge - 1; i++) +// Aurora Sim + //for (i = 0; i < (S32)mPatchesPerEdge - 1; i++) + for (i = 0; i < ppe[0] - 1; i++) +// Aurora Sim { - patchp = getPatch(i, mPatchesPerEdge - 1); - neighbor_patchp = neighborp->getPatch(i+1, 0); +// Aurora Sim + //patchp = getPatch(i, mPatchesPerEdge - 1); + //neighbor_patchp = neighborp->getPatch(i+1, 0); + patchp = getPatch(i + own_offset[0], mPatchesPerEdge - 1); + neighbor_patchp = neighborp->getPatch(i+1 + neighbor_offset[0], 0); +// Aurora Sim patchp->connectNeighbor(neighbor_patchp, NORTHEAST); neighbor_patchp->connectNeighbor(patchp, SOUTHWEST); } // Do southeast/northwest connections - for (i = 1; i < (S32)mPatchesPerEdge; i++) +// Aurora Sim + //for (i = 1; i < (S32)mPatchesPerEdge; i++) + for (i = 1; i < ppe[0]; i++) +// Aurora Sim { - patchp = getPatch(i, mPatchesPerEdge - 1); - neighbor_patchp = neighborp->getPatch(i-1, 0); +// Aurora Sim + //patchp = getPatch(i, mPatchesPerEdge - 1); + //neighbor_patchp = neighborp->getPatch(i-1, 0); + patchp = getPatch(i + own_offset[0], mPatchesPerEdge - 1); + neighbor_patchp = neighborp->getPatch(i-1 + neighbor_offset[0], 0); +// Aurora Sim patchp->connectNeighbor(neighbor_patchp, NORTHWEST); neighbor_patchp->connectNeighbor(patchp, SOUTHEAST); @@ -478,10 +607,17 @@ void LLSurface::connectNeighbor(LLSurface *neighborp, U32 direction) else if (WEST == direction) { // Do east/west connections, first - for (i = 0; i < mPatchesPerEdge; i++) +// Aurora Sim + //for (i = 0; i < mPatchesPerEdge; i++) + for (i = 0; i < ppe[1]; i++) +// Aurora Sim { - patchp = getPatch(0, i); - neighbor_patchp = neighborp->getPatch(mPatchesPerEdge - 1, i); +// Aurora Sim + //patchp = getPatch(0, i); + //neighbor_patchp = neighborp->getPatch(mPatchesPerEdge - 1, i); + patchp = getPatch(0, i + own_offset[1]); + neighbor_patchp = neighborp->getPatch(neighborPatchesPerEdge - 1, i + neighbor_offset[1]); +// Aurora Sim patchp->connectNeighbor(neighbor_patchp, direction); neighbor_patchp->connectNeighbor(patchp, gDirOpposite[direction]); @@ -491,20 +627,34 @@ void LLSurface::connectNeighbor(LLSurface *neighborp, U32 direction) } // Now do northeast/southwest connections - for (i = 1; i < mPatchesPerEdge; i++) +// Aurora Sim + //for (i = 1; i < mPatchesPerEdge; i++) + for (i = 1; i < ppe[1]; i++) +// Aurora Sim { - patchp = getPatch(0, i); - neighbor_patchp = neighborp->getPatch(mPatchesPerEdge - 1, i - 1); +// Aurora Sim + //patchp = getPatch(0, i); + //neighbor_patchp = neighborp->getPatch(mPatchesPerEdge - 1, i - 1); + patchp = getPatch(0, i + own_offset[1]); + neighbor_patchp = neighborp->getPatch(neighborPatchesPerEdge - 1, i - 1 + neighbor_offset[1]); +// Aurora Sim patchp->connectNeighbor(neighbor_patchp, SOUTHWEST); neighbor_patchp->connectNeighbor(patchp, NORTHEAST); } // Now do northwest/southeast connections - for (i = 0; i < mPatchesPerEdge - 1; i++) +// Aurora Sim + //for (i = 0; i < mPatchesPerEdge - 1; i++) + for (i = 0; i < ppe[1] - 1; i++) +// Aurora Sim { - patchp = getPatch(0, i); - neighbor_patchp = neighborp->getPatch(mPatchesPerEdge - 1, i + 1); +// Aurora Sim + //patchp = getPatch(0, i); + //neighbor_patchp = neighborp->getPatch(mPatchesPerEdge - 1, i + 1); + patchp = getPatch(0, i + own_offset[1]); + neighbor_patchp = neighborp->getPatch(neighborPatchesPerEdge - 1, i + 1 + neighbor_offset[1]); +// Aurora Sim patchp->connectNeighbor(neighbor_patchp, NORTHWEST); neighbor_patchp->connectNeighbor(patchp, SOUTHEAST); @@ -513,10 +663,17 @@ void LLSurface::connectNeighbor(LLSurface *neighborp, U32 direction) else if (SOUTH == direction) { // Do north/south connections, first - for (i = 0; i < mPatchesPerEdge; i++) +// Aurora Sim + //for (i = 0; i < mPatchesPerEdge; i++) + for (i = 0; i < ppe[0]; i++) +// Aurora Sim { - patchp = getPatch(i, 0); - neighbor_patchp = neighborp->getPatch(i, mPatchesPerEdge - 1); +// Aurora Sim + //patchp = getPatch(i, 0); + //neighbor_patchp = neighborp->getPatch(i, mPatchesPerEdge - 1); + patchp = getPatch(i + own_offset[0], 0); + neighbor_patchp = neighborp->getPatch(i + neighbor_offset[0], neighborPatchesPerEdge - 1); +// Aurora Sim patchp->connectNeighbor(neighbor_patchp, direction); neighbor_patchp->connectNeighbor(patchp, gDirOpposite[direction]); @@ -526,19 +683,33 @@ void LLSurface::connectNeighbor(LLSurface *neighborp, U32 direction) } // Now do northeast/southwest connections - for (i = 1; i < mPatchesPerEdge; i++) +// Aurora Sim + //for (i = 1; i < mPatchesPerEdge; i++) + for (i = 1; i < ppe[0]; i++) +// Aurora Sim { - patchp = getPatch(i, 0); - neighbor_patchp = neighborp->getPatch(i - 1, mPatchesPerEdge - 1); +// Aurora Sim + //patchp = getPatch(i, 0); + //neighbor_patchp = neighborp->getPatch(i - 1, mPatchesPerEdge - 1); + patchp = getPatch(i + own_offset[0], 0); + neighbor_patchp = neighborp->getPatch(i - 1 + neighbor_offset[0], neighborPatchesPerEdge - 1); +// Aurora Sim patchp->connectNeighbor(neighbor_patchp, SOUTHWEST); neighbor_patchp->connectNeighbor(patchp, NORTHEAST); } // Now do northeast/southwest connections - for (i = 0; i < mPatchesPerEdge - 1; i++) +// Aurora Sim + //for (i = 0; i < mPatchesPerEdge - 1; i++) + for (i = 0; i < ppe[0] - 1; i++) +// Aurora Sim { - patchp = getPatch(i, 0); - neighbor_patchp = neighborp->getPatch(i + 1, mPatchesPerEdge - 1); +// Aurora Sim + //patchp = getPatch(i, 0); + //neighbor_patchp = neighborp->getPatch(i + 1, mPatchesPerEdge - 1); + patchp = getPatch(i + own_offset[0], 0); + neighbor_patchp = neighborp->getPatch(i + 1 + neighbor_offset[0], neighborPatchesPerEdge - 1); +// Aurora Sim patchp->connectNeighbor(neighbor_patchp, SOUTHEAST); neighbor_patchp->connectNeighbor(patchp, NORTHWEST); @@ -700,14 +871,29 @@ void LLSurface::decompressDCTPatch(LLBitPack &bitpack, LLGroupHeader *gopp, BOOL while (1) { - decode_patch_header(bitpack, &ph); +// Aurora Sim + //decode_patch_header(bitpack, &ph); + decode_patch_header(bitpack, &ph, b_large_patch); +// Aurora Sim if (ph.quant_wbits == END_OF_PATCHES) { break; } - i = ph.patchids >> 5; - j = ph.patchids & 0x1F; +// Aurora Sim + //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 + } +// Aurora Sim if ((i >= mPatchesPerEdge) || (j >= mPatchesPerEdge)) { @@ -1229,7 +1415,10 @@ BOOL LLSurface::generateWaterTexture(const F32 x, const F32 y, LLPointer raw = new LLImageRaw(tex_width, tex_height, tex_comps); U8 *rawp = raw->getData(); - F32 scale = 256.f * getMetersPerGrid() / (F32)tex_width; +// Aurora Sim + //F32 scale = 256.f * getMetersPerGrid() / (F32)tex_width; + F32 scale = getRegion()->getWidth() * getMetersPerGrid() / (F32)tex_width; +// Aurora Sim F32 scale_inv = 1.f / scale; S32 x_begin, y_begin, x_end, y_end; diff --git a/indra/newview/llsurface.h b/indra/newview/llsurface.h index a693f6943..aedac01a3 100644 --- a/indra/newview/llsurface.h +++ b/indra/newview/llsurface.h @@ -85,6 +85,9 @@ public: void disconnectNeighbor(LLSurface *neighborp); void disconnectAllNeighbors(); +// Aurora Sim + void rebuildWater(); +// Aurora Sim virtual void decompressDCTPatch(LLBitPack &bitpack, LLGroupHeader *gopp, BOOL b_large_patch); virtual void updatePatchVisibilities(LLAgent &agent); diff --git a/indra/newview/llsurfacepatch.cpp b/indra/newview/llsurfacepatch.cpp index 3ebea883c..b85b7b99a 100644 --- a/indra/newview/llsurfacepatch.cpp +++ b/indra/newview/llsurfacepatch.cpp @@ -36,6 +36,7 @@ #include "timing.h" #include "llsky.h" #include "llviewercamera.h" +#include "llregionhandle.h" // Aurora Sim // For getting composition values #include "llviewerregion.h" @@ -231,8 +232,8 @@ void LLSurfacePatch::eval(const U32 x, const U32 y, const U32 stride, LLVector3 const F32 xyScaleInv = (1.f / xyScale)*(0.2222222222f); F32 vec[3] = { - (F32)fmod((F32)(mOriginGlobal.mdV[0] + x)*xyScaleInv, 256.f), - (F32)fmod((F32)(mOriginGlobal.mdV[1] + y)*xyScaleInv, 256.f), + (F32)fmod((F32)(mOriginGlobal.mdV[0] + x)*xyScaleInv, 256.f), // Added (F32) for proper array initialization + (F32)fmod((F32)(mOriginGlobal.mdV[1] + y)*xyScaleInv, 256.f), // Added (F32) for proper array initialization 0.f }; F32 rand_val = llclamp(noise2(vec)* 0.75f + 0.5f, 0.f, 1.f); @@ -249,18 +250,33 @@ void LLSurfacePatch::calcNormal(const U32 x, const U32 y, const U32 stride) const F32 mpg = mSurfacep->getMetersPerGrid() * stride; - S32 poffsets[2][2][2]; +// Aurora Sim + //S32 poffsets[2][2][2]; + S32 poffsets[2][2][3]; +// Aurora Sim poffsets[0][0][0] = x - stride; poffsets[0][0][1] = y - stride; +// Aurora Sim + poffsets[0][0][2] = surface_stride; +// Aurora Sim poffsets[0][1][0] = x - stride; poffsets[0][1][1] = y + stride; +// Aurora Sim + poffsets[0][1][2] = surface_stride; +// Aurora Sim poffsets[1][0][0] = x + stride; poffsets[1][0][1] = y - stride; +// Aurora Sim + poffsets[1][0][2] = surface_stride; +// Aurora Sim poffsets[1][1][0] = x + stride; poffsets[1][1][1] = y + stride; +// Aurora Sim + poffsets[1][1][2] = surface_stride; +// Aurora Sim const LLSurfacePatch *ppatches[2][2]; @@ -284,8 +300,11 @@ void LLSurfacePatch::calcNormal(const U32 x, const U32 y, const U32 stride) } else { - poffsets[i][j][0] += patch_width; +// Aurora Sim ppatches[i][j] = ppatches[i][j]->getNeighborPatch(WEST); + poffsets[i][j][0] += patch_width; + poffsets[i][j][2] = ppatches[i][j]->getSurface()->getGridsPerEdge(); +// Aurora Sim } } if (poffsets[i][j][1] < 0) @@ -296,8 +315,11 @@ void LLSurfacePatch::calcNormal(const U32 x, const U32 y, const U32 stride) } else { - poffsets[i][j][1] += patch_width; +// Aurora Sim ppatches[i][j] = ppatches[i][j]->getNeighborPatch(SOUTH); + poffsets[i][j][1] += patch_width; + poffsets[i][j][2] = ppatches[i][j]->getSurface()->getGridsPerEdge(); +// CR> Aurora Sim } } if (poffsets[i][j][0] >= (S32)patch_width) @@ -308,8 +330,11 @@ void LLSurfacePatch::calcNormal(const U32 x, const U32 y, const U32 stride) } else { - poffsets[i][j][0] -= patch_width; +// Aurora Sim ppatches[i][j] = ppatches[i][j]->getNeighborPatch(EAST); + poffsets[i][j][0] -= patch_width; + poffsets[i][j][2] = ppatches[i][j]->getSurface()->getGridsPerEdge(); +// Aurora Sim } } if (poffsets[i][j][1] >= (S32)patch_width) @@ -320,8 +345,11 @@ void LLSurfacePatch::calcNormal(const U32 x, const U32 y, const U32 stride) } else { - poffsets[i][j][1] -= patch_width; +// Aurora Sim ppatches[i][j] = ppatches[i][j]->getNeighborPatch(NORTH); + poffsets[i][j][1] -= patch_width; + poffsets[i][j][2] = ppatches[i][j]->getSurface()->getGridsPerEdge(); +// Aurora Sim } } } @@ -330,19 +358,31 @@ void LLSurfacePatch::calcNormal(const U32 x, const U32 y, const U32 stride) LLVector3 p00(-mpg,-mpg, *(ppatches[0][0]->mDataZ + poffsets[0][0][0] - + poffsets[0][0][1]*surface_stride)); +// Aurora Sim + //+ poffsets[0][0][1]*surface_stride)); + + poffsets[0][0][1]*poffsets[0][0][2])); +// Aurora Sim LLVector3 p01(-mpg,+mpg, *(ppatches[0][1]->mDataZ + poffsets[0][1][0] - + poffsets[0][1][1]*surface_stride)); +// Aurora Sim + //+ poffsets[0][1][1]*surface_stride)); + + poffsets[0][1][1]*poffsets[0][1][2])); +// Aurora Sim LLVector3 p10(+mpg,-mpg, *(ppatches[1][0]->mDataZ + poffsets[1][0][0] - + poffsets[1][0][1]*surface_stride)); +// Aurora Sim + //+ poffsets[1][0][1]*surface_stride)); + + poffsets[1][0][1]*poffsets[1][0][2])); +// Aurora Sim LLVector3 p11(+mpg,+mpg, *(ppatches[1][1]->mDataZ + poffsets[1][1][0] - + poffsets[1][1][1]*surface_stride)); +// Aurora Sim + //+ poffsets[1][1][1]*surface_stride)); + + poffsets[1][1][1]*poffsets[1][1][2])); +// Aurora Sim LLVector3 c1 = p11 - p00; LLVector3 c2 = p01 - p10; @@ -480,6 +520,18 @@ void LLSurfacePatch::updateNormals() // update the north edge if (mNormalsInvalid[NORTHEAST] || mNormalsInvalid[NORTH] || mNormalsInvalid[NORTHWEST]) { +// Aurora Sim + /* + if(!getNeighborPatch(EAST) && getNeighborPatch(NORTHEAST)) + { + if(getNeighborPatch(NORTHEAST)->getHasReceivedData()) + { + *(getNeighborPatch(NORTHEAST)->mDataZ) = 100.0f; + } + } + */ +// Aurora Sim + for (i = 0; i <= grids_per_patch_edge; i++) { calcNormal(i, grids_per_patch_edge, 2); @@ -493,6 +545,16 @@ void LLSurfacePatch::updateNormals() // update the west edge if (mNormalsInvalid[NORTHWEST] || mNormalsInvalid[WEST] || mNormalsInvalid[SOUTHWEST]) { +// Aurora Sim + if(!getNeighborPatch(NORTH) && getNeighborPatch(NORTHWEST)) + { + if(getNeighborPatch(NORTHWEST)->getHasReceivedData()) + { + *(mDataZ + grids_per_patch_edge*grids_per_edge) = *(getNeighborPatch(NORTHWEST)->mDataZ + grids_per_patch_edge); + } + } +// Aurora Sim + for (j = 0; j < grids_per_patch_edge; j++) { calcNormal(0, j, 2); @@ -504,6 +566,17 @@ void LLSurfacePatch::updateNormals() // update the south edge if (mNormalsInvalid[SOUTHWEST] || mNormalsInvalid[SOUTH] || mNormalsInvalid[SOUTHEAST]) { +// Aurora Sim + if(!getNeighborPatch(EAST) && getNeighborPatch(SOUTHEAST)) + { + if(getNeighborPatch(SOUTHEAST)->getHasReceivedData()) + { + *(mDataZ + grids_per_patch_edge) = + *(getNeighborPatch(SOUTHEAST)->mDataZ + grids_per_patch_edge * getNeighborPatch(SOUTHEAST)->getSurface()->getGridsPerEdge()); + } + } +// Aurora Sim + for (i = 0; i < grids_per_patch_edge; i++) { calcNormal(i, 0, 2); @@ -532,7 +605,10 @@ void LLSurfacePatch::updateNormals() { // East, but not north. Pull from your east neighbor's northwest point. *(mDataZ + grids_per_patch_edge + grids_per_patch_edge*grids_per_edge) = - *(getNeighborPatch(EAST)->mDataZ + (grids_per_patch_edge - 1)*grids_per_edge); +// Aurora Sim + //*(getNeighborPatch(EAST)->mDataZ + (grids_per_patch_edge - 1)*grids_per_edge); + *(getNeighborPatch(EAST)->mDataZ + (getNeighborPatch(EAST)->getSurface()->getGridsPerPatchEdge() - 1)*getNeighborPatch(EAST)->getSurface()->getGridsPerEdge()); +// Aurora Sim } else { @@ -557,7 +633,10 @@ void LLSurfacePatch::updateNormals() { // North, but not east. Pull from your north neighbor's southeast corner. *(mDataZ + grids_per_patch_edge + grids_per_patch_edge*grids_per_edge) = - *(getNeighborPatch(NORTH)->mDataZ + (grids_per_patch_edge - 1)); +// Aurora Sim + //*(getNeighborPatch(NORTH)->mDataZ + (grids_per_patch_edge - 1)); + *(getNeighborPatch(NORTH)->mDataZ + (getNeighborPatch(NORTH)->getSurface()->getGridsPerPatchEdge() - 1)); +// Aurora Sim } else { @@ -574,8 +653,25 @@ void LLSurfacePatch::updateNormals() && (!getNeighborPatch(EAST) || (getNeighborPatch(EAST)->mSurfacep != mSurfacep))) { +// Aurora Sim + U32 own_xpos, own_ypos, neighbor_xpos, neighbor_ypos; + S32 own_offset = 0, neighbor_offset = 0; + from_region_handle(mSurfacep->getRegion()->getHandle(), &own_xpos, &own_ypos); + from_region_handle(getNeighborPatch(NORTHEAST)->mSurfacep->getRegion()->getHandle(), &neighbor_xpos, &neighbor_ypos); + if(own_ypos >= neighbor_ypos) { + neighbor_offset = own_ypos - neighbor_ypos; + } + else { + own_offset = neighbor_ypos - own_ypos; + } +// Aurora Sim + *(mDataZ + grids_per_patch_edge + grids_per_patch_edge*grids_per_edge) = - *(getNeighborPatch(NORTHEAST)->mDataZ); + *(getNeighborPatch(NORTHEAST)->mDataZ + +// Aurora Sim + (grids_per_edge + neighbor_offset - own_offset - 1) * + getNeighborPatch(NORTHEAST)->getSurface()->getGridsPerEdge() ); +// Aurora Sim } } else @@ -618,8 +714,12 @@ void LLSurfacePatch::updateEastEdge() { U32 grids_per_patch_edge = mSurfacep->getGridsPerPatchEdge(); U32 grids_per_edge = mSurfacep->getGridsPerEdge(); +// Aurora Sim + U32 grids_per_edge_east = grids_per_edge; - U32 j, k; + //U32 j, k; + U32 j, k, h; +// Aurora Sim F32 *west_surface, *east_surface; if (!getNeighborPatch(EAST)) @@ -631,6 +731,9 @@ void LLSurfacePatch::updateEastEdge() { west_surface = mDataZ + grids_per_patch_edge; east_surface = getNeighborPatch(EAST)->mDataZ; +// Aurora Sim + grids_per_edge_east = getNeighborPatch(EAST)->getSurface()->getGridsPerEdge(); +// Aurora Sim } else { @@ -642,7 +745,11 @@ void LLSurfacePatch::updateEastEdge() for (j=0; j < grids_per_patch_edge; j++) { k = j * grids_per_edge; - *(west_surface + k) = *(east_surface + k); // update buffer Z +// Aurora Sim + h = j * grids_per_edge_east; + *(west_surface + k) = *(east_surface + h); // update buffer Z + //*(west_surface + k) = *(east_surface + k); // update buffer Z +// Aurora Sim } } @@ -671,13 +778,12 @@ void LLSurfacePatch::updateNorthEdge() } // Update patchp's north edge ... - for (i=0; igetU64Fast(_PREHASH_Info, _PREHASH_RegionHandle, region_handle); U32 teleport_flags; msg->getU32Fast(_PREHASH_Info, _PREHASH_TeleportFlags, teleport_flags); - + +// Aurora Sim + 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; + } +// Aurora Sim std::string seedCap; msg->getStringFast(_PREHASH_Info, _PREHASH_SeedCapability, seedCap); @@ -4429,7 +4443,10 @@ 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); +// Aurora Sim + //LLViewerRegion* regionp = LLWorld::getInstance()->addRegion(region_handle, sim_host); + LLViewerRegion* regionp = LLWorld::getInstance()->addRegion(region_handle, sim_host, region_size_x, region_size_y); +// Aurora Sim /* // send camera update to new region @@ -4752,9 +4769,26 @@ void process_crossed_region(LLMessageSystem* msg, void**) std::string seedCap; msg->getStringFast(_PREHASH_RegionData, _PREHASH_SeedCapability, seedCap); +// Aurora Sim + 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; + } +// Aurora Sim send_complete_agent_movement(sim_host); - LLViewerRegion* regionp = LLWorld::getInstance()->addRegion(region_handle, sim_host); +// Aurora Sim + //LLViewerRegion* regionp = LLWorld::getInstance()->addRegion(region_handle, sim_host); + LLViewerRegion* regionp = LLWorld::getInstance()->addRegion(region_handle, sim_host, region_size_x, region_size_y); +// Aurora Sim regionp->setSeedCapability(seedCap); } diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 6429b89c7..234ebab2e 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -962,7 +962,10 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, U16 valswizzle[4]; #endif U16 *val; - const F32 size = LLWorld::getInstance()->getRegionWidthInMeters(); +// Aurora Sim + //const F32 size = LLWorld::getInstance()->getRegionWidthInMeters(); + const F32 size = mRegionp->getWidth(); +// Aurora Sim const F32 MAX_HEIGHT = LLWorld::getInstance()->getRegionMaxHeight(); const F32 MIN_HEIGHT = LLWorld::getInstance()->getRegionMinHeight(); S32 length; diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp index 5b7c7f274..51aeffff3 100644 --- a/indra/newview/llviewerparcelmgr.cpp +++ b/indra/newview/llviewerparcelmgr.cpp @@ -145,7 +145,13 @@ LLViewerParcelMgr::LLViewerParcelMgr() mHoverParcel = new LLParcel(); mCollisionParcel = new LLParcel(); - mParcelsPerEdge = S32( REGION_WIDTH_METERS / PARCEL_GRID_STEP_METERS ); +// Aurora Sim + // Max region size on Aurora-Sim, 8192, just creating larger buffers, it will still work on Second Life and Opensim + F32 region_size = 8192.f; + + mParcelsPerEdge = S32( region_size / PARCEL_GRID_STEP_METERS ); + //mParcelsPerEdge = S32( REGION_WIDTH_METERS / PARCEL_GRID_STEP_METERS ); +// Aurora Sim mHighlightSegments = new U8[(mParcelsPerEdge+1)*(mParcelsPerEdge+1)]; resetSegments(mHighlightSegments); @@ -168,9 +174,19 @@ LLViewerParcelMgr::LLViewerParcelMgr() mAgentParcelOverlay[i] = 0; } +// Aurora Sim + mParcelsPerEdge = S32( REGION_WIDTH_METERS / PARCEL_GRID_STEP_METERS ); +// Aurora Sim + mTeleportInProgress = TRUE; // the initial parcel update is treated like teleport } +// Aurora Sim +void LLViewerParcelMgr::init(F32 region_size) +{ + mParcelsPerEdge = S32( region_size / PARCEL_GRID_STEP_METERS ); +} +// Aurora Sim LLViewerParcelMgr::~LLViewerParcelMgr() { @@ -450,9 +466,15 @@ LLParcelSelectionHandle LLViewerParcelMgr::selectParcelInRectangle() void LLViewerParcelMgr::selectCollisionParcel() { // BUG: Claim to be in the agent's region - mWestSouth = gAgent.getRegion()->getOriginGlobal(); +// Aurora Sim + //mWestSouth = gAgent.getRegion()->getOriginGlobal(); + //mEastNorth = mWestSouth; + //mEastNorth += LLVector3d(PARCEL_GRID_STEP_METERS, PARCEL_GRID_STEP_METERS, 0.0); + mWestSouth = getSelectionRegion()->getOriginGlobal(); mEastNorth = mWestSouth; - mEastNorth += LLVector3d(PARCEL_GRID_STEP_METERS, PARCEL_GRID_STEP_METERS, 0.0); + mEastNorth += LLVector3d((getSelectionRegion()->getWidth() / REGION_WIDTH_METERS) * PARCEL_GRID_STEP_METERS, + (getSelectionRegion()->getWidth() / REGION_WIDTH_METERS) * PARCEL_GRID_STEP_METERS, 0.0); +// Aurora Sim // BUG: must be in the sim you are in LLMessageSystem *msg = gMessageSystem; @@ -1410,8 +1432,11 @@ 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; +// Aurora Sim + //S32 parcels_per_edge = LLViewerParcelMgr::getInstance()->mParcelsPerEdge; + //S32 expected_size = parcels_per_edge * parcels_per_edge / PARCEL_OVERLAY_CHUNKS; + S32 expected_size = 1024; +// Aurora Sim if (packed_overlay_size != expected_size) { llwarns << "Got parcel overlay size " << packed_overlay_size @@ -1474,6 +1499,15 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use S32 other_clean_time = 0; LLViewerParcelMgr& parcel_mgr = LLViewerParcelMgr::instance(); +// Aurora Sim + LLViewerRegion* msg_region = LLWorld::getInstance()->getRegion( msg->getSender() ); + if(msg_region) { + parcel_mgr.mParcelsPerEdge = S32( msg_region->getWidth() / PARCEL_GRID_STEP_METERS ); + } + else { + parcel_mgr.mParcelsPerEdge = S32( gAgent.getRegion()->getWidth() / PARCEL_GRID_STEP_METERS ); + } +// Aurora Sim msg->getS32Fast(_PREHASH_ParcelData, _PREHASH_RequestResult, request_result ); msg->getS32Fast(_PREHASH_ParcelData, _PREHASH_SequenceID, sequence_id ); diff --git a/indra/newview/llviewerparcelmgr.h b/indra/newview/llviewerparcelmgr.h index 5ae44e2d0..022465a97 100644 --- a/indra/newview/llviewerparcelmgr.h +++ b/indra/newview/llviewerparcelmgr.h @@ -89,6 +89,9 @@ public: LLViewerParcelMgr(); ~LLViewerParcelMgr(); +// Aurora Sim + void init(F32 region_size); +// Aurora Sim static void cleanupGlobals(); BOOL selectionEmpty() const; diff --git a/indra/newview/llviewerparceloverlay.cpp b/indra/newview/llviewerparceloverlay.cpp index 42bf3100c..6eb83a9f7 100644 --- a/indra/newview/llviewerparceloverlay.cpp +++ b/indra/newview/llviewerparceloverlay.cpp @@ -59,6 +59,9 @@ 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 ) ), +// Aurora Sim + mRegionSize(S32(region_width_meters)), +// Aurora Sim mDirty( FALSE ), mTimeSinceLastUpdate(), mOverlayTextureIdx(-1), @@ -413,7 +416,12 @@ 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; + +// Aurora Sim + //S32 chunk_size = size / PARCEL_OVERLAY_CHUNKS; + S32 mParcelOverLayChunks = mRegionSize * mRegionSize / (128 * 128); + S32 chunk_size = size / mParcelOverLayChunks; +// Aurora Sim memcpy(mOwnership + chunk*chunk_size, packed_overlay, chunk_size); /*Flawfinder: ignore*/ diff --git a/indra/newview/llviewerparceloverlay.h b/indra/newview/llviewerparceloverlay.h index 794a485e6..d53a4c15f 100644 --- a/indra/newview/llviewerparceloverlay.h +++ b/indra/newview/llviewerparceloverlay.h @@ -109,6 +109,9 @@ private: LLViewerRegion* mRegion; S32 mParcelGridsPerEdge; +// Aurora Sim + S32 mRegionSize; +// Aurora Sim LLPointer mTexture; LLPointer mImageRaw; diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 50865c610..761de56be 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -78,6 +78,7 @@ #include "llviewercontrol.h" #include "llsdserialize.h" +#include "llviewerparcelmgr.h" //Aurora Sim #ifdef LL_WINDOWS #pragma warning(disable:4355) #endif @@ -309,9 +310,12 @@ LLViewerRegion::LLViewerRegion(const U64 &handle, mReleaseNotesRequested(FALSE), mCapabilitiesReceived(false), mFeaturesReceived(false), - mGamingFlags(0) + mGamingFlags(0), +// Aurora Sim + mWidth(region_width_meters) { - mWidth = region_width_meters; + // Moved this up... -> mWidth = region_width_meters; +// mImpl->mOriginGlobal = from_region_handle(handle); updateRenderMatrix(); @@ -321,7 +325,10 @@ LLViewerRegion::LLViewerRegion(const U64 &handle, mImpl->mCompositionp = new LLVLComposition(mImpl->mLandp, grids_per_region_edge, - region_width_meters / grids_per_region_edge); +// Aurora Sim + //region_width_meters / grids_per_region_edge); + mWidth / grids_per_region_edge); +// Aurora Sim mImpl->mCompositionp->setSurface(mImpl->mLandp); // Create the surfaces @@ -331,7 +338,11 @@ LLViewerRegion::LLViewerRegion(const U64 &handle, mImpl->mOriginGlobal, mWidth); - mParcelOverlay = new LLViewerParcelOverlay(this, region_width_meters); +// Aurora Sim + //mParcelOverlay = new LLViewerParcelOverlay(this, region_width_meters); + mParcelOverlay = new LLViewerParcelOverlay(this, mWidth); + LLViewerParcelMgr::getInstance()->init(mWidth); +// Aurora Sim setOriginGlobal(from_region_handle(handle)); calculateCenterGlobal(); @@ -493,6 +504,13 @@ void LLViewerRegion::setWaterHeight(F32 water_level) mImpl->mLandp->setWaterHeight(water_level); } +// Aurora Sim +void LLViewerRegion::rebuildWater() +{ + mImpl->mLandp->rebuildWater(); +} +// Aurora Sim + F32 LLViewerRegion::getWaterHeight() const { return mImpl->mLandp->getWaterHeight(); @@ -838,11 +856,20 @@ LLVLComposition * LLViewerRegion::getComposition() const F32 LLViewerRegion::getCompositionXY(const S32 x, const S32 y) const { - if (x >= 256) +// Aurora Sim + //if (x >= 256) + if (x >= mWidth) +// Aurora Sim { - if (y >= 256) +// Aurora Sim + //if (y >= 256) + if (y >= mWidth) +// Aurora Sim { - LLVector3d center = getCenterGlobal() + LLVector3d(256.f, 256.f, 0.f); +// Aurora Sim + //LLVector3d center = getCenterGlobal() + LLVector3d(256.f, 256.f, 0.f); + LLVector3d center = getCenterGlobal() + LLVector3d(mWidth, mWidth, 0.f); +// Aurora Sim LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromPosGlobal(center); if (regionp) { @@ -851,8 +878,12 @@ F32 LLViewerRegion::getCompositionXY(const S32 x, const S32 y) const // If we're attempting to blend, then we want to make the fractional part of // this region match the fractional of the adjacent. For now, just minimize // the delta. - F32 our_comp = getComposition()->getValueScaled(255, 255); - F32 adj_comp = regionp->getComposition()->getValueScaled(x - 256.f, y - 256.f); +// Aurora Sim + //F32 our_comp = getComposition()->getValueScaled(255, 255); + //F32 adj_comp = regionp->getComposition()->getValueScaled(x - 256.f, y - 256.f); + F32 our_comp = getComposition()->getValueScaled(mWidth-1.f, mWidth-1.f); + F32 adj_comp = regionp->getComposition()->getValueScaled(x - regionp->getWidth(), y - regionp->getWidth()); +// Aurora Sim while (llabs(our_comp - adj_comp) >= 1.f) { if (our_comp > adj_comp) @@ -869,7 +900,10 @@ F32 LLViewerRegion::getCompositionXY(const S32 x, const S32 y) const } else { - LLVector3d center = getCenterGlobal() + LLVector3d(256.f, 0, 0.f); +// Aurora Sim + //LLVector3d center = getCenterGlobal() + LLVector3d(256.f, 0, 0.f); + LLVector3d center = getCenterGlobal() + LLVector3d(mWidth, 0.f, 0.f); +// Aurora Sim LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromPosGlobal(center); if (regionp) { @@ -878,8 +912,12 @@ F32 LLViewerRegion::getCompositionXY(const S32 x, const S32 y) const // If we're attempting to blend, then we want to make the fractional part of // this region match the fractional of the adjacent. For now, just minimize // the delta. - F32 our_comp = getComposition()->getValueScaled(255.f, (F32)y); - F32 adj_comp = regionp->getComposition()->getValueScaled(x - 256.f, (F32)y); +// Aurora Sim + //F32 our_comp = getComposition()->getValueScaled(255.f, (F32)y); + //F32 adj_comp = regionp->getComposition()->getValueScaled(x - 256.f, (F32)y); + F32 our_comp = getComposition()->getValueScaled(mWidth-1.f, (F32)y); + F32 adj_comp = regionp->getComposition()->getValueScaled(x - regionp->getWidth(), (F32)y); +// Aurora Sim while (llabs(our_comp - adj_comp) >= 1.f) { if (our_comp > adj_comp) @@ -895,9 +933,15 @@ F32 LLViewerRegion::getCompositionXY(const S32 x, const S32 y) const } } } - else if (y >= 256) +// Aurora Sim + //else if (y >= 256) + else if (y >= mWidth) +// Aurora Sim { - LLVector3d center = getCenterGlobal() + LLVector3d(0.f, 256.f, 0.f); +// Aurora Sim + //LLVector3d center = getCenterGlobal() + LLVector3d(0.f, 256.f, 0.f); + LLVector3d center = getCenterGlobal() + LLVector3d(0.f, mWidth, 0.f); +// Aurora Sim LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromPosGlobal(center); if (regionp) { @@ -906,8 +950,12 @@ F32 LLViewerRegion::getCompositionXY(const S32 x, const S32 y) const // If we're attempting to blend, then we want to make the fractional part of // this region match the fractional of the adjacent. For now, just minimize // the delta. - F32 our_comp = getComposition()->getValueScaled((F32)x, 255.f); - F32 adj_comp = regionp->getComposition()->getValueScaled((F32)x, y - 256.f); +// Aurora Sim + //F32 our_comp = getComposition()->getValueScaled((F32)x, 255.f); + //F32 adj_comp = regionp->getComposition()->getValueScaled((F32)x, y - 256.f); + F32 our_comp = getComposition()->getValueScaled((F32)x, mWidth-1.f); + F32 adj_comp = regionp->getComposition()->getValueScaled((F32)x, y - regionp->getWidth()); +// Aurora Sim while (llabs(our_comp - adj_comp) >= 1.f) { if (our_comp > adj_comp) @@ -1651,6 +1699,9 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames) capabilityNames.append("CustomMenuAction"); capabilityNames.append("DispatchRegionInfo"); capabilityNames.append("EnvironmentSettings"); +// Aurora Sim + capabilityNames.append("DispatchOpenRegionSettings"); +// Aurora Sim capabilityNames.append("EstateChangeInfo"); capabilityNames.append("EventQueueGet"); capabilityNames.append("FetchLib2"); diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index 6b0e73b49..460bc34c3 100644 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -147,6 +147,9 @@ public: void setWaterHeight(F32 water_level); F32 getWaterHeight() const; +// Aurora Sim + void rebuildWater(); +// Aurora Sim BOOL isVoiceEnabled() const; diff --git a/indra/newview/llvlcomposition.cpp b/indra/newview/llvlcomposition.cpp index 8954a2da2..94ae918be 100644 --- a/indra/newview/llvlcomposition.cpp +++ b/indra/newview/llvlcomposition.cpp @@ -164,7 +164,10 @@ 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; +// Aurora Sim + //const F32 inv_width = 1.f/mWidth; + const F32 inv_width = 1.f/(F32)mWidth; +// Aurora Sim // OK, for now, just have the composition value equal the height at the point. for (S32 j = y_begin; j < y_end; j++) diff --git a/indra/newview/llvlmanager.cpp b/indra/newview/llvlmanager.cpp index 88afc9cc3..43b42f0ec 100644 --- a/indra/newview/llvlmanager.cpp +++ b/indra/newview/llvlmanager.cpp @@ -44,11 +44,6 @@ LLVLManager gVLManager; -// Extended land layer for Aurora Sim -const char AURORA_LAND_LAYER_CODE = 'M'; -const char AURORA_WIND_LAYER_CODE = '9'; -const char AURORA_CLOUD_LAYER_CODE = ':'; - LLVLManager::~LLVLManager() { S32 i; @@ -61,18 +56,33 @@ LLVLManager::~LLVLManager() void LLVLManager::addLayerData(LLVLData *vl_datap, const S32 mesg_size) { +// Aurora Sim + //if (LAND_LAYER_CODE == vl_datap->mType) if (LAND_LAYER_CODE == vl_datap->mType || AURORA_LAND_LAYER_CODE == vl_datap->mType) +// Aurora Sim { mLandBits += mesg_size * 8; } +// Aurora Sim + //else if (WIND_LAYER_CODE == vl_datap->mType) else if (WIND_LAYER_CODE == vl_datap->mType || AURORA_WIND_LAYER_CODE == vl_datap->mType) +// Aurora Sim { mWindBits += mesg_size * 8; } +// Aurora Sim + //else if (CLOUD_LAYER_CODE == vl_datap->mType) else if (CLOUD_LAYER_CODE == vl_datap->mType || AURORA_CLOUD_LAYER_CODE == vl_datap->mType) +// Aurora Sim { mCloudBits += mesg_size * 8; } +// Aurora Sim + else if (WATER_LAYER_CODE == vl_datap->mType || AURORA_CLOUD_LAYER_CODE == vl_datap->mType) + { + mWaterBits += mesg_size * 8; + } +// Aurora Sim else { llerrs << "Unknown layer type!" << (S32)vl_datap->mType << llendl; @@ -98,11 +108,14 @@ void LLVLManager::unpackData(const S32 num_packets) { datap->mRegionp->getLand().decompressDCTPatch(bit_pack, &goph, FALSE); } +// Aurora Sim else if (AURORA_LAND_LAYER_CODE == datap->mType) { datap->mRegionp->getLand().decompressDCTPatch(bit_pack, &goph, TRUE); } + //else if (WIND_LAYER_CODE == datap->mType) else if (WIND_LAYER_CODE == datap->mType || AURORA_WIND_LAYER_CODE == datap->mType) +// Aurora Sim { datap->mRegionp->mWind.decompress(bit_pack, &goph); diff --git a/indra/newview/llvlmanager.h b/indra/newview/llvlmanager.h index 9d64d6f24..6bf495e62 100644 --- a/indra/newview/llvlmanager.h +++ b/indra/newview/llvlmanager.h @@ -65,6 +65,9 @@ protected: U32 mLandBits; U32 mWindBits; U32 mCloudBits; +// Aurora Sim + U32 mWaterBits; +// Aurora Sim }; class LLVLData diff --git a/indra/newview/llvowater.cpp b/indra/newview/llvowater.cpp index 049a89d1a..c4e73d90b 100644 --- a/indra/newview/llvowater.cpp +++ b/indra/newview/llvowater.cpp @@ -74,7 +74,10 @@ 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. +// Aurora Sim + //setScale(LLVector3(256.f, 256.f, 0.f)); // Hack for setting scale for bounding boxes/visibility. + setScale(LLVector3(mRegionp->getWidth(), mRegionp->getWidth(), 0.f)); +// Aurora Sim mUseTexture = TRUE; mIsEdgePatch = FALSE; diff --git a/indra/newview/llwind.cpp b/indra/newview/llwind.cpp index 2b0f0d969..a6679cf2d 100644 --- a/indra/newview/llwind.cpp +++ b/indra/newview/llwind.cpp @@ -54,6 +54,9 @@ const F32 CLOUD_DIVERGENCE_COEF = 0.5f; +// Aurora Sim +#include "llviewerregion.h" +// Aurora Sim ////////////////////////////////////////////////////////////////////// // Construction/Destruction @@ -121,12 +124,18 @@ void LLWind::decompress(LLBitPack &bitpack, LLGroupHeader *group_headerp) set_group_of_patch_header(group_headerp); // X component - decode_patch_header(bitpack, &patch_header); +// Aurora Sim + //decode_patch_header(bitpack, &patch_header); + decode_patch_header(bitpack, &patch_header, FALSE); +// Aurora Sim decode_patch(bitpack, buffer); decompress_patch(mVelX, buffer, &patch_header); // Y component - decode_patch_header(bitpack, &patch_header); +// Aurora Sim + //decode_patch_header(bitpack, &patch_header); + decode_patch_header(bitpack, &patch_header, FALSE); +// Aurora Sim decode_patch(bitpack, buffer); decompress_patch(mVelY, buffer, &patch_header); @@ -254,7 +263,10 @@ LLVector3 LLWind::getVelocity(const LLVector3 &pos_region) LLVector3 pos_clamped_region(pos_region); - F32 region_width_meters = LLWorld::getInstance()->getRegionWidthInMeters(); +// Aurora Sim + //F32 region_width_meters = LLWorld::getInstance()->getRegionWidthInMeters(); + F32 region_width_meters = gAgent.getRegion()->getWidth(); +// Aurora Sim if (pos_clamped_region.mV[VX] < 0.f) { diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index 5c8c8f4a8..a0498781d 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -80,13 +80,18 @@ const S32 MAX_NUMBER_OF_CLOUDS = 750; const S32 WORLD_PATCH_SIZE = 16; extern LLColor4U MAX_WATER_COLOR; - -const U32 LLWorld::mWidth = 256; +// Aurora Sim +//const U32 LLWorld::mWidth = 256; +U32 LLWorld::mWidth = 256; +// Aurora Sim // meters/point, therefore mWidth * mScale = meters per edge const F32 LLWorld::mScale = 1.f; -const F32 LLWorld::mWidthInMeters = mWidth * mScale; +// Aurora Sim +//const F32 LLWorld::mWidthInMeters = mWidth * mScale; +F32 LLWorld::mWidthInMeters = mWidth * mScale; +// Aurora Sim // // Functions @@ -147,7 +152,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) { llinfos << "Add region with handle: " << region_handle << " on host " << host << llendl; LLViewerRegion *regionp = getRegionFromHandle(region_handle); @@ -179,9 +184,17 @@ LLViewerRegion* LLWorld::addRegion(const U64 ®ion_handle, const LLHost &host) U32 iindex = 0; U32 jindex = 0; +// Aurora Sim + mWidth = region_size_x; //MegaRegion + mWidthInMeters = mWidth * mScale; //MegaRegion +// Aurora Sim from_region_handle(region_handle, &iindex, &jindex); - S32 x = (S32)(iindex/mWidth); - S32 y = (S32)(jindex/mWidth); +// Aurora Sim + //S32 x = (S32)(iindex/mWidth); + //S32 y = (S32)(jindex/mWidth); + S32 x = (S32)(iindex/256); //MegaRegion + S32 y = (S32)(jindex/256); //MegaRegion +// Aurora Sim llinfos << "Adding new region (" << x << ":" << y << ")" << llendl; llinfos << "Host: " << host << llendl; @@ -223,21 +236,48 @@ LLViewerRegion* LLWorld::addRegion(const U64 ®ion_handle, const LLHost &host) F32 width = getRegionWidthInMeters(); LLViewerRegion *neighborp; +// Aurora Sim + LLViewerRegion *last_neighborp; +// Aurora Sim from_region_handle(region_handle, ®ion_x, ®ion_y); // Iterate through all directions, and connect neighbors if there. S32 dir; for (dir = 0; dir < 8; dir++) { +// Aurora Sim + last_neighborp = NULL; +// Aurora Sim adj_x = region_x + width * gDirAxes[dir][0]; adj_y = region_y + width * gDirAxes[dir][1]; - to_region_handle(adj_x, adj_y, &adj_handle); +// Aurora Sim + //to_region_handle(adj_x, adj_y, &adj_handle); + if(gDirAxes[dir][0] < 0) adj_x = region_x - WORLD_PATCH_SIZE; + if(gDirAxes[dir][1] < 0) adj_y = region_y - WORLD_PATCH_SIZE; - neighborp = getRegionFromHandle(adj_handle); - if (neighborp) + for(S32 offset = 0; offset < width; offset += WORLD_PATCH_SIZE) { - //llinfos << "Connecting " << region_x << ":" << region_y << " -> " << adj_x << ":" << adj_y << llendl; - regionp->connectNeighbor(neighborp, dir); + to_region_handle(adj_x, adj_y, &adj_handle); + neighborp = getRegionFromHandle(adj_handle); + + if (neighborp && last_neighborp != neighborp) + { + //llinfos << "Connecting " << region_x << ":" << region_y << " -> " << adj_x << ":" << adj_y << " dir:" << dir << llendl; + regionp->connectNeighbor(neighborp, dir); + last_neighborp = neighborp; + } + + if(dir == NORTHEAST || + dir == NORTHWEST || + dir == SOUTHWEST || + dir == SOUTHEAST) + { + break; + } + + if(dir == NORTH || dir == SOUTH) adj_x += WORLD_PATCH_SIZE; + if(dir == EAST || dir == WEST) adj_y += WORLD_PATCH_SIZE; +// Aurora Sim } } @@ -409,11 +449,24 @@ LLVector3d LLWorld::clipToVisibleRegions(const LLVector3d &start_pos, const LLVe LLViewerRegion* LLWorld::getRegionFromHandle(const U64 &handle) { +// Aurora Sim + U32 x, y; + from_region_handle(handle, &x, &y); +// Aurora Sim + for (region_list_t::iterator iter = mRegionList.begin(); iter != mRegionList.end(); ++iter) { LLViewerRegion* regionp = *iter; - if (regionp->getHandle() == handle) +// Aurora Sim + //if (regionp->getHandle() == handle) + U32 checkRegionX, checkRegionY; + F32 checkRegionWidth = regionp->getWidth(); + from_region_handle(regionp->getHandle(), &checkRegionX, &checkRegionY); + + if (x >= checkRegionX && x < (checkRegionX + checkRegionWidth) && + y >= checkRegionY && y < (checkRegionY + checkRegionWidth)) +// Aurora Sim { return regionp; } @@ -862,7 +915,10 @@ F32 LLWorld::getLandFarClip() const void LLWorld::setLandFarClip(const F32 far_clip) { - static S32 const rwidth = (S32)REGION_WIDTH_U32; +// Aurora Sim + //static S32 const rwidth = (S32)REGION_WIDTH_U32; + static S32 const rwidth = (S32)getRegionWidthInMeters(); +// Aurora Sim S32 const n1 = (llceil(mLandFarClip) - 1) / rwidth; S32 const n2 = (llceil(far_clip) - 1) / rwidth; bool need_water_objects_update = n1 != n2; @@ -1294,9 +1350,25 @@ void process_enable_simulator(LLMessageSystem *msg, void **user_data) // which simulator should we modify? LLHost sim(ip_u32, port); +// Aurora Sim + 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; + } +// Aurora Sim // Viewer trusts the simulator. msg->enableCircuit(sim, TRUE); - LLWorld::getInstance()->addRegion(handle, sim); +// Aurora Sim + //LLWorld::getInstance()->addRegion(handle, sim); + LLWorld::getInstance()->addRegion(handle, sim, region_size_x, region_size_y); +// Aurora Sim // 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 8cdaeae4e..8056139bd 100644 --- a/indra/newview/llworld.h +++ b/indra/newview/llworld.h @@ -71,7 +71,11 @@ public: LLWorld(); void destroyClass(); - LLViewerRegion* addRegion(const U64 ®ion_handle, const LLHost &host); +// Aurora Sim + void updateLimits(); // Aurora Sim + //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); +// Aurora Sim // 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); @@ -182,12 +186,18 @@ private: region_remove_signal_t mRegionRemovedSignal; // Number of points on edge - static const U32 mWidth; +// Aurora Sim + //static const U32 mWidth; + static U32 mWidth; +// Aurora Sim // meters/point, therefore mWidth * mScale = meters per edge static const F32 mScale; - static const F32 mWidthInMeters; +// Aurora Sim + //static const F32 mWidthInMeters; + static F32 mWidthInMeters; +// Aurora Sim F32 mLandFarClip; // Far clip distance for land. LLPatchVertexArray mLandPatch; diff --git a/indra/newview/llworldmap.cpp b/indra/newview/llworldmap.cpp index b153cfafd..64f5eb082 100644 --- a/indra/newview/llworldmap.cpp +++ b/indra/newview/llworldmap.cpp @@ -84,8 +84,10 @@ LLSimInfo::LLSimInfo(U64 handle) mAccess(0x0), mRegionFlags(0x0), mFirstAgentRequest(true), +// Aurora Sim mSizeX(REGION_WIDTH_UNITS), mSizeY(REGION_WIDTH_UNITS), +// Aurora Sim mAlpha(0.f) { } @@ -376,10 +378,31 @@ LLSimInfo* LLWorldMap::simInfoFromPosGlobal(const LLVector3d& pos_global) LLSimInfo* LLWorldMap::simInfoFromHandle(const U64 handle) { - sim_info_map_t::iterator it = mSimInfoMap.find(handle); - if (it != mSimInfoMap.end()) +// Aurora Sim + //sim_info_map_t::iterator it = mSimInfoMap.find(handle); + //if (it != mSimInfoMap.end()) + //{ + // return it->second; + std::map::const_iterator it; + for (it = LLWorldMap::getInstance()->mSimInfoMap.begin(); it != LLWorldMap::getInstance()->mSimInfoMap.end(); ++it) { - return it->second; + const U64 hndl = (*it).first; + LLSimInfo* info = (*it).second; + if(hndl == handle) + { + return info; + } + U32 x = 0, y = 0; + from_region_handle(handle, &x, &y); + U32 checkRegionX, checkRegionY; + from_region_handle(hndl, &checkRegionX, &checkRegionY); + + if(x >= checkRegionX && x < (checkRegionX + info->mSizeX) && + y >= checkRegionY && y < (checkRegionY + info->mSizeY)) + { + return info; + } +// Aurora Sim } return NULL; } @@ -538,7 +561,10 @@ void LLWorldMap::reloadItems(bool force) // static public // Insert a region in the region map // returns true if region inserted, false otherwise -bool LLWorldMap::insertRegion(U32 x_world, U32 y_world, U32 x_size, U32 y_size, U32 agent_flags, std::string& name, LLUUID& image_id, U32 accesscode, U32 region_flags) +// Aurora Sim +//bool LLWorldMap::insertRegion(U32 x_world, U32 y_world, std::string& name, LLUUID& image_id, U32 accesscode, U64 region_flags) +bool LLWorldMap::insertRegion(U32 x_world, U32 y_world, U16 x_size, U16 y_size, std::string& name, LLUUID& image_id, U32 accesscode, U64 region_flags) +// Aurora Sim { // This region doesn't exist if (accesscode == 255) @@ -562,17 +588,14 @@ bool LLWorldMap::insertRegion(U32 x_world, U32 y_world, U32 x_size, U32 y_size, { siminfo = LLWorldMap::getInstance()->createSimInfoFromHandle(handle); } - - siminfo->setName( name ); - siminfo->setAccess( accesscode ); - siminfo->setRegionFlags( region_flags ); - //siminfo->setWaterHeight((F32) water_height); - U32 layer = flagsToLayer(agent_flags); - if (layer == SIM_LAYER_OVERLAY) - siminfo->setLandForSaleImage(image_id); - else if(layer < SIM_LAYER_COUNT) - siminfo->setMapImageID( image_id, layer ); - siminfo->setSize( x_size, y_size ); + siminfo->setName(name); + siminfo->setAccess(accesscode); + siminfo->setRegionFlags(region_flags); + // siminfo->setWaterHeight((F32) water_height); + siminfo->setLandForSaleImage(image_id); +// Aurora Sim + siminfo->setSize(x_size, y_size); +// Aurora Sim // Handle the location tracking (for teleport, UI feedback and info display) if (LLWorldMap::getInstance()->isTrackingInRectangle( x_world, y_world, x_world + REGION_WIDTH_UNITS, y_world + REGION_WIDTH_UNITS)) diff --git a/indra/newview/llworldmap.h b/indra/newview/llworldmap.h index fd654316d..794b0f767 100644 --- a/indra/newview/llworldmap.h +++ b/indra/newview/llworldmap.h @@ -192,8 +192,15 @@ public: const LLSimInfo::item_info_list_t& getLandForSaleAdult() const { return mLandForSaleAdult; } const LLSimInfo::item_info_list_t& getAgentLocation() const { return mAgentLocations; } + const U64 &getHandle() const { return mHandle; } + +//private: + U64 mHandle; // This is a hash of the X and Y world coordinates of the SW corner of the sim + U16 mSizeX; + U16 mSizeY; + private: - U64 mHandle; +// Aurora Sim std::string mName; F64 mAgentsUpdateTime; // Time stamp giving the last time the agents information was requested for that region @@ -201,8 +208,6 @@ private: U32 mAccess; // Down/up and maturity rating of the region U32 mRegionFlags; - U16 mSizeX; - U16 mSizeY; F32 mAlpha; @@ -235,8 +240,12 @@ struct LLWorldMapLayer // We request region data on the world by "blocks" of (MAP_BLOCK_SIZE x MAP_BLOCK_SIZE) regions // This is to reduce the number of requests to the asset DB and get things in big "blocks" -const S32 MAP_MAX_SIZE = 2048; -const S32 MAP_BLOCK_SIZE = 4; +// Aurora Sim +//const S32 MAP_MAX_SIZE = 2048; +//const S32 MAP_BLOCK_SIZE = 4; +const S32 MAP_MAX_SIZE = 16384; +const S32 MAP_BLOCK_SIZE = 16; +// Aurora Sim const S32 MAP_BLOCK_RES = (MAP_MAX_SIZE / MAP_BLOCK_SIZE); class LLWorldMap : public LLSingleton @@ -262,7 +271,10 @@ public: // Insert a region and items in the map global instance // Note: x_world and y_world in world coordinates (meters) - static bool insertRegion(U32 x_world, U32 y_world, U32 x_size, U32 y_size, U32 agent_flags, std::string& name, LLUUID& image_id, U32 accesscode, U32 region_flags); +// Aurora Sim + static bool insertRegion(U32 x_world, U32 y_world, std::string& name, LLUUID& uuid, U32 accesscode, U64 region_flags); + static bool insertRegion(U32 x_world, U32 y_world, U16 x_size, U16 y_size, std::string& name, LLUUID& uuid, U32 accesscode, U64 region_flags); +// Aurora Sim static bool insertItem(U32 x_world, U32 y_world, std::string& name, LLUUID& uuid, U32 type, S32 extra, S32 extra2); // Get info on sims (region) : note that those methods only search the range of loaded sims (the one that are being browsed) diff --git a/indra/newview/llworldmapmessage.cpp b/indra/newview/llworldmapmessage.cpp index 5729bcb11..d7eaaafb6 100644 --- a/indra/newview/llworldmapmessage.cpp +++ b/indra/newview/llworldmapmessage.cpp @@ -170,8 +170,10 @@ void LLWorldMapMessage::processMapBlockReply(LLMessageSystem* msg, void**) { U16 x_regions; U16 y_regions; +// Aurora Sim U16 x_size = 256; U16 y_size = 256; +// Aurora Sim std::string name; U8 accesscode; U32 region_flags; @@ -186,6 +188,7 @@ void LLWorldMapMessage::processMapBlockReply(LLMessageSystem* msg, void**) // msg->getU8Fast(_PREHASH_Data, _PREHASH_WaterHeight, water_height, block); // msg->getU8Fast(_PREHASH_Data, _PREHASH_Agents, agents, block); msg->getUUIDFast(_PREHASH_Data, _PREHASH_MapImageID, image_id, block); +// Aurora Sim if(msg->getNumberOfBlocksFast(_PREHASH_Size) > 0) { msg->getU16Fast(_PREHASH_Size, _PREHASH_SizeX, x_size, block); @@ -196,6 +199,7 @@ void LLWorldMapMessage::processMapBlockReply(LLMessageSystem* msg, void**) x_size = 256; y_size = 256; } +// Aurora Sim U32 x_world = (U32)(x_regions) * REGION_WIDTH_UNITS; U32 y_world = (U32)(y_regions) * REGION_WIDTH_UNITS; @@ -209,7 +213,10 @@ void LLWorldMapMessage::processMapBlockReply(LLMessageSystem* msg, void**) continue; // Insert that region in the world map, if failure, flag it as a "null_sim" - if (!(LLWorldMap::getInstance()->insertRegion(x_world, y_world, x_size, y_size, agent_flags, name, image_id, (U32)accesscode, region_flags))) +// Aurora Sim + //if (!(LLWorldMap::getInstance()->insertRegion(x_world, y_world, name, image_id, (U32)accesscode, region_flags))) + if (!(LLWorldMap::getInstance()->insertRegion(x_world, y_world, x_size, y_size, name, image_id, (U32)accesscode, region_flags))) +// Aurora Sim { found_null_sim = true; } diff --git a/indra/newview/skins/default/xui/en-us/floater_world_map.xml b/indra/newview/skins/default/xui/en-us/floater_world_map.xml index ba1f068c2..580286dda 100644 --- a/indra/newview/skins/default/xui/en-us/floater_world_map.xml +++ b/indra/newview/skins/default/xui/en-us/floater_world_map.xml @@ -156,14 +156,14 @@ Location: