15 #include "coordinateSystem.h" 16 #include "config_linmath.h" 17 #include "configVariableEnum.h" 18 #include "string_utils.h" 26 (
"coordinate-system", CS_zup_right,
27 PRC_DESC(
"The default coordinate system to use throughout Panda for " 28 "rendering, user input, and matrix operations, unless specified " 33 get_default_coordinate_system() {
34 CoordinateSystem cs = default_cs;
35 return (cs == CS_default || cs == CS_invalid) ? CS_zup_right : cs;
40 parse_coordinate_system_string(
const string &str) {
41 if (cmp_nocase_uh(str,
"default") == 0) {
44 }
else if (cmp_nocase_uh(str,
"zup") == 0 ||
45 cmp_nocase_uh(str,
"zup-right") == 0 ||
46 cmp_nocase_uh(str,
"z-up") == 0 ||
47 cmp_nocase_uh(str,
"z-up-right") == 0) {
50 }
else if (cmp_nocase_uh(str,
"yup") == 0 ||
51 cmp_nocase_uh(str,
"yup-right") == 0 ||
52 cmp_nocase_uh(str,
"y-up") == 0 ||
53 cmp_nocase_uh(str,
"y-up-right") == 0) {
56 }
else if (cmp_nocase_uh(str,
"z-up-left") == 0 ||
57 cmp_nocase_uh(str,
"zup-left") == 0) {
60 }
else if (cmp_nocase_uh(str,
"y-up-left") == 0 ||
61 cmp_nocase_uh(str,
"yup-left") == 0) {
69 format_coordinate_system(CoordinateSystem cs) {
76 is_right_handed(CoordinateSystem cs) {
77 if (cs == CS_default) {
78 cs = get_default_coordinate_system();
91 <<
"Invalid coordinate system value: " << (int)cs <<
"\n";
92 nassertr(
false,
false);
98 operator << (ostream &out, CoordinateSystem cs) {
101 return out <<
"default";
104 return out <<
"zup_right";
107 return out <<
"yup_right";
110 return out <<
"zup_left";
113 return out <<
"yup_left";
116 return out <<
"invalid";
120 <<
"Invalid coordinate_system value: " << (int)cs <<
"\n";
121 nassertr(
false, out);
126 operator >> (istream &in, CoordinateSystem &cs) {
129 cs = parse_coordinate_system_string(word);
130 if (cs == CS_invalid) {
132 <<
"Invalid coordinate_system string: " << word <<
"\n";
This class specializes ConfigVariable as an enumerated type.