Panda3D

textureStage.cxx

00001 // Filename: textureStage.cxx
00002 // Created by:  MAsaduzz (16Jul04)
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 "textureStage.h"
00016 #include "internalName.h"
00017 #include "bamReader.h"
00018 #include "bamWriter.h"
00019 
00020 PT(TextureStage) TextureStage::_default_stage;
00021 UpdateSeq TextureStage::_sort_seq;
00022 
00023 TypeHandle TextureStage::_type_handle;
00024 
00025 ////////////////////////////////////////////////////////////////////
00026 //     Function: TextureStage::Constructor
00027 //       Access: Published
00028 //  Description: Initialize the texture stage at construction
00029 ////////////////////////////////////////////////////////////////////
00030 TextureStage::
00031 TextureStage(const string &name) {
00032   _name = name;
00033   _sort = 0;
00034   _priority = 0;
00035   _texcoord_name = InternalName::get_texcoord();
00036   _mode = M_modulate;
00037   _color.set(0.0f, 0.0f, 0.0f, 1.0f);
00038   _rgb_scale = 1;
00039   _alpha_scale = 1;
00040   _saved_result = false;
00041   _combine_rgb_mode = CM_undefined;
00042   _num_combine_rgb_operands = 0;
00043   _combine_rgb_source0 = CS_undefined;
00044   _combine_rgb_operand0 = CO_undefined;
00045   _combine_rgb_source1 = CS_undefined;
00046   _combine_rgb_operand1 = CO_undefined;
00047   _combine_rgb_source2 = CS_undefined;
00048   _combine_rgb_operand2 = CO_undefined;
00049   _combine_alpha_mode = CM_undefined;
00050   _num_combine_alpha_operands = 0;
00051   _combine_alpha_source0 = CS_undefined;
00052   _combine_alpha_operand0 = CO_undefined;
00053   _combine_alpha_source1 = CS_undefined;
00054   _combine_alpha_operand1 = CO_undefined;
00055   _combine_alpha_source2 = CS_undefined;
00056   _combine_alpha_operand2 = CO_undefined;
00057 
00058   _uses_color = false;
00059   _involves_color_scale = false;
00060 }
00061 
00062 ////////////////////////////////////////////////////////////////////
00063 //     Function: TextureStage::operator =
00064 //       Access: Published
00065 //  Description: just copy the members of other to this
00066 ////////////////////////////////////////////////////////////////////
00067 void TextureStage::
00068 operator = (const TextureStage &other) {
00069   _name = other._name;
00070   _sort = other._sort;
00071   _priority = other._priority;
00072   _texcoord_name = other._texcoord_name;
00073   _mode = other._mode;
00074   _color = other._color;
00075   _rgb_scale = other._rgb_scale;
00076   _alpha_scale = other._alpha_scale;
00077   _saved_result = other._saved_result;
00078 
00079   _combine_rgb_mode = other._combine_rgb_mode;
00080   _combine_rgb_source0 = other._combine_rgb_source0;
00081   _combine_rgb_operand0 = other._combine_rgb_operand0;
00082   _combine_rgb_source1 = other._combine_rgb_source1;
00083   _combine_rgb_operand1 = other._combine_rgb_operand1;
00084   _combine_rgb_source2 = other._combine_rgb_source2;
00085   _combine_rgb_operand2 = other._combine_rgb_operand2;
00086   _combine_alpha_mode = other._combine_alpha_mode;
00087   _combine_alpha_source0 = other._combine_alpha_source0;
00088   _combine_alpha_operand0 = _combine_alpha_operand0;
00089   _combine_alpha_source1 = other._combine_alpha_source1;
00090   _combine_alpha_operand1 = other._combine_alpha_operand1;
00091   _combine_alpha_source2 = other._combine_alpha_source2;
00092   _combine_alpha_operand2 = other._combine_alpha_operand2;
00093 
00094   _uses_color = other._uses_color;
00095   _involves_color_scale = other._involves_color_scale;
00096 }
00097 
00098 ////////////////////////////////////////////////////////////////////
00099 //     Function: TextureStage::Destructor
00100 //       Access: Published, Virtual
00101 //  Description:
00102 ////////////////////////////////////////////////////////////////////
00103 TextureStage::
00104 ~TextureStage() {
00105 }
00106 
00107 ////////////////////////////////////////////////////////////////////
00108 //     Function: TextureStage::compare_to
00109 //       Access: Published
00110 //  Description: Returns a number less than zero if this TextureStage
00111 //               sorts before the other one, greater than zero if it
00112 //               sorts after, or zero if they are equivalent.  The
00113 //               sorting order is arbitrary and largely meaningless,
00114 //               except to differentiate different stages.
00115 ////////////////////////////////////////////////////////////////////
00116 int TextureStage::
00117 compare_to(const TextureStage &other) const {
00118   // We put the sort parameter first, so that we sorting a list of
00119   // TextureStages will happen to put them in sorted order, even
00120   // though we don't promise to do that.  But there's no reason not to
00121   // do so, and it might be more convenient for the developer.
00122   if (get_sort() != other.get_sort()) {
00123     return get_sort() < other.get_sort() ? -1 : 1;
00124   }
00125 
00126   // The remaining parameters are arbitrary.  We start with the name,
00127   // because that's most likely to be consistent between similar
00128   // TextureStages, and different between different TextureStages.
00129   int compare = strcmp(get_name().c_str(), other.get_name().c_str());
00130   if (compare != 0) {
00131     return compare;
00132   }
00133 
00134   if (get_priority() != other.get_priority()) {
00135     return get_priority() < other.get_priority() ? -1 : 1;
00136   }
00137   if (get_texcoord_name() != other.get_texcoord_name()) {
00138     return get_texcoord_name() < other.get_texcoord_name() ? -1 : 1;
00139   }
00140   if (get_mode() != other.get_mode()) {
00141     return get_mode() < other.get_mode() ? -1 : 1;
00142   }
00143   if (get_rgb_scale() != other.get_rgb_scale()) {
00144     return get_rgb_scale() < other.get_rgb_scale() ? -1 : 1;
00145   }
00146   if (get_alpha_scale() != other.get_alpha_scale()) {
00147     return get_alpha_scale() < other.get_alpha_scale() ? -1 : 1;
00148   }
00149   if (get_saved_result() != other.get_saved_result()) {
00150     return get_saved_result() < other.get_saved_result() ? -1 : 1;
00151   }
00152   if (get_mode() != other.get_mode()) {
00153     return get_mode() < other.get_mode() ? -1 : 1;
00154   }
00155   if (get_mode() == M_combine) {
00156     if (get_combine_rgb_mode() != other.get_combine_rgb_mode()) {
00157       return get_combine_rgb_mode() < other.get_combine_rgb_mode() ? -1 : 1;
00158     }
00159     
00160     if (get_num_combine_rgb_operands() != other.get_num_combine_rgb_operands()) {
00161       return get_num_combine_rgb_operands() < other.get_num_combine_rgb_operands() ? -1 : 1;
00162     }
00163     if (get_num_combine_rgb_operands() >= 1) {
00164       if (get_combine_rgb_source0() != other.get_combine_rgb_source0()) {
00165         return get_combine_rgb_source0() < other.get_combine_rgb_source0() ? -1 : 1;
00166       }
00167       if (get_combine_rgb_operand0() != other.get_combine_rgb_operand0()) {
00168         return get_combine_rgb_operand0() < other.get_combine_rgb_operand0() ? -1 : 1;
00169       }
00170     }
00171     if (get_num_combine_rgb_operands() >= 2) {
00172       if (get_combine_rgb_source1() != other.get_combine_rgb_source1()) {
00173         return get_combine_rgb_source1() < other.get_combine_rgb_source1() ? -1 : 1;
00174       }
00175       if (get_combine_rgb_operand1() != other.get_combine_rgb_operand1()) {
00176         return get_combine_rgb_operand1() < other.get_combine_rgb_operand1() ? -1 : 1;
00177       }
00178     }
00179     if (get_num_combine_rgb_operands() >= 3) {
00180       if (get_combine_rgb_source2() != other.get_combine_rgb_source2()) {
00181         return get_combine_rgb_source2() < other.get_combine_rgb_source2() ? -1 : 1;
00182       }
00183       if (get_combine_rgb_operand2() != other.get_combine_rgb_operand2()) {
00184         return get_combine_rgb_operand2() < other.get_combine_rgb_operand2() ? -1 : 1;
00185       }
00186     }
00187     if (get_combine_alpha_mode() != other.get_combine_alpha_mode()) {
00188       return get_combine_alpha_mode() < other.get_combine_alpha_mode() ? -1 : 1;
00189     }
00190     
00191     if (get_num_combine_alpha_operands() != other.get_num_combine_alpha_operands()) {
00192       return get_num_combine_alpha_operands() < other.get_num_combine_alpha_operands() ? -1 : 1;
00193     }
00194     if (get_num_combine_alpha_operands() >= 1) {
00195       if (get_combine_alpha_source0() != other.get_combine_alpha_source0()) {
00196         return get_combine_alpha_source0() < other.get_combine_alpha_source0() ? -1 : 1;
00197       }
00198       if (get_combine_alpha_operand0() != other.get_combine_alpha_operand0()) {
00199         return get_combine_alpha_operand0() < other.get_combine_alpha_operand0() ? -1 : 1;
00200       }
00201     }
00202     if (get_num_combine_alpha_operands() >= 2) {
00203       if (get_combine_alpha_source1() != other.get_combine_alpha_source1()) {
00204         return get_combine_alpha_source1() < other.get_combine_alpha_source1() ? -1 : 1;
00205       }
00206       if (get_combine_alpha_operand1() != other.get_combine_alpha_operand1()) {
00207         return get_combine_alpha_operand1() < other.get_combine_alpha_operand1() ? -1 : 1;
00208       }
00209     }
00210     if (get_num_combine_alpha_operands() >= 3) {
00211       if (get_combine_alpha_source2() != other.get_combine_alpha_source2()) {
00212         return get_combine_alpha_source2() < other.get_combine_alpha_source2() ? -1 : 1;
00213       }
00214       if (get_combine_alpha_operand2() != other.get_combine_alpha_operand2()) {
00215         return get_combine_alpha_operand2() < other.get_combine_alpha_operand2() ? -1 : 1;
00216       }
00217     }
00218   }
00219 
00220   return 0;
00221 }
00222 
00223 ////////////////////////////////////////////////////////////////////
00224 //     Function: TextureStage::Destructor
00225 //       Access: Published
00226 //  Description: Writes the details of this stage
00227 ////////////////////////////////////////////////////////////////////
00228 void TextureStage::
00229 write(ostream &out) const {
00230   out << "TextureStage " << get_name() << ", sort = " << get_sort() << ", priority = " << get_priority() << "\n"
00231       << "  texcoords = " << get_texcoord_name()->get_name()
00232       << ", mode = " << get_mode() << ", color = " << get_color()
00233       << ", scale = " << get_rgb_scale() << ", " << get_alpha_scale()
00234       << ", saved_result = " << get_saved_result() << "\n";
00235 
00236   if (get_mode() == M_combine) {
00237     out << "  RGB combine mode =  " << get_combine_rgb_mode() << "\n";
00238     if (get_num_combine_rgb_operands() >= 1) {
00239       out << "    0: " << get_combine_rgb_source0() << ", "
00240           << get_combine_rgb_operand0() << "\n";
00241     }
00242     if (get_num_combine_rgb_operands() >= 2) {
00243       out << "    1: " << get_combine_rgb_source1() << ", "
00244           << get_combine_rgb_operand1() << "\n";
00245     }
00246     if (get_num_combine_rgb_operands() >= 3) {
00247       out << "    2: " << get_combine_rgb_source2() << ", "
00248           << get_combine_rgb_operand2() << "\n";
00249     }
00250     out << "  alpha combine mode =  " << get_combine_alpha_mode() << "\n";
00251     if (get_num_combine_alpha_operands() >= 1) {
00252       out << "    0: " << get_combine_alpha_source0() << ", "
00253           << get_combine_alpha_operand0() << "\n";
00254     }
00255     if (get_num_combine_alpha_operands() >= 2) {
00256       out << "    1: " << get_combine_alpha_source1() << ", "
00257           << get_combine_alpha_operand1() << "\n";
00258     }
00259     if (get_num_combine_alpha_operands() >= 3) {
00260       out << "    2: " << get_combine_alpha_source2() << ", "
00261           << get_combine_alpha_operand2() << "\n";
00262     }
00263   }
00264 }
00265 
00266 ////////////////////////////////////////////////////////////////////
00267 //     Function: TextureStage::Destructor
00268 //       Access: Published
00269 //  Description: Just a single line output
00270 ////////////////////////////////////////////////////////////////////
00271 void TextureStage::
00272 output(ostream &out) const {
00273   out << "TextureStage " << get_name();
00274 }
00275 
00276 ////////////////////////////////////////////////////////////////////
00277 //     Function: TextureStage::get_expected_num_combine_operands
00278 //       Access: Private, Static
00279 //  Description: Returns the number of combine operands expected with
00280 //               the indicated combine mode (0, 1, 2, or 3).
00281 ////////////////////////////////////////////////////////////////////
00282 int TextureStage::
00283 get_expected_num_combine_operands(TextureStage::CombineMode cm) {
00284   switch (cm) {
00285   case CM_undefined:
00286     return 0;
00287 
00288   case CM_replace:
00289     return 1;
00290 
00291   case CM_modulate:
00292   case CM_add:
00293   case CM_add_signed:
00294   case CM_subtract:
00295   case CM_dot3_rgb:
00296   case CM_dot3_rgba:
00297     return 2;
00298 
00299   case CM_interpolate:
00300     return 3;
00301   }
00302 
00303   return 0;
00304 }
00305 
00306 ////////////////////////////////////////////////////////////////////
00307 //     Function: TextureStage::operand_valid_for_rgb
00308 //       Access: Private, Static
00309 //  Description: Returns true if the indicated CombineOperand is valid
00310 //               for one of the RGB modes, false otherwise.
00311 ////////////////////////////////////////////////////////////////////
00312 bool TextureStage::
00313 operand_valid_for_rgb(TextureStage::CombineOperand co) {
00314   switch (co) {
00315   case CO_undefined:
00316     return false;
00317 
00318   case CO_src_color:
00319   case CO_one_minus_src_color:
00320   case CO_src_alpha:
00321   case CO_one_minus_src_alpha:
00322     return true;
00323   }
00324 
00325   return false;
00326 }
00327 
00328 ////////////////////////////////////////////////////////////////////
00329 //     Function: TextureStage::operand_valid_for_alpha
00330 //       Access: Private, Static
00331 //  Description: Returns true if the indicated CombineOperand is valid
00332 //               for one of the alpha modes, false otherwise.
00333 ////////////////////////////////////////////////////////////////////
00334 bool TextureStage::
00335 operand_valid_for_alpha(TextureStage::CombineOperand co) {
00336   switch (co) {
00337   case CO_undefined:
00338   case CO_src_color:
00339   case CO_one_minus_src_color:
00340     return false;
00341 
00342   case CO_src_alpha:
00343   case CO_one_minus_src_alpha:
00344     return true;
00345   }
00346 
00347   return false;
00348 }
00349 
00350 ////////////////////////////////////////////////////////////////////
00351 //     Function: TextureStage::register_with_read_factory
00352 //       Access: Public, Static
00353 //  Description: Factory method to generate a TextureStage object
00354 ////////////////////////////////////////////////////////////////////
00355 void TextureStage::
00356 register_with_read_factory() {
00357   BamReader::get_factory()->register_factory(get_class_type(), make_TextureStage);
00358 }
00359 
00360 ////////////////////////////////////////////////////////////////////
00361 //     Function: TextureStage::make_TextureStage
00362 //       Access: Protected
00363 //  Description: Factory method to generate a TextureStage object
00364 ////////////////////////////////////////////////////////////////////
00365 TypedWritable* TextureStage::
00366 make_TextureStage(const FactoryParams &params) {
00367   DatagramIterator scan;
00368   BamReader *manager;
00369 
00370   parse_params(params, scan, manager);
00371 
00372   bool is_default = scan.get_bool();
00373   if (is_default) {
00374     return get_default();
00375   } else {
00376     TextureStage *me = new TextureStage("");
00377     me->fillin(scan, manager);
00378     return me;
00379   }
00380 }
00381 
00382 ////////////////////////////////////////////////////////////////////
00383 //     Function: TextureStage::fillin
00384 //       Access: Protected
00385 //  Description: Function that reads out of the datagram (or asks
00386 //               manager to read) all of the data that is needed to
00387 //               re-create this object and stores it in the appropiate
00388 //               place
00389 ////////////////////////////////////////////////////////////////////
00390 void TextureStage::
00391 fillin(DatagramIterator &scan, BamReader *manager) {
00392   _name = scan.get_string();
00393   _sort = scan.get_int32();
00394   _priority = scan.get_int32();
00395 
00396   manager->read_pointer(scan);
00397 
00398   _mode = (TextureStage::Mode) scan.get_uint8();
00399   _color.read_datagram(scan);
00400 
00401   _rgb_scale = scan.get_uint8();
00402   _alpha_scale = scan.get_uint8();
00403   _saved_result = false;
00404   _saved_result = scan.get_bool();
00405 
00406   _combine_rgb_mode = (TextureStage::CombineMode) scan.get_uint8();
00407   _num_combine_rgb_operands = scan.get_uint8();
00408   _combine_rgb_source0 = (TextureStage::CombineSource) scan.get_uint8();
00409   _combine_rgb_operand0 = (TextureStage::CombineOperand) scan.get_uint8();
00410   _combine_rgb_source1 = (TextureStage::CombineSource) scan.get_uint8();
00411   _combine_rgb_operand1 = (TextureStage::CombineOperand) scan.get_uint8();
00412   _combine_rgb_source2 = (TextureStage::CombineSource) scan.get_uint8();
00413   _combine_rgb_operand2 = (TextureStage::CombineOperand) scan.get_uint8();
00414 
00415   _combine_alpha_mode = (TextureStage::CombineMode) scan.get_uint8();
00416   _num_combine_alpha_operands = scan.get_uint8();
00417   _combine_alpha_source0 = (TextureStage::CombineSource) scan.get_uint8();
00418   _combine_alpha_operand0 = (TextureStage::CombineOperand) scan.get_uint8();
00419   _combine_alpha_source1 = (TextureStage::CombineSource) scan.get_uint8();
00420   _combine_alpha_operand1 = (TextureStage::CombineOperand) scan.get_uint8();
00421   _combine_alpha_source2 = (TextureStage::CombineSource) scan.get_uint8();
00422   _combine_alpha_operand2 = (TextureStage::CombineOperand) scan.get_uint8();
00423 
00424   update_color_flags();
00425 }
00426 
00427 ////////////////////////////////////////////////////////////////////
00428 //     Function: TextureStage::complete_pointers
00429 //       Access: Public, Virtual
00430 //  Description: Receives an array of pointers, one for each time
00431 //               manager->read_pointer() was called in fillin().
00432 //               Returns the number of pointers processed.
00433 ////////////////////////////////////////////////////////////////////
00434 int TextureStage::
00435 complete_pointers(TypedWritable **p_list, BamReader *manager) {
00436   int pi = TypedWritableReferenceCount::complete_pointers(p_list, manager);
00437 
00438   _texcoord_name = DCAST(InternalName, p_list[pi++]);
00439 
00440   return pi;
00441 }
00442 
00443 ////////////////////////////////////////////////////////////////////
00444 //     Function: TextureStage::write_datagram
00445 //       Access: Public
00446 //  Description: Function to write the important information in
00447 //               the particular object to a Datagram
00448 ////////////////////////////////////////////////////////////////////
00449 void TextureStage::
00450 write_datagram(BamWriter *manager, Datagram &me) {
00451   // These properties are read in again by fillin(), above.
00452   if (this == get_default()) {
00453     me.add_bool(true);
00454   } else {
00455     me.add_bool(false);
00456     me.add_string(_name);
00457     me.add_int32(_sort);
00458     me.add_int32(_priority);
00459 
00460     manager->write_pointer(me, _texcoord_name);
00461     
00462     me.add_uint8(_mode);
00463     _color.write_datagram(me);
00464     me.add_uint8(_rgb_scale);
00465     me.add_uint8(_alpha_scale);
00466     me.add_bool(_saved_result);
00467     
00468     me.add_uint8(_combine_rgb_mode);
00469     me.add_uint8(_num_combine_rgb_operands);
00470     me.add_uint8(_combine_rgb_source0);
00471     me.add_uint8(_combine_rgb_operand0);
00472     me.add_uint8(_combine_rgb_source1);
00473     me.add_uint8(_combine_rgb_operand1);
00474     me.add_uint8(_combine_rgb_source2);
00475     me.add_uint8(_combine_rgb_operand2);
00476     
00477     me.add_uint8(_combine_alpha_mode);
00478     me.add_uint8(_num_combine_alpha_operands);
00479     me.add_uint8(_combine_alpha_source0);
00480     me.add_uint8(_combine_alpha_operand0);
00481     me.add_uint8(_combine_alpha_source1);
00482     me.add_uint8(_combine_alpha_operand1);
00483     me.add_uint8(_combine_alpha_source2);
00484     me.add_uint8(_combine_alpha_operand2);
00485   }
00486 }
00487 
00488 ostream &
00489 operator << (ostream &out, TextureStage::Mode mode) {
00490   switch (mode) {
00491   case TextureStage::M_modulate:
00492     return out << "modulate";
00493 
00494   case TextureStage::M_decal:
00495     return out << "decal";
00496 
00497   case TextureStage::M_blend:
00498     return out << "blend";
00499 
00500   case TextureStage::M_replace:
00501     return out << "replace";
00502 
00503   case TextureStage::M_add:
00504     return out << "add";
00505 
00506   case TextureStage::M_combine:
00507     return out << "combine";
00508 
00509   case TextureStage::M_blend_color_scale:
00510     return out << "blend_color_scale";
00511 
00512   case TextureStage::M_modulate_glow:
00513     return out << "modulate_glow";
00514   
00515   case TextureStage::M_modulate_gloss:
00516     return out << "modulate_gloss";
00517   
00518   case TextureStage::M_normal:
00519     return out << "normal";
00520 
00521   case TextureStage::M_normal_height:
00522     return out << "normal_height";
00523 
00524   case TextureStage::M_glow:
00525     return out << "glow";
00526   
00527   case TextureStage::M_gloss:
00528     return out << "gloss";
00529 
00530   case TextureStage::M_height:
00531     return out << "height";
00532   
00533   case TextureStage::M_selector:
00534     return out << "selector";
00535   }
00536 
00537   return out << "**invalid Mode(" << (int)mode << ")**";
00538 }
00539 
00540 ostream &
00541 operator << (ostream &out, TextureStage::CombineMode cm) {
00542   switch (cm) {
00543   case TextureStage::CM_undefined:
00544     return out << "undefined";
00545 
00546   case TextureStage::CM_replace:
00547     return out << "replace";
00548 
00549   case TextureStage::CM_modulate:
00550     return out << "modulate";
00551 
00552   case TextureStage::CM_add:
00553     return out << "add";
00554 
00555   case TextureStage::CM_add_signed:
00556     return out << "add_signed";
00557 
00558   case TextureStage::CM_interpolate:
00559     return out << "interpolate";
00560 
00561   case TextureStage::CM_subtract:
00562     return out << "subtract";
00563 
00564   case TextureStage::CM_dot3_rgb:
00565     return out << "dot3_rgb";
00566 
00567   case TextureStage::CM_dot3_rgba:
00568     return out << "dot3_rgba";
00569   }
00570 
00571   return out << "**invalid CombineMode(" << (int)cm << ")**";
00572 }
00573 
00574 ostream &
00575 operator << (ostream &out, TextureStage::CombineSource cs) {
00576   switch (cs) {
00577   case TextureStage::CS_undefined:
00578     return out << "undefined";
00579 
00580   case TextureStage::CS_texture:
00581     return out << "texture";
00582 
00583   case TextureStage::CS_constant:
00584     return out << "constant";
00585 
00586   case TextureStage::CS_primary_color:
00587     return out << "primary_color";
00588 
00589   case TextureStage::CS_previous:
00590     return out << "previous";
00591 
00592   case TextureStage::CS_constant_color_scale:
00593     return out << "constant_color_scale";
00594 
00595   case TextureStage::CS_last_saved_result:
00596     return out << "last_saved_result";
00597   }
00598 
00599   return out << "**invalid CombineSource(" << (int)cs << ")**";
00600 }
00601 
00602 ostream &
00603 operator << (ostream &out, TextureStage::CombineOperand co) {
00604   switch (co) {
00605   case TextureStage::CO_undefined:
00606     return out << "undefined";
00607 
00608   case TextureStage::CO_src_color:
00609     return out << "src_color";
00610 
00611   case TextureStage::CO_one_minus_src_color:
00612     return out << "one_minus_src_color";
00613 
00614   case TextureStage::CO_src_alpha:
00615     return out << "src_alpha";
00616 
00617   case TextureStage::CO_one_minus_src_alpha:
00618     return out << "one_minus_src_alpha";
00619   }
00620 
00621   return out << "**invalid CombineOperand(" << (int)co << ")**";
00622 }
 All Classes Functions Variables Enumerations