aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llcharacter/llpose.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/llcharacter/llpose.cpp20
1 files changed, 8 insertions, 12 deletions
diff --git a/linden/indra/llcharacter/llpose.cpp b/linden/indra/llcharacter/llpose.cpp
index ccedc1e..a07cd58 100644
--- a/linden/indra/llcharacter/llpose.cpp
+++ b/linden/indra/llcharacter/llpose.cpp
@@ -275,9 +275,9 @@ void LLJointStateBlender::blendJointStates(BOOL apply_now)
275 joint_state_index < JSB_NUM_JOINT_STATES && mJointStates[joint_state_index] != NULL; 275 joint_state_index < JSB_NUM_JOINT_STATES && mJointStates[joint_state_index] != NULL;
276 joint_state_index++) 276 joint_state_index++)
277 { 277 {
278 U32 current_usage = mJointStates[joint_state_index]->getUsage();
279 F32 current_weight = mJointStates[joint_state_index]->getWeight();
280 LLJointState* jsp = mJointStates[joint_state_index]; 278 LLJointState* jsp = mJointStates[joint_state_index];
279 U32 current_usage = jsp->getUsage();
280 F32 current_weight = jsp->getWeight();
281 281
282 if (current_weight == 0.f) 282 if (current_weight == 0.f)
283 { 283 {
@@ -292,17 +292,14 @@ void LLJointStateBlender::blendJointStates(BOOL apply_now)
292 292
293 // add in pos for this jointstate modulated by weight 293 // add in pos for this jointstate modulated by weight
294 added_pos += jsp->getPosition() * (new_weight_sum - sum_weights[POS_WEIGHT]); 294 added_pos += jsp->getPosition() * (new_weight_sum - sum_weights[POS_WEIGHT]);
295 //sum_weights[POS_WEIGHT] = new_weight_sum;
296 } 295 }
297 296
298 // now do scale
299 if(current_usage & LLJointState::SCALE) 297 if(current_usage & LLJointState::SCALE)
300 { 298 {
301 F32 new_weight_sum = llmin(1.f, current_weight + sum_weights[SCALE_WEIGHT]); 299 F32 new_weight_sum = llmin(1.f, current_weight + sum_weights[SCALE_WEIGHT]);
302 300
303 // add in scale for this jointstate modulated by weight 301 // add in scale for this jointstate modulated by weight
304 added_scale += jsp->getScale() * (new_weight_sum - sum_weights[SCALE_WEIGHT]); 302 added_scale += jsp->getScale() * (new_weight_sum - sum_weights[SCALE_WEIGHT]);
305 //sum_weights[SCALE_WEIGHT] = new_weight_sum;
306 } 303 }
307 304
308 if (current_usage & LLJointState::ROT) 305 if (current_usage & LLJointState::ROT)
@@ -311,7 +308,6 @@ void LLJointStateBlender::blendJointStates(BOOL apply_now)
311 308
312 // add in rotation for this jointstate modulated by weight 309 // add in rotation for this jointstate modulated by weight
313 added_rot = nlerp((new_weight_sum - sum_weights[ROT_WEIGHT]), added_rot, jsp->getRotation()) * added_rot; 310 added_rot = nlerp((new_weight_sum - sum_weights[ROT_WEIGHT]), added_rot, jsp->getRotation()) * added_rot;
314 //sum_weights[ROT_WEIGHT] = new_weight_sum;
315 } 311 }
316 } 312 }
317 else 313 else
@@ -326,13 +322,13 @@ void LLJointStateBlender::blendJointStates(BOOL apply_now)
326 F32 new_weight_sum = llmin(1.f, current_weight + sum_weights[POS_WEIGHT]); 322 F32 new_weight_sum = llmin(1.f, current_weight + sum_weights[POS_WEIGHT]);
327 323
328 // blend positions from both 324 // blend positions from both
329 blended_pos = lerp(mJointStates[joint_state_index]->getPosition(), blended_pos, sum_weights[POS_WEIGHT] / new_weight_sum); 325 blended_pos = lerp(jsp->getPosition(), blended_pos, sum_weights[POS_WEIGHT] / new_weight_sum);
330 sum_weights[POS_WEIGHT] = new_weight_sum; 326 sum_weights[POS_WEIGHT] = new_weight_sum;
331 } 327 }
332 else 328 else
333 { 329 {
334 // copy position from current 330 // copy position from current
335 blended_pos = mJointStates[joint_state_index]->getPosition(); 331 blended_pos = jsp->getPosition();
336 sum_weights[POS_WEIGHT] = current_weight; 332 sum_weights[POS_WEIGHT] = current_weight;
337 } 333 }
338 } 334 }
@@ -345,13 +341,13 @@ void LLJointStateBlender::blendJointStates(BOOL apply_now)
345 F32 new_weight_sum = llmin(1.f, current_weight + sum_weights[SCALE_WEIGHT]); 341 F32 new_weight_sum = llmin(1.f, current_weight + sum_weights[SCALE_WEIGHT]);
346 342
347 // blend scales from both 343 // blend scales from both
348 blended_scale = lerp(mJointStates[joint_state_index]->getScale(), blended_scale, sum_weights[SCALE_WEIGHT] / new_weight_sum); 344 blended_scale = lerp(jsp->getScale(), blended_scale, sum_weights[SCALE_WEIGHT] / new_weight_sum);
349 sum_weights[SCALE_WEIGHT] = new_weight_sum; 345 sum_weights[SCALE_WEIGHT] = new_weight_sum;
350 } 346 }
351 else 347 else
352 { 348 {
353 // copy scale from current 349 // copy scale from current
354 blended_scale = mJointStates[joint_state_index]->getScale(); 350 blended_scale = jsp->getScale();
355 sum_weights[SCALE_WEIGHT] = current_weight; 351 sum_weights[SCALE_WEIGHT] = current_weight;
356 } 352 }
357 } 353 }
@@ -364,13 +360,13 @@ void LLJointStateBlender::blendJointStates(BOOL apply_now)
364 F32 new_weight_sum = llmin(1.f, current_weight + sum_weights[ROT_WEIGHT]); 360 F32 new_weight_sum = llmin(1.f, current_weight + sum_weights[ROT_WEIGHT]);
365 361
366 // blend rotations from both 362 // blend rotations from both
367 blended_rot = nlerp(sum_weights[ROT_WEIGHT] / new_weight_sum, mJointStates[joint_state_index]->getRotation(), blended_rot); 363 blended_rot = nlerp(sum_weights[ROT_WEIGHT] / new_weight_sum, jsp->getRotation(), blended_rot);
368 sum_weights[ROT_WEIGHT] = new_weight_sum; 364 sum_weights[ROT_WEIGHT] = new_weight_sum;
369 } 365 }
370 else 366 else
371 { 367 {
372 // copy rotation from current 368 // copy rotation from current
373 blended_rot = mJointStates[joint_state_index]->getRotation(); 369 blended_rot = jsp->getRotation();
374 sum_weights[ROT_WEIGHT] = current_weight; 370 sum_weights[ROT_WEIGHT] = current_weight;
375 } 371 }
376 } 372 }