Commit 368629e
committed
Fix texture scroll
Previous code assumed that a texture with a scroll textureMod would always wrap around when `scroll * backEnd.refdef.floatTime == floor( scroll * backEnd.refdef.floatTime )`. This is incorrect if the texture matrix had already been modified by another texMod, so the relevant values are no longer 1.0f and 0.0f. Fix this by using `scrollPeriod[0] / ( matrix[0] + matrix[4] )` and `scrollPeriod[0] / ( matrix[0] + matrix[4] )` to get the actual time at which wrap-around for `x` and `y` will occur, and use `fmodf( backEnd.refdef.floatTime, period )` to get the part that is equivalent to just using `backEnd.refdef.floatTime`, but without the value getting continuously larger.
Also NUKED some useless matrix computations from texMod scroll.1 parent 2a3ebd8 commit 368629e
1 file changed
Lines changed: 24 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
701 | 701 | | |
702 | 702 | | |
703 | 703 | | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
704 | 714 | | |
705 | 715 | | |
706 | 716 | | |
| |||
741 | 751 | | |
742 | 752 | | |
743 | 753 | | |
744 | | - | |
745 | | - | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
746 | 757 | | |
747 | | - | |
| 758 | + | |
| 759 | + | |
748 | 760 | | |
749 | 761 | | |
750 | 762 | | |
751 | 763 | | |
752 | 764 | | |
753 | | - | |
754 | | - | |
755 | | - | |
756 | 765 | | |
757 | 766 | | |
758 | | - | |
759 | | - | |
| 767 | + | |
| 768 | + | |
760 | 769 | | |
761 | | - | |
| 770 | + | |
| 771 | + | |
762 | 772 | | |
763 | 773 | | |
764 | 774 | | |
| |||
804 | 814 | | |
805 | 815 | | |
806 | 816 | | |
807 | | - | |
808 | | - | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
809 | 820 | | |
810 | | - | |
| 821 | + | |
| 822 | + | |
811 | 823 | | |
812 | 824 | | |
813 | 825 | | |
| |||
0 commit comments