本文整理汇总了C++中LLVOAvatar::getVisualParam方法的典型用法代码示例。如果您正苦于以下问题:C++ LLVOAvatar::getVisualParam方法的具体用法?C++ LLVOAvatar::getVisualParam怎么用?C++ LLVOAvatar::getVisualParam使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLVOAvatar
的用法示例。
在下文中一共展示了LLVOAvatar::getVisualParam方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: spawn
// Creates new parameters for the given wearable and applies them to the avatar.
void LLGenePool::spawn( EWearableType type )
{
LLVOAvatar* avatar = gAgent.getAvatarObject();
if( !avatar )
{
return;
}
if( !mLoaded )
{
if( !load() )
{
return;
}
}
if( mArchetypes.count() < 1 )
{
return;
}
// Only consider archetypes that have the same sex as you have already.
LLVisualParam* male_param = avatar->getVisualParam( "male" );
if (!male_param)
{
llwarns << "The hard coded \'male\' parameter passed to avatar->getVisualParam() in LLGenePool::spawn() is no longer valid."
<< llendl;
return;
}
S32 male_param_id = male_param->getID();
F32 sex_weight = male_param->getWeight();
S32 i = 0;
S32 j = 0;
S32 k = 0;
const S32 MAX_CYCLES = 1000;
S32 cycles = 0;
F32 cur_sex_weight = 0.f;
do
{
i = rand() % mArchetypes.count();
cur_sex_weight = mArchetypes[i]->getParam(male_param_id, 0.f);
cycles++;
if (cur_sex_weight != sex_weight)
{
break;
}
} while((cycles < MAX_CYCLES));
if( cycles >= MAX_CYCLES )
{
return;
}
LLAppearance* arch1 = mArchetypes[i];
LLAppearance* arch2 = NULL;
LLAppearance* arch3 = NULL;
if( mArchetypes.count() > 1 )
{
cycles = 0;
do
{
j = rand() % mArchetypes.count();
cur_sex_weight = mArchetypes[j]->getParam(male_param_id, 0.f);
cycles++;
} while(
(cycles < MAX_CYCLES) &&
( (i == j) || (cur_sex_weight != sex_weight) )
);
if( cycles >= MAX_CYCLES )
{
return;
}
arch2 = mArchetypes[j];
}
if( mArchetypes.count() > 2 )
{
cycles = 0;
do
{
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;
//.........这里部分代码省略.........
示例2: setMorphFromMesh
//.........这里部分代码省略.........
}
}
mAvgDistortion.mul(1.f/(F32)nindices);
mAvgDistortion.normalize3();
//-------------------------------------------------------------------------
// compute the change in the morph
//-------------------------------------------------------------------------
// Because meshes are set by continually updating morph weights
// there is no easy way to reapply the morphs, so we just compute
// the change in this morph and apply that appropriately weighted.
for( morph_index = 0; morph_index < mNumIndices; morph_index++)
{
vert_index = mVertexIndices[morph_index];
delta_coords[vert_index].sub( mCoords[morph_index]);
delta_normals[vert_index].sub( mNormals[morph_index]);
delta_binormals[vert_index].sub(mBinormals[morph_index]);
delta_tex_coords[vert_index] -= mTexCoords[morph_index];
}
//-------------------------------------------------------------------------
// Update all avatars
//-------------------------------------------------------------------------
std::vector< LLCharacter* >::iterator avatar_it;
for(avatar_it = LLCharacter::sInstances.begin(); avatar_it != LLCharacter::sInstances.end(); ++avatar_it)
{
LLVOAvatar* avatarp = (LLVOAvatar*)*avatar_it;
LLPolyMorphTarget* param = (LLPolyMorphTarget*) avatarp->getVisualParam(mName.c_str());
if (!param)
{
continue;
}
F32 weight = param->getLastWeight();
if (weight == 0.0f)
{
continue;
}
LLPolyMesh* mesh = avatarp->getMesh(mMesh);
if (!mesh)
{
continue;
}
// If we have a vertex mask, just remove it. It will be recreated.
/*if (param->undoMask(TRUE))
{
continue;
}*/
LLVector4a *mesh_coords = mesh->getWritableCoords();
LLVector4a *mesh_normals = mesh->getWritableNormals();
LLVector4a *mesh_binormals = mesh->getWritableBinormals();
LLVector2 *mesh_tex_coords = mesh->getWritableTexCoords();
LLVector4a *mesh_scaled_normals = mesh->getScaledNormals();
LLVector4a *mesh_scaled_binormals = mesh->getScaledBinormals();
for( vert_index = 0; vert_index < nverts; vert_index++)
{
示例3: loadNodeArchetype
//-----------------------------------------------------------------------------
// loadNodeArchetype(): loads <archetype> node from XML tree
//-----------------------------------------------------------------------------
BOOL LLGenePool::loadNodeArchetype( LLXmlTreeNode* node )
{
llassert( node->hasName( "archetype" ) );
LLAppearance* archetype = new LLAppearance();
BOOL success = TRUE;
LLVOAvatar* avatar = gAgent.getAvatarObject();
if( !avatar )
{
delete archetype;
return FALSE;
}
LLXmlTreeNode* child;
for (child = node->getChildByName( "param" );
child;
child = node->getNextNamedChild())
{
F32 value;
static LLStdStringHandle value_string = LLXmlTree::addAttributeString("value");
if( !child->getFastAttributeF32( value_string, value ) )
{
llwarns << "avatar genepool file: <param> missing value attribute" << llendl;
success = FALSE;
break;
}
S32 id;
static LLStdStringHandle id_string = LLXmlTree::addAttributeString("id");
if( !child->getFastAttributeS32( id_string, id ) )
{
llwarns << "avatar genepool file: <param> missing id attribute" << llendl;
success = FALSE;
break;
}
LLVisualParam* param = avatar->getVisualParam( id );
if( param )
{
archetype->addParam( id, value );
}
else
{
llwarns << "avatar genepool file: ignoring invalid <param> with id: " << id << llendl;
}
}
for (child = node->getChildByName( "texture" );
child;
child = node->getNextNamedChild())
{
LLUUID uuid;
static LLStdStringHandle uuid_string = LLXmlTree::addAttributeString("uuid");
if( !child->getFastAttributeUUID( uuid_string, uuid ) )
{
llwarns << "avatar genepool file: <texture> missing uuid attribute" << llendl;
success = FALSE;
break;
}
S32 te;
static LLStdStringHandle te_string = LLXmlTree::addAttributeString("te");
if( !child->getFastAttributeS32( te_string, te ) )
{
llwarns << "avatar genepool file: <texture> missing te attribute" << llendl;
success = FALSE;
break;
}
archetype->addTexture( te, uuid );
}
if( success )
{
mArchetypes.put( archetype );
}
else
{
delete archetype;
}
return success;
}