00001 // Filename: eggAttributes.I 00002 // Created by: drose (16Jan99) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #include <notify.h> 00020 00021 00022 //////////////////////////////////////////////////////////////////// 00023 // Function: EggAttributes::has_normal 00024 // Access: Public 00025 // Description: 00026 //////////////////////////////////////////////////////////////////// 00027 INLINE bool EggAttributes:: 00028 has_normal() const { 00029 return (_flags & F_has_normal) != 0; 00030 } 00031 00032 //////////////////////////////////////////////////////////////////// 00033 // Function: EggAttributes::get_normal 00034 // Access: Public 00035 // Description: 00036 //////////////////////////////////////////////////////////////////// 00037 INLINE const Normald &EggAttributes:: 00038 get_normal() const { 00039 nassertr(has_normal(), _normal); 00040 return _normal; 00041 } 00042 00043 //////////////////////////////////////////////////////////////////// 00044 // Function: EggAttributes::set_normal 00045 // Access: Public 00046 // Description: 00047 //////////////////////////////////////////////////////////////////// 00048 INLINE void EggAttributes:: 00049 set_normal(const Normald &normal) { 00050 _normal = normal; 00051 _flags |= F_has_normal; 00052 } 00053 00054 //////////////////////////////////////////////////////////////////// 00055 // Function: EggAttributes::clear_normal 00056 // Access: Public 00057 // Description: 00058 //////////////////////////////////////////////////////////////////// 00059 INLINE void EggAttributes:: 00060 clear_normal() { 00061 _flags &= ~F_has_normal; 00062 } 00063 00064 //////////////////////////////////////////////////////////////////// 00065 // Function: EggAttributes::has_uv 00066 // Access: Public 00067 // Description: 00068 //////////////////////////////////////////////////////////////////// 00069 INLINE bool EggAttributes:: 00070 has_uv() const { 00071 return (_flags & F_has_uv) != 0; 00072 } 00073 00074 //////////////////////////////////////////////////////////////////// 00075 // Function: EggAttributes::get_uv 00076 // Access: Public 00077 // Description: 00078 //////////////////////////////////////////////////////////////////// 00079 INLINE const TexCoordd &EggAttributes:: 00080 get_uv() const { 00081 nassertr(has_uv(), _uv); 00082 return _uv; 00083 } 00084 00085 //////////////////////////////////////////////////////////////////// 00086 // Function: EggAttributes::set_uv 00087 // Access: Public 00088 // Description: 00089 //////////////////////////////////////////////////////////////////// 00090 INLINE void EggAttributes:: 00091 set_uv(const TexCoordd &uv) { 00092 _uv = uv; 00093 _flags |= F_has_uv; 00094 } 00095 00096 //////////////////////////////////////////////////////////////////// 00097 // Function: EggAttributes::clear_uv 00098 // Access: Public 00099 // Description: 00100 //////////////////////////////////////////////////////////////////// 00101 INLINE void EggAttributes:: 00102 clear_uv() { 00103 _flags &= ~F_has_uv; 00104 } 00105 00106 //////////////////////////////////////////////////////////////////// 00107 // Function: EggAttributes::has_color 00108 // Access: Public 00109 // Description: 00110 //////////////////////////////////////////////////////////////////// 00111 INLINE bool EggAttributes:: 00112 has_color() const { 00113 return (_flags & F_has_color) != 0; 00114 } 00115 00116 //////////////////////////////////////////////////////////////////// 00117 // Function: EggAttributes::get_color 00118 // Access: Public 00119 // Description: Returns the color set on this particular attribute. 00120 // If there is no color set, returns white. 00121 //////////////////////////////////////////////////////////////////// 00122 INLINE Colorf EggAttributes:: 00123 get_color() const { 00124 if (has_color()) { 00125 return _color; 00126 } else { 00127 return Colorf(1.0, 1.0, 1.0, 1.0); 00128 } 00129 } 00130 00131 //////////////////////////////////////////////////////////////////// 00132 // Function: EggAttributes:: 00133 // Access: Public 00134 // Description: 00135 //////////////////////////////////////////////////////////////////// 00136 INLINE void EggAttributes:: 00137 set_color(const Colorf &color) { 00138 _color = color; 00139 _flags |= F_has_color; 00140 } 00141 00142 //////////////////////////////////////////////////////////////////// 00143 // Function: EggAttributes:: 00144 // Access: Public 00145 // Description: 00146 //////////////////////////////////////////////////////////////////// 00147 INLINE void EggAttributes:: 00148 clear_color() { 00149 _flags &= ~F_has_color; 00150 }