diff --git a/indra/llcharacter/llkeyframewalkmotion.cpp b/indra/llcharacter/llkeyframewalkmotion.cpp index 251ff3ed5..f9c2e4766 100644 --- a/indra/llcharacter/llkeyframewalkmotion.cpp +++ b/indra/llcharacter/llkeyframewalkmotion.cpp @@ -280,7 +280,7 @@ BOOL LLWalkAdjustMotion::onUpdate(F32 time, U8* joint_mask) avatar_movement_dir.normalize(); // planted foot speed is avatar velocity - foot slip amount along avatar movement direction - F32 foot_speed = speed - ((foot_slip_vector * avatar_movement_dir) / delta_time); + F32 foot_speed = llmax(0.f, speed - ((foot_slip_vector * avatar_movement_dir) / delta_time)); // multiply animation playback rate so that foot speed matches avatar speed F32 min_speed_multiplier = clamp_rescale(speed, 0.f, 1.f, 0.f, 0.1f); diff --git a/indra/llmessage/patch_code.cpp b/indra/llmessage/patch_code.cpp index 6ab3a6e11..3bcd70944 100644 --- a/indra/llmessage/patch_code.cpp +++ b/indra/llmessage/patch_code.cpp @@ -231,7 +231,7 @@ void decode_patch_group_header(LLBitPack &bitpack, LLGroupHeader *gopp) // Aurora Sim //void decode_patch_header(LLBitPack &bitpack, LLPatchHeader *ph) -void decode_patch_header(LLBitPack &bitpack, LLPatchHeader *ph, BOOL b_large_patch) +void decode_patch_header(LLBitPack &bitpack, LLPatchHeader *ph, bool b_large_patch) // Aurora Sim { U8 retvalu8; @@ -275,12 +275,11 @@ void decode_patch_header(LLBitPack &bitpack, LLPatchHeader *ph, BOOL b_large_pat //retvalu16 = 0; retvalu32 = 0; #ifdef LL_BIG_ENDIAN -// Aurora Sim //ret = (U8 *)&retvalu16; - if(b_large_patch) + ret = (U8*)&retvalu32; +// Aurora Sim + if (b_large_patch) { - //todo test - ret = (U8 *)&retvalu32; bitpack.bitUnpack(&(ret[3]), 8); bitpack.bitUnpack(&(ret[2]), 8); bitpack.bitUnpack(&(ret[1]), 8); @@ -288,21 +287,14 @@ void decode_patch_header(LLBitPack &bitpack, LLPatchHeader *ph, BOOL b_large_pat } else { - ret = (U8 *)&retvalu32; bitpack.bitUnpack(&(ret[1]), 8); bitpack.bitUnpack(&(ret[0]), 2); } - // Aurora Sim #else // Aurora Sim //bitpack.bitUnpack((U8 *)&retvalu16, 10); - if(b_large_patch) - bitpack.bitUnpack((U8 *)&retvalu32, 32); - else - bitpack.bitUnpack((U8 *)&retvalu32, 10); -// Aurora Sim + bitpack.bitUnpack((U8*)&retvalu32, b_large_patch ? 32 : 10); #endif -// Aurora Sim //ph->patchids = retvalu16; ph->patchids = retvalu32; // Aurora Sim diff --git a/indra/llmessage/patch_code.h b/indra/llmessage/patch_code.h index 0b9091f43..a3361daf3 100644 --- a/indra/llmessage/patch_code.h +++ b/indra/llmessage/patch_code.h @@ -42,7 +42,7 @@ void init_patch_decoding(LLBitPack &bitpack); void decode_patch_group_header(LLBitPack &bitpack, LLGroupHeader *gopp); // Aurora Sim //void decode_patch_header(LLBitPack &bitpack, LLPatchHeader *ph); -void decode_patch_header(LLBitPack &bitpack, LLPatchHeader *ph, BOOL b_large_patch); +void decode_patch_header(LLBitPack &bitpack, LLPatchHeader *ph, bool b_large_patch = false); // Aurora Sim void decode_patch(LLBitPack &bitpack, S32 *patches); diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 3bccad5e3..9dddf8b38 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -565,7 +565,7 @@ void LLImageGL::setSize(S32 width, S32 height, S32 ncomponents, S32 discard_leve // Check if dimensions are a power of two! if (!checkSize(width,height)) { - llerrs << llformat("Texture has non power of two dimension: %dx%d",width,height) << llendl; + llwarns << llformat("Texture has non power of two dimension: %dx%d",width,height) << " Unless on Aurora-Sim, beware." << llendl; } if (mTexName) diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index ea3aa6145..472836c3a 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -2321,7 +2321,7 @@ void LLAgent::setStartPosition( U32 location_id ) const F32 INSET = 0.5f; //meters // Aurora Sim //const F32 REGION_WIDTH = LLWorld::getInstance()->getRegionWidthInMeters(); - const F32 REGION_WIDTH = getRegion()->getWidth(); + const F32 REGION_WIDTH = getRegion()->getWidth(); // Aurora Sim LLVector3 agent_pos = getPositionAgent(); diff --git a/indra/newview/llcloud.cpp b/indra/newview/llcloud.cpp index ebe6460dd..fcdfbecd4 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, FALSE); + decode_patch_header(bitpack, &patch_header); decode_patch(bitpack, gBuffer); decompress_patch(mDensityp, gBuffer, &patch_header); } diff --git a/indra/newview/llfloateravatarlist.cpp b/indra/newview/llfloateravatarlist.cpp index 1cef54918..14ef9b2b6 100644 --- a/indra/newview/llfloateravatarlist.cpp +++ b/indra/newview/llfloateravatarlist.cpp @@ -747,6 +747,7 @@ void LLFloaterAvatarList::refreshAvatarList() LLVector3d posagent; posagent.setVec(gAgent.getPositionAgent()); LLVector3d simpos = mypos - posagent; + const S32 width(gAgent.getRegion() ? gAgent.getRegion()->getWidth() : 256); BOOST_FOREACH(av_list_t::value_type& entry, mAvatars) { @@ -904,7 +905,7 @@ void LLFloaterAvatarList::refreshAvatarList() S32 x = (S32)position.mdV[VX]; S32 y = (S32)position.mdV[VY]; - if (x >= 0 && x <= 256 && y >= 0 && y <= 256) + if (x >= 0 && x <= width && y >= 0 && y <= width) { snprintf(temp, sizeof(temp), "%d, %d", x, y); } @@ -915,7 +916,7 @@ void LLFloaterAvatarList::refreshAvatarList() { strcat(temp, "S"); } - else if (y > 256) + else if (y > width) { strcat(temp, "N"); } @@ -923,7 +924,7 @@ void LLFloaterAvatarList::refreshAvatarList() { strcat(temp, "W"); } - else if (x > 256) + else if (x > width) { strcat(temp, "E"); } diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index d8e7fadd4..da8aaedd4 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -86,6 +86,7 @@ #include "llvlcomposition.h" #include "llwaterparammanager.h" #include "llagentui.h" +#include "hippogridmanager.h" // [RLVa:KB] #include "rlvhandler.h" // [/RLVa:KB] @@ -1300,8 +1301,8 @@ BOOL LLPanelRegionTerrainInfo::sendUpdate() // ======================================= // Assemble and send texturedetail message - // Make sure user hasn't chosen wacky textures. - if (!validateTextureSizes()) + // Make sure user hasn't chosen wacky textures on sl grids. + if (gHippoGridManager->getConnectedGrid()->isSecondLife() && !validateTextureSizes()) { return FALSE; } diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp index 24f11cbfc..1d33194a0 100644 --- a/indra/newview/llfloaterworldmap.cpp +++ b/indra/newview/llfloaterworldmap.cpp @@ -875,6 +875,11 @@ void LLFloaterWorldMap::updateLocation() // [/RLVa:KB] // if ( gotSimName ) { + // Singu Note: Var region support for SLURLs + const LLSimInfo* sim = LLWorldMap::getInstance()->simInfoFromPosGlobal(pos_global); + const F64 size(sim ? sim->getSizeX() : 256); + pos_global[0] = fmod(pos_global[0], size); + pos_global[1] = fmod(pos_global[1], size); mSLURL = LLSLURL(sim_name, pos_global); } else diff --git a/indra/newview/llmanip.cpp b/indra/newview/llmanip.cpp index 44ab0f9bc..f83e14e9b 100644 --- a/indra/newview/llmanip.cpp +++ b/indra/newview/llmanip.cpp @@ -47,9 +47,9 @@ #include "llviewercamera.h" #include "llviewerjoint.h" #include "llviewerobject.h" +#include "llviewerregion.h" #include "llviewerwindow.h" #include "llvoavatar.h" -#include "llworld.h" // for LLWorld::getInstance() #include "llresmgr.h" #include "pipeline.h" #include "llglheaders.h" @@ -406,7 +406,7 @@ void LLManip::renderGuidelines(BOOL draw_x, BOOL draw_y, BOOL draw_z) grid_rot.getAngleAxis(&angle_radians, &x, &y, &z); gGL.rotatef(angle_radians * RAD_TO_DEG, x, y, z); - F32 region_size = LLWorld::getInstance()->getRegionWidthInMeters(); + F32 region_size = object->getRegion()->getWidth(); const F32 LINE_ALPHA = 0.33f; diff --git a/indra/newview/llmanipscale.cpp b/indra/newview/llmanipscale.cpp index 76aa99775..c3b21429c 100644 --- a/indra/newview/llmanipscale.cpp +++ b/indra/newview/llmanipscale.cpp @@ -1344,7 +1344,7 @@ void LLManipScale::renderGuidelinesPart( const LLBBox& bbox ) guideline_end -= guideline_start; guideline_end.normVec(); - guideline_end *= LLWorld::getInstance()->getRegionWidthInMeters(); + guideline_end *= gAgent.getRegion()->getWidth(); guideline_end += guideline_start; { diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp index 045c08015..8b0a17c62 100644 --- a/indra/newview/llnetmap.cpp +++ b/indra/newview/llnetmap.cpp @@ -101,7 +101,7 @@ LLNetMap::LLNetMap(const std::string& name) : mUpdateNow( FALSE ) { mScale = gSavedSettings.getF32("MiniMapScale"); - mPixelsPerMeter = mScale / LLWorld::getInstance()->getRegionWidthInMeters(); + mPixelsPerMeter = mScale / REGION_WIDTH_METERS; mDotRadius = llmax(DOT_SCALE * mPixelsPerMeter, MIN_DOT_RADIUS); mObjectImageCenterGlobal = gAgentCamera.getCameraPositionGlobal(); @@ -166,7 +166,7 @@ void LLNetMap::setScale( F32 scale ) mObjectMapPixels = diameter; } - mPixelsPerMeter = mScale / LLWorld::getInstance()->getRegionWidthInMeters(); + mPixelsPerMeter = mScale / REGION_WIDTH_METERS; mDotRadius = llmax(DOT_SCALE * mPixelsPerMeter, MIN_DOT_RADIUS); mUpdateNow = TRUE; @@ -261,7 +261,7 @@ void LLNetMap::draw() LLColor4 dead_region_color = gColors.getColor( "NetMapDeadRegion" ); // Aurora Sim //S32 region_width = llround(LLWorld::getInstance()->getRegionWidthInMeters()); - S32 region_width = llround(REGION_WIDTH_METERS); + S32 region_width = REGION_WIDTH_UNITS; // Aurora Sim for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); @@ -280,8 +280,8 @@ void LLNetMap::draw() // 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 ; + F32 top = bottom + (regionp->getWidth() / REGION_WIDTH_METERS) * mScale ; + F32 right = left + (regionp->getWidth() / REGION_WIDTH_METERS) * mScale ; // Aurora Sim gGL.color4fv(regionp == gAgent.getRegion() ? this_region_color.mV : live_region_color.mV); @@ -351,8 +351,8 @@ void LLNetMap::draw() LLVector3 map_center_agent = gAgent.getPosAgentFromGlobal(mObjectImageCenterGlobal); map_center_agent -= gAgentCamera.getCameraPositionAgent(); - map_center_agent.mV[0] *= mScale/LLWorld::getInstance()->getRegionWidthInMeters(); - map_center_agent.mV[1] *= mScale/LLWorld::getInstance()->getRegionWidthInMeters(); + map_center_agent.mV[0] *= mScale/REGION_WIDTH_METERS; + map_center_agent.mV[1] *= mScale/REGION_WIDTH_METERS; gGL.getTexUnit(0)->bind(mObjectImagep); F32 image_half_width = 0.5f*mObjectMapPixels; diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index 7cf9872ae..77363270a 100644 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -2568,7 +2568,7 @@ void LLPanelObject::onPastePos(void* user_data) LLPanelObject* self = (LLPanelObject*) user_data; LLCalc* calcp = LLCalc::getInstance(); - float region_width = LLWorld::getInstance()->getRegionWidthInMeters(); + float region_width = gAgent.getRegion()->getWidth(); mClipboardPos.mV[VX] = llclamp( mClipboardPos.mV[VX], -3.5f, region_width); mClipboardPos.mV[VY] = llclamp( mClipboardPos.mV[VY], -3.5f, region_width); mClipboardPos.mV[VZ] = llclamp( mClipboardPos.mV[VZ], -3.5f, gHippoLimits->getMaxHeight()); @@ -2648,7 +2648,9 @@ void LLPanelObject::onPastePosClip(void* user_data) std::string stringVec = wstring_to_utf8str(temp_string); if(!getvectorfromclip(stringVec, &mClipboardPos)) return; - float region_width = LLWorld::getInstance()->getRegionWidthInMeters(); + const LLViewerRegion* region(self->mObject ? self->mObject->getRegion() : NULL); + if (!region) return; + F32 region_width = region->getWidth(); mClipboardPos.mV[VX] = llclamp(mClipboardPos.mV[VX], -3.5f, region_width); mClipboardPos.mV[VY] = llclamp(mClipboardPos.mV[VY], -3.5f, region_width); mClipboardPos.mV[VZ] = llclamp(mClipboardPos.mV[VZ], -3.5f, gHippoLimits->getMaxHeight()); diff --git a/indra/newview/llpatchvertexarray.cpp b/indra/newview/llpatchvertexarray.cpp index 4eab93167..2fe72ad04 100644 --- a/indra/newview/llpatchvertexarray.cpp +++ b/indra/newview/llpatchvertexarray.cpp @@ -82,7 +82,8 @@ void LLPatchVertexArray::create(U32 surface_width, U32 patch_width, F32 meters_p surface_order += 1; } - if (power_of_two == (surface_width-1)) + if (power_of_two != (surface_width-1)) + surface_width = power_of_two + 1; { mSurfaceWidth = surface_width; @@ -99,16 +100,11 @@ void LLPatchVertexArray::create(U32 surface_width, U32 patch_width, F32 meters_p power_of_two *= 2; patch_order += 1; } - if (power_of_two == patch_width) - { - mPatchWidth = patch_width; - mPatchOrder = patch_order; - } - else // patch_width is not a power of two... - { - mPatchWidth = 0; - mPatchOrder = 0; - } + if (power_of_two != patch_width) + patch_width = power_of_two; + + mPatchWidth = patch_width; + mPatchOrder = patch_order; } else // patch_width is not a factor of (surface_width - 1)... { @@ -116,12 +112,6 @@ void LLPatchVertexArray::create(U32 surface_width, U32 patch_width, F32 meters_p mPatchOrder = 0; } } - else // surface_width is not a power of two... - { - mSurfaceWidth = 0; - mPatchWidth = 0; - mPatchOrder = 0; - } // PART 2 -- Allocate memory for the render level table if (mPatchWidth > 0) diff --git a/indra/newview/llslurl.cpp b/indra/newview/llslurl.cpp index 3f1b194c5..abd21bd75 100644 --- a/indra/newview/llslurl.cpp +++ b/indra/newview/llslurl.cpp @@ -312,9 +312,9 @@ LLSLURL::LLSLURL(const std::string& slurl) mPosition = LLVector3(path_array); // this construction handles LLSD without all components (values default to 0.f) if((F32(mPosition[VX]) < 0.f) || - (mPosition[VX] > REGION_WIDTH_METERS) || + (mPosition[VX] > 8192.f/*REGION_WIDTH_METERS*/) || (F32(mPosition[VY]) < 0.f) || - (mPosition[VY] > REGION_WIDTH_METERS) || + (mPosition[VY] > 8192.f/*REGION_WIDTH_METERS*/) || (F32(mPosition[VZ]) < 0.f) || (mPosition[VZ] > 8192.f/*REGION_HEIGHT_METERS*/)) { @@ -355,8 +355,8 @@ LLSLURL::LLSLURL(const std::string& grid, { mGrid = grid; mRegion = region; - S32 x = llround( (F32)fmod( position[VX], (F32)REGION_WIDTH_METERS ) ); - S32 y = llround( (F32)fmod( position[VY], (F32)REGION_WIDTH_METERS ) ); + S32 x = llround( (F32)position[VX] ); + S32 y = llround( (F32)position[VY] ); S32 z = llround( (F32)position[VZ] ); mType = LOCATION; mPosition = LLVector3(x, y, z); diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index bcbc34cf3..222630fdb 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -310,8 +310,8 @@ void release_start_screen(); void reset_login(); void apply_udp_blacklist(const std::string& csv); // 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); +//bool process_login_success_response(std::string& password); +bool process_login_success_response(std::string& password, U32& first_sim_size_x); // Aurora Sim void transition_back_to_login_panel(const std::string& emsg); @@ -402,7 +402,6 @@ bool idle_startup() // 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 @@ -1550,7 +1549,7 @@ bool idle_startup() if (successful_login) { // unpack login data needed by the application - if(process_login_success_response(password, first_sim_size_x, first_sim_size_y)) + if (process_login_success_response(password, first_sim_size_x)) { std::string name = firstname; if (!gHippoGridManager->getCurrentGrid()->isSecondLife() || @@ -1670,9 +1669,9 @@ bool idle_startup() display_startup(); // Aurora Sim - //LLWorld::getInstance()->addRegion(gFirstSimHandle, gFirstSim); -LLWorld::getInstance()->addRegion(gFirstSimHandle, gFirstSim, first_sim_size_x, first_sim_size_y); + LLWorld::getInstance()->setRegionWidth(first_sim_size_x); // Aurora Sim + LLWorld::getInstance()->addRegion(gFirstSimHandle, gFirstSim); display_startup(); LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromHandle(gFirstSimHandle); @@ -3854,7 +3853,7 @@ void apply_udp_blacklist(const std::string& csv) } -bool process_login_success_response(std::string& password, U32 &first_sim_size_x, U32 &first_sim_size_y) +bool process_login_success_response(std::string& password, U32& first_sim_size_x) { LLSD response = LLUserAuth::getInstance()->getResponse(); @@ -3994,18 +3993,12 @@ bool process_login_success_response(std::string& password, U32 &first_sim_size_x U32 region_y = strtoul(region_y_str.c_str(), NULL, 10); 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); + if (!text.empty()) LLViewerParcelMgr::getInstance()->init(first_sim_size_x = atoi(text.c_str())); // 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 f6485e0d9..661358bfb 100644 --- a/indra/newview/llsurface.cpp +++ b/indra/newview/llsurface.cpp @@ -302,28 +302,7 @@ void LLSurface::initTextures() //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); } } @@ -414,20 +393,24 @@ void LLSurface::connectNeighbor(LLSurface *neighborp, U32 direction) from_region_handle(mRegionp->getHandle(), &own_xpos, &own_ypos); from_region_handle(neighborp->getRegion()->getHandle(), &neighbor_xpos, &neighbor_ypos); - if(own_ypos >= neighbor_ypos) { + if(own_ypos >= neighbor_ypos) + { neighbor_offset[1] = (own_ypos - neighbor_ypos) / mGridsPerPatchEdge; ppe[1] = llmin(mPatchesPerEdge, neighborPatchesPerEdge-neighbor_offset[1]); } - else { + else + { own_offset[1] = (neighbor_ypos - own_ypos) / mGridsPerPatchEdge; ppe[1] = llmin(mPatchesPerEdge-own_offset[1], neighborPatchesPerEdge); } - if(own_xpos >= neighbor_xpos) { + if(own_xpos >= neighbor_xpos) + { neighbor_offset[0] = (own_xpos - neighbor_xpos) / mGridsPerPatchEdge; ppe[0] = llmin(mPatchesPerEdge, neighborPatchesPerEdge-neighbor_offset[0]); } - else { + else + { own_offset[0] = (neighbor_xpos - own_xpos) / mGridsPerPatchEdge; ppe[0] = llmin(mPatchesPerEdge-own_offset[0], neighborPatchesPerEdge); } diff --git a/indra/newview/llsurfacepatch.cpp b/indra/newview/llsurfacepatch.cpp index b85b7b99a..22aa66f17 100644 --- a/indra/newview/llsurfacepatch.cpp +++ b/indra/newview/llsurfacepatch.cpp @@ -36,7 +36,6 @@ #include "timing.h" #include "llsky.h" #include "llviewercamera.h" -#include "llregionhandle.h" // Aurora Sim // For getting composition values #include "llviewerregion.h" @@ -251,30 +250,23 @@ void LLSurfacePatch::calcNormal(const U32 x, const U32 y, const U32 stride) const F32 mpg = mSurfacep->getMetersPerGrid() * stride; // Aurora Sim +// Singu Note: poffsets gets an extra space each for surface stride (tag clutter removed) //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 @@ -312,12 +304,6 @@ void LLSurfacePatch::calcNormal(const U32 x, const U32 y, const U32 stride) if (!ppatches[i][j]->getNeighborPatch(SOUTH)) { poffsets[i][j][1] = 0; - } - else - { -// 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 } @@ -359,28 +345,19 @@ void LLSurfacePatch::calcNormal(const U32 x, const U32 y, const U32 stride) *(ppatches[0][0]->mDataZ + poffsets[0][0][0] // Aurora Sim - //+ poffsets[0][0][1]*surface_stride)); +// Singu Note: multiply the y poffsets by its own surface stride (tag clutter removed) + poffsets[0][0][1]*poffsets[0][0][2])); -// Aurora Sim LLVector3 p01(-mpg,+mpg, *(ppatches[0][1]->mDataZ + poffsets[0][1][0] -// 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] -// 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] -// Aurora Sim - //+ poffsets[1][1][1]*surface_stride)); + poffsets[1][1][1]*poffsets[1][1][2])); // Aurora Sim @@ -520,18 +497,6 @@ 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); @@ -546,12 +511,9 @@ void LLSurfacePatch::updateNormals() if (mNormalsInvalid[NORTHWEST] || mNormalsInvalid[WEST] || mNormalsInvalid[SOUTHWEST]) { // Aurora Sim - if(!getNeighborPatch(NORTH) && getNeighborPatch(NORTHWEST)) + if (!getNeighborPatch(NORTH) && getNeighborPatch(NORTHWEST) && getNeighborPatch(NORTHWEST)->getHasReceivedData()) { - if(getNeighborPatch(NORTHWEST)->getHasReceivedData()) - { - *(mDataZ + grids_per_patch_edge*grids_per_edge) = *(getNeighborPatch(NORTHWEST)->mDataZ + grids_per_patch_edge); - } + *(mDataZ + grids_per_patch_edge*grids_per_edge) = *(getNeighborPatch(NORTHWEST)->mDataZ + grids_per_patch_edge); } // Aurora Sim @@ -567,13 +529,9 @@ void LLSurfacePatch::updateNormals() if (mNormalsInvalid[SOUTHWEST] || mNormalsInvalid[SOUTH] || mNormalsInvalid[SOUTHEAST]) { // Aurora Sim - if(!getNeighborPatch(EAST) && getNeighborPatch(SOUTHEAST)) + if (!getNeighborPatch(EAST) && getNeighborPatch(SOUTHEAST) && getNeighborPatch(SOUTHEAST)->getHasReceivedData()) { - if(getNeighborPatch(SOUTHEAST)->getHasReceivedData()) - { - *(mDataZ + grids_per_patch_edge) = - *(getNeighborPatch(SOUTHEAST)->mDataZ + grids_per_patch_edge * getNeighborPatch(SOUTHEAST)->getSurface()->getGridsPerEdge()); - } + *(mDataZ + grids_per_patch_edge) = *(getNeighborPatch(SOUTHEAST)->mDataZ + grids_per_patch_edge * getNeighborPatch(SOUTHEAST)->getSurface()->getGridsPerEdge()); } // Aurora Sim @@ -658,19 +616,13 @@ void LLSurfacePatch::updateNormals() 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) { + if (own_ypos >= neighbor_ypos) neighbor_offset = own_ypos - neighbor_ypos; - } - else { + else own_offset = neighbor_ypos - own_ypos; - } -// Aurora Sim *(mDataZ + grids_per_patch_edge + grids_per_patch_edge*grids_per_edge) = - *(getNeighborPatch(NORTHEAST)->mDataZ + -// Aurora Sim - (grids_per_edge + neighbor_offset - own_offset - 1) * - getNeighborPatch(NORTHEAST)->getSurface()->getGridsPerEdge() ); + *(getNeighborPatch(NORTHEAST)->mDataZ + (grids_per_edge + neighbor_offset - own_offset - 1) * getNeighborPatch(NORTHEAST)->getSurface()->getGridsPerEdge()); // Aurora Sim } } diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 267b0c3d4..39faf5c61 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -4410,21 +4410,6 @@ void process_teleport_finish(LLMessageSystem* msg, void**) 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); @@ -4444,9 +4429,11 @@ void process_teleport_finish(LLMessageSystem* msg, void**) // Viewer trusts the simulator. gMessageSystem->enableCircuit(sim_host, TRUE); // 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); + U32 region_size_x = 256; + msg->getU32Fast(_PREHASH_Info, _PREHASH_RegionSizeX, region_size_x); + LLWorld::getInstance()->setRegionWidth(region_size_x); // Aurora Sim + LLViewerRegion* regionp = LLWorld::getInstance()->addRegion(region_handle, sim_host); /* // send camera update to new region @@ -4769,26 +4756,14 @@ 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); // 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); + U32 region_size_x = 256; + msg->getU32(_PREHASH_RegionData, _PREHASH_RegionSizeX, region_size_x); + LLWorld::getInstance()->setRegionWidth(region_size_x); // Aurora Sim + LLViewerRegion* regionp = LLWorld::getInstance()->addRegion(region_handle, sim_host); regionp->setSeedCapability(seedCap); } diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp index 51aeffff3..57037a871 100644 --- a/indra/newview/llviewerparcelmgr.cpp +++ b/indra/newview/llviewerparcelmgr.cpp @@ -146,10 +146,7 @@ LLViewerParcelMgr::LLViewerParcelMgr() mCollisionParcel = new LLParcel(); // 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(8192.f / PARCEL_GRID_STEP_METERS); // 8192 is the maximum region size on Aurora and solves the audio problem. //mParcelsPerEdge = S32( REGION_WIDTH_METERS / PARCEL_GRID_STEP_METERS ); // Aurora Sim mHighlightSegments = new U8[(mParcelsPerEdge+1)*(mParcelsPerEdge+1)]; @@ -175,7 +172,7 @@ LLViewerParcelMgr::LLViewerParcelMgr() } // Aurora Sim - mParcelsPerEdge = S32( REGION_WIDTH_METERS / PARCEL_GRID_STEP_METERS ); + mParcelsPerEdge = S32(REGION_WIDTH_METERS / PARCEL_GRID_STEP_METERS); // Aurora Sim mTeleportInProgress = TRUE; // the initial parcel update is treated like teleport @@ -184,7 +181,7 @@ LLViewerParcelMgr::LLViewerParcelMgr() // Aurora Sim void LLViewerParcelMgr::init(F32 region_size) { - mParcelsPerEdge = S32( region_size / PARCEL_GRID_STEP_METERS ); + mParcelsPerEdge = S32(region_size / PARCEL_GRID_STEP_METERS); } // Aurora Sim @@ -472,8 +469,7 @@ void LLViewerParcelMgr::selectCollisionParcel() //mEastNorth += LLVector3d(PARCEL_GRID_STEP_METERS, PARCEL_GRID_STEP_METERS, 0.0); mWestSouth = getSelectionRegion()->getOriginGlobal(); mEastNorth = mWestSouth; - mEastNorth += LLVector3d((getSelectionRegion()->getWidth() / REGION_WIDTH_METERS) * PARCEL_GRID_STEP_METERS, - (getSelectionRegion()->getWidth() / REGION_WIDTH_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 @@ -1500,13 +1496,11 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use 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 ); - } + 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 ); diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 761de56be..b00bf25ad 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -66,6 +66,7 @@ #include "lltrans.h" #include "llurldispatcher.h" #include "llviewerobjectlist.h" +#include "llviewerparcelmgr.h" #include "llviewerparceloverlay.h" #include "llviewerstatsrecorder.h" #include "llvlmanager.h" @@ -504,13 +505,6 @@ 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(); @@ -856,20 +850,13 @@ LLVLComposition * LLViewerRegion::getComposition() const F32 LLViewerRegion::getCompositionXY(const S32 x, const S32 y) const { +// Singu Note: The Aurora Sim patches here were too many to read the code itself, mWidth and getWidth() (-1) replace 256 (255) in this function, only the first and last tags remain // Aurora Sim - //if (x >= 256) if (x >= mWidth) -// Aurora Sim { -// Aurora Sim - //if (y >= 256) if (y >= mWidth) -// Aurora Sim { -// 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) { @@ -878,12 +865,8 @@ 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. -// 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) @@ -900,10 +883,7 @@ F32 LLViewerRegion::getCompositionXY(const S32 x, const S32 y) const } else { -// 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) { @@ -912,12 +892,8 @@ 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. -// 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) @@ -933,15 +909,9 @@ F32 LLViewerRegion::getCompositionXY(const S32 x, const S32 y) const } } } -// Aurora Sim - //else if (y >= 256) else if (y >= mWidth) -// Aurora Sim { -// 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) { @@ -950,9 +920,6 @@ 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. -// 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 @@ -1699,9 +1666,6 @@ 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 460bc34c3..6b0e73b49 100644 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -147,9 +147,6 @@ public: void setWaterHeight(F32 water_level); F32 getWaterHeight() const; -// Aurora Sim - void rebuildWater(); -// Aurora Sim BOOL isVoiceEnabled() const; diff --git a/indra/newview/llwind.cpp b/indra/newview/llwind.cpp index a6679cf2d..d35838ed1 100644 --- a/indra/newview/llwind.cpp +++ b/indra/newview/llwind.cpp @@ -50,13 +50,10 @@ #include "noise.h" #include "v4color.h" #include "llagent.h" -#include "llworld.h" +#include "llviewerregion.h" const F32 CLOUD_DIVERGENCE_COEF = 0.5f; -// Aurora Sim -#include "llviewerregion.h" -// Aurora Sim ////////////////////////////////////////////////////////////////////// // Construction/Destruction @@ -124,18 +121,12 @@ void LLWind::decompress(LLBitPack &bitpack, LLGroupHeader *group_headerp) set_group_of_patch_header(group_headerp); // X component -// Aurora Sim - //decode_patch_header(bitpack, &patch_header); - decode_patch_header(bitpack, &patch_header, FALSE); -// Aurora Sim + decode_patch_header(bitpack, &patch_header); decode_patch(bitpack, buffer); decompress_patch(mVelX, buffer, &patch_header); // Y component -// Aurora Sim - //decode_patch_header(bitpack, &patch_header); - decode_patch_header(bitpack, &patch_header, FALSE); -// Aurora Sim + decode_patch_header(bitpack, &patch_header); decode_patch(bitpack, buffer); decompress_patch(mVelY, buffer, &patch_header); @@ -333,7 +324,7 @@ LLVector3 LLWind::getCloudVelocity(const LLVector3 &pos_region) LLVector3 pos_clamped_region(pos_region); - F32 region_width_meters = LLWorld::getInstance()->getRegionWidthInMeters(); + F32 region_width_meters = gAgent.getRegion()->getWidth(); if (pos_clamped_region.mV[VX] < 0.f) { diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index a0498781d..84ac30bf8 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -80,6 +80,7 @@ const S32 MAX_NUMBER_OF_CLOUDS = 750; const S32 WORLD_PATCH_SIZE = 16; extern LLColor4U MAX_WATER_COLOR; + // Aurora Sim //const U32 LLWorld::mWidth = 256; U32 LLWorld::mWidth = 256; @@ -151,8 +152,13 @@ void LLWorld::destroyClass() } } +void LLWorld::setRegionWidth(const U32 width) +{ + mWidth = width ? width : 256; // Width of 0 is really 256 + mWidthInMeters = mWidth * mScale; +} -LLViewerRegion* LLWorld::addRegion(const U64 ®ion_handle, const LLHost &host, const U32 ®ion_size_x, const U32 ®ion_size_y) +LLViewerRegion* LLWorld::addRegion(const U64 ®ion_handle, const LLHost &host) { llinfos << "Add region with handle: " << region_handle << " on host " << host << llendl; LLViewerRegion *regionp = getRegionFromHandle(region_handle); @@ -184,10 +190,6 @@ 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); // Aurora Sim //S32 x = (S32)(iindex/mWidth); @@ -236,48 +238,51 @@ 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]; -// 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; - for(S32 offset = 0; offset < width; offset += WORLD_PATCH_SIZE) + if (mWidth == 256) { to_region_handle(adj_x, adj_y, &adj_handle); neighborp = getRegionFromHandle(adj_handle); - - if (neighborp && last_neighborp != neighborp) + if (neighborp) { - //llinfos << "Connecting " << region_x << ":" << region_y << " -> " << adj_x << ":" << adj_y << " dir:" << dir << llendl; + //llinfos << "Connecting " << region_x << ":" << region_y << " -> " << adj_x << ":" << adj_y << llendl; regionp->connectNeighbor(neighborp, dir); - last_neighborp = neighborp; } + } + else // Unconventional region size + { + LLViewerRegion* last_neighborp = NULL; + if(gDirAxes[dir][0] < 0) adj_x = region_x - WORLD_PATCH_SIZE; + if(gDirAxes[dir][1] < 0) adj_y = region_y - WORLD_PATCH_SIZE; - if(dir == NORTHEAST || - dir == NORTHWEST || - dir == SOUTHWEST || - dir == SOUTHEAST) + for (S32 offset = 0; offset < width; offset += WORLD_PATCH_SIZE) { - break; - } + to_region_handle(adj_x, adj_y, &adj_handle); + neighborp = getRegionFromHandle(adj_handle); - if(dir == NORTH || dir == SOUTH) adj_x += WORLD_PATCH_SIZE; - if(dir == EAST || dir == WEST) adj_y += WORLD_PATCH_SIZE; -// Aurora Sim + if (neighborp && last_neighborp != neighborp) + { + //llinfos << "Connecting " << region_x << ":" << region_y << " -> " << adj_x << ":" << adj_y << llendl; + regionp->connectNeighbor(neighborp, dir); + last_neighborp = neighborp; + } + + if (dir == NORTH || dir == SOUTH) + adj_x += WORLD_PATCH_SIZE; + else if (dir == EAST || dir == WEST) + adj_y += WORLD_PATCH_SIZE; + else if (dir == NORTHEAST || dir == NORTHWEST || dir == SOUTHWEST || dir == SOUTHEAST) + break; + + } } } @@ -917,7 +922,7 @@ void LLWorld::setLandFarClip(const F32 far_clip) { // Aurora Sim //static S32 const rwidth = (S32)REGION_WIDTH_U32; - static S32 const rwidth = (S32)getRegionWidthInMeters(); + S32 const rwidth = (S32)getRegionWidthInMeters(); // Aurora Sim S32 const n1 = (llceil(mLandFarClip) - 1) / rwidth; S32 const n2 = (llceil(far_clip) - 1) / rwidth; @@ -993,8 +998,10 @@ void LLWorld::updateWaterObjects() return; } + LLViewerRegion const* regionp = gAgent.getRegion(); + // Region width in meters. - S32 const rwidth = (S32)REGION_WIDTH_U32; + S32 const rwidth = (S32)regionp->getWidth(); // The distance we might see into the void // when standing on the edge of a region, in meters. @@ -1011,15 +1018,14 @@ void LLWorld::updateWaterObjects() S32 const range = nsims * rwidth; // Get South-West corner of current region. - LLViewerRegion const* regionp = gAgent.getRegion(); U32 region_x, region_y; from_region_handle(regionp->getHandle(), ®ion_x, ®ion_y); // The min. and max. coordinates of the South-West corners of the Hole water objects. S32 const min_x = (S32)region_x - range; S32 const min_y = (S32)region_y - range; - S32 const max_x = (S32)region_x + range; - S32 const max_y = (S32)region_y + range; + S32 const max_x = (S32)region_x + rwidth-256 + range; + S32 const max_y = (S32)region_y + rwidth-256 + range; // Attempt to determine a sensible water height for all the // Hole Water objects. @@ -1198,19 +1204,19 @@ void LLWorld::updateWaterObjects() // the current regions water height. F32 const box_height = 1024; F32 const water_center_z = water_height + box_height / 2; - + const S32 step = 256; // Create new Hole water objects within 'range' where there is no region. - for (S32 x = min_x; x <= max_x; x += rwidth) + for (S32 x = min_x; x <= max_x; x += step) { - for (S32 y = min_y; y <= max_y; y += rwidth) + for (S32 y = min_y; y <= max_y; y += step) { U64 region_handle = to_region_handle(x, y); if (!getRegionFromHandle(region_handle)) { LLVOWater* waterp = (LLVOWater*)gObjectList.createObjectViewer(LLViewerObject::LL_VO_VOID_WATER, gAgent.getRegion()); waterp->setUseTexture(FALSE); - waterp->setPositionGlobal(LLVector3d(x + rwidth / 2, y + rwidth / 2, water_center_z)); - waterp->setScale(LLVector3((F32)rwidth, (F32)rwidth, box_height)); + waterp->setPositionGlobal(LLVector3d(x + step / 2, y + step / 2, water_center_z)); + waterp->setScale(LLVector3((F32)step, (F32)step, box_height)); gPipeline.createObject(waterp); mHoleWaterObjects.push_back(waterp); } @@ -1218,10 +1224,10 @@ void LLWorld::updateWaterObjects() } // Center of the region. - S32 const center_x = region_x + rwidth / 2; - S32 const center_y = region_y + rwidth / 2; + S32 const center_x = region_x + step / 2; + S32 const center_y = region_y + step / 2; // Width of the area with Hole water objects. - S32 const width = rwidth + 2 * range; + S32 const width = step + 2 * range; S32 const horizon_extend = 2048 + 512 - range; // Legacy value. // The overlap is needed to get rid of sky pixels being visible between the // Edge and Hole water object at greater distances (due to floating point @@ -1350,25 +1356,14 @@ 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); // Aurora Sim - //LLWorld::getInstance()->addRegion(handle, sim); - LLWorld::getInstance()->addRegion(handle, sim, region_size_x, region_size_y); + U32 region_size_x = 256; + msg->getU32Fast(_PREHASH_SimulatorInfo, _PREHASH_RegionSizeX, region_size_x); + LLWorld::getInstance()->setRegionWidth(region_size_x); // Aurora Sim + LLWorld::getInstance()->addRegion(handle, 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 8056139bd..291159540 100644 --- a/indra/newview/llworld.h +++ b/indra/newview/llworld.h @@ -71,11 +71,7 @@ public: LLWorld(); void destroyClass(); -// 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 + LLViewerRegion* addRegion(const U64 ®ion_handle, const LLHost &host); // 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); @@ -118,6 +114,9 @@ public: LLSurfacePatch * resolveLandPatchGlobal(const LLVector3d &position); LLVector3 resolveLandNormalGlobal(const LLVector3d &position); // absolute frame + // update region size + void setRegionWidth(const U32 width = 0); + U32 getRegionWidthInPoints() const { return mWidth; } F32 getRegionScale() const { return mScale; } diff --git a/indra/newview/llworldmap.cpp b/indra/newview/llworldmap.cpp index 64f5eb082..a5d1a9c28 100644 --- a/indra/newview/llworldmap.cpp +++ b/indra/newview/llworldmap.cpp @@ -43,6 +43,7 @@ #include "llmapresponders.h" #include "llviewercontrol.h" #include "llfloaterworldmap.h" +#include "lltexturecache.h" #include "lltracker.h" #include "llviewertexturelist.h" #include "llviewerregion.h" @@ -94,12 +95,17 @@ LLSimInfo::LLSimInfo(U64 handle) void LLSimInfo::setLandForSaleImage (LLUUID image_id) { + const bool is_aurora = gHippoGridManager->getConnectedGrid()->isAurora(); + if (is_aurora && mMapImageID[SIM_LAYER_OVERLAY].isNull() && image_id.notNull() && gTextureList.findImage(image_id)) + LLAppViewer::getTextureCache()->removeFromCache(image_id); + mMapImageID[SIM_LAYER_OVERLAY] = image_id; // Fetch the image if (mMapImageID[SIM_LAYER_OVERLAY].notNull()) { mLayerImage[SIM_LAYER_OVERLAY] = LLViewerTextureManager::getFetchedTexture(mMapImageID[SIM_LAYER_OVERLAY], MIPMAP_TRUE, LLGLTexture::BOOST_MAP, LLViewerTexture::LOD_TEXTURE); + if (is_aurora) mLayerImage[SIM_LAYER_OVERLAY]->forceImmediateUpdate(); mLayerImage[SIM_LAYER_OVERLAY]->setAddressMode(LLTexUnit::TAM_CLAMP); } else @@ -378,32 +384,28 @@ LLSimInfo* LLWorldMap::simInfoFromPosGlobal(const LLVector3d& pos_global) LLSimInfo* LLWorldMap::simInfoFromHandle(const U64 handle) { -// 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) + sim_info_map_t::const_iterator it = mSimInfoMap.find(handle); + if (it != mSimInfoMap.end()) { - 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 it->second; } + +// Aurora Sim + U32 x = 0, y = 0; + from_region_handle(handle, &x, &y); + for (it = mSimInfoMap.begin(); it != mSimInfoMap.end(); ++it) + { + U32 checkRegionX, checkRegionY; + from_region_handle((*it).first, &checkRegionX, &checkRegionY); + + LLSimInfo* info = (*it).second; + if (x >= checkRegionX && x < (checkRegionX + info->getSizeX()) && + y >= checkRegionY && y < (checkRegionY + info->getSizeY())) + { + return info; + } + } +// Aurora Sim return NULL; } diff --git a/indra/newview/llworldmap.h b/indra/newview/llworldmap.h index 794b0f767..7037d9f05 100644 --- a/indra/newview/llworldmap.h +++ b/indra/newview/llworldmap.h @@ -142,9 +142,11 @@ public: // Setters void setName(std::string& name) { mName = name; } +// Aurora Sim + void setSize(U16 sizeX, U16 sizeY) { mSizeX = sizeX; mSizeY = sizeY; } +// Aurora Sim void setAccess (U32 accesscode) { mAccess = accesscode; } void setRegionFlags (U32 region_flags) { mRegionFlags = region_flags; } - void setSize(U16 sizeX, U16 sizeY) { mSizeX = sizeX; mSizeY = sizeY; } void setAlpha(F32 alpha) { mAlpha = alpha; } void setLandForSaleImage (LLUUID image_id); @@ -160,8 +162,11 @@ public: LLPointer getLandForSaleImage(); // Get the overlay image, fetch it if necessary const F32 getAlpha() const { return mAlpha; } +// Aurora Sim + const U64& getHandle() const { return mHandle; } const U16 getSizeX() const { return mSizeX; } const U16 getSizeY() const { return mSizeY; } +// Aurora Sim bool isName(const std::string& name) const; bool isDown() { return (mAccess == SIM_ACCESS_DOWN); } bool isPG() { return (mAccess <= SIM_ACCESS_PG); } @@ -192,15 +197,13 @@ 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: +private: U64 mHandle; // This is a hash of the X and Y world coordinates of the SW corner of the sim +// Aurora Sim U16 mSizeX; U16 mSizeY; - -private: // Aurora Sim + std::string mName; F64 mAgentsUpdateTime; // Time stamp giving the last time the agents information was requested for that region