当前位置: 首页>>代码示例>>C++>>正文


C++ LLAgent类代码示例

本文整理汇总了C++中LLAgent的典型用法代码示例。如果您正苦于以下问题:C++ LLAgent类的具体用法?C++ LLAgent怎么用?C++ LLAgent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了LLAgent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: updateTextures

void LLVOTextBubble::updateTextures(LLAgent &agent)
{
	// Update the image levels of all textures...
	// First we do some quick checks.
	U32 i;

	// This doesn't take into account whether the object is in front
	// or behind...

	LLVector3 position_local = getPositionAgent() - agent.getCameraPositionAgent();
	F32 dot_product = position_local * agent.getFrameAgent().getAtAxis();
	F32 cos_angle = dot_product / position_local.magVec();

	if (cos_angle > 1.f)
	{
		cos_angle = 1.f;
	}

	for (i = 0; i < getNumTEs(); i++)
	{
		const LLTextureEntry *te = getTE(i);
		F32 texel_area_ratio = fabs(te->mScaleS * te->mScaleT);

		LLViewerImage *imagep = getTEImage(i);
		if (imagep)
		{
			imagep->addTextureStats(mPixelArea, texel_area_ratio, cos_angle);
		}
	}
}
开发者ID:xinyaojiejie,项目名称:Dale,代码行数:30,代码来源:llvotextbubble.cpp

示例2: setPixelAreaAndAngle

void LLVOTree::setPixelAreaAndAngle(LLAgent &agent)
{
    // First calculate values as for any other object (for mAppAngle)
    LLViewerObject::setPixelAreaAndAngle(agent);

    // Re-calculate mPixelArea accurately

    // This should be the camera's center, as soon as we move to all region-local.
    LLVector3 relative_position = getPositionAgent() - agent.getCameraPositionAgent();
    F32 range = relative_position.length();				// ugh, square root

    F32 max_scale = mBillboardScale * getMaxScale();
    F32 area = max_scale * (max_scale*mBillboardRatio);

    // Compute pixels per meter at the given range
    F32 pixels_per_meter = LLViewerCamera::getInstance()->getViewHeightInPixels() /
                           (tan(LLViewerCamera::getInstance()->getView()) * range);

    mPixelArea = (pixels_per_meter) * (pixels_per_meter) * area;
#if 0
    // mAppAngle is a bit of voodoo;
    // use the one calculated LLViewerObject::setPixelAreaAndAngle above
    // to avoid LOD miscalculations
    mAppAngle = (F32) atan2( max_scale, range) * RAD_TO_DEG;
#endif
}
开发者ID:AlexRa,项目名称:Kirstens-clone,代码行数:26,代码来源:llvotree.cpp

示例3: playAmbient

// <edit>
void LLPreviewSound::playAmbient( void* userdata )
{
	LLPreviewSound* self = (LLPreviewSound*) userdata;
	const LLInventoryItem *item = self->getItem();

	if(item && gAudiop)
	{
		F32 gain = 0.01f;
		for(int i = 0; i < 2; i++)
		{
			gMessageSystem->newMessageFast(_PREHASH_SoundTrigger);
			gMessageSystem->nextBlockFast(_PREHASH_SoundData);
			gMessageSystem->addUUIDFast(_PREHASH_SoundID, LLUUID(item->getAssetUUID()));
			gMessageSystem->addUUIDFast(_PREHASH_OwnerID, LLUUID::null);
			gMessageSystem->addUUIDFast(_PREHASH_ObjectID, LLUUID::null);
			gMessageSystem->addUUIDFast(_PREHASH_ParentID, LLUUID::null);
			gMessageSystem->addU64Fast(_PREHASH_Handle, gAgent.getRegion()->getHandle());
			LLVector3d	pos = -from_region_handle(gAgent.getRegion()->getHandle());
			gMessageSystem->addVector3Fast(_PREHASH_Position, (LLVector3)pos);
			gMessageSystem->addF32Fast(_PREHASH_Gain, gain);

			gMessageSystem->sendReliable(gAgent.getRegionHost());

			gain = 1.0f;
		}
	}
}
开发者ID:CmdrCupcake,项目名称:SingularityViewer,代码行数:28,代码来源:llpreviewsound.cpp

示例4: auditionAnim

// static
void LLPreviewAnim::auditionAnim( void *userdata )
{
	LLPreviewAnim* self = (LLPreviewAnim*) userdata;
	const LLInventoryItem *item = self->getItem();

	if(item)
	{
		LLUUID itemID=item->getAssetUUID();

		LLButton* btn = self->getChild<LLButton>("Anim audition btn");
		if (btn)
		{
			btn->toggleState();
		}
		
		if (self->childGetValue("Anim audition btn").asBoolean() ) 
		{
			self->mPauseRequest = NULL;
			gAgent.getAvatarObject()->startMotion(item->getAssetUUID());
			
			LLVOAvatar* avatar = gAgent.getAvatarObject();
			LLMotion*   motion = avatar->findMotion(itemID);
			
			if (motion)
			{
				motion->setDeactivateCallback(&endAnimCallback, (void *)(new LLHandle<LLFloater>(self->getHandle())));
			}
		}
		else
		{
			gAgent.getAvatarObject()->stopMotion(itemID);
			gAgent.sendAnimationRequest(itemID, ANIM_REQUEST_STOP);
		}
	}
}
开发者ID:Nora28,项目名称:imprudence,代码行数:36,代码来源:llpreviewanim.cpp

示例5: plywood_above_head

void ImportTracker::plywood_above_head()
{
		LLMessageSystem* msg = gMessageSystem;
		msg->newMessageFast(_PREHASH_ObjectAdd);
		msg->nextBlockFast(_PREHASH_AgentData);
		msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
		msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
		msg->addUUIDFast(_PREHASH_GroupID, gAgent.getGroupID());
		msg->nextBlockFast(_PREHASH_ObjectData);
		msg->addU8Fast(_PREHASH_Material, 3);
		msg->addU32Fast(_PREHASH_AddFlags, FLAGS_CREATE_SELECTED);
		LLVolumeParams	volume_params;
		volume_params.setType(0x01, 0x10);
		volume_params.setBeginAndEndS(0.f, 1.f);
		volume_params.setBeginAndEndT(0.f, 1.f);
		volume_params.setRatio(1, 1);
		volume_params.setShear(0, 0);
		LLVolumeMessage::packVolumeParams(&volume_params, msg);
		msg->addU8Fast(_PREHASH_PCode, 9);
		msg->addVector3Fast(_PREHASH_Scale, LLVector3(0.52345f, 0.52346f, 0.52347f));
		LLQuaternion rot;
		msg->addQuatFast(_PREHASH_Rotation, rot);
		LLViewerRegion *region = gAgent.getRegion();
		
		if (!localids.size())
			root = (initialPos + linksetoffset);
		
		msg->addVector3Fast(_PREHASH_RayStart, root);
		msg->addVector3Fast(_PREHASH_RayEnd, root);
		msg->addU8Fast(_PREHASH_BypassRaycast, (U8)TRUE );
		msg->addU8Fast(_PREHASH_RayEndIsIntersection, (U8)FALSE );
		msg->addU8Fast(_PREHASH_State, (U8)0);
		msg->addUUIDFast(_PREHASH_RayTargetID, LLUUID::null);
		msg->sendReliable(region->getHost());
}
开发者ID:IamusNavarathna,项目名称:SingularityViewer,代码行数:35,代码来源:importtracker.cpp

示例6: plyWood

