Aurora var region support

Firestorm patch by Cinders
Adopted from Angstrom viewer with assistance of nhede Core
and Revolution Smythe.
This commit is contained in:
Latif Khalifa
2013-09-26 04:09:01 +02:00
parent 6c1ea557b5
commit ad8ea07a7a
34 changed files with 901 additions and 174 deletions

View File

@@ -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();
// <FS:CR> Aurora Sim
//const F32 REGION_WIDTH = LLWorld::getInstance()->getRegionWidthInMeters();
const F32 REGION_WIDTH = getRegion()->getWidth();
// </FS:CR> 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);
// <FS:CR> Aurora-sim var region teleports
//teleportRequest(handle, pos_local);
teleportRequest(info->getHandle(), pos_local);
// </FS:CR>
}
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);
// <FS:CR> Aurora-sim var region teleports
LLSimInfo* simInfo = LLWorldMap::instance().simInfoFromHandle(region_handle);
if (simInfo)
{
region_handle = simInfo->getHandle();
}
// </FS:CR>
LLVector3 pos_local = (LLVector3)(pos_global - from_region_handle(region_handle));
teleportRequest(region_handle, pos_local, getTeleportKeepsLookAt());
}

View File

@@ -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);
}

View File

@@ -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 );
// <FS:CR> 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;
// </FS:CR>
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());
// <FS:CR> Aurora-sim var region teleports
//mSLURL = LLSLURL(agent_sim_name, gAgent.getPositionGlobal());
mSLURL = LLSLURL(agent_sim_name, gAgent.getPositionAgent());
// </FS:CR>
}
}

View File

@@ -297,7 +297,10 @@ void LLWind::renderVectors()
S32 i,j;
F32 x,y;
F32 region_width_meters = LLWorld::getInstance()->getRegionWidthInMeters();
// <FS:CR> Aurora Sim
//F32 region_width_meters = LLWorld::getInstance()->getRegionWidthInMeters();
F32 region_width_meters = gAgent.getRegion()->getWidth();
// </FS:CR> 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;
// <FS:CR> Aurora Sim
//const F32 BORDER = REGION_WIDTH_METERS - 0.1f;
const F32 BORDER = regionp->getWidth() - 0.1f;
// </FS:CR> Aurora Sim
F32 clamped_x1 = x1;
F32 clamped_y1 = y1;

View File

@@ -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();
// <FS:CR> Aurora Sim
//F32 meters = region_widths * LLWorld::getInstance()->getRegionWidthInMeters();
F32 meters = region_widths * REGION_WIDTH_METERS;
// </FS:CR> 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" );
// <FS:CR> Aurora Sim
//S32 region_width = llround(LLWorld::getInstance()->getRegionWidthInMeters());
S32 region_width = llround(REGION_WIDTH_METERS);
// </FS:CR> 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 ;
// <FS:CR> 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 ;
// </FS:CR> 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();
// <FS:CR> Aurora Sim
//F32 meters_to_pixels = mScale/ LLWorld::getInstance()->getRegionWidthInMeters();
F32 meters_to_pixels = mScale/ REGION_WIDTH_METERS;
// </FS:CR> 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
// <FS:CR> Aurora Sim
mPixelsPerMeter = mScale / REGION_WIDTH_METERS;
// </FS:CR> 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 );
// <FS:CR> Aurora Sim
//pos_local *= ( LLWorld::getInstance()->getRegionWidthInMeters() / mScale );
pos_local *= ( REGION_WIDTH_METERS / mScale );
// </FS:CR> Aurora Sim
LLVector3d pos_global;
pos_global.setVec( pos_local );

View File

