本文整理汇总了C++中LLPointer::getJoint方法的典型用法代码示例。如果您正苦于以下问题:C++ LLPointer::getJoint方法的具体用法?C++ LLPointer::getJoint怎么用?C++ LLPointer::getJoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLPointer
的用法示例。
在下文中一共展示了LLPointer::getJoint方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addJointState
//-----------------------------------------------------------------------------
// addJointState()
//-----------------------------------------------------------------------------
BOOL LLPose::addJointState(const LLPointer<LLJointState>& jointState)
{
if (mJointMap.find(jointState->getJoint()->getName()) == mJointMap.end())
{
mJointMap[jointState->getJoint()->getName()] = jointState;
}
return TRUE;
}
示例2: addJointState
//-----------------------------------------------------------------------------
// addJointState()
//-----------------------------------------------------------------------------
BOOL LLPose::addJointState(const LLPointer<LLJointState>& jointState)
{
llassert_always(jointState.notNull());
if (mJointMap.find(jointState->getJoint()->getName()) == mJointMap.end())
{
mJointMap[jointState->getJoint()->getName()] = jointState;
}
return TRUE;
}
示例3: addJointState
//-----------------------------------------------------------------------------
// addJointState()
//-----------------------------------------------------------------------------
void LLMotion::addJointState(const LLPointer<LLJointState>& jointState)
{
mPose.addJointState(jointState);
S32 priority = jointState->getPriority();
if (priority == LLJoint::USE_MOTION_PRIORITY)
{
priority = getPriority();
}
U32 usage = jointState->getUsage();
// for now, usage is everything
mJointSignature[0][jointState->getJoint()->getJointNum()] = (usage & LLJointState::POS) ? (0xff >> (7 - priority)) : 0;
mJointSignature[1][jointState->getJoint()->getJointNum()] = (usage & LLJointState::ROT) ? (0xff >> (7 - priority)) : 0;
mJointSignature[2][jointState->getJoint()->getJointNum()] = (usage & LLJointState::SCALE) ? (0xff >> (7 - priority)) : 0;
}
示例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: onUpdate
// Return TRUE if character has to update visual params.
BOOL LLPhysicsMotion::onUpdate(F32 time)
{
// static FILE *mFileWrite = fopen("c:\\temp\\avatar_data.txt","w");
if (!mParamDriver)
return FALSE;
if (!mLastTime)
{
mLastTime = time;
return FALSE;
}
////////////////////////////////////////////////////////////////////////////////
// Get all parameters and settings
//
const F32 time_delta = time - mLastTime;
// Don't update too frequently, to avoid precision errors from small time slices.
if (time_delta <= .01)
{
return FALSE;
}
// If less than 1FPS, we don't want to be spending time updating physics at all.
if (time_delta > 1.0)
{
mLastTime = time;
return FALSE;
}
// Higher LOD is better. This controls the granularity
// and frequency of updates for the motions.
const F32 lod_factor = LLVOAvatar::sPhysicsLODFactor;
if (lod_factor == 0)
{
return TRUE;
}
LLJoint *joint = mJointState->getJoint();
const F32 behavior_mass = getParamValue("Mass");
const F32 behavior_gravity = getParamValue("Gravity");
const F32 behavior_spring = getParamValue("Spring");
const F32 behavior_gain = getParamValue("Gain");
const F32 behavior_damping = getParamValue("Damping");
const F32 behavior_drag = getParamValue("Drag");
const BOOL physics_test = FALSE; // Enable this to simulate bouncing on all parts.
F32 behavior_maxeffect = getParamValue("MaxEffect");
if (physics_test)
behavior_maxeffect = 1.0f;
// Normalize the param position to be from [0,1].
// We have to use normalized values because there may be more than one driven param,
// and each of these driven params may have its own range.
// This means we'll do all our calculations in normalized [0,1] local coordinates.
const F32 position_user_local = (mParamDriver->getWeight() - mParamDriver->getMinWeight()) / (mParamDriver->getMaxWeight() - mParamDriver->getMinWeight());
//
// End parameters and settings
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// Calculate velocity and acceleration in parameter space.
//
//const F32 velocity_joint_local = calculateVelocity_local(time_iteration_step);
const F32 velocity_joint_local = calculateVelocity_local();
const F32 acceleration_joint_local = calculateAcceleration_local(velocity_joint_local);
//
// End velocity and acceleration
////////////////////////////////////////////////////////////////////////////////
BOOL update_visuals = FALSE;
// Break up the physics into a bunch of iterations so that differing framerates will show
// roughly the same behavior.
for (F32 time_iteration = 0; time_iteration <= time_delta; time_iteration += TIME_ITERATION_STEP)
{
F32 time_iteration_step = TIME_ITERATION_STEP;
if (time_iteration + TIME_ITERATION_STEP > time_delta)
{
time_iteration_step = time_delta-time_iteration;
}
// mPositon_local should be in normalized 0,1 range already. Just making sure...
const F32 position_current_local = llclamp(mPosition_local,
0.0f,
1.0f);
// If the effect is turned off then don't process unless we need one more update
// to set the position to the default (i.e. user) position.
if ((behavior_maxeffect == 0) && (position_current_local == position_user_local))
{
return update_visuals;
}
//.........这里部分代码省略.........
示例7: removeJointState
//-----------------------------------------------------------------------------
// removeJointState()
//-----------------------------------------------------------------------------
BOOL LLPose::removeJointState(const LLPointer<LLJointState>& jointState)
{
mJointMap.erase(jointState->getJoint()->getName());
return TRUE;
}