hey all;

am trying to create a camera class in c++ with opengl however am a bit confused with the formulas used for the rotation;

Code :
void Camera::GetViewDir( void )
    SF3dVector Step1, Step2;
    //Rotate around Y-axis:
    Step1.x = cos( (RotatedY + 90.0) * PIdiv180);
    Step1.z = -sin( (RotatedY + 90.0) * PIdiv180);
    //Rotate around X-axis:
    double cosX = cos (RotatedX * PIdiv180);
    Step2.x = Step1.x * cosX;
    Step2.z = Step1.z * cosX;
    Step2.y = sin(RotatedX * PIdiv180);
    //need to implement rotation around Z-axis
    ViewDir = Step2;

whole source code


already read about trigonometry and rotation matrix in opengl but still it doesnt make sense for me;