本文整理汇总了C++中LLJoint类的典型用法代码示例。如果您正苦于以下问题:C++ LLJoint类的具体用法?C++ LLJoint怎么用?C++ LLJoint使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LLJoint类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void lljoint_object::test<1>()
{
LLJoint lljoint;
LLJoint* jnt = lljoint.getParent();
ensure("getParent() failed ", (NULL == jnt));
ensure("getRoot() failed ", (&lljoint == lljoint.getRoot()));
}
示例2: getSex
//-----------------------------------------------------------------------------
// apply()
//-----------------------------------------------------------------------------
void LLPolySkeletalDistortion::apply( ESex avatar_sex )
{
F32 effective_weight = ( getSex() & avatar_sex ) ? mCurWeight : getDefaultWeight();
LLJoint* joint;
joint_vec_map_t::iterator iter;
for (iter = mJointScales.begin();
iter != mJointScales.end();
iter++)
{
joint = iter->first;
LLVector3 newScale = joint->getScale();
LLVector3 scaleDelta = iter->second;
newScale = newScale + (effective_weight * scaleDelta) - (mLastWeight * scaleDelta);
joint->setScale(newScale);
}
for (iter = mJointOffsets.begin();
iter != mJointOffsets.end();
iter++)
{
joint = iter->first;
LLVector3 newPosition = joint->getPosition();
LLVector3 positionDelta = iter->second;
newPosition = newPosition + (effective_weight * positionDelta) - (mLastWeight * positionDelta);
joint->setPosition(newPosition);
}
if (mLastWeight != mCurWeight && !mIsAnimating)
{
mAvatar->setSkeletonSerialNum(mAvatar->getSkeletonSerialNum() + 1);
}
mLastWeight = mCurWeight;
}
示例3: main_axis
//-----------------------------------------------------------------------------
// clampRotation()
//-----------------------------------------------------------------------------
void LLJoint::clampRotation(LLQuaternion old_rot, LLQuaternion new_rot)
{
LLVector3 main_axis(1.f, 0.f, 0.f);
for (child_list_t::iterator iter = mChildren.begin();
iter != mChildren.end(); ++iter)
{
LLJoint* joint = *iter;
if (joint->isAnimatable())
{
main_axis = joint->getPosition();
main_axis.normVec();
// only care about first animatable child
break;
}
}
// 2003.03.26 - This code was just using up cpu cycles. AB
// LLVector3 old_axis = main_axis * old_rot;
// LLVector3 new_axis = main_axis * new_rot;
// for (S32 i = 0; i < mConstraintSilhouette.count() - 1; i++)
// {
// LLVector3 vert1 = mConstraintSilhouette[i];
// LLVector3 vert2 = mConstraintSilhouette[i + 1];
// figure out how to clamp rotation to line on 3-sphere
// }
}
示例4: toLocal
// Local space means "parameter space".
F32 LLPhysicsMotion::toLocal(const LLVector3 &world)
{
LLJoint *joint = mJointState->getJoint();
const LLQuaternion rotation_world = joint->getWorldRotation();
LLVector3 dir_world = mMotionDirectionVec * rotation_world;
dir_world.normalize();
return world * dir_world;
}
示例5: calculateVelocity_local
F32 LLPhysicsMotion::calculateVelocity_local()
{
const F32 world_to_model_scale = 100.0f;
LLJoint *joint = mJointState->getJoint();
const LLVector3 position_world = joint->getWorldPosition();
const LLVector3 last_position_world = mPosition_world;
const LLVector3 positionchange_world = (position_world-last_position_world) * world_to_model_scale;
const LLVector3 velocity_world = positionchange_world;
const F32 velocity_local = toLocal(velocity_world);
return velocity_local;
}
示例6: getParent
//-----------------------------------------------------------------------------
// updateWorldMatrixParent()
//-----------------------------------------------------------------------------
void LLJoint::updateWorldMatrixParent()
{
if (mDirtyFlags & MATRIX_DIRTY)
{
LLJoint *parent = getParent();
if (parent)
{
parent->updateWorldMatrixParent();
}
updateWorldMatrix();
}
}
示例7: llassert
BOOL LLPolySkeletalDistortion::setInfo(LLPolySkeletalDistortionInfo *info)
{
llassert(mInfo == NULL);
if (info->mID < 0)
return FALSE;
mInfo = info;
mID = info->mID;
setWeight(getDefaultWeight(), FALSE );
LLPolySkeletalDistortionInfo::bone_info_list_t::iterator iter;
for (iter = getInfo()->mBoneInfoList.begin(); iter != getInfo()->mBoneInfoList.end(); iter++)
{
LLPolySkeletalBoneInfo *bone_info = &(*iter);
LLJoint* joint = mAvatar->getJoint(bone_info->mBoneName);
if (!joint)
{
llwarns << "Joint " << bone_info->mBoneName << " not found." << llendl;
continue;
}
if (mJointScales.find(joint) != mJointScales.end())
{
llwarns << "Scale deformation already supplied for joint " << joint->getName() << "." << llendl;
}
// store it
mJointScales[joint] = bone_info->mScaleDeformation;
// apply to children that need to inherit it
for (LLJoint::child_list_t::iterator iter = joint->mChildren.begin();
iter != joint->mChildren.end(); ++iter)
{
LLViewerJoint* child_joint = (LLViewerJoint*)(*iter);
if (child_joint->inheritScale())
{
LLVector3 childDeformation = LLVector3(child_joint->getScale());
childDeformation.scaleVec(bone_info->mScaleDeformation);
mJointScales[child_joint] = childDeformation;
}
}
if (bone_info->mHasPositionDeformation)
{
if (mJointOffsets.find(joint) != mJointOffsets.end())
{
llwarns << "Offset deformation already supplied for joint " << joint->getName() << "." << llendl;
}
mJointOffsets[joint] = bone_info->mPositionDeformation;
}
}
return TRUE;
}
示例8: removeAllChildren
//--------------------------------------------------------------------
// removeAllChildren()
//--------------------------------------------------------------------
void LLJoint::removeAllChildren()
{
for (child_list_t::iterator iter = mChildren.begin();
iter != mChildren.end();)
{
child_list_t::iterator curiter = iter++;
LLJoint* joint = *curiter;
mChildren.erase(curiter);
joint->mXform.setParent(NULL);
joint->mParent = NULL;
joint->touch();
}
}
示例9: onDeactivate
//-----------------------------------------------------------------------------
// LLEyeMotion::onDeactivate()
//-----------------------------------------------------------------------------
void LLEyeMotion::onDeactivate()
{
LLJoint* joint = mLeftEyeState->getJoint();
if (joint)
{
joint->setRotation(LLQuaternion::DEFAULT);
}
joint = mRightEyeState->getJoint();
if (joint)
{
joint->setRotation(LLQuaternion::DEFAULT);
}
}
示例10: updateWorldMatrix
//-----------------------------------------------------------------------------
// updateWorldMatrixChildren()
//-----------------------------------------------------------------------------
void LLJoint::updateWorldMatrixChildren()
{
if (!this->mUpdateXform) return;
if (mDirtyFlags & MATRIX_DIRTY)
{
updateWorldMatrix();
}
for (child_list_t::iterator iter = mChildren.begin();
iter != mChildren.end(); ++iter)
{
LLJoint* joint = *iter;
joint->updateWorldMatrixChildren();
}
}
示例11: showJointPosOverrides
void showJointPosOverrides( const LLJoint& joint, const std::string& note, const std::string& av_info )
{
std::ostringstream os;
os << joint.m_posBeforeOverrides;
joint.m_attachmentOverrides.showJointPosOverrides(os);
LL_DEBUGS("Avatar") << av_info << " joint " << joint.getName() << " " << note << " " << os.str() << LL_ENDL;
}
示例12: getRootJoint
//-----------------------------------------------------------------------------
// getJoint()
//-----------------------------------------------------------------------------
LLJoint *LLCharacter::getJoint( const std::string &name )
{
LLJoint* joint = NULL;
LLJoint *root = getRootJoint();
if (root)
{
joint = root->findJoint(name);
}
if (!joint)
{
llwarns << "Failed to find joint." << llendl;
}
return joint;
}
示例13: main_axis
//-----------------------------------------------------------------------------
// clampRotation()
//-----------------------------------------------------------------------------
void LLJoint::clampRotation(LLQuaternion old_rot, LLQuaternion new_rot)
{
LLVector3 main_axis(1.f, 0.f, 0.f);
for (child_list_t::iterator iter = mChildren.begin();
iter != mChildren.end(); ++iter)
{
LLJoint* joint = *iter;
if (joint->isAnimatable())
{
main_axis = joint->getPosition();
main_axis.normVec();
// only care about first animatable child
break;
}
}
}
示例14:
//-----------------------------------------------------------------------------
// findJoint()
//-----------------------------------------------------------------------------
LLJoint *LLJoint::findJoint( const std::string &name )
{
if (name == getName())
return this;
for (child_list_t::iterator iter = mChildren.begin();
iter != mChildren.end(); ++iter)
{
LLJoint* joint = *iter;
LLJoint *found = joint->findJoint(name);
if (found)
{
return found;
}
}
return NULL;
}
示例15: touch
//-----------------------------------------------------------------------------
// touch()
// Sets all dirty flags for all children, recursively.
//-----------------------------------------------------------------------------
void LLJoint::touch(U32 flags)
{
if ((flags | mDirtyFlags) != mDirtyFlags)
{
sNumTouches++;
mDirtyFlags |= flags;
U32 child_flags = flags;
if (flags & ROTATION_DIRTY)
{
child_flags |= POSITION_DIRTY;
}
for (child_list_t::iterator iter = mChildren.begin();
iter != mChildren.end(); ++iter)
{
LLJoint* joint = *iter;
joint->touch(child_flags);
}
}
}