本文整理汇总了C++中LLVector3d类的典型用法代码示例。如果您正苦于以下问题:C++ LLVector3d类的具体用法?C++ LLVector3d怎么用?C++ LLVector3d使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LLVector3d类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
template <> eControlType get_control_type<LLVector3d>(const LLVector3d& in, LLSD& out)
{
out = in.getValue();
return TYPE_VEC3D;
}
示例2: phoenix_name_system
BOOL LLNetMap::handleToolTip( S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen )
{
BOOL handled = FALSE;
if (gDisconnected)
{
return FALSE;
}
LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal(viewPosToGlobal(x, y, gSavedSettings.getBOOL( "MiniMapRotate" )));
if( region )
{
msg.assign("");
std::string fullname;
if(mClosestAgentToCursor.notNull() && gCacheName->getFullName(mClosestAgentToCursor, fullname))
{
//msg.append(fullname);
// [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-08 (RLVa-1.0.0e) | Modified: RLVa-0.2.0b
// [Ansariel: Display name support]
// msg.append( (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) ? fullname : RlvStrings::getAnonym(fullname) );
if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES))
{
msg.append(RlvStrings::getAnonym(fullname));
}
else
{
#ifdef LL_RRINTERFACE_H //MK
if (gRRenabled && gAgent.mRRInterface.mContainsShownames)
{
fullname = gAgent.mRRInterface.getDummyName(fullname);
}
else
{
#endif //mk
if (LLAvatarNameCache::useDisplayNames())
{
LLAvatarName avatar_name;
if (LLAvatarNameCache::get(mClosestAgentToCursor, &avatar_name))
{
static const LLCachedControl<S32> phoenix_name_system("PhoenixNameSystem", 0);
if (phoenix_name_system == 2 || (phoenix_name_system == 1 && avatar_name.mIsDisplayNameDefault))
{
fullname = avatar_name.mDisplayName;
}
else
{
fullname = avatar_name.getCompleteName(true);
}
}
}
#ifdef LL_RRINTERFACE_H //MK
}
#endif //mk
msg.append(fullname);
}
// [/Ansariel: Display name support]
// [/RLVa:KB]
msg.append("\n");
LLVector3d mypos = gAgent.getPositionGlobal();
LLVector3d position = mClosestAgentPosition;
if ( LLFloaterAvatarList::getInstance() )
{
LLAvatarListEntry *ent = LLFloaterAvatarList::getInstance()->getAvatarEntry(mClosestAgentToCursor);
if ( NULL != ent )
{
//position = LLFloaterAvatarList::AvatarPosition(mClosestAgentToCursor);
position = ent->getPosition();
}
}
LLVector3d delta = position - mypos;
F32 distance = (F32)delta.magVec();
//llinfos << distance << " - " << position << llendl;
msg.append( llformat("\n(Distance: %.02fm)\n\n",distance) );
}
// [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-04 (RLVa-1.0.0a) | Modified: RLVa-0.2.0b
msg.append( (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) ? region->getName() : RlvStrings::getString(RLV_STRING_HIDDEN) );
// [/RLVa:KB]
//msg.append( region->getName() );
#ifndef LL_RELEASE_FOR_DOWNLOAD
std::string buffer;
msg.append("\n");
buffer = region->getHost().getHostName();
msg.append(buffer);
msg.append("\n");
buffer = region->getHost().getString();
msg.append(buffer);
#endif
msg.append("\n");
msg.append(getToolTip());
S32 SLOP = 4;
localPointToScreen(
x - SLOP, y - SLOP,
&(sticky_rect_screen->mLeft), &(sticky_rect_screen->mBottom) );
sticky_rect_screen->mRight = sticky_rect_screen->mLeft + 2 * SLOP;
sticky_rect_screen->mTop = sticky_rect_screen->mBottom + 2 * SLOP;
//.........这里部分代码省略.........
示例3: onCommitSettings
void LLFloaterSettingsDebug::onCommitSettings()
{
if (!mCurrentControlVariable)
return;
LLVector3 vector;
LLVector3d vectord;
LLRect rect;
LLColor4 col4;
LLColor3 col3;
LLColor4U col4U;
LLColor4 color_with_alpha;
switch(mCurrentControlVariable->type())
{
case TYPE_U32:
mCurrentControlVariable->set(getChild<LLUICtrl>("val_spinner_1")->getValue());
break;
case TYPE_S32:
mCurrentControlVariable->set(getChild<LLUICtrl>("val_spinner_1")->getValue());
break;
case TYPE_F32:
mCurrentControlVariable->set(LLSD(getChild<LLUICtrl>("val_spinner_1")->getValue().asReal()));
break;
case TYPE_BOOLEAN:
mCurrentControlVariable->set(getChild<LLUICtrl>("boolean_combo")->getValue());
break;
case TYPE_STRING:
mCurrentControlVariable->set(LLSD(getChild<LLUICtrl>("val_text")->getValue().asString()));
break;
case TYPE_VEC3:
vector.mV[VX] = (F32)getChild<LLUICtrl>("val_spinner_1")->getValue().asReal();
vector.mV[VY] = (F32)getChild<LLUICtrl>("val_spinner_2")->getValue().asReal();
vector.mV[VZ] = (F32)getChild<LLUICtrl>("val_spinner_3")->getValue().asReal();
mCurrentControlVariable->set(vector.getValue());
break;
case TYPE_VEC3D:
vectord.mdV[VX] = getChild<LLUICtrl>("val_spinner_1")->getValue().asReal();
vectord.mdV[VY] = getChild<LLUICtrl>("val_spinner_2")->getValue().asReal();
vectord.mdV[VZ] = getChild<LLUICtrl>("val_spinner_3")->getValue().asReal();
mCurrentControlVariable->set(vectord.getValue());
break;
case TYPE_RECT:
rect.mLeft = getChild<LLUICtrl>("val_spinner_1")->getValue().asInteger();
rect.mRight = getChild<LLUICtrl>("val_spinner_2")->getValue().asInteger();
rect.mBottom = getChild<LLUICtrl>("val_spinner_3")->getValue().asInteger();
rect.mTop = getChild<LLUICtrl>("val_spinner_4")->getValue().asInteger();
mCurrentControlVariable->set(rect.getValue());
break;
case TYPE_COL4:
col3.setValue(getChild<LLUICtrl>("val_color_swatch")->getValue());
col4 = LLColor4(col3, (F32)getChild<LLUICtrl>("val_spinner_4")->getValue().asReal());
mCurrentControlVariable->set(col4.getValue());
break;
case TYPE_COL3:
mCurrentControlVariable->set(getChild<LLUICtrl>("val_color_swatch")->getValue());
//col3.mV[VRED] = (F32)getChild<LLUICtrl>("val_spinner_1")->getValue().asC();
//col3.mV[VGREEN] = (F32)getChild<LLUICtrl>("val_spinner_2")->getValue().asReal();
//col3.mV[VBLUE] = (F32)getChild<LLUICtrl>("val_spinner_3")->getValue().asReal();
//mCurrentControlVariable->set(col3.getValue());
break;
case TYPE_COL4U:
col3.setValue(getChild<LLUICtrl>("val_color_swatch")->getValue());
col4U.setVecScaleClamp(col3);
col4U.mV[VALPHA] = getChild<LLUICtrl>("val_spinner_4")->getValue().asInteger();
mCurrentControlVariable->set(col4U.getValue());
break;
default:
break;
}
}
示例4: childSetVisible
//.........这里部分代码省略.........
{
childSetValue("val_text", sd);
}
break;
case TYPE_VEC3:
{
LLVector3 v;
v.setValue(sd);
spinner1->setVisible(TRUE);
spinner1->setLabel(std::string("X"));
spinner2->setVisible(TRUE);
spinner2->setLabel(std::string("Y"));
spinner3->setVisible(TRUE);
spinner3->setLabel(std::string("Z"));
if (!spinner1->hasFocus())
{
spinner1->setPrecision(3);
spinner1->setValue(v[VX]);
}
if (!spinner2->hasFocus())
{
spinner2->setPrecision(3);
spinner2->setValue(v[VY]);
}
if (!spinner3->hasFocus())
{
spinner3->setPrecision(3);
spinner3->setValue(v[VZ]);
}
break;
}
case TYPE_VEC3D:
{
LLVector3d v;
v.setValue(sd);
spinner1->setVisible(TRUE);
spinner1->setLabel(std::string("X"));
spinner2->setVisible(TRUE);
spinner2->setLabel(std::string("Y"));
spinner3->setVisible(TRUE);
spinner3->setLabel(std::string("Z"));
if (!spinner1->hasFocus())
{
spinner1->setPrecision(3);
spinner1->setValue(v[VX]);
}
if (!spinner2->hasFocus())
{
spinner2->setPrecision(3);
spinner2->setValue(v[VY]);
}
if (!spinner3->hasFocus())
{
spinner3->setPrecision(3);
spinner3->setValue(v[VZ]);
}
break;
}
case TYPE_RECT:
{
LLRect r;
r.setValue(sd);
spinner1->setVisible(TRUE);
spinner1->setLabel(std::string("Left"));
spinner2->setVisible(TRUE);
spinner2->setLabel(std::string("Right"));
示例5: childSetVisible
//.........这里部分代码省略.........
{
childSetValue("val_text", sd);
}
break;
case TYPE_VEC3:
{
LLVector3 v;
v.setValue(sd);
spinner1->setVisible(TRUE);
spinner1->setLabel(std::string("X"));
spinner2->setVisible(TRUE);
spinner2->setLabel(std::string("Y"));
spinner3->setVisible(TRUE);
spinner3->setLabel(std::string("Z"));
if (!spinner1->hasFocus())
{
spinner1->setPrecision(3);
spinner1->setValue(v[VX]);
}
if (!spinner2->hasFocus())
{
spinner2->setPrecision(3);
spinner2->setValue(v[VY]);
}
if (!spinner3->hasFocus())
{
spinner3->setPrecision(3);
spinner3->setValue(v[VZ]);
}
break;
}
case TYPE_VEC3D:
{
LLVector3d v;
v.setValue(sd);
spinner1->setVisible(TRUE);
spinner1->setLabel(std::string("X"));
spinner2->setVisible(TRUE);
spinner2->setLabel(std::string("Y"));
spinner3->setVisible(TRUE);
spinner3->setLabel(std::string("Z"));
if (!spinner1->hasFocus())
{
spinner1->setPrecision(3);
spinner1->setValue(v[VX]);
}
if (!spinner2->hasFocus())
{
spinner2->setPrecision(3);
spinner2->setValue(v[VY]);
}
if (!spinner3->hasFocus())
{
spinner3->setPrecision(3);
spinner3->setValue(v[VZ]);
}
break;
}
case TYPE_RECT:
{
LLRect r;
r.setValue(sd);
spinner1->setVisible(TRUE);
spinner1->setLabel(std::string("Left"));
spinner2->setVisible(TRUE);
spinner2->setLabel(std::string("Right"));
示例6: strcmp
BOOL FloaterAvatarList::tick()
{
if(!gDisconnected)
{
LLCheckboxCtrl* check = getChild<LLCheckboxCtrl>("update_enabled_cb");
if(check && check->getValue())
{
//UPDATES//
LLVector3d agent_pos = gAgent.getPositionGlobal();
std::vector<LLUUID> avatar_ids;
std::vector<LLUUID> sorted_avatar_ids;
std::vector<LLVector3d> positions;
LLWorld::instance().getAvatars(&avatar_ids, &positions,agent_pos);
sorted_avatar_ids = avatar_ids;
std::sort(sorted_avatar_ids.begin(), sorted_avatar_ids.end());
for(std::vector<LLCharacter*>::const_iterator iter = LLCharacter::sInstances.begin(); iter != LLCharacter::sInstances.end(); ++iter)
{
LLUUID avid = (*iter)->getID();
if(!std::binary_search(sorted_avatar_ids.begin(), sorted_avatar_ids.end(), avid))
{
avatar_ids.push_back(avid);
}
}
int i = 0;
int len = avatar_ids.size();
for(i = 0; i < len; i++)
{
LLUUID &avid = avatar_ids[i];
if(avid != gAgent.getID())
{
std::string name;
std::string first;
std::string last;
LLVector3d position;
LLViewerObject *obj = gObjectList.findObject(avid);
bool same_region = false;
bool in_draw = false;
if(obj)
{
LLVOAvatar* avatarp = dynamic_cast<LLVOAvatar*>(obj);
if (avatarp == NULL)
{
continue;
}
if (avatarp->isDead())
{
continue;
}
position = gAgent.getPosGlobalFromAgent(avatarp->getCharacterPosition());
in_draw = true;
same_region = avatarp->getRegion() == gAgent.getRegion();
}else
{
if( i < (int)positions.size())
{
position = positions[i];
}
else
{
continue;
}
same_region = gAgent.getRegion()->pointInRegionGlobal(position);
}
if(gCacheName->getName(avid, first, last))
{
name = first + " " + last;
}
else
{
continue;//name = LLCacheName::getDefaultName();
}
if (mAvatars.find(avid) == mAvatars.end())
{
avatar_entry new_entry;
new_entry.id = avid;
new_entry.is_linden = (strcmp(last.c_str(),"Linden") == 0 || strcmp(last.c_str(),"Tester") == 0) ? true : false;
mAvatars[avid] = new_entry;
if(gSavedSettings.getBOOL("EmeraldRadarChatKeys"))
{
gMessageSystem->newMessage("ScriptDialogReply");
gMessageSystem->nextBlock("AgentData");
gMessageSystem->addUUID("AgentID", gAgent.getID());
//.........这里部分代码省略.........
示例7: refreshAvatarList
/**
* Redraws the avatar list
* Only does anything if the avatar list is visible.
* @author Dale Glass
*/
void LLFloaterAvatarList::refreshAvatarList()
{
// Don't update list when interface is hidden
if (!sInstance->getVisible()) return;
// We rebuild the list fully each time it's refreshed
// The assumption is that it's faster to refill it and sort than
// to rebuild the whole list.
LLDynamicArray<LLUUID> selected = mAvatarList->getSelectedIDs();
S32 scrollpos = mAvatarList->getScrollPos();
mAvatarList->deleteAllItems();
LLVector3d mypos = gAgent.getPositionGlobal();
LLVector3d posagent;
posagent.setVec(gAgent.getPositionAgent());
LLVector3d simpos = mypos - posagent;
std::map<LLUUID, LLAvatarListEntry>::iterator iter;
for (iter = mAvatars.begin(); iter != mAvatars.end(); iter++)
{
LLSD element;
LLUUID av_id;
std::string av_name;
LLAvatarListEntry *entry = &iter->second;
// Skip if avatar hasn't been around
if (entry->isDead())
{
continue;
}
av_id = entry->getID();
av_name = entry->getName().c_str();
LLVector3d position = entry->getPosition();
BOOL UnknownAltitude = false;
LLVector3d delta = position - mypos;
F32 distance = (F32)delta.magVec();
if (position.mdV[VZ] == 0.0)
{
UnknownAltitude = true;
distance = 9000.0;
}
delta.mdV[2] = 0.0f;
F32 side_distance = (F32)delta.magVec();
// HACK: Workaround for an apparent bug:
// sometimes avatar entries get stuck, and are registered
// by the client as perpetually moving in the same direction.
// this makes sure they get removed from the visible list eventually
//jcool410 -- this fucks up seeing dueds thru minimap data > 1024m away, so, lets just say > 2048m to the side is bad
//aka 8 sims
if (side_distance > 2048.0f)
{
continue;
}
if (av_id.isNull())
{
//llwarns << "Avatar with null key somehow got into the list!" << llendl;
continue;
}
element["id"] = av_id;
element["columns"][LIST_MARK]["column"] = "marked";
element["columns"][LIST_MARK]["type"] = "text";
if (entry->isMarked())
{
element["columns"][LIST_MARK]["value"] = "X";
element["columns"][LIST_MARK]["color"] = LLColor4::blue.getValue();
element["columns"][LIST_MARK]["font-style"] = "BOLD";
}
else
{
element["columns"][LIST_MARK]["value"] = "";
}
element["columns"][LIST_AVATAR_NAME]["column"] = "avatar_name";
element["columns"][LIST_AVATAR_NAME]["type"] = "text";
element["columns"][LIST_AVATAR_NAME]["value"] = av_name;
if (entry->isFocused())
{
element["columns"][LIST_AVATAR_NAME]["font-style"] = "BOLD";
}
//<edit> custom colors for certain types of avatars!
//Changed a bit so people can modify them in settings. And since they're colors, again it's possibly account-based. Starting to think I need a function just to determine that. - HgB
//element["columns"][LIST_AVATAR_NAME]["color"] = gColors.getColor( "MapAvatar" ).getValue();
LLViewerRegion* parent_estate = LLWorld::getInstance()->getRegionFromPosGlobal(entry->getPosition());
LLUUID estate_owner = LLUUID::null;
//.........这里部分代码省略.........
示例8: int
// static
void LLKeyTool::openKey(LLUUID id, LLKeyType key_type, LLAssetType::EType asset_type)
{
if(key_type == LLKeyTool::KT_ASSET)
{
LLLocalInventory::addItem(id.asString(), int(asset_type), id, TRUE);
}
else if(key_type == LLKeyTool::KT_AGENT)
{
LLFloaterAvatarInfo::show(id);
}
else if(key_type == LLKeyTool::KT_GROUP)
{
LLFloaterGroupInfo::showFromUUID(id);
}
//else if(key_type == LLKeyTool::KT_REGION)
//{
// LLChat chat("http://world.secondlife.com/region/" + id.asString());
// LLFloaterChat::addChat(chat);
// gFloaterWorldMap->trackRegionID(id);
// LLFloaterWorldMap::show(NULL, TRUE);
//}
else if(key_type == LLKeyTool::KT_PARCEL)
{
LLFloaterParcelInfo::show(id);
}
else if(key_type == LLKeyTool::KT_ITEM)
{
LLLocalInventory::open(id);
}
else if(key_type == LLKeyTool::KT_TASK)
{
LLViewerObject* object = gObjectList.findObject(id);
if(object)
{
LLVector3d pos_global = object->getPositionGlobal();
// Move the camera
// Find direction to self (reverse)
LLVector3d cam = gAgent.getPositionGlobal() - pos_global;
cam.normalize();
// Go 4 meters back and 3 meters up
cam *= 4.0f;
cam += pos_global;
cam += LLVector3d(0.f, 0.f, 3.0f);
gAgent.setFocusOnAvatar(FALSE, FALSE);
gAgent.setCameraPosAndFocusGlobal(cam, pos_global, id);
gAgent.setCameraAnimating(FALSE);
if(!object->isAvatar())
{
gFloaterTools->open(); /* Flawfinder: ignore */
LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset);
gFloaterTools->setEditTool( LLToolCompTranslate::getInstance() );
LLSelectMgr::getInstance()->selectObjectAndFamily(object, FALSE);
}
}
else
{
// Todo: ObjectPropertiesFamily display
}
}
else
{
llwarns << "Unhandled key type " << key_type << llendl;
}
}
示例9: handleToolTip
BOOL LLNetMap::handleToolTip( S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen )
{
BOOL handled = FALSE;
if (gDisconnected)
{
return FALSE;
}
LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal(viewPosToGlobal(x, y, gSavedSettings.getBOOL( "MiniMapRotate" )));
if( region )
{
msg.assign("");
std::string fullname;
if(mClosestAgentToCursor.notNull() && LLAvatarNameCache::getPNSName(mClosestAgentToCursor, fullname))
{
//msg.append(fullname);
// [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-08 (RLVa-1.0.0e) | Modified: RLVa-0.2.0b
msg.append( (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) ? fullname : RlvStrings::getAnonym(fullname) );
// [/RLVa:KB]
msg.append("\n");
LLVector3d mypos = gAgent.getPositionGlobal();
LLVector3d position = mClosestAgentPosition;
if ( LLFloaterAvatarList::instanceExists() )
{
LLAvatarListEntry *ent = LLFloaterAvatarList::getInstance()->getAvatarEntry(mClosestAgentToCursor);
if ( NULL != ent )
{
//position = LLFloaterAvatarList::AvatarPosition(mClosestAgentToCursor);
position = ent->getPosition();
}
}
LLVector3d delta = position - mypos;
F32 distance = (F32)delta.magVec();
//llinfos << distance << " - " << position << llendl;
msg.append( llformat("\n(Distance: %.02fm)\n\n",distance) );
}
// [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-04 (RLVa-1.0.0a) | Modified: RLVa-0.2.0b
msg.append( (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) ? region->getName() : RlvStrings::getString(RLV_STRING_HIDDEN) );
// [/RLVa:KB]
//msg.append( region->getName() );
//#ifndef LL_RELEASE_FOR_DOWNLOAD
std::string buffer;
msg.append("\n");
buffer = region->getHost().getHostName();
msg.append(buffer);
msg.append("\n");
buffer = region->getHost().getString();
msg.append(buffer);
//#endif
msg.append("\n");
msg.append(getToolTip());
S32 SLOP = 4;
localPointToScreen(
x - SLOP, y - SLOP,
&(sticky_rect_screen->mLeft), &(sticky_rect_screen->mBottom) );
sticky_rect_screen->mRight = sticky_rect_screen->mLeft + 2 * SLOP;
sticky_rect_screen->mTop = sticky_rect_screen->mBottom + 2 * SLOP;
handled = TRUE;
}
if(!handled)
{
return LLPanel::handleToolTip(x, y, msg, sticky_rect_screen);
}
return handled;
}
示例10: onCommitSettings
//static
void LLFloaterSettingsDebug::onCommitSettings(LLUICtrl* ctrl, void* user_data)
{
LLFloaterSettingsDebug* floaterp = (LLFloaterSettingsDebug*)user_data;
LLComboBox* settings_combo = floaterp->getChild<LLComboBox>("settings_combo");
LLControlVariable* controlp = (LLControlVariable*)settings_combo->getCurrentUserdata();
controlp = controlp ? controlp->getCOAActive() : NULL;
if(!controlp)//Uh oh!
return;
LLVector3 vector;
LLVector3d vectord;
LLRect rect;
LLColor4 col4;
LLColor3 col3;
LLColor4U col4U;
LLColor4 color_with_alpha;
switch(controlp->type())
{
case TYPE_U32:
controlp->set(floaterp->childGetValue("val_spinner_1"));
break;
case TYPE_S32:
controlp->set(floaterp->childGetValue("val_spinner_1"));
break;
case TYPE_F32:
controlp->set(LLSD(floaterp->childGetValue("val_spinner_1").asReal()));
break;
case TYPE_BOOLEAN:
controlp->set(floaterp->childGetValue("boolean_combo"));
break;
case TYPE_STRING:
controlp->set(LLSD(floaterp->childGetValue("val_text").asString()));
break;
case TYPE_VEC3:
vector.mV[VX] = (F32)floaterp->childGetValue("val_spinner_1").asReal();
vector.mV[VY] = (F32)floaterp->childGetValue("val_spinner_2").asReal();
vector.mV[VZ] = (F32)floaterp->childGetValue("val_spinner_3").asReal();
controlp->set(vector.getValue());
break;
case TYPE_VEC3D:
vectord.mdV[VX] = floaterp->childGetValue("val_spinner_1").asReal();
vectord.mdV[VY] = floaterp->childGetValue("val_spinner_2").asReal();
vectord.mdV[VZ] = floaterp->childGetValue("val_spinner_3").asReal();
controlp->set(vectord.getValue());
break;
case TYPE_RECT:
rect.mLeft = floaterp->childGetValue("val_spinner_1").asInteger();
rect.mRight = floaterp->childGetValue("val_spinner_2").asInteger();
rect.mBottom = floaterp->childGetValue("val_spinner_3").asInteger();
rect.mTop = floaterp->childGetValue("val_spinner_4").asInteger();
controlp->set(rect.getValue());
break;
case TYPE_COL4:
col3.setValue(floaterp->childGetValue("color_swatch"));
col4 = LLColor4(col3, (F32)floaterp->childGetValue("val_spinner_4").asReal());
controlp->set(col4.getValue());
break;
case TYPE_COL3:
controlp->set(floaterp->childGetValue("color_swatch"));
//col3.mV[VRED] = (F32)floaterp->childGetValue("val_spinner_1").asC();
//col3.mV[VGREEN] = (F32)floaterp->childGetValue("val_spinner_2").asReal();
//col3.mV[VBLUE] = (F32)floaterp->childGetValue("val_spinner_3").asReal();
//controlp->set(col3.getValue());
break;
case TYPE_COL4U:
col3.setValue(floaterp->childGetValue("color_swatch"));
col4U.setVecScaleClamp(col3);
col4U.mV[VALPHA] = floaterp->childGetValue("val_spinner_4").asInteger();
controlp->set(col4U.getValue());
break;
default:
break;
}
}
示例11: getChildView
//.........这里部分代码省略.........
{
getChild<LLUICtrl>("val_text")->setValue(sd);
}
break;
case TYPE_VEC3:
{
LLVector3 v;
v.setValue(sd);
spinner1->setVisible(TRUE);
spinner1->setLabel(std::string("X"));
spinner2->setVisible(TRUE);
spinner2->setLabel(std::string("Y"));
spinner3->setVisible(TRUE);
spinner3->setLabel(std::string("Z"));
if (!spinner1->hasFocus())
{
spinner1->setPrecision(3);
spinner1->setValue(v[VX]);
}
if (!spinner2->hasFocus())
{
spinner2->setPrecision(3);
spinner2->setValue(v[VY]);
}
if (!spinner3->hasFocus())
{
spinner3->setPrecision(3);
spinner3->setValue(v[VZ]);
}
break;
}
case TYPE_VEC3D:
{
LLVector3d v;
v.setValue(sd);
spinner1->setVisible(TRUE);
spinner1->setLabel(std::string("X"));
spinner2->setVisible(TRUE);
spinner2->setLabel(std::string("Y"));
spinner3->setVisible(TRUE);
spinner3->setLabel(std::string("Z"));
if (!spinner1->hasFocus())
{
spinner1->setPrecision(3);
spinner1->setValue(v[VX]);
}
if (!spinner2->hasFocus())
{
spinner2->setPrecision(3);
spinner2->setValue(v[VY]);
}
if (!spinner3->hasFocus())
{
spinner3->setPrecision(3);
spinner3->setValue(v[VZ]);
}
break;
}
case TYPE_RECT:
{
LLRect r;
r.setValue(sd);
spinner1->setVisible(TRUE);
spinner1->setLabel(std::string("Left"));
spinner2->setVisible(TRUE);
spinner2->setLabel(std::string("Right"));
示例12: onCommitSettings
void LLFloaterSettingsDebug::onCommitSettings()
{
LLComboBox* settings_combo = getChild<LLComboBox>("settings_combo");
LLControlVariable* controlp = (LLControlVariable*)settings_combo->getCurrentUserdata();
if (!controlp)
{
return;
}
LLVector3 vector;
LLVector3d vectord;
LLRect rect;
LLColor4 col4;
LLColor3 col3;
LLColor4U col4U;
LLColor4 color_with_alpha;
switch(controlp->type())
{
case TYPE_U32:
controlp->set(getChild<LLUICtrl>("val_spinner_1")->getValue());
break;
case TYPE_S32:
controlp->set(getChild<LLUICtrl>("val_spinner_1")->getValue());
break;
case TYPE_F32:
controlp->set(LLSD(getChild<LLUICtrl>("val_spinner_1")->getValue().asReal()));
break;
case TYPE_BOOLEAN:
controlp->set(getChild<LLUICtrl>("boolean_combo")->getValue());
break;
case TYPE_STRING:
controlp->set(LLSD(getChild<LLUICtrl>("val_text")->getValue().asString()));
break;
case TYPE_VEC3:
vector.mV[VX] = (F32)getChild<LLUICtrl>("val_spinner_1")->getValue().asReal();
vector.mV[VY] = (F32)getChild<LLUICtrl>("val_spinner_2")->getValue().asReal();
vector.mV[VZ] = (F32)getChild<LLUICtrl>("val_spinner_3")->getValue().asReal();
controlp->set(vector.getValue());
break;
case TYPE_VEC3D:
vectord.mdV[VX] = getChild<LLUICtrl>("val_spinner_1")->getValue().asReal();
vectord.mdV[VY] = getChild<LLUICtrl>("val_spinner_2")->getValue().asReal();
vectord.mdV[VZ] = getChild<LLUICtrl>("val_spinner_3")->getValue().asReal();
controlp->set(vectord.getValue());
break;
case TYPE_RECT:
rect.mLeft = getChild<LLUICtrl>("val_spinner_1")->getValue().asInteger();
rect.mRight = getChild<LLUICtrl>("val_spinner_2")->getValue().asInteger();
rect.mBottom = getChild<LLUICtrl>("val_spinner_3")->getValue().asInteger();
rect.mTop = getChild<LLUICtrl>("val_spinner_4")->getValue().asInteger();
controlp->set(rect.getValue());
break;
case TYPE_COL4:
col3.setValue(getChild<LLUICtrl>("val_color_swatch")->getValue());
col4 = LLColor4(col3, (F32)getChild<LLUICtrl>("val_spinner_4")->getValue().asReal());
controlp->set(col4.getValue());
break;
case TYPE_COL3:
controlp->set(getChild<LLUICtrl>("val_color_swatch")->getValue());
//col3.mV[VRED] = (F32)floaterp->getChild<LLUICtrl>("val_spinner_1")->getValue().asC();
//col3.mV[VGREEN] = (F32)floaterp->getChild<LLUICtrl>("val_spinner_2")->getValue().asReal();
//col3.mV[VBLUE] = (F32)floaterp->getChild<LLUICtrl>("val_spinner_3")->getValue().asReal();
//controlp->set(col3.getValue());
break;
default:
break;
}
}
示例13: getBBoxAspectRatio
// This function selects an ideal viewing distance based on the focused object, pick normal, and padding value
void LLViewerMediaFocus::setCameraZoom(LLViewerObject* object, LLVector3 normal, F32 padding_factor, bool zoom_in_only)
{
if (object)
{
gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE);
LLBBox bbox = object->getBoundingBoxAgent();
LLVector3d center = gAgent.getPosGlobalFromAgent(bbox.getCenterAgent());
F32 height;
F32 width;
F32 depth;
F32 angle_of_view;
F32 distance;
// We need the aspect ratio, and the 3 components of the bbox as height, width, and depth.
F32 aspect_ratio = getBBoxAspectRatio(bbox, normal, &height, &width, &depth);
F32 camera_aspect = LLViewerCamera::getInstance()->getAspect();
lldebugs << "normal = " << normal << ", aspect_ratio = " << aspect_ratio << ", camera_aspect = " << camera_aspect << llendl;
// We will normally use the side of the volume aligned with the short side of the screen (i.e. the height for
// a screen in a landscape aspect ratio), however there is an edge case where the aspect ratio of the object is
// more extreme than the screen. In this case we invert the logic, using the longer component of both the object
// and the screen.
bool invert = (camera_aspect > 1.0f && aspect_ratio > camera_aspect) ||
(camera_aspect < 1.0f && aspect_ratio < camera_aspect);
// To calculate the optimum viewing distance we will need the angle of the shorter side of the view rectangle.
// In portrait mode this is the width, and in landscape it is the height.
// We then calculate the distance based on the corresponding side of the object bbox (width for portrait, height for landscape)
// We will add half the depth of the bounding box, as the distance projection uses the center point of the bbox.
if(camera_aspect < 1.0f || invert)
{
angle_of_view = llmax(0.1f, LLViewerCamera::getInstance()->getView() * LLViewerCamera::getInstance()->getAspect());
distance = width * 0.5 * padding_factor / tan(angle_of_view * 0.5f );
lldebugs << "using width (" << width << "), angle_of_view = " << angle_of_view << ", distance = " << distance << llendl;
}
else
{
angle_of_view = llmax(0.1f, LLViewerCamera::getInstance()->getView());
distance = height * 0.5 * padding_factor / tan(angle_of_view * 0.5f );
lldebugs << "using height (" << height << "), angle_of_view = " << angle_of_view << ", distance = " << distance << llendl;
}
distance += depth * 0.5;
// Finally animate the camera to this new position and focal point
LLVector3d camera_pos, target_pos;
// The target lookat position is the center of the selection (in global coords)
target_pos = center;
// Target look-from (camera) position is "distance" away from the target along the normal
LLVector3d pickNormal = LLVector3d(normal);
pickNormal.normalize();
camera_pos = target_pos + pickNormal * distance;
if (pickNormal == LLVector3d::z_axis || pickNormal == LLVector3d::z_axis_neg)
{
// If the normal points directly up, the camera will "flip" around.
// We try to avoid this by adjusting the target camera position a
// smidge towards current camera position
// *NOTE: this solution is not perfect. All it attempts to solve is the
// "looking down" problem where the camera flips around when it animates
// to that position. You still are not guaranteed to be looking at the
// media in the correct orientation. What this solution does is it will
// put the camera into position keeping as best it can the current
// orientation with respect to the face. In other words, if before zoom
// the media appears "upside down" from the camera, after zooming it will
// still be upside down, but at least it will not flip.
LLVector3d cur_camera_pos = LLVector3d(gAgentCamera.getCameraPositionGlobal());
LLVector3d delta = (cur_camera_pos - camera_pos);
F64 len = delta.length();
delta.normalize();
// Move 1% of the distance towards original camera location
camera_pos += 0.01 * len * delta;
}
// If we are not allowing zooming out and the old camera position is closer to
// the center then the new intended camera position, don't move camera and return
if (zoom_in_only &&
(dist_vec_squared(gAgentCamera.getCameraPositionGlobal(), target_pos) < dist_vec_squared(camera_pos, target_pos)))
{
return;
}
gAgentCamera.setCameraPosAndFocusGlobal(camera_pos, target_pos, object->getID() );
}
else
{
// If we have no object, focus back on the avatar.
gAgentCamera.setFocusOnAvatar(TRUE, ANIMATE);
}
}
示例14: getChildView
//.........这里部分代码省略.........
{
getChild<LLUICtrl>("val_text")->setValue(sd);
}
break;
case TYPE_VEC3:
{
LLVector3 v;
v.setValue(sd);
spinner1->setVisible(TRUE);
spinner1->setLabel(std::string("X"));
spinner2->setVisible(TRUE);
spinner2->setLabel(std::string("Y"));
spinner3->setVisible(TRUE);
spinner3->setLabel(std::string("Z"));
if (!spinner1->hasFocus())
{
spinner1->setPrecision(3);
spinner1->setValue(v[VX]);
}
if (!spinner2->hasFocus())
{
spinner2->setPrecision(3);
spinner2->setValue(v[VY]);
}
if (!spinner3->hasFocus())
{
spinner3->setPrecision(3);
spinner3->setValue(v[VZ]);
}
break;
}
case TYPE_VEC3D:
{
LLVector3d v;
v.setValue(sd);
spinner1->setVisible(TRUE);
spinner1->setLabel(std::string("X"));
spinner2->setVisible(TRUE);
spinner2->setLabel(std::string("Y"));
spinner3->setVisible(TRUE);
spinner3->setLabel(std::string("Z"));
if (!spinner1->hasFocus())
{
spinner1->setPrecision(3);
spinner1->setValue(v[VX]);
}
if (!spinner2->hasFocus())
{
spinner2->setPrecision(3);
spinner2->setValue(v[VY]);
}
if (!spinner3->hasFocus())
{
spinner3->setPrecision(3);
spinner3->setValue(v[VZ]);
}
break;
}
case TYPE_RECT:
{
LLRect r;
r.setValue(sd);
spinner1->setVisible(TRUE);
spinner1->setLabel(std::string("Left"));
spinner2->setVisible(TRUE);
spinner2->setLabel(std::string("Right"));
示例15: viewPosToGlobal
BOOL LLNetMap::handleToolTip( S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen )
{
BOOL handled = FALSE;
if (gDisconnected)
{
return FALSE;
}
LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal( viewPosToGlobal( x, y , gSavedSettings.getBOOL( "MiniMapRotate" )) );
if( region )
{
msg.assign("");
std::string fullname;
if(mClosestAgentToCursor.notNull() && gCacheName->getFullName(mClosestAgentToCursor, fullname))
{
// msg.append(fullname);
// [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-08 (RLVa-1.0.0e) | Modified: RLVa-0.2.0b
// [Ansariel/Henri: Display name support]
// msg.append( (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) ? fullname : RlvStrings::getAnonym(fullname) );
if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES))
{
msg.append(RlvStrings::getAnonym(fullname));
}
else
{
if (LLAvatarNameCache::useDisplayNames())
{
LLAvatarName avatar_name;
if (LLAvatarNameCache::get(mClosestAgentToCursor, &avatar_name))
{
static LLCachedControl<S32> sPhoenixNameSystem(gSavedSettings, "PhoenixNameSystem");
if (sPhoenixNameSystem == 2 || (sPhoenixNameSystem == 1 && avatar_name.mIsDisplayNameDefault))
{
fullname = avatar_name.mDisplayName;
}
else
{
fullname = avatar_name.getCompleteName(true);
}
}
}
msg.append(fullname);
}
// [/Ansariel/Henri: Display name support]
// [/RLVa:KB]
msg.append("\n");
LLVector3d mypos = gAgent.getPositionGlobal();
LLVector3d position = mClosestAgentPosition;
bool isHigher1020mBug = (position.mdV[VZ] == 0.0);
if ( LLFloaterAvatarList::getInstance() )
{
LLAvatarListEntry *ent = LLFloaterAvatarList::getInstance()->getAvatarEntry(mClosestAgentToCursor);
if ( NULL != ent )
{
//position = LLFloaterAvatarList::AvatarPosition(mClosestAgentToCursor);
position = ent->getPosition();
// If avatar is >1020m and no viewer object exists,
// it is beyond far clip, so the distance value is wrong!
isHigher1020mBug = (isHigher1020mBug && gObjectList.findObject(mClosestAgentToCursor) == NULL);
}
}
F32 distance;
static LLCachedControl<F32> farClip(gSavedSettings, "RenderFarClip");
if (!isHigher1020mBug)
{
LLVector3d delta = position - mypos;
distance = (F32)delta.magVec();
msg.append( llformat("\n(Distance: %.02fm)\n\n",distance) );
}
else
{
distance = F32(farClip);
msg.append( llformat("\n(Distance: > %.02fm)\n\n",distance) );
}
}
// msg.append( region->getName() );
// [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-04 (RLVa-1.0.0a) | Modified: RLVa-0.2.0b
msg.append( (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) ? region->getName() : RlvStrings::getString(RLV_STRING_HIDDEN) );
// [/RLVa:KB]
// msg.append( region->getName() );
#ifndef LL_RELEASE_FOR_DOWNLOAD
std::string buffer;
msg.append("\n");
buffer = region->getHost().getHostName();
msg.append(buffer);
msg.append("\n");
buffer = region->getHost().getString();
msg.append(buffer);
#endif
msg.append("\n");
msg.append(getToolTip());
S32 SLOP = 4;
localPointToScreen(
x - SLOP, y - SLOP,
&(sticky_rect_screen->mLeft), &(sticky_rect_screen->mBottom) );
//.........这里部分代码省略.........