本文整理汇总了C++中LLViewerRegion::getOriginGlobal方法的典型用法代码示例。如果您正苦于以下问题:C++ LLViewerRegion::getOriginGlobal方法的具体用法?C++ LLViewerRegion::getOriginGlobal怎么用?C++ LLViewerRegion::getOriginGlobal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLViewerRegion
的用法示例。
在下文中一共展示了LLViewerRegion::getOriginGlobal方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onSelectRegion
void LLPanelRegionTools::onSelectRegion()
{
LL_INFOS() << "LLPanelRegionTools::onSelectRegion" << LL_ENDL;
LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromPosGlobal(gAgent.getPositionGlobal());
if (!regionp)
{
return;
}
LLVector3d north_east(REGION_WIDTH_METERS, REGION_WIDTH_METERS, 0);
LLViewerParcelMgr::getInstance()->selectLand(regionp->getOriginGlobal(),
regionp->getOriginGlobal() + north_east, FALSE);
}
示例2: getAvatars
void LLWorld::getAvatars(std::vector<LLUUID>* avatar_ids, std::vector<LLVector3d>* positions, const LLVector3d& relative_to, F32 radius) const
{
if(avatar_ids != NULL)
{
avatar_ids->clear();
}
if(positions != NULL)
{
positions->clear();
}
for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
{
LLViewerRegion* regionp = *iter;
const LLVector3d& origin_global = regionp->getOriginGlobal();
S32 count = regionp->mMapAvatars.count();
for (S32 i = 0; i < count; i++)
{
LLVector3d pos_global = unpackLocalToGlobalPosition(regionp->mMapAvatars.get(i), origin_global);
if(dist_vec(pos_global, relative_to) <= radius)
{
if(positions != NULL)
{
positions->push_back(pos_global);
}
if(avatar_ids != NULL)
{
avatar_ids->push_back(regionp->mMapAvatarIDs.get(i));
}
}
}
}
}
示例3: onSelectRegion
// static
void LLPanelRegionTools::onSelectRegion(void* userdata)
{
llinfos << "LLPanelRegionTools::onSelectRegion" << llendl;
if (!gWorldp)
{
return;
}
LLViewerRegion *regionp = gWorldp->getRegionFromPosGlobal(gAgent.getPositionGlobal());
if (!regionp)
{
return;
}
LLVector3d north_east(REGION_WIDTH_METERS, REGION_WIDTH_METERS, 0);
gParcelMgr->selectLand(regionp->getOriginGlobal(),
regionp->getOriginGlobal() + north_east, FALSE);
}
示例4: removeRegion
void LLWorld::removeRegion(const LLHost &host)
{
F32 x, y;
LLViewerRegion *regionp = getRegion(host);
if (!regionp)
{
llwarns << "Trying to remove region that doesn't exist!" << llendl;
return;
}
if (regionp == gAgent.getRegion())
{
for (region_list_t::iterator iter = mRegionList.begin();
iter != mRegionList.end(); ++iter)
{
LLViewerRegion* reg = *iter;
llwarns << "RegionDump: " << reg->getName()
<< " " << reg->getHost()
<< " " << reg->getOriginGlobal()
<< llendl;
}
llwarns << "Agent position global " << gAgent.getPositionGlobal()
<< " agent " << gAgent.getPositionAgent()
<< llendl;
llwarns << "Regions visited " << gAgent.getRegionsVisited() << llendl;
llwarns << "gFrameTimeSeconds " << gFrameTimeSeconds << llendl;
llwarns << "Disabling region " << regionp->getName() << " that agent is in!" << llendl;
LLAppViewer::instance()->forceDisconnect(LLTrans::getString("YouHaveBeenDisconnected"));
regionp->saveObjectCache() ; //force to save objects here in case that the object cache is about to be destroyed.
return;
}
from_region_handle(regionp->getHandle(), &x, &y);
llinfos << "Removing region " << x << ":" << y << llendl;
mRegionList.remove(regionp);
mActiveRegionList.remove(regionp);
mCulledRegionList.remove(regionp);
mVisibleRegionList.remove(regionp);
mRegionRemovedSignal(regionp);
//double check all objects of this region are removed.
gObjectList.clearAllMapObjectsInRegion(regionp) ;
//llassert_always(!gObjectList.hasMapObjectInRegion(regionp)) ;
updateWaterObjects();
delete regionp;
}
示例5: removeRegion
void LLWorld::removeRegion(const LLHost &host)
{
F32 x, y;
LLViewerRegion *regionp = getRegion(host);
if (!regionp)
{
llwarns << "Trying to remove region that doesn't exist!" << llendl;
return;
}
if (regionp == gAgent.getRegion())
{
for (region_list_t::iterator iter = mRegionList.begin();
iter != mRegionList.end(); ++iter)
{
LLViewerRegion* reg = *iter;
llwarns << "RegionDump: " << reg->getName()
<< " " << reg->getHost()
<< " " << reg->getOriginGlobal()
<< llendl;
}
llwarns << "Agent position global " << gAgent.getPositionGlobal()
<< " agent " << gAgent.getPositionAgent()
<< llendl;
llwarns << "Regions visited " << gAgent.getRegionsVisited() << llendl;
llwarns << "gFrameTimeSeconds " << gFrameTimeSeconds << llendl;
llwarns << "Disabling region " << regionp->getName() << " that agent is in!" << llendl;
LLAppViewer::instance()->forceDisconnect("You have been disconnected from the region you were in.");
return;
}
from_region_handle(regionp->getHandle(), &x, &y);
llinfos << "Removing region " << x << ":" << y << llendl;
mRegionList.remove(regionp);
mActiveRegionList.remove(regionp);
mCulledRegionList.remove(regionp);
mVisibleRegionList.remove(regionp);
delete regionp;
updateWaterObjects();
}
示例6: postBuild
// virtual
BOOL LLFloaterReporter::postBuild()
{
LLSLURL slurl;
LLAgentUI::buildSLURL(slurl);
getChild<LLUICtrl>("abuse_location_edit")->setValue(slurl.getSLURLString());
enableControls(TRUE);
// convert the position to a string
LLVector3d pos = gAgent.getPositionGlobal();
LLViewerRegion *regionp = gAgent.getRegion();
if (regionp)
{
getChild<LLUICtrl>("sim_field")->setValue(regionp->getName());
pos -= regionp->getOriginGlobal();
}
setPosBox(pos);
// Take a screenshot, but don't draw this floater.
setVisible(FALSE);
takeScreenshot();
setVisible(TRUE);
// Default text to be blank
getChild<LLUICtrl>("object_name")->setValue(LLStringUtil::null);
getChild<LLUICtrl>("owner_name")->setValue(LLStringUtil::null);
mOwnerName = LLStringUtil::null;
getChild<LLUICtrl>("summary_edit")->setFocus(TRUE);
mDefaultSummary = getChild<LLUICtrl>("details_edit")->getValue().asString();
// send a message and ask for information about this region -
// result comes back in processRegionInfo(..)
LLMessageSystem* msg = gMessageSystem;
msg->newMessage("RequestRegionInfo");
msg->nextBlock("AgentData");
msg->addUUID("AgentID", gAgent.getID());
msg->addUUID("SessionID", gAgent.getSessionID());
gAgent.sendReliableMessage();
// abuser name is selected from a list
LLUICtrl* le = getChild<LLUICtrl>("abuser_name_edit");
le->setEnabled( false );
LLButton* pick_btn = getChild<LLButton>("pick_btn");
// XUI: Why aren't these in viewerart.ini?
pick_btn->setImages(std::string("UIImgFaceUUID"),
std::string("UIImgFaceSelectedUUID") );
childSetAction("pick_btn", onClickObjPicker, this);
childSetAction("select_abuser", boost::bind(&LLFloaterReporter::onClickSelectAbuser, this));
childSetAction("send_btn", onClickSend, this);
childSetAction("cancel_btn", onClickCancel, this);
// grab the user's name
std::string reporter;
gAgent.buildFullname(reporter);
getChild<LLUICtrl>("reporter_field")->setValue(reporter);
center();
return TRUE;
}
示例7: LLResourceData
//-----------------------------------------------------------------------------
// Member functions
//-----------------------------------------------------------------------------
LLFloaterReporter::LLFloaterReporter(
const std::string& name,
const LLRect& rect,
const std::string& title,
EReportType report_type)
:
LLFloater(name, rect, title),
mReportType(report_type),
mObjectID(),
mScreenID(),
mAbuserID(),
mDeselectOnClose( FALSE ),
mPicking( FALSE),
mPosition(),
mCopyrightWarningSeen( FALSE ),
mResourceDatap(new LLResourceData())
{
if (report_type == BUG_REPORT)
{
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_report_bug.xml");
}
else
{
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_report_abuse.xml");
}
childSetText("abuse_location_edit", gAgent.getSLURL() );
// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) | Modified: RLVa-1.0.0a
if (rlv_handler_t::isEnabled())
{
// Can't filter these since they get sent as part of the report so just hide them instead
if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC))
{
childSetVisible("abuse_location_edit", false);
childSetVisible("pos_field", false);
}
if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES))
{
childSetVisible("owner_name", false);
childSetVisible("abuser_name_edit", false);
}
}
// [/RLVa:KB]
LLButton* pick_btn = getChild<LLButton>("pick_btn");
if (pick_btn)
{
// XUI: Why aren't these in viewerart.ini?
pick_btn->setImages( std::string("UIImgFaceUUID"),
std::string("UIImgFaceSelectedUUID") );
childSetAction("pick_btn", onClickObjPicker, this);
}
if (report_type != BUG_REPORT)
{
// abuser name is selected from a list
LLLineEditor* le = getChild<LLLineEditor>("abuser_name_edit");
le->setEnabled( FALSE );
}
childSetAction("select_abuser", onClickSelectAbuser, this);
childSetAction("send_btn", onClickSend, this);
childSetAction("cancel_btn", onClickCancel, this);
enableControls(TRUE);
// convert the position to a string
LLVector3d pos = gAgent.getPositionGlobal();
LLViewerRegion *regionp = gAgent.getRegion();
if (regionp)
{
pos -= regionp->getOriginGlobal();
}
setPosBox(pos);
gReporterInstances.addData(report_type, this);
// Take a screenshot, but don't draw this floater.
setVisible(FALSE);
takeScreenshot();
setVisible(TRUE);
// Default text to be blank
childSetText("object_name", LLStringUtil::null);
childSetText("owner_name", LLStringUtil::null);
childSetFocus("summary_edit");
mDefaultSummary = childGetText("details_edit");
gDialogVisible = TRUE;
// only request details for abuse reports (not BUG reports)
if (report_type != BUG_REPORT)
{
//.........这里部分代码省略.........
示例8: uploadSnapshot
void KVFloaterFlickrUpload::uploadSnapshot()
{
mTitle = childGetValue("title_form").asString();
LLSD params;
params["title"] = childGetValue("title_form");
params["safety_level"] = childGetValue("rating_combo");
std::string tags = childGetValue("tags_form");
std::string description = childGetValue("description_form");
if(childGetValue("show_position_check").asBoolean())
{
// Work out where this was taken.
LLVector3d clamped_global = LLWorld::getInstance()->clipToVisibleRegions(gAgent.getPositionGlobal(), mPosTakenGlobal);
LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal(clamped_global);
if(!region)
{
// Clamping failed? Shouldn't happen.
// Use the agent's position instead; if the region the agent is in doesn't exist we have some serious issues,
// and crashing is an entirely reasonable thing to do.
region = gAgent.getRegion();
clamped_global = gAgent.getPositionGlobal();
}
std::string region_name = region->getName();
LLVector3 region_pos = region->getPosRegionFromGlobal(clamped_global);
std::ostringstream region_tags;
region_tags << " \"secondlife:region=" << region_name << "\"";
region_tags << " secondlife:x=" << llround(region_pos[VX]);
region_tags << " secondlife:y=" << llround(region_pos[VY]);
region_tags << " secondlife:z=" << llround(region_pos[VZ]);
// Now let's give some precise camera values.
region_tags << " secondlife:camera_pos_x=" << (mPosTakenGlobal[VX] - region->getOriginGlobal()[VX]);
region_tags << " secondlife:camera_pos_y=" << (mPosTakenGlobal[VY] - region->getOriginGlobal()[VY]);
region_tags << " secondlife:camera_pos_z=" << mPosTakenGlobal[VZ];
tags += region_tags.str();
// Include an SLurl in the description, too (maybe).
if(gSavedSettings.getBOOL("KittyFlickrIncludeSLURL"))
{
LLSLURL url(region_name, region_pos);
std::ostringstream region_desc;
region_desc << "<em><a href='" << url.getSLURLString() << "'>";
region_desc << "Taken at " << region_name << " (";
region_desc << llround(region_pos[VX]) << ", ";
region_desc << llround(region_pos[VY]) << ", ";
region_desc << llround(region_pos[VZ]) << ")";
region_desc << "</a></em>";
if(description != "")
{
description += "\n\n";
}
description += region_desc.str();
}
}
params["tags"] = tags;
params["description"] = description;
LL_INFOS("FlickrAPI") << "Uploading snapshot with metadata: " << params << LL_ENDL;
params["auth_token"] = gSavedPerAccountSettings.getLLSD("KittyFlickrToken");
LLUploadDialog::modalUploadDialog(getString("uploading"));
KVFlickrRequest::uploadPhoto(params, mCompressedImage, boost::bind(&KVFloaterFlickrUpload::imageUploaded, this, _1, _2));
}
示例9: post
virtual void post(
ResponsePtr responder,
const LLSD& context,
const LLSD& input) const
{
LLHost host(input["sender"].asString());
LLViewerRegion* region = LLWorld::getInstance()->getRegion(host);
if( !region )
{
return;
}
S32 target_index = input["body"]["Index"][0]["Prey"].asInteger();
S32 you_index = input["body"]["Index"][0]["You" ].asInteger();
LLDynamicArray<U32>* avatar_locs = ®ion->mMapAvatars;
LLDynamicArray<LLUUID>* avatar_ids = ®ion->mMapAvatarIDs;
avatar_locs->reset();
avatar_ids->reset();
//llinfos << "coarse locations agent[0] " << input["body"]["AgentData"][0]["AgentID"].asUUID() << llendl;
//llinfos << "my agent id = " << gAgent.getID() << llendl;
//llinfos << ll_pretty_print_sd(input) << llendl;
LLSD
locs = input["body"]["Location"],
agents = input["body"]["AgentData"];
LLSD::array_iterator
locs_it = locs.beginArray(),
agents_it = agents.beginArray();
BOOL has_agent_data = input["body"].has("AgentData");
for(int i=0;
locs_it != locs.endArray();
i++, locs_it++)
{
U8
x = locs_it->get("X").asInteger(),
y = locs_it->get("Y").asInteger(),
z = locs_it->get("Z").asInteger();
// treat the target specially for the map, and don't add you or the target
if(i == target_index)
{
LLVector3d global_pos(region->getOriginGlobal());
global_pos.mdV[VX] += (F64)x;
global_pos.mdV[VY] += (F64)y;
global_pos.mdV[VZ] += (F64)z * 4.0;
LLAvatarTracker::instance().setTrackedCoarseLocation(global_pos);
}
else if( i != you_index)
{
U32 loc = x << 16 | y << 8 | z; loc = loc;
U32 pos = 0x0;
pos |= x;
pos <<= 8;
pos |= y;
pos <<= 8;
pos |= z;
avatar_locs->put(pos);
//llinfos << "next pos: " << x << "," << y << "," << z << ": " << pos << llendl;
if(has_agent_data) // for backwards compatibility with old message format
{
LLUUID agent_id(agents_it->get("AgentID").asUUID());
//llinfos << "next agent: " << agent_id.asString() << llendl;
avatar_ids->put(agent_id);
}
}
if (has_agent_data)
{
agents_it++;
}
}
}
示例10: getAvatars
void LLWorld::getAvatars(std::vector<LLUUID>* avatar_ids, std::vector<LLVector3d>* positions, const LLVector3d& relative_to, F32 radius) const
{
F32 radius_squared = radius * radius;
if(avatar_ids != NULL)
{
avatar_ids->clear();
}
if(positions != NULL)
{
positions->clear();
}
// get the list of avatars from the character list first, so distances are correct
// when agent is above 1020m and other avatars are nearby
for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin();
iter != LLCharacter::sInstances.end(); ++iter)
{
LLVOAvatar* pVOAvatar = (LLVOAvatar*) *iter;
if (!pVOAvatar->isDead() && !pVOAvatar->isSelf() && !pVOAvatar->mIsDummy)
{
LLUUID uuid = pVOAvatar->getID();
if(!uuid.isNull())
{
LLVector3d pos_global = pVOAvatar->getPositionGlobal();
if(dist_vec_squared(pos_global, relative_to) <= radius_squared)
{
if(positions != NULL)
{
positions->push_back(pos_global);
}
if(avatar_ids !=NULL)
{
avatar_ids->push_back(uuid);
}
}
}
}
}
// region avatars added for situations where radius is greater than RenderFarClip
for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
{
LLViewerRegion* regionp = *iter;
const LLVector3d& origin_global = regionp->getOriginGlobal();
S32 count = regionp->mMapAvatars.count();
for (S32 i = 0; i < count; i++)
{
LLVector3d pos_global = unpackLocalToGlobalPosition(regionp->mMapAvatars.get(i), origin_global);
if(dist_vec_squared(pos_global, relative_to) <= radius_squared)
{
LLUUID uuid = regionp->mMapAvatarIDs.get(i);
// if this avatar doesn't already exist in the list, add it
if(uuid.notNull() && avatar_ids != NULL && std::find(avatar_ids->begin(), avatar_ids->end(), uuid) == avatar_ids->end())
{
if(positions != NULL)
{
positions->push_back(pos_global);
}
avatar_ids->push_back(uuid);
}
}
}
}
}
示例11: getAvatars
void LLWorld::getAvatars(std::vector<LLUUID>* avatar_ids, std::vector<LLVector3d>* positions, const LLVector3d& relative_to, F32 radius) const
{
if(avatar_ids != NULL)
{
avatar_ids->clear();
}
if(positions != NULL)
{
positions->clear();
}
for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
{
LLViewerRegion* regionp = *iter;
const LLVector3d& origin_global = regionp->getOriginGlobal();
S32 count = regionp->mMapAvatars.count();
for (S32 i = 0; i < count; i++)
{
LLVector3d pos_global = unpackLocalToGlobalPosition(regionp->mMapAvatars.get(i), origin_global);
if(dist_vec(pos_global, relative_to) <= radius)
{
if(positions != NULL)
{
positions->push_back(pos_global);
}
if(avatar_ids != NULL)
{
avatar_ids->push_back(regionp->mMapAvatarIDs.get(i));
}
}
}
}
// retrieve the list of close avatars from viewer objects as well
// for when we are above 1000m, only do this when we are retrieving
// uuid's too as there could be duplicates
if(avatar_ids != NULL)
{
for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin();
iter != LLCharacter::sInstances.end(); ++iter)
{
LLVOAvatar* pVOAvatar = (LLVOAvatar*) *iter;
if(pVOAvatar->isDead() || pVOAvatar->isSelf())
continue;
LLUUID uuid = pVOAvatar->getID();
if(uuid.isNull())
continue;
LLVector3d pos_global = pVOAvatar->getPositionGlobal();
if(dist_vec(pos_global, relative_to) <= radius)
{
bool found = false;
uuid_vec_t::iterator sel_iter = avatar_ids->begin();
for (; sel_iter != avatar_ids->end(); sel_iter++)
{
if(*sel_iter == uuid)
{
found = true;
break;
}
}
if(!found)
{
if(positions != NULL)
positions->push_back(pos_global);
avatar_ids->push_back(uuid);
}
}
}
}
}
示例12: title
// Default constructor
LLFloaterAbout::LLFloaterAbout()
: LLFloater(std::string("floater_about"), std::string("FloaterAboutRect"), LLStringUtil::null)
{
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_about.xml");
// Support for changing product name.
std::string title("About ");
title += LLAppViewer::instance()->getSecondLifeTitle();
setTitle(title);
LLViewerTextEditor *support_widget =
getChild<LLViewerTextEditor>("support_editor", true);
LLViewerTextEditor *credits_widget =
getChild<LLViewerTextEditor>("credits_editor", true);
LLViewerTextEditor *licenses_widget =
getChild<LLViewerTextEditor>("licenses_editor", true);
childSetAction("copy_btn", onAboutClickCopyToClipboard, this);
if (!support_widget || !credits_widget)
{
return;
}
// For some reason, adding style doesn't work unless this is true.
support_widget->setParseHTML(TRUE);
// Text styles for release notes hyperlinks
LLStyleSP viewer_link_style(new LLStyle);
viewer_link_style->setVisible(true);
viewer_link_style->setFontName(LLStringUtil::null);
viewer_link_style->setLinkHREF(get_viewer_release_notes_url());
viewer_link_style->setColor(gSavedSettings.getColor4("HTMLLinkColor"));
// Version string
std::string version = std::string(LLAppViewer::instance()->getSecondLifeTitle()
#if defined(_WIN64) || defined(__x86_64__)
+ " (64 bit)"
#endif
+ llformat(" %d.%d.%d (%d) %s %s (%s)\n",
LLVersionInfo::getMajor(), LLVersionInfo::getMinor(), LLVersionInfo::getPatch(), LLVersionInfo::getBuild(),
__DATE__, __TIME__,
LLVersionInfo::getChannel().c_str()));
support_widget->appendColoredText(version, FALSE, FALSE, gColors.getColor("TextFgReadOnlyColor"));
support_widget->appendStyledText(LLTrans::getString("ReleaseNotes"), false, false, viewer_link_style);
std::string support;
support.append("\n\n");
support.append("Grid: " + gHippoGridManager->getConnectedGrid()->getGridName() + "\n\n");
#if LL_MSVC
support.append(llformat("Built with MSVC version %d\n\n", _MSC_VER));
#endif
#if LL_CLANG
support.append(llformat("Built with Clang version %d\n\n", CLANG_VERSION));
#endif
#if LL_INTELC
support.append(llformat("Built with ICC version %d\n\n", __ICC));
#endif
#if LL_GNUC
support.append(llformat("Built with GCC version %d\n\n", GCC_VERSION));
#endif
// Position
LLViewerRegion* region = gAgent.getRegion();
if (region)
{
// [RLVa:KB] - Checked: 2014-02-24 (RLVa-1.4.10)
if (RlvActions::canShowLocation())
{
const LLVector3d &pos = gAgent.getPositionGlobal();
LLUIString pos_text = getString("you_are_at");
pos_text.setArg("[POSITION]",
llformat("%.1f, %.1f, %.1f ", pos.mdV[VX], pos.mdV[VY], pos.mdV[VZ]));
support.append(pos_text);
if (const LLViewerRegion* region = gAgent.getRegion())
{
const LLVector3d& coords(region->getOriginGlobal());
std::string region_text = llformat("in %s (%.0f, %.0f) located at ", region->getName().c_str(), coords.mdV[VX]/REGION_WIDTH_METERS, coords.mdV[VY]/REGION_WIDTH_METERS);
support.append(region_text);
std::string buffer;
buffer = region->getHost().getHostName();
support.append(buffer);
support.append(" (");
buffer = region->getHost().getString();
support.append(buffer);
support.append(")");
}
}
else
support.append(RlvStrings::getString(RLV_STRING_HIDDEN_REGION));
// [/RLVa:KN]
//.........这里部分代码省略.........
示例13: draw
//.........这里部分代码省略.........
map_timer.reset();
}
LLVector3 map_center_agent = gAgent.getPosAgentFromGlobal(mObjectImageCenterGlobal);
map_center_agent -= gAgent.getCameraPositionAgent();
map_center_agent.mV[VX] *= gMiniMapScale/region_width;
map_center_agent.mV[VY] *= gMiniMapScale/region_width;
LLViewerImage::bindTexture(mObjectImagep);
F32 image_half_width = 0.5f*mObjectMapPixels;
F32 image_half_height = 0.5f*mObjectMapPixels;
gGL.begin(LLVertexBuffer::QUADS);
gGL.texCoord2f(0.f, 1.f);
gGL.vertex2f(map_center_agent.mV[VX] - image_half_width, image_half_height + map_center_agent.mV[VY]);
gGL.texCoord2f(0.f, 0.f);
gGL.vertex2f(map_center_agent.mV[VX] - image_half_width, map_center_agent.mV[VY] - image_half_height);
gGL.texCoord2f(1.f, 0.f);
gGL.vertex2f(image_half_width + map_center_agent.mV[VX], map_center_agent.mV[VY] - image_half_height);
gGL.texCoord2f(1.f, 1.f);
gGL.vertex2f(image_half_width + map_center_agent.mV[VX], image_half_height + map_center_agent.mV[VY]);
gGL.end();
gGL.popMatrix();
LLVector3d pos_global;
LLVector3 pos_map;
// Draw avatars
for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->mActiveRegionList.begin();
iter != LLWorld::getInstance()->mActiveRegionList.end(); ++iter)
{
LLViewerRegion* regionp = *iter;
const LLVector3d& origin_global = regionp->getOriginGlobal();
S32 count = regionp->mMapAvatars.count();
S32 i;
LLVector3 pos_local;
U32 compact_local;
U8 bits;
// TODO: it'd be very cool to draw these in sorted order from lowest Z to highest.
// just be careful to sort the avatar IDs along with the positions. -MG
for (i = 0; i < count; i++)
{
compact_local = regionp->mMapAvatars.get(i);
bits = compact_local & 0xFF;
pos_local.mV[VZ] = F32(bits) * 4.f;
compact_local >>= 8;
bits = compact_local & 0xFF;
pos_local.mV[VY] = (F32)bits;
compact_local >>= 8;
bits = compact_local & 0xFF;
pos_local.mV[VX] = (F32)bits;
pos_global.setVec( pos_local );
pos_global += origin_global;
pos_map = globalPosToView(pos_global);
BOOL show_as_friend = FALSE;
if( i < regionp->mMapAvatarIDs.count())
{
show_as_friend = is_agent_friend(regionp->mMapAvatarIDs.get(i));
示例14: draw
//.........这里部分代码省略.........
F32 image_half_width = 0.5f*mObjectMapPixels;
F32 image_half_height = 0.5f*mObjectMapPixels;
gGL.begin(LLRender::QUADS);
gGL.texCoord2f(0.f, 1.f);
gGL.vertex2f(map_center_agent.mV[VX] - image_half_width, image_half_height + map_center_agent.mV[VY]);
gGL.texCoord2f(0.f, 0.f);
gGL.vertex2f(map_center_agent.mV[VX] - image_half_width, map_center_agent.mV[VY] - image_half_height);
gGL.texCoord2f(1.f, 0.f);
gGL.vertex2f(image_half_width + map_center_agent.mV[VX], map_center_agent.mV[VY] - image_half_height);
gGL.texCoord2f(1.f, 1.f);
gGL.vertex2f(image_half_width + map_center_agent.mV[VX], image_half_height + map_center_agent.mV[VY]);
gGL.end();
gGL.popMatrix();
LLVector3d pos_global;
LLVector3 pos_map;
// Mouse pointer in local coordinates
S32 local_mouse_x;
S32 local_mouse_y;
//localMouse(&local_mouse_x, &local_mouse_y);
LLUI::getMousePositionLocal(this, &local_mouse_x, &local_mouse_y);
mClosestAgentToCursor.setNull();
F32 closest_dist = F32_MAX;
F32 min_pick_dist = mDotRadius * MIN_PICK_SCALE;
// Draw avatars
for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
{
LLViewerRegion* regionp = *iter;
const LLVector3d& origin_global = regionp->getOriginGlobal();
S32 count = regionp->mMapAvatars.count();
S32 i;
LLVector3 pos_local;
U32 compact_local;
U8 bits;
// TODO: it'd be very cool to draw these in sorted order from lowest Z to highest.
// just be careful to sort the avatar IDs along with the positions. -MG
for (i = 0; i < count; i++)
{
compact_local = regionp->mMapAvatars.get(i);
bits = compact_local & 0xFF;
pos_local.mV[VZ] = F32(bits) * 4.f;
compact_local >>= 8;
bits = compact_local & 0xFF;
pos_local.mV[VY] = (F32)bits;
compact_local >>= 8;
bits = compact_local & 0xFF;
pos_local.mV[VX] = (F32)bits;
pos_global.setVec( pos_local );
pos_global += origin_global;
pos_map = globalPosToView(pos_global);
BOOL show_as_friend = FALSE;
if( i < regionp->mMapAvatarIDs.count())
{
show_as_friend = (LLAvatarTracker::instance().getBuddyInfo(regionp->mMapAvatarIDs.get(i)) != NULL);