void Object::plyWood()
{
		LLMessageSystem* msg = gMessageSystem;
		msg->newMessageFast(_PREHASH_ObjectAdd);
		msg->nextBlockFast(_PREHASH_AgentData);
		msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
		msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
		msg->addUUIDFast(_PREHASH_GroupID, gAgent.getGroupID());
		msg->nextBlockFast(_PREHASH_ObjectData);
		msg->addU8Fast(_PREHASH_Material, 3);
		//msg->addU32Fast(_PREHASH_AddFlags, ); // CREATE_SELECTED
		LLVolumeParams	volume_params;
		volume_params.setType(0x01, 0x10);
		volume_params.setBeginAndEndS(0.f, 1.f);
		volume_params.setBeginAndEndT(0.f, 1.f);
		volume_params.setRatio(1, 1);
		volume_params.setShear(0, 0);
		LLVolumeMessage::packVolumeParams(&volume_params, msg);
		msg->addU8Fast(_PREHASH_PCode, 9);
		msg->addVector3Fast(_PREHASH_Scale, LLVector3(0.52346f, 0.52347f, 0.52348f));
		LLQuaternion rot;
		msg->addQuatFast(_PREHASH_Rotation, rot);
		LLViewerRegion *region = gAgent.getRegion();
		LLVector3 root(0.f,0.f,0.1f);
		root+=gAgent.getCameraPositionAgent();
		msg->addVector3Fast(_PREHASH_RayStart, root);
		msg->addVector3Fast(_PREHASH_RayEnd, root);
		msg->addU8Fast(_PREHASH_BypassRaycast, (U8)TRUE );
		msg->addU8Fast(_PREHASH_RayEndIsIntersection, (U8)FALSE );
		msg->addU8Fast(_PREHASH_State, (U8)0);
		msg->addUUIDFast(_PREHASH_RayTargetID, LLUUID::null);
		msg->sendReliable(region->getHost());
}
开发者ID:N3X15,项目名称:Luna-Viewer,代码行数:33,代码来源:LuaBuild_f.cpp

示例7: send_image

void ImportTracker::send_image(LLSD& prim)
{
	LLMessageSystem* msg = gMessageSystem;
	msg->newMessageFast(_PREHASH_ObjectImage);
	msg->nextBlockFast(_PREHASH_AgentData);
	msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
	msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
	
	msg->nextBlockFast(_PREHASH_ObjectData);
	msg->addU32Fast(_PREHASH_ObjectLocalID, prim["LocalID"].asInteger());
	msg->addStringFast(_PREHASH_MediaURL, NULL);
	
	LLPrimitive obj;
	LLSD tes = prim["textures"];
	obj.setNumTEs(U8(tes.size()));
	
	for (int i = 0; i < tes.size(); i++)
	{
		LLTextureEntry tex;
		tex.fromLLSD(tes[i]);
		obj.setTE(U8(i), tex);
	}
	
	obj.packTEMessage(gMessageSystem);
	
	msg->sendReliable(gAgent.getRegion()->getHost());
}
开发者ID:IamusNavarathna,项目名称:SingularityViewer,代码行数:27,代码来源:importtracker.cpp

示例8: auditionSound

// static
void LLPreviewSound::auditionSound( void *userdata )
{
	LLPreviewSound* self = (LLPreviewSound*) userdata;
	const LLInventoryItem *item = self->getItem();

	if(item && gAudiop)
	{
		LLVector3d lpos_global = gAgent.getPositionGlobal();
		gAudiop->triggerSound(item->getAssetUUID(), gAgent.getID(), SOUND_GAIN, LLAudioEngine::AUDIO_TYPE_UI, lpos_global);
	}
}
开发者ID:CmdrCupcake,项目名称:SingularityViewer,代码行数:12,代码来源:llpreviewsound.cpp

示例9: getItem

