Vector Gradient

De DigiWiki.

(Différences entre les versions)
(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… »)
 
Ligne 5 : Ligne 5 :
// this function take as input a list containg vectors, a float specifying the min range of the input and another for the end,  
// 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
// 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
+
 
-
   
+
  // converts the index to the range of the vetors list
-
   
+
  float transfindex = ((index - rangestart)/(rangeend - rangestart)) * (llGetListLength(vectors)- 1);  
-
      integer pos = llFloor(transfindex); //get the position on the list
+
 
-
        float firstmulti =  (1-(transfindex-pos)); // the multiplier for the first vector
+
  integer pos = llFloor(transfindex); //get the position on the list
-
        float secondmulti = (transfindex-pos); //the multiplier for the second vector
+
 
 +
  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 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 secondvec = (llList2Vector(vectors, pos+1) * secondmulti); //same thign but with the next vector
-
        vector newvec = firstvec + secondvec ; //mix the two
+
  vector newvec = firstvec + secondvec ; //mix the two
          
          
-
        return newvec; //and the cross-fade is done =^.^=
+
  return newvec; //and the cross-fade is done =^.^=
}
}
</lsl>
</lsl>

Version actuelle en date du 11 mars 2012 à 05:19

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
 
  // converts the index to the range of the vetors list
  float transfindex = ((index - rangestart)/(rangeend - rangestart)) * (llGetListLength(vectors)- 1);    
 
  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
  • Cette page a été consultée 660 fois.
donate
Google Ads