Panda3D
|
00001 // Filename: physxEnums.cxx 00002 // Created by: enn0x (23Sep09) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #include "physxEnums.h" 00016 00017 #include "string_utils.h" 00018 #include "config_util.h" 00019 00020 ostream & 00021 operator << (ostream &out, PhysxEnums::PhysxUpAxis axis) { 00022 00023 switch (axis) { 00024 case PhysxEnums::X_up: 00025 return out << "x"; 00026 00027 case PhysxEnums::Y_up: 00028 return out << "y"; 00029 00030 case PhysxEnums::Z_up: 00031 return out << "z"; 00032 } 00033 00034 return out << "**invalid PhysxEnums::PhysxUpAxis value: (" << (int)axis << ")**"; 00035 } 00036 00037 istream & 00038 operator >> (istream &in, PhysxEnums::PhysxUpAxis &axis) { 00039 00040 string word; 00041 in >> word; 00042 00043 if (cmp_nocase(word, "x") == 0) { 00044 axis = PhysxEnums::X_up; 00045 } 00046 else if (cmp_nocase(word, "y") == 0) { 00047 axis = PhysxEnums::Y_up; 00048 } 00049 else if (cmp_nocase(word, "z") == 0) { 00050 axis = PhysxEnums::Z_up; 00051 } 00052 else { 00053 physx_cat->error() 00054 << "Invalid up-axis string: " << word << "\n"; 00055 axis = PhysxEnums::Z_up; 00056 } 00057 00058 return in; 00059 } 00060