@@ -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);
// <FS:CR> 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);
// </FS:CR> 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<const char*> requested_options;
static std::string redirect_uri;
// <FS:CR> Aurora Sim
static U32 first_sim_size_x = 256;
static U32 first_sim_size_y = 256;
// </FS:CR> 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);
// <FS:CR> Aurora Sim
//LLWorld::getInstance()->addRegion(gFirstSimHandle, gFirstSim);
LLWorld::getInstance()->addRegion(gFirstSimHandle, gFirstSim, first_sim_size_x, first_sim_size_y);
// </FS:CR> 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);
}
// <FS:CR> 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);
// </FS:CR> Aurora Sim
const std::string look_at_str = response["look_at"];
if (!look_at_str.empty())
{

View File

@@ -172,6 +172,9 @@ void LLSurface::create(const S32 grids_per_edge,
mNumberOfPatches = mPatchesPerEdge * mPatchesPerEdge;
mMetersPerGrid = width / ((F32)(mGridsPerEdge - 1));
mMetersPerEdge = mMetersPerGrid * (mGridsPerEdge - 1);
// <FS:CR> Aurora Sim
sTextureSize = width;
// </FS:CR> 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);
// <FS:CR> 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);
// </FS:CR> 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;
// <FS:CR> 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;
// </FS:CR> 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;
// <FS:CR> Aurora Sim
S32 neighborPatchesPerEdge = neighborp->mPatchesPerEdge;
// </FS:CR> Aurora Sim
mNeighbors[direction] = neighborp;
neighborp->mNeighbors[gDirOpposite[direction]] = this;
// <FS:CR> 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);
}
// <FS:CR> Aurora Sim
// Connect patches
if (NORTHEAST == direction)
{
patchp = getPatch(mPatchesPerEdge - 1, mPatchesPerEdge - 1);
neighbor_patchp = neighborp->getPatch(0, 0);
// <FS:CR> Aurora Sim
//neighbor_patchp = neighborp->getPatch(0, 0);
neighbor_patchp = neighborp->getPatch(neighbor_offset[0], neighbor_offset[1]);
// </FS:CR> 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)
{
// <FS:CR> Aurora Sim
S32 off = mPatchesPerEdge + neighbor_offset[1] - own_offset[1];
// </FS:CR> Aurora Sim
patchp = getPatch(0, mPatchesPerEdge - 1);
neighbor_patchp = neighborp->getPatch(mPatchesPerEdge - 1, 0);
// <FS:CR> Aurora Sim
//neighbor_patchp = neighborp->getPatch(mPatchesPerEdge - 1, 0);
neighbor_patchp = neighborp->getPatch(neighbor_offset[0] - 1, off); //neighborPatchesPerEdge - 1
// </FS:CR> 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);
// <FS:CR> Aurora Sim
//neighbor_patchp = neighborp->getPatch(mPatchesPerEdge - 1, mPatchesPerEdge - 1);
neighbor_patchp = neighborp->getPatch(neighbor_offset[0] - 1, neighbor_offset[1] - 1);
// </FS:CR> Aurora Sim
patchp->connectNeighbor(neighbor_patchp, direction);
neighbor_patchp->connectNeighbor(patchp, gDirOpposite[direction]);
neighbor_patchp->updateNorthEdge(); // Only update one of north or east.
// <FS:CR> Aurora Sim
//neighbor_patchp->updateNorthEdge(); // Only update one of north or east.
neighbor_patchp->updateEastEdge(); // Only update one of north or east.
// </FS:CR> Aurora Sim
neighbor_patchp->dirtyZ();
}
else if (SOUTHEAST == direction)
{
// <FS:CR> Aurora Sim
S32 off = mPatchesPerEdge + neighbor_offset[0] - own_offset[0];
// </FS:CR> Aurora Sim
patchp = getPatch(mPatchesPerEdge - 1, 0);
neighbor_patchp = neighborp->getPatch(0, mPatchesPerEdge - 1);
// <FS:CR> Aurora Sim
//neighbor_patchp = neighborp->getPatch(0, mPatchesPerEdge - 1);
neighbor_patchp = neighborp->getPatch(off, neighbor_offset[1] - 1); //0
// </FS:CR> 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++)
// <FS:CR> Aurora Sim
//for (i = 0; i < (S32)mPatchesPerEdge; i++)
for (i = 0; i < ppe[1]; i++)
// </FS:CR> Aurora Sim
{
patchp = getPatch(mPatchesPerEdge - 1, i);
neighbor_patchp = neighborp->getPatch(0, i);
// <FS:CR> 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]);
// </FS:CR> 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++)
// <FS:CR> Aurora Sim
//for (i = 0; i < (S32)mPatchesPerEdge - 1; i++)
for (i = 0; i < ppe[1] - 1; i++)
// </FS:CR> Aurora Sim
{
patchp = getPatch(mPatchesPerEdge - 1, i);
neighbor_patchp = neighborp->getPatch(0, i+1);
// <FS:CR> 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]);
// </FS:CR> Aurora Sim
patchp->connectNeighbor(neighbor_patchp, NORTHEAST);
neighbor_patchp->connectNeighbor(patchp, SOUTHWEST);
}
// Now do southeast/northwest connections
for (i = 1; i < (S32)mPatchesPerEdge; i++)
// <FS:CR> Aurora Sim
//for (i = 1; i < (S32)mPatchesPerEdge; i++)
for (i = 1; i < ppe[1]; i++)
// </FS:CR> Aurora Sim
{
patchp = getPatch(mPatchesPerEdge - 1, i);
neighbor_patchp = neighborp->getPatch(0, i-1);
// <FS:CR> 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]);
// </FS:CR> 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++)
// <FS:CR> Aurora Sim
//for (i = 0; i < (S32)mPatchesPerEdge; i++)
for (i = 0; i < ppe[0]; i++)
// </FS:CR> Aurora Sim
{
patchp = getPatch(i, mPatchesPerEdge - 1);
neighbor_patchp = neighborp->getPatch(i, 0);
// <FS:CR> 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);
// </FS:CR> 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++)
// <FS:CR> Aurora Sim
//for (i = 0; i < (S32)mPatchesPerEdge - 1; i++)
for (i = 0; i < ppe[0] - 1; i++)
// </FS:CR> Aurora Sim
{
patchp = getPatch(i, mPatchesPerEdge - 1);
neighbor_patchp = neighborp->getPatch(i+1, 0);
// <FS:CR> 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);
// </FS:CR> Aurora Sim
patchp->connectNeighbor(neighbor_patchp, NORTHEAST);
neighbor_patchp->connectNeighbor(patchp, SOUTHWEST);
}
// Do southeast/northwest connections
for (i = 1; i < (S32)mPatchesPerEdge; i++)
// <FS:CR> Aurora Sim
//for (i = 1; i < (S32)mPatchesPerEdge; i++)
for (i = 1; i < ppe[0]; i++)
// </FS:CR> Aurora Sim
{
patchp = getPatch(i, mPatchesPerEdge - 1);
neighbor_patchp = neighborp->getPatch(i-1, 0);
// <FS:CR> 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);
// </FS:CR> 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++)
// <FS:CR> Aurora Sim
//for (i = 0; i < mPatchesPerEdge; i++)
for (i = 0; i < ppe[1]; i++)
// </FS:CR> Aurora Sim
{
patchp = getPatch(0, i);
neighbor_patchp = neighborp->getPatch(mPatchesPerEdge - 1, i);
// <FS:CR> 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]);
// </FS:CR> 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++)
// <FS:CR> Aurora Sim
//for (i = 1; i < mPatchesPerEdge; i++)
for (i = 1; i < ppe[1]; i++)
// </FS:CR> Aurora Sim
{
patchp = getPatch(0, i);
neighbor_patchp = neighborp->getPatch(mPatchesPerEdge - 1, i - 1);
// <FS:CR> 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]);
// </FS:CR> Aurora Sim
patchp->connectNeighbor(neighbor_patchp, SOUTHWEST);
neighbor_patchp->connectNeighbor(patchp, NORTHEAST);
}
// Now do northwest/southeast connections
for (i = 0; i < mPatchesPerEdge - 1; i++)
// <FS:CR> Aurora Sim
//for (i = 0; i < mPatchesPerEdge - 1; i++)
for (i = 0; i < ppe[1] - 1; i++)
// </FS:CR> Aurora Sim
{
patchp = getPatch(0, i);
neighbor_patchp = neighborp->getPatch(mPatchesPerEdge - 1, i + 1);
// <FS:CR> 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]);
// </FS:CR> 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++)
// <FS:CR> Aurora Sim
//for (i = 0; i < mPatchesPerEdge; i++)
for (i = 0; i < ppe[0]; i++)
// </FS:CR> Aurora Sim
{
patchp = getPatch(i, 0);
neighbor_patchp = neighborp->getPatch(i, mPatchesPerEdge - 1);
// <FS:CR> 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);
// </FS:CR> 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++)
// <FS:CR> Aurora Sim
//for (i = 1; i < mPatchesPerEdge; i++)
for (i = 1; i < ppe[0]; i++)
// </FS:CR> Aurora Sim
{
patchp = getPatch(i, 0);
neighbor_patchp = neighborp->getPatch(i - 1, mPatchesPerEdge - 1);
// <FS:CR> 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);
// </FS:CR> Aurora Sim
patchp->connectNeighbor(neighbor_patchp, SOUTHWEST);
neighbor_patchp->connectNeighbor(patchp, NORTHEAST);
}
// Now do northeast/southwest connections
for (i = 0; i < mPatchesPerEdge - 1; i++)
// <FS:CR> Aurora Sim
//for (i = 0; i < mPatchesPerEdge - 1; i++)
for (i = 0; i < ppe[0] - 1; i++)
// </FS:CR> Aurora Sim
{
patchp = getPatch(i, 0);
neighbor_patchp = neighborp->getPatch(i + 1, mPatchesPerEdge - 1);
// <FS:CR> 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);
// </FS:CR> 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);
// <FS:CR> Aurora Sim
//decode_patch_header(bitpack, &ph);
decode_patch_header(bitpack, &ph, b_large_patch);
// </FS:CR> Aurora Sim
if (ph.quant_wbits == END_OF_PATCHES)
{
break;
}
i = ph.patchids >> 5;
j = ph.patchids & 0x1F;
// <FS:CR> 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
}
// </FS:CR> Aurora Sim
if ((i >= mPatchesPerEdge) || (j >= mPatchesPerEdge))
{
@@ -1229,7 +1415,10 @@ BOOL LLSurface::generateWaterTexture(const F32 x, const F32 y,
LLPointer<LLImageRaw> raw = new LLImageRaw(tex_width, tex_height, tex_comps);
U8 *rawp = raw->getData();
F32 scale = 256.f * getMetersPerGrid() / (F32)tex_width;
// <FS:CR> Aurora Sim
//F32 scale = 256.f * getMetersPerGrid() / (F32)tex_width;
F32 scale = getRegion()->getWidth() * getMetersPerGrid() / (F32)tex_width;
// <FS:CR> Aurora Sim
F32 scale_inv = 1.f / scale;
S32 x_begin, y_begin, x_end, y_end;

View File

@@ -85,6 +85,9 @@ public:
void disconnectNeighbor(LLSurface *neighborp);
void disconnectAllNeighbors();
// <FS:CR> Aurora Sim
void rebuildWater();
// </FS:CR> Aurora Sim
virtual void decompressDCTPatch(LLBitPack &bitpack, LLGroupHeader *gopp, BOOL b_large_patch);
virtual void updatePatchVisibilities(LLAgent &agent);

View File

@@ -36,6 +36,7 @@
#include "timing.h"
#include "llsky.h"
#include "llviewercamera.h"
#include "llregionhandle.h" // <FS:CR> 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), // <FS:ND/> Added (F32) for proper array initialization
(F32)fmod((F32)(mOriginGlobal.mdV[1] + y)*xyScaleInv, 256.f), // <FS:ND/> 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];
// <FS:CR> Aurora Sim
//S32 poffsets[2][2][2];
S32 poffsets[2][2][3];
// </FS:CR> Aurora Sim
poffsets[0][0][0] = x - stride;
poffsets[0][0][1] = y - stride;
// <FS:CR> Aurora Sim
poffsets[0][0][2] = surface_stride;
// </FS:CR> Aurora Sim
poffsets[0][1][0] = x - stride;
poffsets[0][1][1] = y + stride;
// <FS:CR> Aurora Sim
poffsets[0][1][2] = surface_stride;
// </FS:CR> Aurora Sim
poffsets[1][0][0] = x + stride;
poffsets[1][0][1] = y - stride;
// <FS:CR> Aurora Sim
poffsets[1][0][2] = surface_stride;
// </FS:CR> Aurora Sim
poffsets[1][1][0] = x + stride;
poffsets[1][1][1] = y + stride;
// <FS:CR> Aurora Sim
poffsets[1][1][2] = surface_stride;
// </FS:CR> 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;
// <FS:CR> 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();
// </FS:CR> 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;
// <FS:CR> 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();
// </FS>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;
// <FS:CR> 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();
// </FS:CR> 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;
// <FS:CR> 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();
// </FS:CR> 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));
// <FS:CR> Aurora Sim
//+ poffsets[0][0][1]*surface_stride));
+ poffsets[0][0][1]*poffsets[0][0][2]));
// </FS:CR> Aurora Sim
LLVector3 p01(-mpg,+mpg,
*(ppatches[0][1]->mDataZ
+ poffsets[0][1][0]
+ poffsets[0][1][1]*surface_stride));
// <FS:CR> Aurora Sim
//+ poffsets[0][1][1]*surface_stride));
+ poffsets[0][1][1]*poffsets[0][1][2]));
// </FS:CR> Aurora Sim
LLVector3 p10(+mpg,-mpg,
*(ppatches[1][0]->mDataZ
+ poffsets[1][0][0]
+ poffsets[1][0][1]*surface_stride));
// <FS:CR> Aurora Sim
//+ poffsets[1][0][1]*surface_stride));
+ poffsets[1][0][1]*poffsets[1][0][2]));
// </FS:CR> Aurora Sim
LLVector3 p11(+mpg,+mpg,
*(ppatches[1][1]->mDataZ
+ poffsets[1][1][0]
+ poffsets[1][1][1]*surface_stride));
// <FS:CR> Aurora Sim
//+ poffsets[1][1][1]*surface_stride));
+ poffsets[1][1][1]*poffsets[1][1][2]));
// </FS:CR> 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])
{
// <FS:CR> Aurora Sim
/*
if(!getNeighborPatch(EAST) && getNeighborPatch(NORTHEAST))
{
if(getNeighborPatch(NORTHEAST)->getHasReceivedData())
{
*(getNeighborPatch(NORTHEAST)->mDataZ) = 100.0f;
}
}
*/
// </FS:CR> 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])
{
// <FS:CR> 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);
}
}
// </FS:CR> 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])
{
// <FS:CR> 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());
}
}
// </FS:CR> 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);
// <FS:CR> 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());
// </FS:CR> 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));
// <FS:CR> Aurora Sim
//*(getNeighborPatch(NORTH)->mDataZ + (grids_per_patch_edge - 1));
*(getNeighborPatch(NORTH)->mDataZ + (getNeighborPatch(NORTH)->getSurface()->getGridsPerPatchEdge() - 1));
// </FS:CR> Aurora Sim
}
else
{
@@ -574,8 +653,25 @@ void LLSurfacePatch::updateNormals()
&&
(!getNeighborPatch(EAST) || (getNeighborPatch(EAST)->mSurfacep != mSurfacep)))
{
// <FS:CR> 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;
}
// </FS:CR> Aurora Sim
*(mDataZ + grids_per_patch_edge + grids_per_patch_edge*grids_per_edge) =
*(getNeighborPatch(NORTHEAST)->mDataZ);
*(getNeighborPatch(NORTHEAST)->mDataZ +
// <FS:CR> Aurora Sim
(grids_per_edge + neighbor_offset - own_offset - 1) *
getNeighborPatch(NORTHEAST)->getSurface()->getGridsPerEdge() );
// </FS:CR> Aurora Sim
}
}
else
@@ -618,8 +714,12 @@ void LLSurfacePatch::updateEastEdge()
{
U32 grids_per_patch_edge = mSurfacep->getGridsPerPatchEdge();
U32 grids_per_edge = mSurfacep->getGridsPerEdge();
// <FS:CR> Aurora Sim
U32 grids_per_edge_east = grids_per_edge;
U32 j, k;
//U32 j, k;
U32 j, k, h;
// <FS:CR> 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;
// <FS:CR> Aurora Sim
grids_per_edge_east = getNeighborPatch(EAST)->getSurface()->getGridsPerEdge();
// <FS:CR> 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
// <FS:CR> 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
// </FS:CR> Aurora Sim
}
}
@@ -671,13 +778,12 @@ void LLSurfacePatch::updateNorthEdge()
}
// Update patchp's north edge ...
for (i=0; i<grids_per_patch_edge; i++)
for (i = 0; i<grids_per_patch_edge; i++)
{
*(south_surface + i) = *(north_surface + i); // update buffer Z
}
}
BOOL LLSurfacePatch::updateTexture()
{
if (mSTexUpdate) // Update texture as needed

View File

@@ -4409,7 +4409,21 @@ void process_teleport_finish(LLMessageSystem* msg, void**)
msg->getU64Fast(_PREHASH_Info, _PREHASH_RegionHandle, region_handle);
U32 teleport_flags;
msg->getU32Fast(_PREHASH_Info, _PREHASH_TeleportFlags, teleport_flags);
// <FS:CR> 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;
}
// </FS:CR> 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);
// <FS:CR> 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);
// </FS:CR> 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);
// <FS:CR> 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;
}
// </FS:CR> Aurora Sim
send_complete_agent_movement(sim_host);
LLViewerRegion* regionp = LLWorld::getInstance()->addRegion(region_handle, sim_host);
// <FS:CR> 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);
// </FS:CR> Aurora Sim
regionp->setSeedCapability(seedCap);
}

