In Antwort auf:

I could have just used yours




But now you have more experience in shaderprogramming (or converting).