LLPreviewSound::LLPreviewSound(const std::string& name, const LLRect& rect, const std::string& title, const LLUUID& item_uuid, const LLUUID& object_uuid)	:
	LLPreview( name, rect, title, item_uuid, object_uuid)
{
	
	LLUICtrlFactory::getInstance()->buildFloater(this,"floater_preview_sound.xml");

	childSetAction("Sound play btn",&LLPreviewSound::playSound,this);
	childSetAction("Sound audition btn",&LLPreviewSound::auditionSound,this);
	// <edit>
	childSetAction("Sound copy uuid btn", &LLPreviewSound::copyUUID, this);
	childSetAction("Play ambient btn", &LLPreviewSound::playAmbient, this);
	// </edit>

	LLButton* button = getChild<LLButton>("Sound play btn");
	button->setSoundFlags(LLView::SILENT);
	
	button = getChild<LLButton>("Sound audition btn");
	button->setSoundFlags(LLView::SILENT);

	const LLInventoryItem* item = getItem();

	mIsCopyable = false;
	if(item)
	{
		const LLPermissions& perm = item->getPermissions();
		mIsCopyable = (perm.getCreator() == gAgent.getID());
	}
	
	childSetCommitCallback("desc", LLPreview::onText, this);
	childSetText("desc", item->getDescription());
	childSetPrevalidate("desc", &LLLineEditor::prevalidatePrintableNotPipe);	
	
	// preload the sound
	if(item && gAudiop)
	{
		gAudiop->preloadSound(item->getAssetUUID());
		// <edit>
		// that thing above doesn't actually start a sound transfer, so I will do it
		//LLAudioSource *asp = new LLAudioSource(gAgent.getID(), gAgent.getID(), F32(1.0f), LLAudioEngine::AUDIO_TYPE_UI);
		LLAudioSource *asp = gAgentAvatarp->getAudioSource(gAgent.getID());
		LLAudioData *datap = gAudiop->getAudioData(item->getAssetUUID());
		asp->addAudioData(datap, FALSE);
		// </edit>
	}
	
	setTitle(title);

	if (!getHost())
	{
		LLRect curRect = getRect();
		translate(rect.mLeft - curRect.mLeft, rect.mTop - curRect.mTop);
	}

}
开发者ID:Krazy-Bish-Margie,项目名称:SingularityViewer,代码行数:54,代码来源:llpreviewsound.cpp

示例10: JCImportTransferCallback

	/*virtual*/ void uploadComplete(const LLSD& content)
	{
		LLPointer<LLInventoryCallback> cb = new JCImportTransferCallback(data);
		LLPermissions perm;
		LLUUID parent_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);

		create_inventory_item(gAgent.getID(), gAgent.getSessionID(),
			gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH), data->tid, data->name,
			data->description, data->type, LLInventoryType::defaultForAssetType(data->type), data->wear_type,
			LLFloaterPerms::getNextOwnerPerms(),
			cb);
		
	}
开发者ID:linkedinyou,项目名称:SingularityViewer,代码行数:13,代码来源:importtracker.cpp

示例11: cs

Object::Object(int pcode,bool viewerside)
{
	if(viewerside)
		mObject=gObjectList.createObjectViewer((LLPCode)pcode, gAgent.getRegion());
	else
	{
		mObject=NULL;
		mWaiting=true;
		CB_Args0(plyWood);
		while(true)
		{
			// lock to main
			{
				FLLua::CriticalSection cs();
				if(mReady.notNull())
				{
					mObject=gObjectList.findObject(mReady);
					mWaiting=false;
					break;
				}
			}
			FLLua::yield();
		}
	}
}
开发者ID:N3X15,项目名称:Luna-Viewer,代码行数:25,代码来源:LuaBuild_f.cpp

示例12: getItem

