Objects - using the texture

View previous topic View next topic Go down

Objects - using the texture

Post by liquid_ on Fri Sep 14, 2012 12:02 pm

Could someone explain to me how to deal with texture and its coordinates? I'm trying to make an object (.csv file). I want to fill a rectangular surface (say 3m X 3m, coord.: (0,0,0), (-3,0,0), (-3,0,3), (0,0,3)) with a texture 32b X 32b in size in file texture.bmp. How to use SetTextureCoordinates in this case?

liquid_

Posts : 26
Join date : 2012-05-15

Back to top Go down

Re: Objects - using the texture

Post by Quork on Fri Sep 14, 2012 1:42 pm

SetTextureCoordinates 0,31,31
SetTextureCoordinates 1,0,31
SetTextureCoordinates 2,0,0
SetTextureCoordinates 3,0,31
avatar
Quork

Posts : 1106
Join date : 2012-05-05
Age : 26
Location : Hofheim a.T., Hessen (Hesse), European Union

Back to top Go down

Re: Objects - using the texture

Post by Dexter on Fri Sep 14, 2012 2:51 pm

You are totally wrong, Quork!

Liquid, if you are starting the AddFace with TOP LEFT corner, it goes like this:

SetTextureCoordinates 0,0,0
SetTextureCoordinates 1,1,0
SetTextureCoordinates 2,1,1
SetTextureCoordinates 3,0,1

Let me explain
1st parameter refers to the actual vertex (their indexes start at 0) -> SetTextureCoordinates 0
2nd parameter refers to height of the texture, which is taken from top to bottom of the picture. In the upper left corner of the object you need upper left of the texture. Hence SetTextureCoordinates 0,0
3rd parameter refers to width of the texture, which is taken from left to right. So, in the upper left corner of the object you need upper left of the texture. Hence SetTextureCoordinates 0,0,0

Should you need more detailed explanation, do no hesitate to ask.


Last edited by Derryck on Fri Sep 14, 2012 6:02 pm; edited 3 times in total
avatar
Dexter

Posts : 1842
Join date : 2011-07-08
Age : 32
Location : Brno, Czech republic

http://www.brnobve.eu

Back to top Go down

Re: Objects - using the texture

Post by Quork on Fri Sep 14, 2012 3:08 pm

Uh yes, sorry. Mixed it up with another format (not BVE). That's what happens when you answer a seemingly simple question while thinking about elsething...
avatar
Quork

Posts : 1106
Join date : 2012-05-05
Age : 26
Location : Hofheim a.T., Hessen (Hesse), European Union

Back to top Go down

Re: Objects - using the texture

Post by liquid_ on Fri Sep 14, 2012 3:54 pm

Thanks, that worked. As I suppose, if I give numbers greater than 1 ( say 4) as coordinates X and Y this will mean texture will be stretched so that it'll fit 4 times in each of the dimentions of the polygon. Am I right?

liquid_

Posts : 26
Join date : 2012-05-15

Back to top Go down

Re: Objects - using the texture

Post by Dexter on Fri Sep 14, 2012 5:12 pm

Exactly.:-)
avatar
Dexter

Posts : 1842
Join date : 2011-07-08
Age : 32
Location : Brno, Czech republic

http://www.brnobve.eu

Back to top Go down

Re: Objects - using the texture

Post by Dexter on Fri Sep 14, 2012 5:14 pm

Quork wrote:Uh yes, sorry. Mixed it up with another format (not BVE). That's what happens when you answer a seemingly simple question while thinking about elsething...

Very Happy Yea I know, it happens.:-) Sorry fot the caps, I was not screaming, I just need to have it switched on at work. Smile
avatar
Dexter

Posts : 1842
Join date : 2011-07-08
Age : 32
Location : Brno, Czech republic

http://www.brnobve.eu

Back to top Go down

Re: Objects - using the texture

Post by graymac on Fri Sep 14, 2012 5:34 pm

http://celtictrainsim.com/publs.html

eejits guide might help.
avatar
graymac

Posts : 1748
Join date : 2011-08-28
Location : Co Mayo, Eire

http://www.celtictrainsim.com

Back to top Go down

Re: Objects - using the texture

Post by liquid_ on Fri Sep 14, 2012 7:28 pm

This guide looks pretty useful. Thanks.

liquid_

Posts : 26
Join date : 2012-05-15

Back to top Go down

Re: Objects - using the texture

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum