Merge branch 'VarRegion' of https://github.com/Lirusaito/SingularityViewer into aurora-sim
Merged cleanly: indra/llkeyframewalkmotion.cpp -36e6946c96- worked around a bug in Aurora walking motion indra/llrender/llimagegl.cpp -fa8e1f033b- An llerrs here becomes an llwarns, to avoid bothering the user with non power of two dimensioned images indra/newview/llmanip.cpp, indra/newview/llmanipscale.cpp - "Changed hardcoded 256 constants and such to width functions" -a50f0008b2indra/newview/llpatchvertexarray.cpp -fa8e1f033b- Support patches of non power of two width indra/newview/llworldmap.h - conflict Conflicts: indra/llmessage/patch_code.cpp - My version cleaned up a bit of code duplication, so this was applied, within the new tags indra/llmessage/patch_code.h - b_large_patch in decode_patch_header defaults to false, indra/newview/llcloud.cpp patch removed. indra/llmessage/patch_dct.h - false positive indra/newview/llagent.cpp - false positive indra/newview/llfloaterregioninfo.cpp - nonsl wacky textures support meets the refactor. indra/newview/llfloaterworldmap.cpp - false positive indra/newview/llglsandbox.cpp - false positive indra/newview/llnetmap.cpp - small changes for type consistency brought into FS' patch, nothing important; also adds change to LLNetMap:draw removing getRegionWidthInMeters to keep using the constant REGION_WIDTH indra/newview/llpanelobject.cpp - Get the region width of the object we're editing for maximum pasted x/y coords indra/newview/llstartup.cpp - [Fixes old issues] My old patch did not fully use first_sim_size_x here, this has been fixed. The unused first_sim_size_y has been removed. indra/newview/llsurface.cpp - rebuildWater isn't used, removed for now. Styling conflicts otherwise. indra/newview/llsurfacepatch.cpp - remove FS patch that comments out code that isn't even in the modern source; cleaned up a mess of tags with more clear explanation, perhaps it can be expanded upon though. Some styling conflicts. indra/newview/llviewermessage.cpp - Fix the problem? setRegionWidth by number. indra/newview/llviewerobject.cpp - false positive indra/newview/llviewerparcelmgr.cpp - just styling conflicts indra/newview/llviewerparcelmgr.h - false positive indra/newview/llviewerparceloverlay.cpp - false positive indra/newview/llviewerparceloverlay.h - false positive indra/newview/llviewerregion.cpp - cleaned up LLViewerRegion::getCompositionXY patches, they're more in the way than they're worth; removed DispatchOpenRegionSettings capability mention for now, it's not related to variable regions. Also remove rebuildWater, it's not used right now. indra/newview/llvowater.cpp - false positive indra/newview/llwind.cpp - remove decode_patch_header patches for false, since we have a default; otherwise false positive. indra/newview/llworld.* - [Fixes old issues] Remove setRegionWidth by LLMessageSystem as the messages used are not always the same, the by number one remains of course. - Retained separation of connecting neighbors through the old method when the width is 256 - updateLimits() would never have been merged in, we have an entirely different grid manager, therefore it's removed. - Fix the stupidity passed on over the years wherein a static constant variable would hold the same value as the first call to setLandFarClip.. indra/newview/llworldmap.cpp -36e6946c96Aurora map workaround stuffs, parts removed; rework of LLWorldMap::simInfoFromHandle indra/newview/llworldmap.h - Cleaned up organization, avoid making members public, and fixed tagging
This commit is contained in:
@@ -80,6 +80,7 @@ const S32 MAX_NUMBER_OF_CLOUDS = 750;
|
||||
const S32 WORLD_PATCH_SIZE = 16;
|
||||
|
||||
extern LLColor4U MAX_WATER_COLOR;
|
||||
|
||||
// <FS:CR> 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;
|
||||
// <FS:CR> Aurora Sim
|
||||
mWidth = region_size_x; //MegaRegion
|
||||
mWidthInMeters = mWidth * mScale; //MegaRegion
|
||||
// </FS:CR> Aurora Sim
|
||||
from_region_handle(region_handle, &iindex, &jindex);
|
||||
// <FS:CR> 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;
|
||||
// <FS:CR> Aurora Sim
|
||||
LLViewerRegion *last_neighborp;
|
||||
// </FS:CR> 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++)
|
||||
{
|
||||
// <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];
|
||||
// <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;
|
||||
|
||||
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;
|
||||
// </FS:CR> 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)
|
||||
{
|
||||
// <FS:CR> Aurora Sim
|
||||
//static S32 const rwidth = (S32)REGION_WIDTH_U32;
|
||||
static S32 const rwidth = (S32)getRegionWidthInMeters();
|
||||
S32 const rwidth = (S32)getRegionWidthInMeters();
|
||||
// </FS:CR> 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);
|
||||
|
||||
// <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);
|
||||
// <FS:CR> 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);
|
||||
// </FS:CR> 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;
|
||||
|
||||
Reference in New Issue
Block a user