Jump to content
  • Advertisement
Sign in to follow this  
SirDeathKnight

Face Specifics

This topic is 2563 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey everyone!
does anyone at all know how I can calculate the width of a face so I am able to get the TL, TR, BL BR (Top Left, Bottom Left etc) values correctly.

I am able to draw all the verticies perfectly well and am able to view them in blender and a game engine being written, the thing is I need to be able to calculate the texture coordinates to allow for shift, stretch etc, to do this I need to get the above values and perform a calculation on them and I am unsure how to obtain these values when some of the faces have more than or less than 4 verticies.

any help would be greatly appreciated.

thanks.

Share this post


Link to post
Share on other sites
Advertisement
If you are looking for the width between two points, its as simple as find the distance between the two points (dX= TR.x - TL.x, dY= TR.y - TL.y ), then distance can be calculated by taking the square root of

distance = squareroot(dX[size="4"]² + dY[size="4"]²)


Of course, if you just want the distance along a single axis between two points, it's just a matter of point2.x - point1.x == width


Truth of the matter is, I don't think this is what you are looking for, what you want is UV coordinates.

Share this post


Link to post
Share on other sites
I was under the impression that if I am able to calculate the following sum:

'256 / 64 * 0.25'

256 = texture width
64 = face width
0.25 = the stretch

then the total is == 1

which is the kind of coordinates I was expecting? is this not correct?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!