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