LLPreviewAnim::LLPreviewAnim(const std::string& name, const LLRect& rect, const std::string& title, const LLUUID& item_uuid, const S32& activate, const LLUUID& object_uuid )	:
	LLPreview( name, rect, title, item_uuid, object_uuid)
{
	LLUICtrlFactory::getInstance()->buildFloater(this,"floater_preview_animation.xml");

	childSetAction("Anim play btn",playAnim,this);
	childSetAction("Anim audition btn",auditionAnim,this);
	// <edit>
	childSetAction("Anim copy uuid btn", copyAnimID, this);
	// </edit>
	childSetAction("Anim remake btn",dupliAnim,this);
	childSetAction("Anim export btn",exportAnim,this);

	childSetAction("Anim .anim btn",exportasdotAnim,this);

	childSetEnabled("Anim remake btn", FALSE);
	childSetEnabled("Anim export btn", FALSE);
	childSetEnabled("Anim .anim btn", FALSE);
	mAnimBuffer = NULL;

	const LLInventoryItem* item = getItem();
	
	childSetCommitCallback("desc", LLPreview::onText, this);
	childSetText("desc", item->getDescription());
	childSetPrevalidate("desc", &LLLineEditor::prevalidatePrintableNotPipe);
	
	setTitle(title);

	if (!getHost())
	{
		LLRect curRect = getRect();
		translate(rect.mLeft - curRect.mLeft, rect.mTop - curRect.mTop);
	}

	mAnimBuffer = NULL;
	// preload the animation
	if(item)
	{
		gAgent.getAvatarObject()->createMotion(item->getAssetUUID());
			gAssetStorage->getAssetData(item->getAssetUUID(), LLAssetType::AT_ANIMATION, downloadCompleteCallback, (void *)(new LLHandle<LLFloater>(this->getHandle())), TRUE);
	}
	
	switch ( activate ) 
	{
		case 1:
		{
			playAnim( (void *) this );
			break;
		}
		case 2:
		{
			auditionAnim( (void *) this );
			break;
		}
		default:
		{
		//do nothing
		}
	}
}
开发者ID:impostor,项目名称:SingularityViewer,代码行数:60,代码来源:llpreviewanim.cpp

示例13: send_shape

void ImportTracker::send_shape(LLSD& prim)
{
	LLMessageSystem* msg = gMessageSystem;
	msg->newMessageFast(_PREHASH_ObjectShape);
	msg->nextBlockFast(_PREHASH_AgentData);
	msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
	msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
	
	msg->nextBlockFast(_PREHASH_ObjectData);
	msg->addU32Fast(_PREHASH_ObjectLocalID, prim["LocalID"].asInteger());
	
	LLVolumeParams params;
	params.fromLLSD(prim["volume"]);
	LLVolumeMessage::packVolumeParams(&params, msg);
	
	msg->sendReliable(gAgent.getRegion()->getHost());
}
开发者ID:IamusNavarathna,项目名称:SingularityViewer,代码行数:17,代码来源:importtracker.cpp

示例14: JCImportInventorycallback

void JCImportInventorycallback(const LLUUID& uuid, void* user_data, S32 result, LLExtStat ext_status) // StoreAssetData callback (fixed)
{
	if(result == LL_ERR_NOERR)
	{
		//cmdline_printchat("fired importinvcall for "+uuid.asString());
		InventoryImportInfo* data = (InventoryImportInfo*)user_data;

		LLPointer<LLInventoryCallback> cb = new JCImportTransferCallback(data);
		LLPermissions perm;
		LLUUID parent_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);

		create_inventory_item(gAgent.getID(), gAgent.getSessionID(),
			gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH), data->tid, data->name,
			data->description, data->type, LLInventoryType::defaultForAssetType(data->type), data->wear_type,
			LLFloaterPerms::getNextOwnerPerms(),
			cb);
	}else cmdline_printchat("err: "+std::string(LLAssetStorage::getErrorString(result)));
}
开发者ID:IamusNavarathna,项目名称:SingularityViewer,代码行数:18,代码来源:importtracker.cpp

示例15: onClose

// virtual
void LLPreviewAnim::onClose(bool app_quitting)
{
	const LLInventoryItem *item = getItem();

	if(item)
	{
		gAgent.getAvatarObject()->stopMotion(item->getAssetUUID());
		gAgent.sendAnimationRequest(item->getAssetUUID(), ANIM_REQUEST_STOP);
					
		LLVOAvatar* avatar = gAgent.getAvatarObject();
		LLMotion*   motion = avatar->findMotion(item->getAssetUUID());
		
		if (motion)
		{
			// *TODO: minor memory leak here, user data is never deleted (Use real callbacks)
			motion->setDeactivateCallback(NULL, (void *)NULL);
		}
	}
}
开发者ID:Xara,项目名称:Opensource-V2-SL-Viewer,代码行数:20,代码来源:llpreviewanim.cpp


注:本文中的LLAgent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。