Panda3D
|
00001 // Filename: eggCurve.cxx 00002 // Created by: drose (15Feb00) 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 "eggCurve.h" 00016 00017 #include "string_utils.h" 00018 #include "pnotify.h" 00019 00020 TypeHandle EggCurve::_type_handle; 00021 00022 00023 //////////////////////////////////////////////////////////////////// 00024 // Function: EggCurve::string_curve_type 00025 // Access: Public, Static 00026 // Description: Returns the CurveType value associated with the given 00027 // string representation, or CT_invalid if the string 00028 // does not match any known CurveType value. 00029 //////////////////////////////////////////////////////////////////// 00030 EggCurve::CurveType EggCurve:: 00031 string_curve_type(const string &string) { 00032 if (cmp_nocase_uh(string, "xyz") == 0) { 00033 return CT_xyz; 00034 } else if (cmp_nocase_uh(string, "hpr") == 0) { 00035 return CT_hpr; 00036 } else if (cmp_nocase_uh(string, "t") == 0) { 00037 return CT_t; 00038 } else { 00039 return CT_none; 00040 } 00041 } 00042 00043 //////////////////////////////////////////////////////////////////// 00044 // Function: CurveType output operator 00045 // Description: 00046 //////////////////////////////////////////////////////////////////// 00047 ostream &operator << (ostream &out, EggCurve::CurveType t) { 00048 switch (t) { 00049 case EggCurve::CT_none: 00050 return out << "none"; 00051 case EggCurve::CT_xyz: 00052 return out << "XYZ"; 00053 case EggCurve::CT_hpr: 00054 return out << "HPR"; 00055 case EggCurve::CT_t: 00056 return out << "T"; 00057 } 00058 00059 nassertr(false, out); 00060 return out << "(**invalid**)"; 00061 } 00062