56 if (_used_by_auto_shader) {
57 GraphicsStateGuardianBase::mark_rehash_generated_shaders();
88 if (_used_by_auto_shader) {
89 GraphicsStateGuardianBase::mark_rehash_generated_shaders();
110 if (name != _texcoord_name) {
111 _texcoord_name = name;
113 if (_used_by_auto_shader) {
114 GraphicsStateGuardianBase::mark_rehash_generated_shaders();
133 return _texcoord_name;
142 if (_texcoord_name->get_parent() ==
nullptr) {
143 return InternalName::get_tangent();
145 return InternalName::get_tangent_name(_texcoord_name->get_basename());
155 if (_texcoord_name->get_parent() ==
nullptr) {
156 return InternalName::get_binormal();
158 return InternalName::get_binormal_name(_texcoord_name->get_basename());
170 if (_mode != M_combine) {
171 _num_combine_rgb_operands = 0;
172 _num_combine_alpha_operands = 0;
175 update_color_flags();
194 return (_mode < M_normal);
222 if (rgb_scale != _rgb_scale) {
223 nassertv(rgb_scale == 1 || rgb_scale == 2 || rgb_scale == 4);
224 _rgb_scale = rgb_scale;
226 if (_used_by_auto_shader) {
227 GraphicsStateGuardianBase::mark_rehash_generated_shaders();
248 if (alpha_scale != _alpha_scale) {
249 nassertv(alpha_scale == 1 || alpha_scale == 2 || alpha_scale == 4);
250 _alpha_scale = alpha_scale;
252 if (_used_by_auto_shader) {
253 GraphicsStateGuardianBase::mark_rehash_generated_shaders();
279 if (saved_result != _saved_result) {
280 _saved_result = saved_result;
282 if (_used_by_auto_shader) {
283 GraphicsStateGuardianBase::mark_rehash_generated_shaders();
294 return _saved_result;
307 _tex_view_offset = tex_view_offset;
316 return _tex_view_offset;
325 CombineSource source0, CombineOperand operand0) {
326 nassertv(get_expected_num_combine_operands(mode) == 1);
327 nassertv(operand_valid_for_rgb(operand0));
329 _num_combine_rgb_operands = 1;
330 _combine_rgb_mode = mode;
331 _combine_rgb_source0 = source0;
332 _combine_rgb_operand0 = operand0;
333 _combine_rgb_source1 = CS_undefined;
334 _combine_rgb_operand1 = CO_undefined;
335 _combine_rgb_source2 = CS_undefined;
336 _combine_rgb_operand2 = CO_undefined;
338 update_color_flags();
348 CombineSource source0, CombineOperand operand0,
349 CombineSource source1, CombineOperand operand1) {
350 nassertv(get_expected_num_combine_operands(mode) == 2);
351 nassertv(operand_valid_for_rgb(operand0));
352 nassertv(operand_valid_for_rgb(operand1));
354 _num_combine_rgb_operands = 2;
355 _combine_rgb_mode = mode;
356 _combine_rgb_source0 = source0;
357 _combine_rgb_operand0 = operand0;
358 _combine_rgb_source1 = source1;
359 _combine_rgb_operand1 = operand1;
360 _combine_rgb_source2 = CS_undefined;
361 _combine_rgb_operand2 = CO_undefined;
363 update_color_flags();
372 CombineSource source0, CombineOperand operand0,
373 CombineSource source1, CombineOperand operand1,
374 CombineSource source2, CombineOperand operand2) {
375 nassertv(get_expected_num_combine_operands(mode) == 3);
376 nassertv(operand_valid_for_rgb(operand0));
377 nassertv(operand_valid_for_rgb(operand1));
378 nassertv(operand_valid_for_rgb(operand2));
380 _num_combine_rgb_operands = 3;
381 _combine_rgb_mode = mode;
382 _combine_rgb_source0 = source0;
383 _combine_rgb_operand0 = operand0;
384 _combine_rgb_source1 = source1;
385 _combine_rgb_operand1 = operand1;
386 _combine_rgb_source2 = source2;
387 _combine_rgb_operand2 = operand2;
389 update_color_flags();
397 return _combine_rgb_mode;
406 return _num_combine_rgb_operands;
414 return _combine_rgb_source0;
422 return _combine_rgb_operand0;
430 return _combine_rgb_source1;
438 return _combine_rgb_operand1;
446 return _combine_rgb_source2;
454 return _combine_rgb_operand2;
463 CombineSource source0, CombineOperand operand0) {
464 nassertv(get_expected_num_combine_operands(mode) == 1);
465 nassertv(operand_valid_for_alpha(operand0));
467 _num_combine_alpha_operands = 1;
468 _combine_alpha_mode = mode;
469 _combine_alpha_source0 = source0;
470 _combine_alpha_operand0 = operand0;
471 _combine_alpha_source1 = CS_undefined;
472 _combine_alpha_operand1 = CO_undefined;
473 _combine_alpha_source2 = CS_undefined;
474 _combine_alpha_operand2 = CO_undefined;
476 update_color_flags();
486 CombineSource source0, CombineOperand operand0,
487 CombineSource source1, CombineOperand operand1) {
488 nassertv(get_expected_num_combine_operands(mode) == 2);
489 nassertv(operand_valid_for_alpha(operand0));
490 nassertv(operand_valid_for_alpha(operand1));
492 _num_combine_alpha_operands = 2;
493 _combine_alpha_mode = mode;
494 _combine_alpha_source0 = source0;
495 _combine_alpha_operand0 = operand0;
496 _combine_alpha_source1 = source1;
497 _combine_alpha_operand1 = operand1;
498 _combine_alpha_source2 = CS_undefined;
499 _combine_alpha_operand2 = CO_undefined;
501 update_color_flags();
510 CombineSource source0, CombineOperand operand0,
511 CombineSource source1, CombineOperand operand1,
512 CombineSource source2, CombineOperand operand2) {
513 nassertv(get_expected_num_combine_operands(mode) == 3);
514 nassertv(operand_valid_for_alpha(operand0));
515 nassertv(operand_valid_for_alpha(operand1));
516 nassertv(operand_valid_for_alpha(operand2));
518 _num_combine_alpha_operands = 3;
519 _combine_alpha_mode = mode;
520 _combine_alpha_source0 = source0;
521 _combine_alpha_operand0 = operand0;
522 _combine_alpha_source1 = source1;
523 _combine_alpha_operand1 = operand1;
524 _combine_alpha_source2 = source2;
525 _combine_alpha_operand2 = operand2;
527 update_color_flags();
535 return _combine_alpha_mode;
544 return _num_combine_alpha_operands;
552 return _combine_alpha_source0;
560 return _combine_alpha_operand0;
568 return _combine_alpha_source1;
576 return _combine_alpha_operand1;
584 return _combine_alpha_source2;
592 return _combine_alpha_operand2;
601 return _involves_color_scale;
619 return _uses_primary_color;
628 return _uses_last_saved_result;
634 INLINE
bool TextureStage::
642 INLINE
bool TextureStage::
650 INLINE
bool TextureStage::
662 if (_default_stage ==
nullptr) {
665 return _default_stage;
684 _used_by_auto_shader =
true;
691 INLINE
void TextureStage::
692 update_color_flags() {
693 _involves_color_scale =
694 (_mode == M_blend_color_scale ||
695 (_mode == M_combine &&
696 (_combine_rgb_source0 == CS_constant_color_scale ||
697 _combine_rgb_source1 == CS_constant_color_scale ||
698 _combine_rgb_source2 == CS_constant_color_scale ||
699 _combine_alpha_source0 == CS_constant_color_scale ||
700 _combine_alpha_source1 == CS_constant_color_scale ||
701 _combine_alpha_source2 == CS_constant_color_scale)));
704 (_mode == M_blend || _mode == M_blend_color_scale ||
705 (_mode == M_combine &&
706 (_combine_rgb_source0 == CS_constant ||
707 _combine_rgb_source1 == CS_constant ||
708 _combine_rgb_source2 == CS_constant ||
709 _combine_alpha_source0 == CS_constant ||
710 _combine_alpha_source1 == CS_constant ||
711 _combine_alpha_source2 == CS_constant)));
713 _uses_primary_color =
714 (_mode == M_combine &&
715 (_combine_rgb_source0 == CS_primary_color ||
716 _combine_rgb_source1 == CS_primary_color ||
717 _combine_rgb_source2 == CS_primary_color ||
718 _combine_alpha_source0 == CS_primary_color ||
719 _combine_alpha_source1 == CS_primary_color ||
720 _combine_alpha_source2 == CS_primary_color));
722 _uses_last_saved_result =
723 (_mode == M_combine &&
724 (_combine_rgb_source0 == CS_last_saved_result ||
725 _combine_rgb_source1 == CS_last_saved_result ||
726 _combine_rgb_source2 == CS_last_saved_result ||
727 _combine_alpha_source0 == CS_last_saved_result ||
728 _combine_alpha_source1 == CS_last_saved_result ||
729 _combine_alpha_source2 == CS_last_saved_result));
731 if (_used_by_auto_shader) {
732 GraphicsStateGuardianBase::mark_rehash_generated_shaders();
736 INLINE std::ostream &
737 operator << (std::ostream &out,
const TextureStage &ts) {