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


C++ LLVOAvatar::startAppearanceAnimation方法代码示例

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


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

示例1: writeToAvatar

// Updates the user's avatar's appearance
void LLWearable::writeToAvatar( BOOL set_by_user )
{
	LLVOAvatar* avatar = gAgent.getAvatarObject();
	llassert( avatar );
	if( !avatar )
	{
		return;
	}

	ESex old_sex = avatar->getSex();

	// Pull params
	for( LLVisualParam* param = avatar->getFirstVisualParam(); param; param = avatar->getNextVisualParam() )
	{
		if (((LLViewerVisualParam*)param)->getWearableType() == mType && param->isTweakable())
		{
			S32 param_id = param->getID();
			F32 weight = get_if_there(mVisualParamMap, param_id, param->getDefaultWeight());
			// only animate with user-originated changes
			if (set_by_user)
			{
				param->setAnimationTarget(weight, set_by_user);
			}
			else
			{
				avatar->setVisualParamWeight( param_id, weight, set_by_user );
			}
		}
	}

	// only interpolate with user-originated changes
	if (set_by_user)
	{
		avatar->startAppearanceAnimation(TRUE, TRUE);
	}

	// Pull texture entries
	for( S32 te = 0; te < TEX_NUM_INDICES; te++ )
	{
		if( LLVOAvatar::getTEWearableType((ETextureIndex) te ) == mType )
		{
			const LLUUID& image_id = get_if_there(mTEMap, te, LLVOAvatar::getDefaultTEImageID((ETextureIndex) te ) );
			LLViewerImage* image = gImageList.getImage( image_id );
			avatar->setLocTexTE( te, image, set_by_user );
		}
	}

	avatar->updateVisualParams();

	if( gFloaterCustomize )
	{
		LLViewerInventoryItem* item;
		item = (LLViewerInventoryItem*)gInventory.getItem(gAgent.getWearableItem(mType));
		U32 perm_mask = PERM_NONE;
		BOOL is_complete = FALSE;
		if(item)
		{
			perm_mask = item->getPermissions().getMaskOwner();
			is_complete = item->isComplete();
			if(!is_complete)
			{
				item->fetchFromServer();
			}
		}
		gFloaterCustomize->setWearable(mType, this, perm_mask, is_complete);
		LLFloaterCustomize::setCurrentWearableType( mType );
	}

	ESex new_sex = avatar->getSex();
	if( old_sex != new_sex )
	{
		avatar->updateSexDependentLayerSets( set_by_user );
	}	
	
	avatar->updateMeshTextures();

//	if( set_by_user )
//	{
//		gAgent.sendAgentSetAppearance();
//	}
}
开发者ID:Avian-IW,项目名称:InWorldz-Viewer,代码行数:82,代码来源:llwearable.cpp

示例2: spawn


//.........这里部分代码省略.........
    		k = rand() % mArchetypes.count();
			cur_sex_weight = mArchetypes[k]->getParam(male_param_id, 0.f);
			cycles++;
		} while( 
			(cycles < MAX_CYCLES) && 
			( (i == k) || (j == k) || (cur_sex_weight != sex_weight) )
		);

		if( cycles >= MAX_CYCLES )
		{
			return;
		}

    	arch3 = mArchetypes[k];
	}

	// Lame generation of barycentric coordinates
	F32 b1 = F32( rand() ) / RAND_MAX;
	F32 b2 = (F32( rand() ) / RAND_MAX) * (1.f - b1);
	F32 b3 = 1.f - b1 - b2;

//	ESex old_sex = avatar->getSex();

	// Pull params
	for( LLVisualParam* param = avatar->getFirstVisualParam(); param; param = avatar->getNextVisualParam() )
	{
		if( (((LLViewerVisualParam*)param)->getWearableType() == type) && (param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE) )
		{
			S32 param_id = param->getID();

			// don't try to blend male/female param...as fp innaccuracy will break the [0 | 1] semantics
			if (param_id != male_param_id)
			{

				F32 weight1 = arch1->getParam( param_id, param->getDefaultWeight() );
				F32 net_weight = weight1;
				
				if( arch2 && arch3 )
				{
    				F32 weight2 = arch2->getParam( param_id, param->getDefaultWeight() );
    				F32 weight3 = arch3->getParam( param_id, param->getDefaultWeight() );
					net_weight = b1 * weight1 + b2 * weight2 + b3 * weight3;
				}
			
				param->setAnimationTarget(net_weight, TRUE);
			}
		}
	}

	// Find the archetype with the greatest influence
	LLAppearance* dominant_arch = arch1;
	if( (b2 > b1) && (b2 > b3) )
	{
		dominant_arch = arch2;
	}
	else
	if( (b3 > b1) && (b3 > b2) )
	{
		dominant_arch = arch3;
	}


	// Pull Textures from the dominant archetype
	for( S32 te = 0; te < LLVOAvatar::TEX_NUM_ENTRIES; te++ )
	{
		if( LLVOAvatar::isTextureIndexBaked( te ) )
		{
			continue;
		}

		if( LLVOAvatar::getTEWearableType( te ) == type )
		{
			LLUUID image_id = dominant_arch->getTexture( te );
			if( image_id.isNull() )
			{
				image_id = LLVOAvatar::getDefaultTEImageID( te );
			}

			LLViewerImage* image = gImageList.getImage( image_id );
			if( image )
			{
				avatar->setLocTexTE( te, image, TRUE );
			}
		}
	}

//	avatar->setVisualParamWeight( "male", sex_weight );

	avatar->startAppearanceAnimation(TRUE, TRUE);
	avatar->updateVisualParams();

// 	ESex new_sex = avatar->getSex();
//	if( old_sex != new_sex )
//	{
//		avatar->updateSexDependentLayerSets( TRUE );
//	}	
	
	avatar->updateMeshTextures();
    gAgent.sendAgentSetAppearance();
}
开发者ID:Boy,项目名称:rainbow,代码行数:101,代码来源:llgenepool.cpp


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