本文整理汇总了C++中LLViewerRegion::connectNeighbor方法的典型用法代码示例。如果您正苦于以下问题:C++ LLViewerRegion::connectNeighbor方法的具体用法?C++ LLViewerRegion::connectNeighbor怎么用?C++ LLViewerRegion::connectNeighbor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLViewerRegion
的用法示例。
在下文中一共展示了LLViewerRegion::connectNeighbor方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addRegion
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);
if (regionp)
{
llinfos << "Region exists, removing it " << llendl;
LLHost old_host = regionp->getHost();
// region already exists!
if (host == old_host && regionp->isAlive())
{
// This is a duplicate for the same host and it's alive, don't bother.
return regionp;
}
if (host != old_host)
{
llwarns << "LLWorld::addRegion exists, but old host " << old_host
<< " does not match new host " << host << llendl;
}
if (!regionp->isAlive())
{
llwarns << "LLWorld::addRegion exists, but isn't alive" << llendl;
}
// Kill the old host, and then we can continue on and add the new host. We have to kill even if the host
// matches, because all the agent state for the new camera is completely different.
removeRegion(old_host);
}
U32 iindex = 0;
U32 jindex = 0;
from_region_handle(region_handle, &iindex, &jindex);
// <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;
LLVector3d origin_global;
origin_global = from_region_handle(region_handle);
regionp = new LLViewerRegion(region_handle,
host,
mWidth,
WORLD_PATCH_SIZE,
getRegionWidthInMeters() );
if (!regionp)
{
llerrs << "Unable to create new region!" << llendl;
}
//Classic clouds
#if ENABLE_CLASSIC_CLOUDS
regionp->mCloudLayer.create(regionp);
regionp->mCloudLayer.setWidth((F32)mWidth);
regionp->mCloudLayer.setWindPointer(®ionp->mWind);
#endif
mRegionList.push_back(regionp);
mActiveRegionList.push_back(regionp);
mCulledRegionList.push_back(regionp);
// Find all the adjacent regions, and attach them.
// Generate handles for all of the adjacent regions, and attach them in the correct way.
// connect the edges
F32 adj_x = 0.f;
F32 adj_y = 0.f;
F32 region_x = 0.f;
F32 region_y = 0.f;
U64 adj_handle = 0;
F32 width = getRegionWidthInMeters();
LLViewerRegion *neighborp;
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++)
{
adj_x = region_x + width * gDirAxes[dir][0];
adj_y = region_y + width * gDirAxes[dir][1];
if (mWidth == 256 && mLength == 256)
{
to_region_handle(adj_x, adj_y, &adj_handle);
neighborp = getRegionFromHandle(adj_handle);
if (neighborp)
{
//llinfos << "Connecting " << region_x << ":" << region_y << " -> " << adj_x << ":" << adj_y << llendl;
regionp->connectNeighbor(neighborp, dir);
}
}
else // Unconventional region size
//.........这里部分代码省略.........
示例2: addRegion
LLViewerRegion* LLWorld::addRegion(const U64 ®ion_handle, const LLHost &host)
{
LLMemType mt(LLMemType::MTYPE_REGIONS);
llinfos << "Add region with handle: " << region_handle << " on host " << host << llendl;
LLViewerRegion *regionp = getRegionFromHandle(region_handle);
if (regionp)
{
llinfos << "Region exists, removing it " << llendl;
LLHost old_host = regionp->getHost();
// region already exists!
if (host == old_host && regionp->isAlive())
{
// This is a duplicate for the same host and it's alive, don't bother.
return regionp;
}
if (host != old_host)
{
llwarns << "LLWorld::addRegion exists, but old host " << old_host
<< " does not match new host " << host << llendl;
}
if (!regionp->isAlive())
{
llwarns << "LLWorld::addRegion exists, but isn't alive" << llendl;
}
// Kill the old host, and then we can continue on and add the new host. We have to kill even if the host
// matches, because all the agent state for the new camera is completely different.
removeRegion(old_host);
}
U32 iindex = 0;
U32 jindex = 0;
from_region_handle(region_handle, &iindex, &jindex);
S32 x = (S32)(iindex/mWidth);
S32 y = (S32)(jindex/mWidth);
llinfos << "Adding new region (" << x << ":" << y << ")" << llendl;
llinfos << "Host: " << host << llendl;
LLVector3d origin_global;
origin_global = from_region_handle(region_handle);
regionp = new LLViewerRegion(region_handle,
host,
mWidth,
WORLD_PATCH_SIZE,
getRegionWidthInMeters() );
if (!regionp)
{
llerrs << "Unable to create new region!" << llendl;
}
regionp->mCloudLayer.create(regionp);
regionp->mCloudLayer.setWidth((F32)mWidth);
regionp->mCloudLayer.setWindPointer(®ionp->mWind);
mRegionList.push_back(regionp);
mActiveRegionList.push_back(regionp);
mCulledRegionList.push_back(regionp);
// Find all the adjacent regions, and attach them.
// Generate handles for all of the adjacent regions, and attach them in the correct way.
// connect the edges
F32 adj_x = 0.f;
F32 adj_y = 0.f;
F32 region_x = 0.f;
F32 region_y = 0.f;
U64 adj_handle = 0;
F32 width = getRegionWidthInMeters();
LLViewerRegion *neighborp;
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++)
{
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);
neighborp = getRegionFromHandle(adj_handle);
if (neighborp)
{
//llinfos << "Connecting " << region_x << ":" << region_y << " -> " << adj_x << ":" << adj_y << llendl;
regionp->connectNeighbor(neighborp, dir);
}
}
updateWaterObjects();
return regionp;
}