Vector Gradient

De DigiWiki.

(Différences entre les versions)
Djphil (discuter | contributions)
(Page créée avec « <lsl> vector gradient(list vectors, float rangestart, float rangeend, float index) { // Originally coded by TigroSpottystripes Katsu // this function take as input a list co… »)
Modification suivante →

Version du 11 mars 2012 à 05:17

vector gradient(list vectors, float rangestart,  float rangeend, float index)
{
// Originally coded by TigroSpottystripes Katsu
// this function take as input a list containg vectors, a float specifying the min range of the input and another for the end, 
// and finally a float indication which point of the gradient ramp the result will be
    float transfindex = ((index - rangestart)/(rangeend - rangestart)) * (llGetListLength(vectors)- 1);//converts the index to the range of the vetors list
 
 
      integer pos = llFloor(transfindex); //get the position on the list
        float firstmulti =  (1-(transfindex-pos)); // the multiplier for the first vector
        float secondmulti = (transfindex-pos); //the multiplier for the second vector
 
        vector firstvec= (llList2Vector(vectors, pos) * firstmulti); //set how much of the first  vector will be passed
        vector secondvec = (llList2Vector(vectors, pos+1) * secondmulti); //same thign but with the next vector
         vector newvec = firstvec + secondvec ; //mix the two
 
         return newvec; //and the cross-fade is done =^.^=
}
Outils personnels
donate
Google Ads