I think I know what the good doctor is trying to achieve, I've come across similor loss of freedom before. You've solved gimbal lock by forcing all axis to be perpendicular to each other by rotating by an angle then correcting the other axis by applying the crossproduct then normalizing. But now you can no longer rotate one axis freely without it effecting all three? If this is correct then you have not taken maticulous care with exactly which axis you need to correct using the crossproduct.

If you need to rotate only the oriented x axis, it will effect the oriented yz plane. the x axis remains unaffected. so you rotate the y axis conventionally then correct the z axis using crossproduct, finally you normalize z to remove rounding errors. Here is my working code it allows free rotation in yaw, pitch, roll seperately but there is a cost in that you have now lost your euler representation and are working directly in vectors...

`// the rotation matrix...`

float xx = 1.0f, xy = 0.0f, xz = 0.0f;

float yx = 0.0f, yy = 1.0f, yz = 0.0f;

float zx = 0.0f, zy = 0.0f, zz = 1.0f;

// the rotation routine...

bool CameraTransform(float x, float y, float z)

{

float cx = cos(x), sx = sin(x);

float cy = cos(y), sy = sin(y);

float cz = cos(z), sz = sin(z);

float pn;

// rotate x (affects yz) transform y conventionally, normalize, correct z using crossproduct

yx = yx*cx + zx*sx;

yy = yy*cx + zy*sx;

yz = yz*cx + zz*sx;

pn = 1.0f / sqrt(yx*yx + yy*yy + yz*yz);

yx *= pn;

yy *= pn;

yz *= pn;

zx = xy*yz - xz*yy;

zy = xz*yx - xx*yz;

zz = xx*yy - xy*yx;

// rotate y (affects zx) transform z conventionally, normalize, correct x using crossproduct

zx = zx*cy + xx*sy;

zy = zy*cy + xy*sy;

zz = zz*cy + xz*sy;

pn = 1.0f / sqrt(zx*zx + zy*zy + zz*zz);

zx *= pn;

zy *= pn;

zz *= pn;

xx = yy*zz - yz*zy;

xy = yz*zx - yx*zz;

xz = yx*zy - yy*zx;

// rotate z (affects xy) transform x conventionally, normalize, correct y using crossproduct

xx = xx*cz + yx*sz;

xy = xy*cz + yy*sz;

xz = xz*cz + yz*sz;

pn = 1.0f / sqrt(xx*xx + xy*xy + xz*xz);

xx *= pn;

xy *= pn;

xz *= pn;

yx = zy*xz - zz*xy;

yy = zz*xx - zx*xz;

yz = zx*xy - zy*xx;

// to rotate a vertex using this matrix reduces to the following...

//newx = xx*posx + yx*posy + zx*posz;

//newy = xy*posx + yy*posy + zy*posz;

//newz = xz*posx + yz*posy + zz*posz;

return true;

}