The Clover - TextureAtlas helper is a script that automatically scales, and positions a prims texture to display a specific box on a grid texture. This is helpful when you have one texture, split up into rows and columns, displaying different information. Texture Atlases are used in the gaming world to utilize one texture, but output different visuals. for instance: If you have a texture that is split up in rows of 3, and columns of 3, you can output 9 different visuals, from one texture map. This is helpful for reducing texture loading time, lag, and effort/cost on the creators end. A problem that I ran into, when making multiple signs from one texture map, was manually scaling, and determining the offset that each prim needed, in order to display each visual. I decided to create a script that automatically scales your texture, and sets the offset to display the information you need to display in each box. I have made the script, mostly open. The engine script is no-mod, but the Demo script makes it easy for you to change any value you want, without damaging the source script.
♥ How it works ♥
* I suggest you know basic scripting to use this item.
- Drop your "Clover - TextureAtlas helper: Demo script" and the "Clover - TextureAtlas helper: Engine" into the prim you want to change textures.
-Open up the Demo script. I have some functions already made, to make it easier for you to work with.
- You will see Three different functions in the Touch_start event:
~ChangeUvSquares(<1,1,0>); = This is the function where you determine how many boxes are in each row and column of your grid. The first number is how many column you have, and the second number is how many rows you have. Since this is a 2D texture, ignore the last number. it should ALWAYS be 0.
~ChangeUvFace(0); = This is the number indicating which face of this object you want to change.
~ChangeUvGrid(<2,2,0>); = This is the function that actually changes the grid box to display. This indicates that you want to display the box on column 2, row 2. The last number is ALWAYS 0.