126 _texcoord_name = name;
138 _texcoord_name = InternalName::get_texcoord_name(name);
149 return _texcoord_name;
161 if (_texcoord_name->get_parent() == NULL) {
162 return InternalName::get_tangent();
164 return InternalName::get_tangent_name(_texcoord_name->get_basename());
177 if (_texcoord_name->get_parent() == NULL) {
178 return InternalName::get_binormal();
180 return InternalName::get_binormal_name(_texcoord_name->get_basename());
193 if (_mode != M_combine) {
194 _num_combine_rgb_operands = 0;
195 _num_combine_alpha_operands = 0;
197 update_color_flags();
219 return (_mode < M_normal);
254 nassertv(rgb_scale == 1 || rgb_scale == 2 || rgb_scale == 4);
255 _rgb_scale = rgb_scale;
279 nassertv(alpha_scale == 1 || alpha_scale == 2 || alpha_scale == 4);
280 _alpha_scale = alpha_scale;
311 _saved_result = saved_result;
322 return _saved_result;
339 _tex_view_offset = tex_view_offset;
350 return _tex_view_offset;
362 CombineSource source0, CombineOperand operand0) {
363 nassertv(get_expected_num_combine_operands(mode) == 1);
364 nassertv(operand_valid_for_rgb(operand0));
366 _num_combine_rgb_operands = 1;
367 _combine_rgb_mode = mode;
368 _combine_rgb_source0 = source0;
369 _combine_rgb_operand0 = operand0;
370 _combine_rgb_source1 = CS_undefined;
371 _combine_rgb_operand1 = CO_undefined;
372 _combine_rgb_source2 = CS_undefined;
373 _combine_rgb_operand2 = CO_undefined;
375 update_color_flags();
388 CombineSource source0, CombineOperand operand0,
389 CombineSource source1, CombineOperand operand1) {
390 nassertv(get_expected_num_combine_operands(mode) == 2);
391 nassertv(operand_valid_for_rgb(operand0));
392 nassertv(operand_valid_for_rgb(operand1));
394 _num_combine_rgb_operands = 2;
395 _combine_rgb_mode = mode;
396 _combine_rgb_source0 = source0;
397 _combine_rgb_operand0 = operand0;
398 _combine_rgb_source1 = source1;
399 _combine_rgb_operand1 = operand1;
400 _combine_rgb_source2 = CS_undefined;
401 _combine_rgb_operand2 = CO_undefined;
403 update_color_flags();
415 CombineSource source0, CombineOperand operand0,
416 CombineSource source1, CombineOperand operand1,
417 CombineSource source2, CombineOperand operand2) {
418 nassertv(get_expected_num_combine_operands(mode) == 3);
419 nassertv(operand_valid_for_rgb(operand0));
420 nassertv(operand_valid_for_rgb(operand1));
421 nassertv(operand_valid_for_rgb(operand2));
423 _num_combine_rgb_operands = 3;
424 _combine_rgb_mode = mode;
425 _combine_rgb_source0 = source0;
426 _combine_rgb_operand0 = operand0;
427 _combine_rgb_source1 = source1;
428 _combine_rgb_operand1 = operand1;
429 _combine_rgb_source2 = source2;
430 _combine_rgb_operand2 = operand2;
432 update_color_flags();
442 return _combine_rgb_mode;
454 return _num_combine_rgb_operands;
464 return _combine_rgb_source0;
474 return _combine_rgb_operand0;
484 return _combine_rgb_source1;
494 return _combine_rgb_operand1;
504 return _combine_rgb_source2;
514 return _combine_rgb_operand2;
526 CombineSource source0, CombineOperand operand0) {
527 nassertv(get_expected_num_combine_operands(mode) == 1);
528 nassertv(operand_valid_for_alpha(operand0));
530 _num_combine_alpha_operands = 1;
531 _combine_alpha_mode = mode;
532 _combine_alpha_source0 = source0;
533 _combine_alpha_operand0 = operand0;
534 _combine_alpha_source1 = CS_undefined;
535 _combine_alpha_operand1 = CO_undefined;
536 _combine_alpha_source2 = CS_undefined;
537 _combine_alpha_operand2 = CO_undefined;
539 update_color_flags();
552 CombineSource source0, CombineOperand operand0,
553 CombineSource source1, CombineOperand operand1) {
554 nassertv(get_expected_num_combine_operands(mode) == 2);
555 nassertv(operand_valid_for_alpha(operand0));
556 nassertv(operand_valid_for_alpha(operand1));
558 _num_combine_alpha_operands = 2;
559 _combine_alpha_mode = mode;
560 _combine_alpha_source0 = source0;
561 _combine_alpha_operand0 = operand0;
562 _combine_alpha_source1 = source1;
563 _combine_alpha_operand1 = operand1;
564 _combine_alpha_source2 = CS_undefined;
565 _combine_alpha_operand2 = CO_undefined;
567 update_color_flags();
579 CombineSource source0, CombineOperand operand0,
580 CombineSource source1, CombineOperand operand1,
581 CombineSource source2, CombineOperand operand2) {
582 nassertv(get_expected_num_combine_operands(mode) == 3);
583 nassertv(operand_valid_for_alpha(operand0));
584 nassertv(operand_valid_for_alpha(operand1));
585 nassertv(operand_valid_for_alpha(operand2));
587 _num_combine_alpha_operands = 3;
588 _combine_alpha_mode = mode;
589 _combine_alpha_source0 = source0;
590 _combine_alpha_operand0 = operand0;
591 _combine_alpha_source1 = source1;
592 _combine_alpha_operand1 = operand1;
593 _combine_alpha_source2 = source2;
594 _combine_alpha_operand2 = operand2;
596 update_color_flags();
606 return _combine_alpha_mode;
618 return _num_combine_alpha_operands;
628 return _combine_alpha_source0;
638 return _combine_alpha_operand0;
648 return _combine_alpha_source1;
658 return _combine_alpha_operand1;
668 return _combine_alpha_source2;
678 return _combine_alpha_operand2;
690 return _involves_color_scale;
713 return _uses_primary_color;
724 return _uses_last_saved_result;
732 INLINE
bool TextureStage::
742 INLINE
bool TextureStage::
752 INLINE
bool TextureStage::
770 return _default_stage;
794 INLINE
void TextureStage::
795 update_color_flags() {
796 _involves_color_scale =
797 (_mode == M_blend_color_scale ||
798 (_mode == M_combine &&
799 (_combine_rgb_source0 == CS_constant_color_scale ||
800 _combine_rgb_source1 == CS_constant_color_scale ||
801 _combine_rgb_source2 == CS_constant_color_scale ||
802 _combine_alpha_source0 == CS_constant_color_scale ||
803 _combine_alpha_source1 == CS_constant_color_scale ||
804 _combine_alpha_source2 == CS_constant_color_scale)));
807 (_involves_color_scale ||
809 (_mode == M_combine &&
810 (_combine_rgb_source0 == CS_constant ||
811 _combine_rgb_source1 == CS_constant ||
812 _combine_rgb_source2 == CS_constant ||
813 _combine_alpha_source0 == CS_constant ||
814 _combine_alpha_source1 == CS_constant ||
815 _combine_alpha_source2 == CS_constant)));
817 _uses_primary_color =
818 (_mode == M_combine &&
819 (_combine_rgb_source0 == CS_primary_color ||
820 _combine_rgb_source1 == CS_primary_color ||
821 _combine_rgb_source2 == CS_primary_color ||
822 _combine_alpha_source0 == CS_primary_color ||
823 _combine_alpha_source1 == CS_primary_color ||
824 _combine_alpha_source2 == CS_primary_color));
826 _uses_last_saved_result =
827 (_mode == M_combine &&
828 (_combine_rgb_source0 == CS_last_saved_result ||
829 _combine_rgb_source1 == CS_last_saved_result ||
830 _combine_rgb_source2 == CS_last_saved_result ||
831 _combine_alpha_source0 == CS_last_saved_result ||
832 _combine_alpha_source1 == CS_last_saved_result ||
833 _combine_alpha_source2 == CS_last_saved_result));
CombineSource get_combine_alpha_source2() const
Get source2 of combine_alpha_mode.
void set_rgb_scale(int rgb_scale)
Sets an additional factor that will scale all three r, g, b components after the texture has been app...
LColor get_color() const
return the color for this stage
CombineOperand get_combine_alpha_operand0() const
Get operand0 of combine_alpha_mode.
int get_rgb_scale() const
See set_rgb_scale().
static UpdateSeq get_sort_seq()
Returns a global sequence number that is incremented any time any TextureStage in the world changes s...
void set_saved_result(bool saved_result)
Sets the saved_result flag.
int get_alpha_scale() const
See set_alpha_scale().
TextureStage(const string &name)
Initialize the texture stage at construction.
Mode get_mode() const
Return the mode of this stage.
int get_num_combine_alpha_operands() const
Returns the number of meaningful operands that may be retrieved via get_combine_alpha_sourceN() and g...
CombineOperand get_combine_rgb_operand1() const
Get operand1 of combine_rgb_mode.
void set_mode(Mode mode)
Set the mode of this texture stage.
void output(ostream &out) const
Just a single line output.
CombineSource get_combine_rgb_source1() const
Get source1 of combine_rgb_mode.
void set_sort(int sort)
Changes the order in which the texture associated with this stage is rendered relative to the other t...
InternalName * get_binormal_name() const
Returns the set of binormals this texture stage will use.
void set_name(const string &name)
Changes the name of this texture stage.
int compare_to(const TextureStage &other) const
Returns a number less than zero if this TextureStage sorts before the other one, greater than zero if...
bool uses_last_saved_result() const
Returns true if the TextureStage makes use of the CS_primary_color combine source.
CombineSource get_combine_alpha_source0() const
Get source0 of combine_alpha_mode.
bool uses_primary_color() const
Returns true if the TextureStage makes use of the CS_primary_color combine source.
void set_combine_alpha(CombineMode mode, CombineSource source0, CombineOperand operand0)
Specifies any of the CombineMode values that represent a one-parameter operation. ...
void set_priority(int priority)
Changes the relative importance of the texture associated with this stage relative to the other textu...
void set_alpha_scale(int alpha_scale)
Sets an additional factor that will scale the alpha component after the texture has been applied...
CombineSource get_combine_rgb_source2() const
Get source2 of combine_rgb_mode.
bool is_fixed_function() const
Returns true if the TextureStage is relevant to the classic fixed function pipeline.
CombineOperand get_combine_rgb_operand0() const
Get operand0 of combine_rgb_mode.
int get_num_combine_rgb_operands() const
Returns the number of meaningful operands that may be retrieved via get_combine_rgb_sourceN() and get...
InternalName * get_texcoord_name() const
See set_texcoord_name.
CombineMode get_combine_alpha_mode() const
Get combine_alpha_mode.
int get_tex_view_offset() const
Returns the current setting of the tex_view_offset.
CombineOperand get_combine_alpha_operand1() const
Get operand1 of combine_alpha_mode.
int get_priority() const
Returns the priority associated with this stage.
const string & get_name() const
Returns the name of this texture stage.
This is the base class for all three-component vectors and points.
CombineMode get_combine_rgb_mode() const
Get the combine_rgb_mode.
void set_combine_rgb(CombineMode mode, CombineSource source0, CombineOperand operand0)
Specifies any of the CombineMode values that represent a one-parameter operation. ...
CombineSource get_combine_rgb_source0() const
Get source0 of combine_rgb_mode.
void set_color(const LColor &color)
Set the color for this stage.
void set_tex_view_offset(int tex_view_offset)
Sets the tex_view_offset value.
bool involves_color_scale() const
Returns true if the TextureStage is affected by the setting of the current ColorScaleAttrib, false otherwise.
void set_texcoord_name(InternalName *name)
Indicate which set of UV's this texture stage will use.
CombineOperand get_combine_rgb_operand2() const
Get operand2 of combine_rgb_mode.
CombineSource get_combine_alpha_source1() const
Get source1 of combine_alpha_mode.
CombineOperand get_combine_alpha_operand2() const
Get operand2 of combine_alpha_mode.
InternalName * get_tangent_name() const
Returns the set of tangents this texture stage will use.
bool uses_color() const
Returns true if the TextureStage makes use of whatever color is specified in set_color(), false otherwise.
This is a sequence number that increments monotonically.
static TextureStage * get_default()
Returns the default TextureStage that will be used for all texturing that does not name a particular ...
Defines the properties of a named stage of the multitexture pipeline.
int get_sort() const
Returns the sort order of this texture stage.
bool get_saved_result() const
Returns the current setting of the saved_result flag.