26 using std::ostringstream;
30 (
"coordinate-system", CS_zup_right,
31 PRC_DESC(
"The default coordinate system to use throughout Panda for "
32 "rendering, user input, and matrix operations, unless specified "
37 get_default_coordinate_system() {
38 CoordinateSystem cs = default_cs;
39 return (cs == CS_default || cs == CS_invalid) ? CS_zup_right : cs;
44 parse_coordinate_system_string(
const string &str) {
45 if (cmp_nocase_uh(str,
"default") == 0) {
48 }
else if (cmp_nocase_uh(str,
"zup") == 0 ||
49 cmp_nocase_uh(str,
"zup-right") == 0 ||
50 cmp_nocase_uh(str,
"z-up") == 0 ||
51 cmp_nocase_uh(str,
"z-up-right") == 0) {
54 }
else if (cmp_nocase_uh(str,
"yup") == 0 ||
55 cmp_nocase_uh(str,
"yup-right") == 0 ||
56 cmp_nocase_uh(str,
"y-up") == 0 ||
57 cmp_nocase_uh(str,
"y-up-right") == 0) {
60 }
else if (cmp_nocase_uh(str,
"z-up-left") == 0 ||
61 cmp_nocase_uh(str,
"zup-left") == 0) {
64 }
else if (cmp_nocase_uh(str,
"y-up-left") == 0 ||
65 cmp_nocase_uh(str,
"yup-left") == 0) {
73 format_coordinate_system(CoordinateSystem cs) {
80 is_right_handed(CoordinateSystem cs) {
81 if (cs == CS_default) {
82 cs = get_default_coordinate_system();
95 <<
"Invalid coordinate system value: " << (int)cs <<
"\n";
96 nassertr(
false,
false);
102 operator << (ostream &out, CoordinateSystem cs) {
105 return out <<
"default";
108 return out <<
"zup_right";
111 return out <<
"yup_right";
114 return out <<
"zup_left";
117 return out <<
"yup_left";
120 return out <<
"invalid";
124 <<
"Invalid coordinate_system value: " << (int)cs <<
"\n";
125 nassertr(
false, out);
130 operator >> (istream &in, CoordinateSystem &cs) {
133 cs = parse_coordinate_system_string(word);
134 if (cs == CS_invalid) {
136 <<
"Invalid coordinate_system string: " << word <<
"\n";