本文整理汇总了C++中LLViewerRegion::getWidth方法的典型用法代码示例。如果您正苦于以下问题:C++ LLViewerRegion::getWidth方法的具体用法?C++ LLViewerRegion::getWidth怎么用?C++ LLViewerRegion::getWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLViewerRegion
的用法示例。
在下文中一共展示了LLViewerRegion::getWidth方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getRegionFromHandle
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;
// <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;
}
}
return NULL;
}
示例2: draw
void LLNetMap::draw()
{
static LLFrameTimer map_timer;
if (mObjectImagep.isNull())
{
createObjectImage();
}
if (gSavedSettings.getS32( "MiniMapCenter") != MAP_CENTER_NONE)
{
mCurPanX = lerp(mCurPanX, mTargetPanX, LLCriticalDamp::getInterpolant(0.1f));
mCurPanY = lerp(mCurPanY, mTargetPanY, LLCriticalDamp::getInterpolant(0.1f));
}
F32 rotation = 0;
// Prepare a scissor region
{
LLGLEnable scissor(GL_SCISSOR_TEST);
{
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
LLLocalClipRect clip(getLocalRect());
gGL.matrixMode(LLRender::MM_MODELVIEW);
// Draw background rectangle
if(isBackgroundVisible())
{
LLColor4 background_color = isBackgroundOpaque() ? getBackgroundColor().mV : getTransparentColor().mV;
gGL.color4fv( background_color.mV );
gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0);
}
}
// region 0,0 is in the middle
S32 center_sw_left = getRect().getWidth() / 2 + llfloor(mCurPanX);
S32 center_sw_bottom = getRect().getHeight() / 2 + llfloor(mCurPanY);
gGL.pushMatrix();
gGL.translatef( (F32) center_sw_left, (F32) center_sw_bottom, 0.f);
static LLCachedControl<bool> rotate_map("MiniMapRotate", true);
if (rotate_map)
{
// rotate subsequent draws to agent rotation
rotation = atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] );
gGL.rotatef( rotation * RAD_TO_DEG, 0.f, 0.f, 1.f);
}
// figure out where agent is
LLColor4 this_region_color = gColors.getColor( "NetMapThisRegion" );
LLColor4 live_region_color = gColors.getColor( "NetMapLiveRegion" );
LLColor4 dead_region_color = gColors.getColor( "NetMapDeadRegion" );
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();
F32 relative_x = (rel_region_pos.mV[0] / region_width) * mScale;
F32 relative_y = (rel_region_pos.mV[1] / region_width) * mScale;
// background region rectangle
F32 bottom = relative_y;
F32 left = relative_x;
F32 top = bottom + mScale ;
F32 right = left + mScale ;
gGL.color4fv(regionp == gAgent.getRegion() ? this_region_color.mV : live_region_color.mV);
if (!regionp->isAlive())
{
gGL.color4fv(dead_region_color.mV);
}
// Draw using texture.
gGL.getTexUnit(0)->bind(regionp->getLand().getSTexture());
gGL.begin(LLRender::QUADS);
gGL.texCoord2f(0.f, 1.f);
gGL.vertex2f(left, top);
gGL.texCoord2f(0.f, 0.f);
gGL.vertex2f(left, bottom);
gGL.texCoord2f(1.f, 0.f);
gGL.vertex2f(right, bottom);
gGL.texCoord2f(1.f, 1.f);
gGL.vertex2f(right, top);
gGL.end();
// Draw water
gGL.setAlphaRejectSettings(LLRender::CF_GREATER, ABOVE_WATERLINE_ALPHA / 255.f);
{
if (regionp->getLand().getWaterTexture())
{
gGL.getTexUnit(0)->bind(regionp->getLand().getWaterTexture());
//.........这里部分代码省略.........
示例3: modifyLandInSelectionGlobal
void LLToolBrushLand::modifyLandInSelectionGlobal()
{
if (LLViewerParcelMgr::getInstance()->selectionEmpty())
{
return;
}
if (LLToolMgr::getInstance()->getCurrentTool() == LLToolSelectLand::getInstance())
{
// selecting land, don't do anything
return;
}
LLVector3d min;
LLVector3d max;
LLViewerParcelMgr::getInstance()->getSelection(min, max);
S32 radioAction = gSavedSettings.getS32("RadioLandBrushAction");
mLastAffectedRegions.clear();
determineAffectedRegions(mLastAffectedRegions, LLVector3d(min.mdV[VX], min.mdV[VY], 0));
determineAffectedRegions(mLastAffectedRegions, LLVector3d(min.mdV[VX], max.mdV[VY], 0));
determineAffectedRegions(mLastAffectedRegions, LLVector3d(max.mdV[VX], min.mdV[VY], 0));
determineAffectedRegions(mLastAffectedRegions, LLVector3d(max.mdV[VX], max.mdV[VY], 0));
LLRegionPosition mid_point_region((min + max) * 0.5);
LLViewerRegion* center_region = mid_point_region.getRegion();
if (center_region)
{
LLVector3 pos_region = mid_point_region.getPositionRegion();
U32 grids = center_region->getLand().mGridsPerEdge;
S32 i = llclamp( (S32)pos_region.mV[VX], 0, (S32)grids );
S32 j = llclamp( (S32)pos_region.mV[VY], 0, (S32)grids );
mStartingZ = center_region->getLand().getZ(i+j*grids);
}
else
{
mStartingZ = 0.f;
}
// Stop if our selection include a no-terraform region
for(region_list_t::iterator iter = mLastAffectedRegions.begin();
iter != mLastAffectedRegions.end(); ++iter)
{
LLViewerRegion* regionp = *iter;
if (!canTerraform(regionp))
{
alertNoTerraform(regionp);
return;
}
}
for(region_list_t::iterator iter = mLastAffectedRegions.begin();
iter != mLastAffectedRegions.end(); ++iter)
{
LLViewerRegion* regionp = *iter;
//BOOL is_changed = FALSE;
LLVector3 min_region = regionp->getPosRegionFromGlobal(min);
LLVector3 max_region = regionp->getPosRegionFromGlobal(max);
min_region.clamp(0.f, regionp->getWidth());
max_region.clamp(0.f, regionp->getWidth());
F32 seconds = gSavedSettings.getF32("LandBrushForce");
LLSurface &land = regionp->getLand();
char action = E_LAND_LEVEL;
switch (radioAction)
{
case 0:
// // average toward mStartingZ
action = E_LAND_LEVEL;
seconds *= 0.25f;
break;
case 1:
action = E_LAND_RAISE;
seconds *= 0.25f;
break;
case 2:
action = E_LAND_LOWER;
seconds *= 0.25f;
break;
case 3:
action = E_LAND_SMOOTH;
seconds *= 5.0f;
break;
case 4:
action = E_LAND_NOISE;
seconds *= 0.5f;
break;
case 5:
action = E_LAND_REVERT;
seconds = 0.5f;
break;
default:
//action = E_LAND_INVALID;
//seconds = 0.0f;
return;
break;
//.........这里部分代码省略.........
示例4: if
LLVector3d LLWorld::clipToVisibleRegions(const LLVector3d &start_pos, const LLVector3d &end_pos)
{
if (positionRegionValidGlobal(end_pos))
{
return end_pos;
}
LLViewerRegion* regionp = getRegionFromPosGlobal(start_pos);
if (!regionp)
{
return start_pos;
}
LLVector3d delta_pos = end_pos - start_pos;
LLVector3d delta_pos_abs;
delta_pos_abs.setVec(delta_pos);
delta_pos_abs.abs();
LLVector3 region_coord = regionp->getPosRegionFromGlobal(end_pos);
F64 clip_factor = 1.0;
F32 region_width = regionp->getWidth();
if (region_coord.mV[VX] < 0.f)
{
if (region_coord.mV[VY] < region_coord.mV[VX])
{
// clip along y -
clip_factor = -(region_coord.mV[VY] / delta_pos_abs.mdV[VY]);
}
else
{
// clip along x -
clip_factor = -(region_coord.mV[VX] / delta_pos_abs.mdV[VX]);
}
}
else if (region_coord.mV[VX] > region_width)
{
if (region_coord.mV[VY] > region_coord.mV[VX])
{
// clip along y +
clip_factor = (region_coord.mV[VY] - region_width) / delta_pos_abs.mdV[VY];
}
else
{
//clip along x +
clip_factor = (region_coord.mV[VX] - region_width) / delta_pos_abs.mdV[VX];
}
}
else if (region_coord.mV[VY] < 0.f)
{
// clip along y -
clip_factor = -(region_coord.mV[VY] / delta_pos_abs.mdV[VY]);
}
else if (region_coord.mV[VY] > region_width)
{
// clip along y +
clip_factor = (region_coord.mV[VY] - region_width) / delta_pos_abs.mdV[VY];
}
// clamp to within region dimensions
LLVector3d final_region_pos = LLVector3d(region_coord) - (delta_pos * clip_factor);
final_region_pos.mdV[VX] = llclamp(final_region_pos.mdV[VX], 0.0,
(F64)(region_width - F_ALMOST_ZERO));
final_region_pos.mdV[VY] = llclamp(final_region_pos.mdV[VY], 0.0,
(F64)(region_width - F_ALMOST_ZERO));
final_region_pos.mdV[VZ] = llclamp(final_region_pos.mdV[VZ], 0.0,
(F64)(LLWorld::getInstance()->getRegionMaxHeight() - F_ALMOST_ZERO));
return regionp->getPosGlobalFromRegion(LLVector3(final_region_pos));
}
示例5: if
LLVector3d LLWorld::clipToVisibleRegions(const LLVector3d &start_pos, const LLVector3d &end_pos)
{
if (positionRegionValidGlobal(end_pos))
{
return end_pos;
}
LLViewerRegion* regionp = getRegionFromPosGlobal(start_pos);
if (!regionp)
{
return start_pos;
}
LLVector3d delta_pos = end_pos - start_pos;
LLVector3d delta_pos_abs;
delta_pos_abs.setVec(delta_pos);
delta_pos_abs.abs();
LLVector3 region_coord = regionp->getPosRegionFromGlobal(end_pos);
F64 clip_factor = 1.0;
F32 region_width = regionp->getWidth();
if (region_coord.mV[VX] < 0.f)
{
if (region_coord.mV[VY] < region_coord.mV[VX])
{
// clip along y -
clip_factor = -(region_coord.mV[VY] / delta_pos_abs.mdV[VY]);
}
else
{
// clip along x -
clip_factor = -(region_coord.mV[VX] / delta_pos_abs.mdV[VX]);
}
}
else if (region_coord.mV[VX] > region_width)
{
if (region_coord.mV[VY] > region_coord.mV[VX])
{
// clip along y +
clip_factor = (region_coord.mV[VY] - region_width) / delta_pos_abs.mdV[VY];
}
else
{
//clip along x +
clip_factor = (region_coord.mV[VX] - region_width) / delta_pos_abs.mdV[VX];
}
}
else if (region_coord.mV[VY] < 0.f)
{
// clip along y -
clip_factor = -(region_coord.mV[VY] / delta_pos_abs.mdV[VY]);
}
else if (region_coord.mV[VY] > region_width)
{
// clip along y +
clip_factor = (region_coord.mV[VY] - region_width) / delta_pos_abs.mdV[VY];
}
// clamp to < 256 to stay in sim
LLVector3d final_region_pos = LLVector3d(region_coord) - (delta_pos * clip_factor);
final_region_pos.clamp(0.0, 255.999);
return regionp->getPosGlobalFromRegion(LLVector3(final_region_pos));
}
示例6: if
LLVector3d LLWorld::clipToVisibleRegions(const LLVector3d &start_pos, const LLVector3d &end_pos)
{
if (positionRegionValidGlobal(end_pos))
{
return end_pos;
}
LLViewerRegion* regionp = getRegionFromPosGlobal(start_pos);
if (!regionp)
{
return start_pos;
}
LLVector3d delta_pos = end_pos - start_pos;
LLVector3d delta_pos_abs;
delta_pos_abs.setVec(delta_pos);
delta_pos_abs.abs();
LLVector3 region_coord = regionp->getPosRegionFromGlobal(end_pos);
F64 clip_factor = 1.0;
F32 region_width = regionp->getWidth();
if (region_coord.mV[VX] < 0.f)
{
if (region_coord.mV[VY] < region_coord.mV[VX])
{
// clip along y -
clip_factor = -(region_coord.mV[VY] / delta_pos_abs.mdV[VY]);
}
else
{
// clip along x -
clip_factor = -(region_coord.mV[VX] / delta_pos_abs.mdV[VX]);
}
}
else if (region_coord.mV[VX] > region_width)
{
if (region_coord.mV[VY] > region_coord.mV[VX])
{
// clip along y +
clip_factor = (region_coord.mV[VY] - region_width) / delta_pos_abs.mdV[VY];
}
else
{
//clip along x +
clip_factor = (region_coord.mV[VX] - region_width) / delta_pos_abs.mdV[VX];
}
}
else if (region_coord.mV[VY] < 0.f)
{
// clip along y -
clip_factor = -(region_coord.mV[VY] / delta_pos_abs.mdV[VY]);
}
else if (region_coord.mV[VY] > region_width)
{
// clip along y +
clip_factor = (region_coord.mV[VY] - region_width) / delta_pos_abs.mdV[VY];
}
// clamp to < 256 to stay in sim
LLVector3d final_region_pos = LLVector3d(region_coord) - (delta_pos * clip_factor);
// clamp x, y to [0,256[ and z to [0,REGION_HEIGHT_METERS] (the clamp function cannot be used here)
if (final_region_pos.mdV[VX] < 0) final_region_pos.mdV[VX] = 0.0;
if (final_region_pos.mdV[VY] < 0) final_region_pos.mdV[VY] = 0.0;
if (final_region_pos.mdV[VZ] < 0) final_region_pos.mdV[VZ] = 0.0;
if (final_region_pos.mdV[VX] > 255.999) final_region_pos.mdV[VX] = 255.999;
if (final_region_pos.mdV[VY] > 255.999) final_region_pos.mdV[VY] = 255.999;
if (final_region_pos.mdV[VZ] > REGION_HEIGHT_METERS) final_region_pos.mdV[VZ] = REGION_HEIGHT_METERS;
//final_region_pos.clamp(0.0, 255.999);
return regionp->getPosGlobalFromRegion(LLVector3(final_region_pos));
}