Panda3D
 All Classes Functions Variables Enumerations
textureStage.I
00001 // Filename: textureStage.I
00002 // Created by:  masad (15Jul04)
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: TextureStage::Copy Constructor
00018 //       Access: Published
00019 //  Description: Initialize the texture stage from other
00020 ////////////////////////////////////////////////////////////////////
00021 INLINE TextureStage::
00022 TextureStage(TextureStage &copy) {
00023   (*this) = copy;
00024 }
00025 
00026 ////////////////////////////////////////////////////////////////////
00027 //     Function: TextureStage::get_name
00028 //       Access: Published
00029 //  Description: Returns the name of this texture stage
00030 ////////////////////////////////////////////////////////////////////
00031 INLINE const string &TextureStage::
00032 get_name() const {
00033   return _name;
00034 }
00035 
00036 ////////////////////////////////////////////////////////////////////
00037 //     Function: TextureStage::set_name
00038 //       Access: Published
00039 //  Description: Changes the name of this texture stage
00040 ////////////////////////////////////////////////////////////////////
00041 INLINE void TextureStage::
00042 set_name(const string &name) {
00043   _name = name;
00044 }
00045 
00046 ////////////////////////////////////////////////////////////////////
00047 //     Function: TextureStage::set_sort
00048 //       Access: Published
00049 //  Description: Changes the order in which the texture associated
00050 //               with this stage is rendered relative to the other
00051 //               texture stages.  When geometry is rendered with
00052 //               multiple textures, the textures are rendered in order
00053 //               from the lowest sort number to the highest sort
00054 //               number.
00055 //
00056 //               Also see set_priority(), which is used to select the
00057 //               most important textures for rendering when some must
00058 //               be omitted because of hardware limitations.
00059 ////////////////////////////////////////////////////////////////////
00060 INLINE void TextureStage::
00061 set_sort(int sort) {
00062   _sort = sort;
00063 
00064   // Update the global flag to indicate that all TextureAttribs in the
00065   // world must now re-sort their lists.
00066   _sort_seq++;
00067 }
00068 
00069 ////////////////////////////////////////////////////////////////////
00070 //     Function: TextureStage::get_sort
00071 //       Access: Published
00072 //  Description: Returns the sort order of this texture stage.
00073 ////////////////////////////////////////////////////////////////////
00074 INLINE int TextureStage::
00075 get_sort() const {
00076   return _sort;
00077 }
00078 
00079 ////////////////////////////////////////////////////////////////////
00080 //     Function: TextureStage::set_priority
00081 //       Access: Published
00082 //  Description: Changes the relative importance of the texture
00083 //               associated with this stage relative to the other
00084 //               texture stages that are applied simultaneously.
00085 //
00086 //               This is unrelated to set_sort(), which controls the
00087 //               order in which multiple textures are applied.  The
00088 //               priority number is used to decide which of the
00089 //               requested textures are to be selected for rendering
00090 //               when more textures are requested than the hardware
00091 //               will support.  The highest-priority n textures are
00092 //               selected for rendering, and then rendered in order by
00093 //               their sort factor.
00094 ////////////////////////////////////////////////////////////////////
00095 INLINE void TextureStage::
00096 set_priority(int priority) {
00097   _priority = priority;
00098 
00099   // Update the global flag to indicate that all TextureAttribs in the
00100   // world must now re-sort their lists.
00101   _sort_seq++;
00102 }
00103 
00104 ////////////////////////////////////////////////////////////////////
00105 //     Function: TextureStage::get_priority
00106 //       Access: Published
00107 //  Description: Returns the priority associated with this stage.
00108 //
00109 //               This is specially helpful for cards that do not
00110 //               support more than n stages of multi-texturing.
00111 ////////////////////////////////////////////////////////////////////
00112 INLINE int TextureStage::
00113 get_priority() const {
00114   return _priority;
00115 }
00116 
00117 ////////////////////////////////////////////////////////////////////
00118 //     Function: TextureStage::set_texcoord_name
00119 //       Access: Published
00120 //  Description: Indicate which set of UV's this texture stage will
00121 //               use.  Geometry may have any number of associated UV
00122 //               sets, each of which must have a unique name.
00123 ////////////////////////////////////////////////////////////////////
00124 INLINE void TextureStage::
00125 set_texcoord_name(InternalName *name) {
00126   _texcoord_name = name;
00127 }
00128 
00129 ////////////////////////////////////////////////////////////////////
00130 //     Function: TextureStage::set_texcoord_name
00131 //       Access: Published
00132 //  Description: Indicate which set of UV's this texture stage will
00133 //               use.  Geometry may have any number of associated UV
00134 //               sets, each of which must have a unique name.
00135 ////////////////////////////////////////////////////////////////////
00136 INLINE void TextureStage::
00137 set_texcoord_name(const string &name) {
00138   _texcoord_name = InternalName::get_texcoord_name(name);
00139 }
00140 
00141 ////////////////////////////////////////////////////////////////////
00142 //     Function: TextureStage::get_texcoord_name
00143 //       Access: Published
00144 //  Description: Returns the InternalName
00145 ////////////////////////////////////////////////////////////////////
00146 INLINE InternalName *TextureStage::
00147 get_texcoord_name() const {
00148   return _texcoord_name;
00149 }
00150 
00151 ////////////////////////////////////////////////////////////////////
00152 //     Function: TextureStage::set_mode
00153 //       Access: Published
00154 //  Description: Set the mode of this texture stage
00155 ////////////////////////////////////////////////////////////////////
00156 INLINE void TextureStage::
00157 set_mode(TextureStage::Mode mode) {
00158   _mode = mode;
00159 
00160   if (_mode != M_combine) {
00161     _num_combine_rgb_operands = 0;
00162     _num_combine_alpha_operands = 0;
00163   }
00164   update_color_flags();
00165 }
00166 
00167 ////////////////////////////////////////////////////////////////////
00168 //     Function: TextureStage::get_mode
00169 //       Access: Published
00170 //  Description: Return the mode of this stage
00171 ////////////////////////////////////////////////////////////////////
00172 INLINE TextureStage::Mode TextureStage::
00173 get_mode() const {
00174   return _mode;
00175 }
00176 
00177 ////////////////////////////////////////////////////////////////////
00178 //     Function: TextureStage::is_fixed_function
00179 //       Access: Published
00180 //  Description: Returns true if the TextureStage is relevant to
00181 //               the classic fixed function pipeline.  This excludes
00182 //               texture stages such as normal mapping and the like.
00183 ////////////////////////////////////////////////////////////////////
00184 INLINE bool TextureStage::
00185 is_fixed_function() const {
00186   return (_mode < M_normal);
00187 }
00188 
00189 ////////////////////////////////////////////////////////////////////
00190 //     Function: TextureStage::set_color
00191 //       Access: Published
00192 //  Description: Set the color for this stage
00193 ////////////////////////////////////////////////////////////////////
00194 INLINE void TextureStage::
00195 set_color(const LColor &color) {
00196   _color = color;
00197 }
00198 
00199 ////////////////////////////////////////////////////////////////////
00200 //     Function: TextureStage::get_color
00201 //       Access: Published
00202 //  Description: return the color for this stage
00203 ////////////////////////////////////////////////////////////////////
00204 INLINE LColor TextureStage::
00205 get_color() const {
00206   return _color;
00207 }
00208 
00209 ////////////////////////////////////////////////////////////////////
00210 //     Function: TextureStage::set_rgb_scale
00211 //       Access: Published
00212 //  Description: Sets an additional factor that will scale all three
00213 //               r, g, b components after the texture has been
00214 //               applied.  This is used only when the mode is
00215 //               CM_combine.
00216 //
00217 //               The only legal values are 1, 2, or 4.
00218 ////////////////////////////////////////////////////////////////////
00219 INLINE void TextureStage::
00220 set_rgb_scale(int rgb_scale) {
00221   nassertv(rgb_scale == 1 || rgb_scale == 2 || rgb_scale == 4);
00222   _rgb_scale = rgb_scale;
00223 }
00224 
00225 ////////////////////////////////////////////////////////////////////
00226 //     Function: TextureStage::get_rgb_scale
00227 //       Access: Published
00228 //  Description: See set_rgb_scale().
00229 ////////////////////////////////////////////////////////////////////
00230 INLINE int TextureStage::
00231 get_rgb_scale() const {
00232   return _rgb_scale;
00233 }
00234 
00235 ////////////////////////////////////////////////////////////////////
00236 //     Function: TextureStage::set_alpha_scale
00237 //       Access: Published
00238 //  Description: Sets an additional factor that will scale the
00239 //               alpha component after the texture has been applied.
00240 //               This is used only when the mode is CM_combine.
00241 //
00242 //               The only legal values are 1, 2, or 4.
00243 ////////////////////////////////////////////////////////////////////
00244 INLINE void TextureStage::
00245 set_alpha_scale(int alpha_scale) {
00246   nassertv(alpha_scale == 1 || alpha_scale == 2 || alpha_scale == 4);
00247   _alpha_scale = alpha_scale;
00248 }
00249 
00250 ////////////////////////////////////////////////////////////////////
00251 //     Function: TextureStage::get_alpha_scale
00252 //       Access: Published
00253 //  Description: See set_alpha_scale().
00254 ////////////////////////////////////////////////////////////////////
00255 INLINE int TextureStage::
00256 get_alpha_scale() const {
00257   return _alpha_scale;
00258 }
00259 
00260 ////////////////////////////////////////////////////////////////////
00261 //     Function: TextureStage::set_saved_result
00262 //       Access: Published
00263 //  Description: Sets the saved_result flag.  When this is true, the
00264 //               output of this stage will be supplied as the
00265 //               "last_saved_result" source for any future stages,
00266 //               until the next TextureStage with a saved_result set
00267 //               true is encountered.
00268 //
00269 //               This can be used to reuse the results of this texture
00270 //               stage as input to more than one stage later in the
00271 //               pipeline.
00272 //
00273 //               The last texture in the pipeline (the one with the
00274 //               highest sort value) should not have this flag set.
00275 ////////////////////////////////////////////////////////////////////
00276 INLINE void TextureStage::
00277 set_saved_result(bool saved_result) {
00278   _saved_result = saved_result;
00279 }
00280 
00281 ////////////////////////////////////////////////////////////////////
00282 //     Function: TextureStage::get_saved_result
00283 //       Access: Published
00284 //  Description: Returns the current setting of the saved_result flag.
00285 //               See set_saved_result().
00286 ////////////////////////////////////////////////////////////////////
00287 INLINE bool TextureStage::
00288 get_saved_result() const {
00289   return _saved_result;
00290 }
00291 
00292 ////////////////////////////////////////////////////////////////////
00293 //     Function: TextureStage::set_tex_view_offset
00294 //       Access: Published
00295 //  Description: Sets the tex_view_offset value.  This is used only
00296 //               when a special multiview texture is bound to the
00297 //               TextureStage, and it selects the particular view of
00298 //               the texture that is to be used.
00299 //
00300 //               This value is added to the similar parameter on
00301 //               DisplayRegion to derive the final texture view index
00302 //               that is selected for rendering.
00303 ////////////////////////////////////////////////////////////////////
00304 INLINE void TextureStage::
00305 set_tex_view_offset(int tex_view_offset) {
00306   _tex_view_offset = tex_view_offset;
00307 }
00308 
00309 ////////////////////////////////////////////////////////////////////
00310 //     Function: TextureStage::get_tex_view_offset
00311 //       Access: Published
00312 //  Description: Returns the current setting of the tex_view_offset.
00313 //               See set_tex_view_offset().
00314 ////////////////////////////////////////////////////////////////////
00315 INLINE int TextureStage::
00316 get_tex_view_offset() const {
00317   return _tex_view_offset;
00318 }
00319 
00320 ////////////////////////////////////////////////////////////////////
00321 //     Function: TextureStage::set_combine_rgb
00322 //       Access: Published
00323 //  Description: Specifies any of the CombineMode values that
00324 //               represent a one-parameter operation.  Specifically,
00325 //               this is CM_replace only.
00326 ////////////////////////////////////////////////////////////////////
00327 INLINE void TextureStage::
00328 set_combine_rgb(CombineMode mode, 
00329                 CombineSource source0, CombineOperand operand0) {
00330   nassertv(get_expected_num_combine_operands(mode) == 1);
00331   nassertv(operand_valid_for_rgb(operand0));
00332   _mode = M_combine;
00333   _num_combine_rgb_operands = 1;
00334   _combine_rgb_mode = mode;
00335   _combine_rgb_source0 = source0;
00336   _combine_rgb_operand0 = operand0;
00337   _combine_rgb_source1 = CS_undefined;
00338   _combine_rgb_operand1 = CO_undefined;
00339   _combine_rgb_source2 = CS_undefined;
00340   _combine_rgb_operand2 = CO_undefined;
00341 
00342   update_color_flags();
00343 }
00344 
00345 ////////////////////////////////////////////////////////////////////
00346 //     Function: TextureStage::set_combine_rgb
00347 //       Access: Published
00348 //  Description: Specifies any of the CombineMode values that
00349 //               represent a two-parameter operation.  Specifically,
00350 //               this is everything except for CM_replace and
00351 //               CM_interpolate.
00352 ////////////////////////////////////////////////////////////////////
00353 INLINE void TextureStage::
00354 set_combine_rgb(CombineMode mode, 
00355                 CombineSource source0, CombineOperand operand0,
00356                 CombineSource source1, CombineOperand operand1) {
00357   nassertv(get_expected_num_combine_operands(mode) == 2);
00358   nassertv(operand_valid_for_rgb(operand0));
00359   nassertv(operand_valid_for_rgb(operand1));
00360   _mode = M_combine;
00361   _num_combine_rgb_operands = 2;
00362   _combine_rgb_mode = mode;
00363   _combine_rgb_source0 = source0;
00364   _combine_rgb_operand0 = operand0;
00365   _combine_rgb_source1 = source1;
00366   _combine_rgb_operand1 = operand1;
00367   _combine_rgb_source2 = CS_undefined;
00368   _combine_rgb_operand2 = CO_undefined;
00369 
00370   update_color_flags();
00371 }
00372 
00373 ////////////////////////////////////////////////////////////////////
00374 //     Function: TextureStage::set_combine_rgb
00375 //       Access: Published
00376 //  Description: Specifies any of the CombineMode values that
00377 //               represent a one-parameter operation.  Specifically,
00378 //               this is CM_interpolate only.
00379 ////////////////////////////////////////////////////////////////////
00380 INLINE void TextureStage::
00381 set_combine_rgb(CombineMode mode, 
00382                 CombineSource source0, CombineOperand operand0,
00383                 CombineSource source1, CombineOperand operand1,
00384                 CombineSource source2, CombineOperand operand2) {
00385   nassertv(get_expected_num_combine_operands(mode) == 3);
00386   nassertv(operand_valid_for_rgb(operand0));
00387   nassertv(operand_valid_for_rgb(operand1));
00388   nassertv(operand_valid_for_rgb(operand2));
00389   _mode = M_combine;
00390   _num_combine_rgb_operands = 3;
00391   _combine_rgb_mode = mode;
00392   _combine_rgb_source0 = source0;
00393   _combine_rgb_operand0 = operand0;
00394   _combine_rgb_source1 = source1;
00395   _combine_rgb_operand1 = operand1;
00396   _combine_rgb_source2 = source2;
00397   _combine_rgb_operand2 = operand2;
00398 
00399   update_color_flags();
00400 }
00401 
00402 ////////////////////////////////////////////////////////////////////
00403 //     Function: TextureStage::get_combine_rgb_mode
00404 //       Access: Published
00405 //  Description: Get the combine_rgb_mode
00406 ////////////////////////////////////////////////////////////////////
00407 INLINE TextureStage::CombineMode TextureStage::
00408 get_combine_rgb_mode() const {
00409   return _combine_rgb_mode;
00410 }
00411 
00412 ////////////////////////////////////////////////////////////////////
00413 //     Function: TextureStage::get_num_combine_rgb_operands
00414 //       Access: Published
00415 //  Description: Returns the number of meaningful operands that may be
00416 //               retrieved via get_combine_rgb_sourceN() and
00417 //               get_combine_rgb_operandN().
00418 ////////////////////////////////////////////////////////////////////
00419 INLINE int TextureStage::
00420 get_num_combine_rgb_operands() const {
00421   return _num_combine_rgb_operands;
00422 }
00423 
00424 ////////////////////////////////////////////////////////////////////
00425 //     Function: TextureStage::get_combine_rgb_source0
00426 //       Access: Published
00427 //  Description: Get source0 of combine_rgb_mode
00428 ////////////////////////////////////////////////////////////////////
00429 INLINE TextureStage::CombineSource TextureStage::
00430 get_combine_rgb_source0() const {
00431   return _combine_rgb_source0;
00432 }
00433 
00434 ////////////////////////////////////////////////////////////////////
00435 //     Function: TextureStage::get_combine_rgb_operand0
00436 //       Access: Published
00437 //  Description: Get operand0 of combine_rgb_mode
00438 ////////////////////////////////////////////////////////////////////
00439 INLINE TextureStage::CombineOperand TextureStage::
00440 get_combine_rgb_operand0() const {
00441   return _combine_rgb_operand0;
00442 }
00443 
00444 ////////////////////////////////////////////////////////////////////
00445 //     Function: TextureStage::get_combine_rgb_source1
00446 //       Access: Published
00447 //  Description: Get source1 of combine_rgb_mode
00448 ////////////////////////////////////////////////////////////////////
00449 INLINE TextureStage::CombineSource TextureStage::
00450 get_combine_rgb_source1() const {
00451   return _combine_rgb_source1;
00452 }
00453 
00454 ////////////////////////////////////////////////////////////////////
00455 //     Function: TextureStage::get_combine_rgb_operand1
00456 //       Access: Published
00457 //  Description: Get operand1 of combine_rgb_mode
00458 ////////////////////////////////////////////////////////////////////
00459 INLINE TextureStage::CombineOperand TextureStage::
00460 get_combine_rgb_operand1() const {
00461   return _combine_rgb_operand1;
00462 }
00463 
00464 ////////////////////////////////////////////////////////////////////
00465 //     Function: TextureStage::get_combine_rgb_source2
00466 //       Access: Published
00467 //  Description: Get source2 of combine_rgb_mode
00468 ////////////////////////////////////////////////////////////////////
00469 INLINE TextureStage::CombineSource TextureStage::
00470 get_combine_rgb_source2() const {
00471   return _combine_rgb_source2;
00472 }
00473 
00474 ////////////////////////////////////////////////////////////////////
00475 //     Function: TextureStage::get_combine_rgb_operand2
00476 //       Access: Published
00477 //  Description: Get operand2 of combine_rgb_mode
00478 ////////////////////////////////////////////////////////////////////
00479 INLINE TextureStage::CombineOperand TextureStage::
00480 get_combine_rgb_operand2() const {
00481   return _combine_rgb_operand2;
00482 }
00483 
00484 ////////////////////////////////////////////////////////////////////
00485 //     Function: TextureStage::set_combine_alpha
00486 //       Access: Published
00487 //  Description: Specifies any of the CombineMode values that
00488 //               represent a one-parameter operation.  Specifically,
00489 //               this is CM_replace only.
00490 ////////////////////////////////////////////////////////////////////
00491 INLINE void TextureStage::
00492 set_combine_alpha(CombineMode mode, 
00493                   CombineSource source0, CombineOperand operand0) {
00494   nassertv(get_expected_num_combine_operands(mode) == 1);
00495   nassertv(operand_valid_for_alpha(operand0));
00496   _mode = M_combine;
00497   _num_combine_alpha_operands = 1;
00498   _combine_alpha_mode = mode;
00499   _combine_alpha_source0 = source0;
00500   _combine_alpha_operand0 = operand0;
00501   _combine_alpha_source1 = CS_undefined;
00502   _combine_alpha_operand1 = CO_undefined;
00503   _combine_alpha_source2 = CS_undefined;
00504   _combine_alpha_operand2 = CO_undefined;
00505 
00506   update_color_flags();
00507 }
00508 
00509 ////////////////////////////////////////////////////////////////////
00510 //     Function: TextureStage::set_combine_alpha
00511 //       Access: Published
00512 //  Description: Specifies any of the CombineMode values that
00513 //               represent a two-parameter operation.  Specifically,
00514 //               this is everything except for CM_replace and
00515 //               CM_interpolate.
00516 ////////////////////////////////////////////////////////////////////
00517 INLINE void TextureStage::
00518 set_combine_alpha(CombineMode mode, 
00519                   CombineSource source0, CombineOperand operand0,
00520                   CombineSource source1, CombineOperand operand1) {
00521   nassertv(get_expected_num_combine_operands(mode) == 2);
00522   nassertv(operand_valid_for_alpha(operand0));
00523   nassertv(operand_valid_for_alpha(operand1));
00524   _mode = M_combine;
00525   _num_combine_alpha_operands = 2;
00526   _combine_alpha_mode = mode;
00527   _combine_alpha_source0 = source0;
00528   _combine_alpha_operand0 = operand0;
00529   _combine_alpha_source1 = source1;
00530   _combine_alpha_operand1 = operand1;
00531   _combine_alpha_source2 = CS_undefined;
00532   _combine_alpha_operand2 = CO_undefined;
00533 
00534   update_color_flags();
00535 }
00536 
00537 ////////////////////////////////////////////////////////////////////
00538 //     Function: TextureStage::set_combine_alpha
00539 //       Access: Published
00540 //  Description: Specifies any of the CombineMode values that
00541 //               represent a one-parameter operation.  Specifically,
00542 //               this is CM_interpolate only.
00543 ////////////////////////////////////////////////////////////////////
00544 INLINE void TextureStage::
00545 set_combine_alpha(CombineMode mode, 
00546                   CombineSource source0, CombineOperand operand0,
00547                   CombineSource source1, CombineOperand operand1,
00548                   CombineSource source2, CombineOperand operand2) {
00549   nassertv(get_expected_num_combine_operands(mode) == 3);
00550   nassertv(operand_valid_for_alpha(operand0));
00551   nassertv(operand_valid_for_alpha(operand1));
00552   nassertv(operand_valid_for_alpha(operand2));
00553   _mode = M_combine;
00554   _num_combine_alpha_operands = 3;
00555   _combine_alpha_mode = mode;
00556   _combine_alpha_source0 = source0;
00557   _combine_alpha_operand0 = operand0;
00558   _combine_alpha_source1 = source1;
00559   _combine_alpha_operand1 = operand1;
00560   _combine_alpha_source2 = source2;
00561   _combine_alpha_operand2 = operand2;
00562 
00563   update_color_flags();
00564 }
00565 
00566 ////////////////////////////////////////////////////////////////////
00567 //     Function: TextureStage::get_combine_alpha
00568 //       Access: Published
00569 //  Description: Get combine_alpha_mode
00570 ////////////////////////////////////////////////////////////////////
00571 INLINE TextureStage::CombineMode TextureStage::
00572 get_combine_alpha_mode() const {
00573   return _combine_alpha_mode;
00574 }
00575 
00576 ////////////////////////////////////////////////////////////////////
00577 //     Function: TextureStage::get_num_combine_alpha_operands
00578 //       Access: Published
00579 //  Description: Returns the number of meaningful operands that may be
00580 //               retrieved via get_combine_alpha_sourceN() and
00581 //               get_combine_alpha_operandN().
00582 ////////////////////////////////////////////////////////////////////
00583 INLINE int TextureStage::
00584 get_num_combine_alpha_operands() const {
00585   return _num_combine_alpha_operands;
00586 }
00587 
00588 ////////////////////////////////////////////////////////////////////
00589 //     Function: TextureStage::get_combine_alpha_source0
00590 //       Access: Published
00591 //  Description: Get source0 of combine_alpha_mode
00592 ////////////////////////////////////////////////////////////////////
00593 INLINE TextureStage::CombineSource TextureStage::
00594 get_combine_alpha_source0() const {
00595   return _combine_alpha_source0;
00596 }
00597 
00598 ////////////////////////////////////////////////////////////////////
00599 //     Function: TextureStage::get_combine_alpha_operand0
00600 //       Access: Published
00601 //  Description: Get operand0 of combine_alpha_mode
00602 ////////////////////////////////////////////////////////////////////
00603 INLINE TextureStage::CombineOperand TextureStage::
00604 get_combine_alpha_operand0() const {
00605   return _combine_alpha_operand0;
00606 }
00607 
00608 ////////////////////////////////////////////////////////////////////
00609 //     Function: TextureStage::get_combine_alpha_source1
00610 //       Access: Published
00611 //  Description: Get source1 of combine_alpha_mode
00612 ////////////////////////////////////////////////////////////////////
00613 INLINE TextureStage::CombineSource TextureStage::
00614 get_combine_alpha_source1() const {
00615   return _combine_alpha_source1;
00616 }
00617 
00618 ////////////////////////////////////////////////////////////////////
00619 //     Function: TextureStage::get_combine_alpha_operand1
00620 //       Access: Published
00621 //  Description: Get operand1 of combine_alpha_mode
00622 ////////////////////////////////////////////////////////////////////
00623 INLINE TextureStage::CombineOperand TextureStage::
00624 get_combine_alpha_operand1() const {
00625   return _combine_alpha_operand1;
00626 }
00627 
00628 ////////////////////////////////////////////////////////////////////
00629 //     Function: TextureStage::get_combine_alpha_source2
00630 //       Access: Published
00631 //  Description: Get source2 of combine_alpha_mode
00632 ////////////////////////////////////////////////////////////////////
00633 INLINE TextureStage::CombineSource TextureStage::
00634 get_combine_alpha_source2() const {
00635   return _combine_alpha_source2;
00636 }
00637 
00638 ////////////////////////////////////////////////////////////////////
00639 //     Function: TextureStage::get_combine_alpha_operand2
00640 //       Access: Published
00641 //  Description: Get operand2 of combine_alpha_mode
00642 ////////////////////////////////////////////////////////////////////
00643 INLINE TextureStage::CombineOperand TextureStage::
00644 get_combine_alpha_operand2() const {
00645   return _combine_alpha_operand2;
00646 }
00647 
00648 ////////////////////////////////////////////////////////////////////
00649 //     Function: TextureStage::involves_color_scale
00650 //       Access: Published
00651 //  Description: Returns true if the TextureStage is affected by the
00652 //               setting of the current ColorScaleAttrib, false
00653 //               otherwise.
00654 ////////////////////////////////////////////////////////////////////
00655 INLINE bool TextureStage::
00656 involves_color_scale() const {
00657   return _involves_color_scale;
00658 }
00659 
00660 ////////////////////////////////////////////////////////////////////
00661 //     Function: TextureStage::uses_color
00662 //       Access: Published
00663 //  Description: Returns true if the TextureStage makes use of
00664 //               whatever color is specified in set_color(), false
00665 //               otherwise.
00666 ////////////////////////////////////////////////////////////////////
00667 INLINE bool TextureStage::
00668 uses_color() const {
00669   return _uses_color;
00670 }
00671 
00672 ////////////////////////////////////////////////////////////////////
00673 //     Function: TextureStage::uses_primary_color
00674 //       Access: Published
00675 //  Description: Returns true if the TextureStage makes use of
00676 //               the CS_primary_color combine source.
00677 ////////////////////////////////////////////////////////////////////
00678 INLINE bool TextureStage::
00679 uses_primary_color() const {
00680   return _uses_primary_color;
00681 }
00682 
00683 ////////////////////////////////////////////////////////////////////
00684 //     Function: TextureStage::uses_last_saved_result
00685 //       Access: Published
00686 //  Description: Returns true if the TextureStage makes use of
00687 //               the CS_primary_color combine source.
00688 ////////////////////////////////////////////////////////////////////
00689 INLINE bool TextureStage::
00690 uses_last_saved_result() const {
00691   return _uses_last_saved_result;
00692 }
00693 
00694 ////////////////////////////////////////////////////////////////////
00695 //     Function: TextureStage::operator ==
00696 //       Access: Published
00697 //  Description:
00698 ////////////////////////////////////////////////////////////////////
00699 INLINE bool TextureStage::
00700 operator == (const TextureStage &other) const {
00701   return compare_to(other) == 0;
00702 }
00703 
00704 ////////////////////////////////////////////////////////////////////
00705 //     Function: TextureStage::operator !=
00706 //       Access: Published
00707 //  Description:
00708 ////////////////////////////////////////////////////////////////////
00709 INLINE bool TextureStage::
00710 operator != (const TextureStage &other) const {
00711   return compare_to(other) != 0;
00712 }
00713 
00714 ////////////////////////////////////////////////////////////////////
00715 //     Function: TextureStage::operator <
00716 //       Access: Published
00717 //  Description:
00718 ////////////////////////////////////////////////////////////////////
00719 INLINE bool TextureStage::
00720 operator < (const TextureStage &other) const {
00721   return compare_to(other) < 0;
00722 }
00723 
00724 ////////////////////////////////////////////////////////////////////
00725 //     Function: TextureStage::get_default
00726 //       Access: Published, Static
00727 //  Description: Returns the default TextureStage that will be used
00728 //               for all texturing that does not name a particular
00729 //               stage.  This generally handles the normal
00730 //               single-texture case.
00731 ////////////////////////////////////////////////////////////////////
00732 INLINE TextureStage *TextureStage::
00733 get_default() {
00734   if (_default_stage == (TextureStage *)NULL) {
00735     _default_stage = new TextureStage("default");
00736   }
00737   return _default_stage;
00738 }
00739 
00740 ////////////////////////////////////////////////////////////////////
00741 //     Function: TextureStage::get_sort_seq
00742 //       Access: Public, Static
00743 //  Description: Returns a global sequence number that is incremented
00744 //               any time any TextureStage in the world changes sort
00745 //               or priority.  This is used by TextureAttrib to
00746 //               determine when it is necessary to re-sort its
00747 //               internal array of stages.
00748 ////////////////////////////////////////////////////////////////////
00749 INLINE UpdateSeq TextureStage::
00750 get_sort_seq() {
00751   return _sort_seq;
00752 }
00753 
00754 ////////////////////////////////////////////////////////////////////
00755 //     Function: TextureStage::update_color_flags
00756 //       Access: Private
00757 //  Description: Updates _uses_color, _involves_color_scale,
00758 //               _uses_primary_color and _uses_last_saved_result
00759 //               appropriately.
00760 ////////////////////////////////////////////////////////////////////
00761 INLINE void TextureStage::
00762 update_color_flags() {
00763   _involves_color_scale = 
00764     (_mode == M_blend_color_scale ||
00765      (_mode == M_combine &&
00766       (_combine_rgb_source0 == CS_constant_color_scale ||
00767        _combine_rgb_source1 == CS_constant_color_scale ||
00768        _combine_rgb_source2 == CS_constant_color_scale ||
00769        _combine_alpha_source0 == CS_constant_color_scale ||
00770        _combine_alpha_source1 == CS_constant_color_scale ||
00771        _combine_alpha_source2 == CS_constant_color_scale)));
00772   
00773   _uses_color = 
00774     (_involves_color_scale || 
00775      _mode == M_blend ||
00776      (_mode == M_combine &&
00777       (_combine_rgb_source0 == CS_constant ||
00778        _combine_rgb_source1 == CS_constant ||
00779        _combine_rgb_source2 == CS_constant ||
00780        _combine_alpha_source0 == CS_constant ||
00781        _combine_alpha_source1 == CS_constant ||
00782        _combine_alpha_source2 == CS_constant)));
00783 
00784   _uses_primary_color = 
00785      (_mode == M_combine &&
00786       (_combine_rgb_source0 == CS_primary_color ||
00787        _combine_rgb_source1 == CS_primary_color ||
00788        _combine_rgb_source2 == CS_primary_color ||
00789        _combine_alpha_source0 == CS_primary_color ||
00790        _combine_alpha_source1 == CS_primary_color ||
00791        _combine_alpha_source2 == CS_primary_color));
00792 
00793   _uses_last_saved_result = 
00794      (_mode == M_combine &&
00795       (_combine_rgb_source0 == CS_last_saved_result ||
00796        _combine_rgb_source1 == CS_last_saved_result ||
00797        _combine_rgb_source2 == CS_last_saved_result ||
00798        _combine_alpha_source0 == CS_last_saved_result ||
00799        _combine_alpha_source1 == CS_last_saved_result ||
00800        _combine_alpha_source2 == CS_last_saved_result));
00801 }
00802 
00803 INLINE ostream &
00804 operator << (ostream &out, const TextureStage &ts) {
00805   ts.output(out);
00806   return out;
00807 }
 All Classes Functions Variables Enumerations