aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llprimitive/llvolumemessage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/llprimitive/llvolumemessage.cpp')
-rw-r--r--linden/indra/llprimitive/llvolumemessage.cpp51
1 files changed, 23 insertions, 28 deletions
diff --git a/linden/indra/llprimitive/llvolumemessage.cpp b/linden/indra/llprimitive/llvolumemessage.cpp
index cecd2c2..b00bbc5 100644
--- a/linden/indra/llprimitive/llvolumemessage.cpp
+++ b/linden/indra/llprimitive/llvolumemessage.cpp
@@ -448,41 +448,36 @@ bool LLVolumeMessage::unpackPathParams(LLPathParams* params, LLDataPacker &dp)
448// static 448// static
449bool LLVolumeMessage::constrainVolumeParams(LLVolumeParams& params) 449bool LLVolumeMessage::constrainVolumeParams(LLVolumeParams& params)
450{ 450{
451 bool ok = true; 451 U32 bad = 0;
452 452
453 // This is called immediately after an unpack. feed the raw data 453 // This is called immediately after an unpack. feed the raw data
454 // through the checked setters to constraint it to a valid set of 454 // through the checked setters to constraint it to a valid set of
455 // volume params. 455 // volume params.
456 ok &= params.setType( 456 bad |= params.setType(params.getProfileParams().getCurveType(),
457 params.getProfileParams().getCurveType(), 457 params.getPathParams().getCurveType()) ? 0 : 1;
458 params.getPathParams().getCurveType()); 458 bad |= params.setBeginAndEndS(params.getProfileParams().getBegin(),
459 ok &= params.setBeginAndEndS( 459 params.getProfileParams().getEnd()) ? 0 : 2;
460 params.getProfileParams().getBegin(), 460 bad |= params.setBeginAndEndT(params.getPathParams().getBegin(),
461 params.getProfileParams().getEnd()); 461 params.getPathParams().getEnd()) ? 0 : 4;
462 ok &= params.setBeginAndEndT( 462 bad |= params.setHollow(params.getProfileParams().getHollow()) ? 0 : 8;
463 params.getPathParams().getBegin(), 463 bad |= params.setTwistBegin(params.getPathParams().getTwistBegin()) ? 0 : 0x10;
464 params.getPathParams().getEnd()); 464 bad |= params.setTwistEnd(params.getPathParams().getTwistEnd()) ? 0 : 0x20;
465 ok &= params.setHollow(params.getProfileParams().getHollow()); 465 bad |= params.setRatio(params.getPathParams().getScaleX(),
466 ok &= params.setTwistBegin(params.getPathParams().getTwistBegin()); 466 params.getPathParams().getScaleY()) ? 0 : 0x40;
467 ok &= params.setTwistEnd(params.getPathParams().getTwistEnd()); 467 bad |= params.setShear(params.getPathParams().getShearX(),
468 ok &= params.setRatio( 468 params.getPathParams().getShearY()) ? 0 : 0x80;
469 params.getPathParams().getScaleX(), 469 bad |= params.setTaper(params.getPathParams().getTaperX(),
470 params.getPathParams().getScaleY()); 470 params.getPathParams().getTaperY()) ? 0 : 0x100;
471 ok &= params.setShear( 471 bad |= params.setRevolutions(params.getPathParams().getRevolutions()) ? 0 : 0x200;
472 params.getPathParams().getShearX(), 472 bad |= params.setRadiusOffset(params.getPathParams().getRadiusOffset()) ? 0 : 0x400;
473 params.getPathParams().getShearY()); 473 bad |= params.setSkew(params.getPathParams().getSkew()) ? 0 : 0x800;
474 ok &= params.setTaper( 474 if(bad)
475 params.getPathParams().getTaperX(),
476 params.getPathParams().getTaperY());
477 ok &= params.setRevolutions(params.getPathParams().getRevolutions());
478 ok &= params.setRadiusOffset(params.getPathParams().getRadiusOffset());
479 ok &= params.setSkew(params.getPathParams().getSkew());
480 if(!ok)
481 { 475 {
482 llwarns << "LLVolumeMessage::constrainVolumeParams() - " 476 llwarns << "LLVolumeMessage::constrainVolumeParams() - "
483 << "forced to constrain incoming volume params." << llendl; 477 << "forced to constrain incoming volume params: "
478 << llformat("0x%04x",bad) << llendl;
484 } 479 }
485 return ok; 480 return bad ? false : true;
486} 481}
487 482
488bool LLVolumeMessage::packVolumeParams(const LLVolumeParams* params, LLMessageSystem *mesgsys) 483bool LLVolumeMessage::packVolumeParams(const LLVolumeParams* params, LLMessageSystem *mesgsys)