#### Archived

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

# Mapping a texture on several squars in a staggered iso map

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

## Recommended Posts

Hello! I have stumbled across a problem that is hard to find a solution for... My isometric map has the following coordinate system... (0,6)-(1,6)-(2,6)-(3,6)- ----------------------- -(0,5)-(1,5)-(2,5)-(3,5) ----------------------- (0,4)-(1,4)-(2,4)-(3,4)- ----------------------- -(0,3)-(1,3)-(2,2)-(3,3) ----------------------- (0,2)-(1,2)-(2,2)-(3,2)- ----------------------- -(0,1)-(1,1)-(2,1)-(3,1) ----------------------- (0,0)-(1,0)-(2,0)-(3,0)- ...and I want to map a texture over several quads. So if I stretch my texture over 4 quads starting at square (2,0) it would look somthing like this: Map squars ////////////////////////// ---------(2,6)---------- ----------------------- ------(1,5)-(2,5)------- ----------------------- ---(1,4)-(2,4)-(3,4)---- ----------------------- (0,3)-(1,3)-(2,3)-(3,3)- ----------------------- ---(1,2)-(2,2)-(3,2)---- ----------------------- ------(1,1)-(2,1)------- ----------------------- ---------(2,0)---------- Texture squars ////////////////////////// ---------(5,3)---------- ----------------------- ------(4,3)-(5,2)------- ----------------------- ---(3,3)-(4,2)-(5,1)---- ----------------------- (2,3)-(3,2)-(4,1)-(5,0)- ----------------------- ---(2,2)-(3,1)-(4,0)---- ----------------------- ------(2,1)-(3,0)------- ----------------------- ---------(2,0)---------- I´m looking for a simple formula to convert from isometric map space to ordinary rectangular texture space... or something. For example. How can I find out which texture square I should pick on map suare (3,4)? By looking at the picutre, everyone can see that it´s square (5,1) but how can the the computer calculate that? Thanks, [edited by - Gandalf on July 30, 2002 11:02:56 AM] [edited by - Gandalf on July 30, 2002 11:04:45 AM]

##### Share on other sites
I fixed it. I needed this lookup table:

  POINT texArray[] ={ {0,0}, {1,3}, {2,2}, {3,1}, {1,0}, {2,3}, {3,2}, {0,1}, {1,1}, {2,0}, {3,3}, {0,2}, {2,1}, {3,0}, {0,3}, {1,2}, {2,2}, {3,1}, {0,0}, {1,3}, {3,2}, {0,1}, {1,0}, {2,3}, {3,3}, {0,2}, {1,1}, {2,0}, {0,3}, {1,2}, {2,1}, {3,0}};

and this calculation:

  int offset = (y%8)*4+(x%4);		txSolid = texArray[offset].x*fTileSizeSolid;tySolid = texArray[offset].y*fTileSizeSolid;

Thanks anyway,

Gandalf the Black

1. 1
Rutin
30
2. 2
3. 3
4. 4
5. 5

• 13
• 14
• 11
• 10
• 14
• ### Forum Statistics

• Total Topics
632961
• Total Posts
3009496
• ### Who's Online (See full list)

There are no registered users currently online

×