View File

@@ -962,7 +962,10 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
U16 valswizzle[4];
#endif
U16 *val;
const F32 size = LLWorld::getInstance()->getRegionWidthInMeters();
// <FS:CR> Aurora Sim
//const F32 size = LLWorld::getInstance()->getRegionWidthInMeters();
const F32 size = mRegionp->getWidth();
// </FS:CR> Aurora Sim
const F32 MAX_HEIGHT = LLWorld::getInstance()->getRegionMaxHeight();
const F32 MIN_HEIGHT = LLWorld::getInstance()->getRegionMinHeight();
S32 length;

View File

@@ -145,7 +145,13 @@ LLViewerParcelMgr::LLViewerParcelMgr()
mHoverParcel = new LLParcel();
mCollisionParcel = new LLParcel();
mParcelsPerEdge = S32( REGION_WIDTH_METERS / PARCEL_GRID_STEP_METERS );
// <FS:CR> 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 );
// </FS:CR> Aurora Sim
mHighlightSegments = new U8[(mParcelsPerEdge+1)*(mParcelsPerEdge+1)];
resetSegments(mHighlightSegments);
@@ -168,9 +174,19 @@ LLViewerParcelMgr::LLViewerParcelMgr()
mAgentParcelOverlay[i] = 0;
}
// <FS:CR> Aurora Sim
mParcelsPerEdge = S32( REGION_WIDTH_METERS / PARCEL_GRID_STEP_METERS );
// </FS:CR> Aurora Sim
mTeleportInProgress = TRUE; // the initial parcel update is treated like teleport
}
// <FS:CR> Aurora Sim
void LLViewerParcelMgr::init(F32 region_size)
{
mParcelsPerEdge = S32( region_size / PARCEL_GRID_STEP_METERS );
}
// </FS:CR> 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();
// <FS:CR> 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);
// </FS:CR> 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;
// <FS:CR> 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;
// </FS:CR> 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();
// <FS:CR> 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 );
}
// </FS:CR> Aurora Sim
msg->getS32Fast(_PREHASH_ParcelData, _PREHASH_RequestResult, request_result );
msg->getS32Fast(_PREHASH_ParcelData, _PREHASH_SequenceID, sequence_id );

