public static void SubFunc(ref CGfxParticlePose r, ref CGfxParticlePose lh, ref CGfxParticlePose rh) { //r = lh * (1-v) + rh * v; r.mPosition = lh.mPosition - rh.mPosition; r.mVelocity = lh.mVelocity - rh.mVelocity; //r.mAcceleration = lh.mAcceleration - rh.mAcceleration; r.mColor = UInt32_4.Lerp(ref lh.mColor, ref rh.mColor, 0.5f); r.mScale = lh.mScale - rh.mScale; r.mRotation = Quaternion.Lerp(lh.mRotation, rh.mRotation, 0.5f); r.mAngle = lh.mAngle - rh.mAngle; }
public static void Lerp(ref CGfxParticlePose r, ref CGfxParticlePose lh, ref CGfxParticlePose rh, float v) { //r = lh * (1-v) + rh * v; float fa = 1 - v; r.mPosition = lh.mPosition * fa + rh.mPosition * v; r.mVelocity = lh.mVelocity * fa + rh.mVelocity * v; //r.mAcceleration = lh.mAcceleration * fa + rh.mAcceleration * v; r.mColor = UInt32_4.Lerp(ref lh.mColor, ref rh.mColor, v); r.mScale = lh.mScale * fa + rh.mScale * v; r.mRotation = Quaternion.Lerp(lh.mRotation, rh.mRotation, v); r.mAngle = lh.mAngle * fa + rh.mAngle * v; }