This code has been declared by its author to be Public Domain code.
Download source code | Transform Texture! by Rob | 2002 |
| |
|
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 |
Rob, you wrote this for me like 3 years ago...and I'm just now using it...
Where are you hiding out Rob!!
|
|
Late thanks for a great function!
|
|
Late late thanks for a great function.
|
Code Archives Forum