Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


getting texture coordinates from a .MAP file

This topic is 5767 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

I am making a program to parse a .MAP file and generate a list of all the triangles that make up the map. As you may know, .MAP files give you planes that vertices lie on, and you have to generate the vertices. I''ve gottens as far as producing the triangles for a brush, but without the texture coordinates. Here is the equation I am using for calculating the texture coordinates:
tu = DotProduct(Vertex, UNormal)/width / UScale + UOffset/width

tv = DotProduct(Vertex, VNormal)/height / VScale + VOffset/height
width/height are the width and height of the texture. Since I am just using 1 texture right now, I defined the width/height by hand. I assumed these should be in pixels, am I wrong? The normal, scale and offset I get from the .MAP file. The Normal is the texture axis normal (whatever that means). There is one for U and one for V. The texture coordinates are extremely large numbers. The source of info I''m working from has a little function to scale them all down into the range of -1 to 1. I need to have mine in the range of 0 to 1, and this function doesn''t work anyway. So, I need to know if the above equations are correct, and how I can get the texture coordinates into the range of 0 to 1? Thanx. Proceeding on a brutal rampage is the obvious choice.

Share this post

Link to post
Share on other sites

  • 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!