Panda3D
physxEnums.cxx
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file physxEnums.cxx
10  * @author enn0x
11  * @date 2009-09-23
12  */
13 
14 #include "physxEnums.h"
15 
16 #include "string_utils.h"
17 #include "config_putil.h"
18 
19 std::ostream &
20 operator << (std::ostream &out, PhysxEnums::PhysxUpAxis axis) {
21 
22  switch (axis) {
23  case PhysxEnums::X_up:
24  return out << "x";
25 
26  case PhysxEnums::Y_up:
27  return out << "y";
28 
29  case PhysxEnums::Z_up:
30  return out << "z";
31  }
32 
33  return out << "**invalid PhysxEnums::PhysxUpAxis value: (" << (int)axis << ")**";
34 }
35 
36 std::istream &
37 operator >> (std::istream &in, PhysxEnums::PhysxUpAxis &axis) {
38 
39  std::string word;
40  in >> word;
41 
42  if (cmp_nocase(word, "x") == 0) {
43  axis = PhysxEnums::X_up;
44  }
45  else if (cmp_nocase(word, "y") == 0) {
46  axis = PhysxEnums::Y_up;
47  }
48  else if (cmp_nocase(word, "z") == 0) {
49  axis = PhysxEnums::Z_up;
50  }
51  else {
52  physx_cat->error()
53  << "Invalid up-axis string: " << word << "\n";
54  axis = PhysxEnums::Z_up;
55  }
56 
57  return in;
58 }
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.