Panda3D
|
00001 // Filename: colorBlendAttrib.I 00002 // Created by: drose (29Mar02) 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 00016 //////////////////////////////////////////////////////////////////// 00017 // Function: ColorBlendAttrib::Constructor 00018 // Access: Private 00019 // Description: Use ColorBlendAttrib::make() to construct a new 00020 // ColorBlendAttrib object. 00021 //////////////////////////////////////////////////////////////////// 00022 INLINE ColorBlendAttrib:: 00023 ColorBlendAttrib() : 00024 _mode(M_none), 00025 _a(O_one), 00026 _b(O_one), 00027 _color(LColor::zero()), 00028 _involves_constant_color(false), 00029 _involves_color_scale(false) 00030 { 00031 } 00032 00033 //////////////////////////////////////////////////////////////////// 00034 // Function: ColorBlendAttrib::Constructor 00035 // Access: Private 00036 // Description: Use ColorBlendAttrib::make() to construct a new 00037 // ColorBlendAttrib object. 00038 //////////////////////////////////////////////////////////////////// 00039 INLINE ColorBlendAttrib:: 00040 ColorBlendAttrib(ColorBlendAttrib::Mode mode, 00041 ColorBlendAttrib::Operand a, ColorBlendAttrib::Operand b, 00042 const LColor &color) : 00043 _mode(mode), 00044 _a(a), 00045 _b(b), 00046 _color(color), 00047 _involves_constant_color(involves_constant_color(a) || involves_constant_color(b)), 00048 _involves_color_scale(involves_color_scale(a) || involves_color_scale(b)) 00049 { 00050 } 00051 00052 //////////////////////////////////////////////////////////////////// 00053 // Function: ColorBlendAttrib::get_mode 00054 // Access: Published 00055 // Description: Returns the colorBlend mode. 00056 //////////////////////////////////////////////////////////////////// 00057 INLINE ColorBlendAttrib::Mode ColorBlendAttrib:: 00058 get_mode() const { 00059 return _mode; 00060 } 00061 00062 //////////////////////////////////////////////////////////////////// 00063 // Function: ColorBlendAttrib::get_operand_a 00064 // Access: Published 00065 // Description: Returns the multiplier for the first component. 00066 //////////////////////////////////////////////////////////////////// 00067 INLINE ColorBlendAttrib::Operand ColorBlendAttrib:: 00068 get_operand_a() const { 00069 return _a; 00070 } 00071 00072 //////////////////////////////////////////////////////////////////// 00073 // Function: ColorBlendAttrib::get_operand_b 00074 // Access: Published 00075 // Description: Returns the multiplier for the second component. 00076 //////////////////////////////////////////////////////////////////// 00077 INLINE ColorBlendAttrib::Operand ColorBlendAttrib:: 00078 get_operand_b() const { 00079 return _b; 00080 } 00081 00082 //////////////////////////////////////////////////////////////////// 00083 // Function: ColorBlendAttrib::get_color 00084 // Access: Published 00085 // Description: Returns the constant color associated with the attrib. 00086 //////////////////////////////////////////////////////////////////// 00087 INLINE LColor ColorBlendAttrib:: 00088 get_color() const { 00089 return _color; 00090 } 00091 00092 //////////////////////////////////////////////////////////////////// 00093 // Function: ColorBlendAttrib::involves_constant_color 00094 // Access: Published 00095 // Description: Returns true if the this attrib uses the 00096 // constant color, false otherwise. 00097 //////////////////////////////////////////////////////////////////// 00098 INLINE bool ColorBlendAttrib:: 00099 involves_constant_color() const { 00100 return _involves_constant_color; 00101 } 00102 00103 //////////////////////////////////////////////////////////////////// 00104 // Function: ColorBlendAttrib::involves_color_scale 00105 // Access: Published 00106 // Description: Returns true if the this attrib uses the 00107 // color scale attrib, false otherwise. 00108 //////////////////////////////////////////////////////////////////// 00109 INLINE bool ColorBlendAttrib:: 00110 involves_color_scale() const { 00111 return _involves_color_scale; 00112 } 00113 00114 //////////////////////////////////////////////////////////////////// 00115 // Function: ColorBlendAttrib::involves_constant_color 00116 // Access: Published, Static 00117 // Description: Returns true if the indicated operand uses the 00118 // constant color, false otherwise. 00119 //////////////////////////////////////////////////////////////////// 00120 INLINE bool ColorBlendAttrib:: 00121 involves_constant_color(ColorBlendAttrib::Operand operand) { 00122 switch (operand) { 00123 case O_constant_color: 00124 case O_one_minus_constant_color: 00125 case O_constant_alpha: 00126 case O_one_minus_constant_alpha: 00127 return true; 00128 00129 default: 00130 return false; 00131 } 00132 } 00133 00134 //////////////////////////////////////////////////////////////////// 00135 // Function: ColorBlendAttrib::involves_color_scale 00136 // Access: Published, Static 00137 // Description: Returns true if the indicated operand uses the 00138 // color scale attrib, false otherwise. 00139 //////////////////////////////////////////////////////////////////// 00140 INLINE bool ColorBlendAttrib:: 00141 involves_color_scale(ColorBlendAttrib::Operand operand) { 00142 switch (operand) { 00143 case O_color_scale: 00144 case O_one_minus_color_scale: 00145 case O_alpha_scale: 00146 case O_one_minus_alpha_scale: 00147 return true; 00148 00149 default: 00150 return false; 00151 } 00152 }