Posted by R.Stone on March 01, 2000 at 15:28:01:
In reply to: Mapping the meshes posted by E.Popov on March 01, 2000 at 06:48:37:
> You must make some corrections on texture coordinates before using them for
> mapping meshes (I think it's the same thing when mapping the rooms, but I
> didn't test, and the problem should be less visible because faces making a
> room are typically large). Specifically, you have to add / substract one to
> u,v coordinates, based on these rules:
>
> - if the coord. is the min. coord for the face, add 1
> - if the coord. is the max. coord for the face, sub 1
Actually, it's simpler than that. The .Xcoordinate and .Ycoordinate values
can be anything, but are typically 0/1/255. If you simply add that value to
the corresponding .Xpixel/.Ypixel AS A BITU8 (e.g. adding 255 is just like
subtracting 1), you get the appropriate texture coordinate (on a 0..256 scale).
And yes, it's the same for the room textures.
As soon as I can get some free time, I'll post some source code that you
guys might find interesting. Unfortunately, the executable only runs well
on a system with good (hardware) OpenGL - I get 20-70fps on my TNT2Ultra, but
it's "seconds-per-frame" on my ATI Rage Pro. Stay tuned...
-- R.Stone