Difference between revisions of "LlGetTextureScale"

From Second Life Wiki
Jump to navigation Jump to search
m
Line 36: Line 36:
         vector scale_vector = llGetTextureScale(face);  
         vector scale_vector = llGetTextureScale(face);  
         llOwnerSay("llGetTextureScale(0) gives a vector :  " +  (string)scale_vector);  
         llOwnerSay("llGetTextureScale(0) gives a vector :  " +  (string)scale_vector);  
         //You can see that the first 2 values of the vector contain the U_repeats and V_repeats values wehavesetted
         //You can see that the first 2 values of the vector contain the U_repeats and V_repeats values we have setted.


         //The object edit window, in the Texture tab, shows the changes of the U and V values, but only fo face 0.  
         //The object edit window, in the Texture tab, shows the changes of the U and V values, but only for face 0.  
         //Other faces changes are done but do not show in the edit window.   
         //Other faces changes are done but do not show in the edit window.   
     }
     }

Revision as of 22:28, 7 January 2011

Summary

Function: vector llGetTextureScale( integer side );

Returns a vector that is the texture scale of side in the x and y components.

• integer side face number or ALL_SIDES

If side is ALL_SIDES then the function works on all sides.

Specification

In the default texture mapping mode the scale units are in texture repeats per face. In the planar texture mapping mode the scale units are in texture repeats per half meter. This is in contrast to the in-world editing tool, in which the planar texture scaling units are repeats per meter.

Caveats

  • The function silently fails if its side value indicates a face that does not exist.
  • ALL_SIDES seems to return the scale of the *first* face, not an average or other function of all the faces. It acts much like if it were called with side=0.
All Issues ~ Search JIRA for related Bugs

Examples

<lsl>//Script by Basil Wijaya, 2009 August 08 //Sets texture scale on face 0. //Corresponds to the object edit window, Texture tab, Repeats per Face: Horiontal U and Vertical V

float U_repeats = 1.0; float V_repeats = 1.0; integer face = 0;

default {

   state_entry()
   {
       llScaleTexture( U_repeats, V_repeats, ALL_SIDES);  
   }
   
   touch_start(integer num)
   {
       U_repeats = U_repeats + .2;
       V_repeats = V_repeats + .5;
       
       //set texture scale on a face
       llScaleTexture( U_repeats , V_repeats, face);
       llOwnerSay("Scale has been set to " + (string)U_repeats +  " and " +  (string)V_repeats);
       //get texture scale of a face
       vector scale_vector = llGetTextureScale(face); 
       llOwnerSay("llGetTextureScale(0) gives a vector :  " +  (string)scale_vector); 
       //You can see that the first 2 values of the vector contain the U_repeats and V_repeats values we have setted.
       //The object edit window, in the Texture tab, shows the changes of the U and V values, but only for face 0. 
       //Other faces changes are done but do not show in the edit window.  
   }
}</lsl>

See Also

Functions

•  llScaleTexture

Deep Notes

Search JIRA for related Issues

Signature

function vector llGetTextureScale( integer side );