View File

@@ -89,6 +89,9 @@ public:
LLViewerParcelMgr();
~LLViewerParcelMgr();
// <FS:CR> Aurora Sim
void init(F32 region_size);
// </FS:CR> Aurora Sim
static void cleanupGlobals();
BOOL selectionEmpty() const;

View File

@@ -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 ) ),
// <FS:CR> Aurora Sim
mRegionSize(S32(region_width_meters)),
// </FS:CR> 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;
// <FS:CR> Aurora Sim
//S32 chunk_size = size / PARCEL_OVERLAY_CHUNKS;
S32 mParcelOverLayChunks = mRegionSize * mRegionSize / (128 * 128);
S32 chunk_size = size / mParcelOverLayChunks;
// <FS:CR> Aurora Sim
memcpy(mOwnership + chunk*chunk_size, packed_overlay, chunk_size); /*Flawfinder: ignore*/

View File

@@ -109,6 +109,9 @@ private:
LLViewerRegion* mRegion;
S32 mParcelGridsPerEdge;
// <FS:CR> Aurora Sim
S32 mRegionSize;
// </FS:CR> Aurora Sim
LLPointer<LLViewerTexture> mTexture;
LLPointer<LLImageRaw> mImageRaw;

View File

@@ -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),
// <FS:CR> Aurora Sim
mWidth(region_width_meters)
{
mWidth = region_width_meters;
// Moved this up... -> mWidth = region_width_meters;
// </FS:CR>
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);
// <FS:CR> Aurora Sim
//region_width_meters / grids_per_region_edge);
mWidth / grids_per_region_edge);
// </FS:CR> 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);
// <FS:CR> Aurora Sim
//mParcelOverlay = new LLViewerParcelOverlay(this, region_width_meters);
mParcelOverlay = new LLViewerParcelOverlay(this, mWidth);
LLViewerParcelMgr::getInstance()->init(mWidth);
// </FS:CR> Aurora Sim
setOriginGlobal(from_region_handle(handle));
calculateCenterGlobal();
@@ -493,6 +504,13 @@ void LLViewerRegion::setWaterHeight(F32 water_level)
mImpl->mLandp->setWaterHeight(water_level);
}
// <FS:CR> Aurora Sim
void LLViewerRegion::rebuildWater()
{
mImpl->mLandp->rebuildWater();
}
// <FS:CR> 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)
// <FS:CR> Aurora Sim
//if (x >= 256)
if (x >= mWidth)
// </FS:CR> Aurora Sim
{
if (y >= 256)
// <FS:CR> Aurora Sim
//if (y >= 256)
if (y >= mWidth)
// </FS:CR> Aurora Sim
{
LLVector3d center = getCenterGlobal() + LLVector3d(256.f, 256.f, 0.f);
// <FS:CR> Aurora Sim
//LLVector3d center = getCenterGlobal() + LLVector3d(256.f, 256.f, 0.f);
LLVector3d center = getCenterGlobal() + LLVector3d(mWidth, mWidth, 0.f);
// </FS:CR> 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);
// <FS:CR> 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());
// </FS:CR> 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);
// <FS:CR> Aurora Sim
//LLVector3d center = getCenterGlobal() + LLVector3d(256.f, 0, 0.f);
LLVector3d center = getCenterGlobal() + LLVector3d(mWidth, 0.f, 0.f);
// </FS:CR> 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);
// <FS:CR> 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);
// </FS:CR> 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)
// <FS:CR> Aurora Sim
//else if (y >= 256)
else if (y >= mWidth)
// </FS:CR> Aurora Sim
{
LLVector3d center = getCenterGlobal() + LLVector3d(0.f, 256.f, 0.f);
// <FS:CR> Aurora Sim
//LLVector3d center = getCenterGlobal() + LLVector3d(0.f, 256.f, 0.f);
LLVector3d center = getCenterGlobal() + LLVector3d(0.f, mWidth, 0.f);
// </FS:CR> 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);
// <FS:CR> 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());
// <FS:CR> 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");
// <FS:CR> Aurora Sim
capabilityNames.append("DispatchOpenRegionSettings");
// </FS:CR> Aurora Sim
capabilityNames.append("EstateChangeInfo");
capabilityNames.append("EventQueueGet");
capabilityNames.append("FetchLib2");

View File

@@ -147,6 +147,9 @@ public:
void setWaterHeight(F32 water_level);
F32 getWaterHeight() const;
// <FS:CR> Aurora Sim
void rebuildWater();
// </FS:CR> Aurora Sim
BOOL isVoiceEnabled() const;

View File

@@ -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;
// <FS:CR> Aurora Sim
//const F32 inv_width = 1.f/mWidth;
const F32 inv_width = 1.f/(F32)mWidth;
// </FS:CR> 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++)

View File

@@ -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)
{
// <FS:CR> Aurora Sim
//if (LAND_LAYER_CODE == vl_datap->mType)
if (LAND_LAYER_CODE == vl_datap->mType || AURORA_LAND_LAYER_CODE == vl_datap->mType)
// </FS:CR> Aurora Sim
{
mLandBits += mesg_size * 8;
}
// <FS:CR> 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)
// </FS:CR> Aurora Sim
{
mWindBits += mesg_size * 8;
}
// <FS:CR> 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)
// </FS:CR> Aurora Sim
{
mCloudBits += mesg_size * 8;
}
// <FS:CR> Aurora Sim
else if (WATER_LAYER_CODE == vl_datap->mType || AURORA_CLOUD_LAYER_CODE == vl_datap->mType)
{
mWaterBits += mesg_size * 8;
}
// </FS:CR> 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);
}
// <FS:CR> 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)
// </FS:CR> Aurora Sim
{
datap->mRegionp->mWind.decompress(bit_pack, &goph);

View File

@@ -65,6 +65,9 @@ protected:
U32 mLandBits;
U32 mWindBits;
U32 mCloudBits;
// <FS:CR> Aurora Sim
U32 mWaterBits;
// </FS:CR> Aurora Sim
};
class LLVLData

View File

@@ -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.
// <FS:CR> 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));
// </FS:CR> Aurora Sim
mUseTexture = TRUE;
mIsEdgePatch = FALSE;

View File

@@ -54,6 +54,9 @@
const F32 CLOUD_DIVERGENCE_COEF = 0.5f;
// <FS:CR> Aurora Sim
#include "llviewerregion.h"
// </FS:CR> 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);
// <FS:CR> Aurora Sim
//decode_patch_header(bitpack, &patch_header);
decode_patch_header(bitpack, &patch_header, FALSE);
// </FS:CR> Aurora Sim
decode_patch(bitpack, buffer);
decompress_patch(mVelX, buffer, &patch_header);
// Y component
decode_patch_header(bitpack, &patch_header);
// <FS:CR> Aurora Sim
//decode_patch_header(bitpack, &patch_header);
decode_patch_header(bitpack, &patch_header, FALSE);
// </FS:CR> 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();
// <FS:CR> Aurora Sim
//F32 region_width_meters = LLWorld::getInstance()->getRegionWidthInMeters();
F32 region_width_meters = gAgent.getRegion()->getWidth();
// </FS:CR> Aurora Sim
if (pos_clamped_region.mV[VX] < 0.f)
{

View File

@@ -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;
// <FS:CR> Aurora Sim
//const U32 LLWorld::mWidth = 256;
U32 LLWorld::mWidth = 256;
// </FS:CR> Aurora Sim
// meters/point, therefore mWidth * mScale = meters per edge
const F32 LLWorld::mScale = 1.f;
const F32 LLWorld::mWidthInMeters = mWidth * mScale;
// <FS:CR> Aurora Sim
//const F32 LLWorld::mWidthInMeters = mWidth * mScale;
F32 LLWorld::mWidthInMeters = mWidth * mScale;
// </FS:CR> Aurora Sim
//
// Functions
@@ -147,7 +152,7 @@ void LLWorld::destroyClass()
}
LLViewerRegion* LLWorld::addRegion(const U64 &region_handle, const LLHost &host)
LLViewerRegion* LLWorld::addRegion(const U64 &region_handle, const LLHost &host, const U32 &region_size_x, const U32 &region_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 &region_handle, const LLHost &host)
U32 iindex = 0;
U32 jindex = 0;
// <FS:CR> Aurora Sim
mWidth = region_size_x; //MegaRegion
mWidthInMeters = mWidth * mScale; //MegaRegion
// </FS:CR> Aurora Sim
from_region_handle(region_handle, &iindex, &jindex);
S32 x = (S32)(iindex/mWidth);
S32 y = (S32)(jindex/mWidth);
// <FS:CR> Aurora Sim
//S32 x = (S32)(iindex/mWidth);
//S32 y = (S32)(jindex/mWidth);
S32 x = (S32)(iindex/256); //MegaRegion
S32 y = (S32)(jindex/256); //MegaRegion
// </FS:CR> Aurora Sim
llinfos << "Adding new region (" << x << ":" << y << ")" << llendl;
llinfos << "Host: " << host << llendl;
@@ -223,21 +236,48 @@ LLViewerRegion* LLWorld::addRegion(const U64 &region_handle, const LLHost &host)
F32 width = getRegionWidthInMeters();
LLViewerRegion *neighborp;
// <FS:CR> Aurora Sim
LLViewerRegion *last_neighborp;
// </FS:CR> Aurora Sim
from_region_handle(region_handle, &region_x, &region_y);
// Iterate through all directions, and connect neighbors if there.
S32 dir;
for (dir = 0; dir < 8; dir++)
{
// <FS:CR> Aurora Sim
last_neighborp = NULL;
// </FS:CR> 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);
// <FS:CR> 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;
// </FS:CR> Aurora Sim
}
}
@@ -409,11 +449,24 @@ LLVector3d LLWorld::clipToVisibleRegions(const LLVector3d &start_pos, const LLVe
LLViewerRegion* LLWorld::getRegionFromHandle(const U64 &handle)
{
// <FS:CR> Aurora Sim
U32 x, y;
from_region_handle(handle, &x, &y);
// </FS:CR> Aurora Sim
for (region_list_t::iterator iter = mRegionList.begin();
iter != mRegionList.end(); ++iter)
{
LLViewerRegion* regionp = *iter;
if (regionp->getHandle() == handle)
// <FS:CR> 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))
// <FS:CR> 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;
// <FS:CR> Aurora Sim
//static S32 const rwidth = (S32)REGION_WIDTH_U32;
static S32 const rwidth = (S32)getRegionWidthInMeters();
// </FS:CR> 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);
// <FS:CR> 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;
}
// </FS:CR> Aurora Sim
// Viewer trusts the simulator.
msg->enableCircuit(sim, TRUE);
LLWorld::getInstance()->addRegion(handle, sim);
// <FS:CR> Aurora Sim
//LLWorld::getInstance()->addRegion(handle, sim);
LLWorld::getInstance()->addRegion(handle, sim, region_size_x, region_size_y);
// </FS:CR> 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;

View File

@@ -71,7 +71,11 @@ public:
LLWorld();
void destroyClass();
LLViewerRegion* addRegion(const U64 &region_handle, const LLHost &host);
// <FS:CR> Aurora Sim
void updateLimits(); // <FS:CR> Aurora Sim
//LLViewerRegion* addRegion(const U64 &region_handle, const LLHost &host);
LLViewerRegion* addRegion(const U64 &region_handle, const LLHost &host, const U32 &region_size_x, const U32 &region_size_y);
// <FS:CR> 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;
// <FS:CR> Aurora Sim
//static const U32 mWidth;
static U32 mWidth;
// </FS:CR> Aurora Sim
// meters/point, therefore mWidth * mScale = meters per edge
static const F32 mScale;
static const F32 mWidthInMeters;
// <FS:CR> Aurora Sim
//static const F32 mWidthInMeters;
static F32 mWidthInMeters;
// </FS:CR> Aurora Sim
F32 mLandFarClip; // Far clip distance for land.
LLPatchVertexArray mLandPatch;

View File

@@ -84,8 +84,10 @@ LLSimInfo::LLSimInfo(U64 handle)
mAccess(0x0),
mRegionFlags(0x0),
mFirstAgentRequest(true),
// <FS:CR> Aurora Sim
mSizeX(REGION_WIDTH_UNITS),
mSizeY(REGION_WIDTH_UNITS),
// </FS:CR> 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())
// <FS:CR> Aurora Sim
//sim_info_map_t::iterator it = mSimInfoMap.find(handle);
//if (it != mSimInfoMap.end())
//{
// return it->second;
std::map<U64, LLSimInfo*>::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;
}
// </FS:CR> 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)
// <FS:CR> 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)
// </FS:CR> 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);
// <FS:CR> Aurora Sim
siminfo->setSize(x_size, y_size);
// </FS:CR> 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))

View File

@@ -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;
// </FS:CR> 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;
// <FS:CR> 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;
// </FS:CR> Aurora Sim
const S32 MAP_BLOCK_RES = (MAP_MAX_SIZE / MAP_BLOCK_SIZE);
class LLWorldMap : public LLSingleton<LLWorldMap>
@@ -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);
// <FS:CR> 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);
// </FS:CR> 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)

View File

@@ -170,8 +170,10 @@ void LLWorldMapMessage::processMapBlockReply(LLMessageSystem* msg, void**)
{
U16 x_regions;
U16 y_regions;
// <FS:CR> Aurora Sim
U16 x_size = 256;
U16 y_size = 256;
// </FS:CR> 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);
// <FS:CR> 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;
}
// </FS:CR> 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)))
// <FS:CR> 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)))
// </FS:CR> Aurora Sim
{
found_null_sim = true;
}

View File

@@ -156,14 +156,14 @@
Location:
</text>
<spinner bottom_delta="0" decimal_digits="0" follows="bottom|right" height="16"
increment="1" initial_val="128" left="1090" max_val="255" min_val="0"
increment="1" initial_val="128" left="1090" max_val="8191" min_val="0"
mouse_opaque="true" name="spin x"
tool_tip="X coordinate of location to show on map" label_width="0" width="48" >
<spinner.commit_callback
function="WMap.Coordinates" />
</spinner>
<spinner bottom_delta="0" decimal_digits="0" follows="bottom|right" height="16"
increment="1" initial_val="128" left_delta="50" max_val="255" min_val="0"
increment="1" initial_val="128" left_delta="50" max_val="8191" min_val="0"
mouse_opaque="true" name="spin y"
tool_tip="Y coordinate of location to show on map" label_width="0" width="48" >
<spinner.commit_callback