//rotate_vector function from .FX file #define M_PI 3.14158 float3 rotate_vector(float RX, float RY, float RZ, float3 v) { float heading = RY*M_PI/180; float bank = RX*M_PI/180; float attitude = RZ*M_PI/180; float3x3 m; float ch = cos(heading); float sh = sin(heading); float ca = cos(attitude); float sa = sin(attitude); float cb = cos(bank); float sb = sin(bank); m[0][0] = ch * ca; m[0][1] = sh*sb - ch*sa*cb; m[0][2] = ch*sa*sb + sh*cb; m[1][0] = sa; m[1][1] = ca*cb; m[1][2] = -ca*sb; m[2][0] = -sh*ca; m[2][1] = sh*sa*cb + ch*sb; m[2][2] = -sh*sa*sb + ch*cb; return mul(m,v); }