This code has not been declared by its author to be Public Domain code, and therefore should not be assumed to be so.
Download source code | | Transform Texture! by Rob | (Posted 1+ years ago) |
| |
|
| This offsets a texture to center with your own rotation & scale. Very useful for shaders and stuff. Ever wanted to scale a texture and/or rotate it yet keep it in the middle? Now you can! |
Function TransTex(texture,angle#,scale#=1)
ScaleTexture texture,scale,scale
RotateTexture texture,angle#
x#=Cos(angle)/scale/2
y#=Sin(angle)/scale/2
PositionTexture texture,(x-.5)-y,(y-.5)+x
End Function |
Comments| Jams | (Posted 1+ years ago) |
|
Lovely :)
|
| Chroma | (Posted 1+ years ago) |
|
Rob, you wrote this for me like 3 years ago...and I'm just now using it...
Where are you hiding out Rob!!
|
| Hujiklo | (Posted 1+ years ago) |
|
Late thanks for a great function!
|
| Kryzon | (Posted 1+ years ago) |
|
Late late thanks for a great function.
|
Code Archives Forum