Skip to main content
GameDev.net gamedev.net
🔒 Locked

Transform values

Started by durfos May 26, 2009 at 8:57 PM 2 replies 1.1k views
Original Post
durfos
durfos
Hi, i have a little problem with textures, and need realize a calc to texturize tiles with precision. Already know what i need in calculations but i could not build the formula. The idea is, have a value example 404 get the third part like 404/3 (the divisor is a variable like the dividend) or A / B. The result of this, must be transformed in a value like X.XX (example 0.32), and the 100 percent is 1.00. That is the idea.
Stani R
Stani R
If you want to get texture coordinates out of some large number, you are missing one piece of information: the total number of subdivisions you want. 404 could be 0.79 (404/512 if you use 512 as the largest value) or 0.39 (if you use 404/1024). This is before taking the size of the texture into account, but it might be a good idea to use the size as your divisor, since you aren't gonna get sub-pixel precision.
durfos
durfos
Got it ! thanks !
Stani R
Stani R
Come to think of it, you said "tiles", are you referring to this article? If so, you can probably throw my advice out the window since I have no clue about this technique :)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.