Example #1
0
 public static void ApplyValueLerp(AMMaterialTrack.ValueType valueType, string prop, int propId, Material mat, AMMaterialKey fromKey, AMMaterialKey toKey, float t)
 {
     switch(valueType) {
         case AMMaterialTrack.ValueType.Float:
         case AMMaterialTrack.ValueType.Range:
             mat.SetFloat(propId, Mathf.Lerp(fromKey.val, toKey.val, t));
             break;
         case AMMaterialTrack.ValueType.Vector:
             mat.SetVector(propId, Vector4.Lerp(fromKey.vector, toKey.vector, t));
             break;
         case AMMaterialTrack.ValueType.Color:
             mat.SetColor(propId, Color.Lerp(fromKey.color, toKey.color, t));
             break;
         case AMMaterialTrack.ValueType.TexOfs:
             mat.SetTextureOffset(prop, Vector2.Lerp(fromKey.texOfs, toKey.texOfs, t));
             break;
         case AMMaterialTrack.ValueType.TexScale:
             mat.SetTextureScale(prop, Vector2.Lerp(fromKey.texScale, toKey.texScale, t));
             break;
     }
 }
Example #2
0
 public bool targetsAreEqual(AMMaterialTrack.ValueType valueType, AMMaterialKey nextKey)
 {
     if(nextKey) {
         if(valueType == AMMaterialTrack.ValueType.Float || valueType == AMMaterialTrack.ValueType.Range) return val == nextKey.val;
         if(valueType == AMMaterialTrack.ValueType.Vector) return vector == nextKey.vector;
         if(valueType == AMMaterialTrack.ValueType.Color) return color == nextKey.color;
         if(valueType == AMMaterialTrack.ValueType.TexOfs) return texOfs == nextKey.texOfs;
         if(valueType == AMMaterialTrack.ValueType.TexScale) return texScale == nextKey.texScale;
     }
     return false;
 }
Example #3
0
        public string getValueString(AMMaterialTrack.ValueType valueType, AMMaterialKey nextKey, bool brief)
        {
            System.Text.StringBuilder s = new System.Text.StringBuilder();

            switch(valueType) {
                case AMMaterialTrack.ValueType.Float:
                case AMMaterialTrack.ValueType.Range:
                    s.Append(formatNumeric(val));
                    if(!brief && nextKey) { s.Append(" -> "); s.Append(formatNumeric(nextKey.val)); }
                    break;
                case AMMaterialTrack.ValueType.Vector:
                    s.Append(_val4.ToString());
                    if(!brief && nextKey) { s.Append(" -> "); s.Append(nextKey._val4.ToString()); }
                    break;
                case AMMaterialTrack.ValueType.Color:
                    s.Append(color.ToString());
                    if(!brief && nextKey) { s.Append(" -> "); s.Append(nextKey.color.ToString()); }
                    break;
                case AMMaterialTrack.ValueType.TexEnv:
                    s.Append(texture ? texture.name : "None");
                    break;
                case AMMaterialTrack.ValueType.TexOfs:
                    s.Append(texOfs.ToString());
                    if(!brief && nextKey) { s.Append(" -> "); s.Append(nextKey.texOfs.ToString()); }
                    break;
                case AMMaterialTrack.ValueType.TexScale:
                    s.Append(texScale.ToString());
                    if(!brief && nextKey) { s.Append(" -> "); s.Append(nextKey.texScale.ToString()); }
                    break;
            }

            return s.ToString();
        }