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:
@@ -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 ®ion_handle, const LLHost &host)
|
||||
LLViewerRegion* LLWorld::addRegion(const U64 ®ion_handle, const LLHost &host, const U32 ®ion_size_x, const U32 ®ion_size_y)
|
||||
{
|
||||
llinfos << "Add region with handle: " << region_handle << " on host " << host << llendl;
|
||||
LLViewerRegion *regionp = getRegionFromHandle(region_handle);
|
||||
@@ -179,9 +184,17 @@ LLViewerRegion* LLWorld::addRegion(const U64 ®ion_handle, const LLHost &host)
|
||||
|
||||
U32 iindex = 0;
|
||||
U32 jindex = 0;
|
||||
// <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 ®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];
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user