static byte DoDisp( type_length val, hw_reg_set base_reg, name *op ) /**********************************************************************/ { name *base; if( op == NULL ) { return( Displacement( val, base_reg ) ); } else if( op->n.class == N_TEMP ) { base = DeAlias( op ); if( base->t.location == NO_LOCATION ) { _Zoiks( ZOIKS_034 ); } val += TmpLoc( base, op ); return( Displacement( val, base_reg ) ); } else if( op->n.class == N_MEMORY ) {
bool AttributeAttractRepelParticleAffector::affect(ParticleSystemRefPtr System, Int32 ParticleIndex, const Time& elps) { if(System != NULL) { Vec3f Displacement(System->getSecPosition(ParticleIndex) - System->getPosition(ParticleIndex) ); Real32 Distance(Displacement.squareLength()); if((Distance > getMinDistance()*getMinDistance()) && (Distance < getMaxDistance()*getMaxDistance())) { Distance = osgSqrt(Distance); Displacement.normalize(); Real32 t((getQuadratic() * (Distance*Distance) + getLinear() * Distance + getConstant())*elps); if(t > Distance) { t=Distance; } System->setPosition(System->getPosition(ParticleIndex) + (Displacement * t),ParticleIndex) ; } } return false; }
static byte DoDisp( name *op, hw_reg_set regs ) /*************************************************/ { name *base; int val; byte dmod; name *temp_base; val = op->i.constant; /* use integer value*/ base = op->i.base; if( !HasTrueBase( op ) ) { dmod = Displacement( val, regs ); } else if( base->n.class == N_TEMP ) { temp_base = DeAlias( base ); if( temp_base->t.location == NO_LOCATION ) { _Zoiks( ZOIKS_034 ); } val += NewBase( temp_base ) + base->v.offset - temp_base->v.offset; dmod = Displacement( val, regs ); } else {
Suspension::Displacement Suspension::Spring::doRaycast() { double length = Physics::PhysicsWorld::getInstance() ->raycastLength(suspensionPoint, suspensionPoint + axis); bool onGround = true; if(length > stretchLength) { // stretched too far length = stretchLength; onGround = false; } else if(length < minLength) { // compressed too much length = minLength; } double normalizedLength = length - restLength; return Displacement(normalizedLength, onGround); }