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

.MAP files question

Started by amish1234 Mar 13, 2003 at 5:07 PM 0 replies 250+ views
Original Post
amish1234
amish1234
I am making a .MAP files parser. What I''m trying to do is take a .MAP file (created by Valve Hammer Editor) and make a new text file that is just a list of all the triangles with texture coordinates. I have used this tutorial: http://folk.uio.no/stefanha/Downloads/MAPFiles.zip. I am able to get all the vertices and even make triangle strips from them and sort them in clockwise order. The only thing I''m having trouble with is texture coordinates. The .MAP file contains something called a texture axis, which basically says what percentage of the X, Y, and Z components are used in determining tu and tv. There is one texture axis for U and one for V. Doing a dot product with a vertex (there is actually a little more in the equation, but thats basically it) gives you the texture coordinate, but it is a huge number, and may be negative. Once I have these huge texture coordinates, how can I get them into the range of 0 to 1 (for use with Direct3D)? Proceeding on a brutal rampage is the obvious choice.
___________________________________________________________Where to find the intensity (Updated Dec 28, 2004)Member of UBAAG (Unban aftermath Association of Gamedev)
amish1234
amish1234
To normalize the texture coordinates, I have tried the following.

For each brush:
Find the smallest tu and tv.
Subtract the smallest tu and tv from each tu and tv
Find the highest tu and tv (after the subtraction has occured)
Divide each tu and tv by the highest tu and tv


Subtracting the smallest tu and tv from each tu and tv should shift all the texture coordinates down so that the lowest value is 0. Dividing by the highest tu and tv should then make the highest value 1. I don''t understand why this doesn''t work. When this does work I will impliment a scaling factor so that larger walls repeat the texture an appropriate number of times.

Proceeding on a brutal rampage is the obvious choice.
___________________________________________________________Where to find the intensity (Updated Dec 28, 2004)Member of UBAAG (Unban aftermath Association of Gamedev)

Topic Locked

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

Sign in to reply to this topic.