SetColorArray() публичный Метод

Set a color array property.

public SetColorArray ( int nameID, Color values ) : void
nameID int Property name ID, use Shader.PropertyToID to get it.
values Color Array of values to set.
Результат void
Пример #1
0
    static int SetColorArray(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 3 && TypeChecker.CheckTypes <int, UnityEngine.Color[]>(L, 2))
            {
                UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject <UnityEngine.Material>(L, 1);
                int arg0 = (int)LuaDLL.lua_tonumber(L, 2);
                UnityEngine.Color[] arg1 = ToLua.ToStructArray <UnityEngine.Color>(L, 3);
                obj.SetColorArray(arg0, arg1);
                return(0);
            }
            else if (count == 3 && TypeChecker.CheckTypes <string, UnityEngine.Color[]>(L, 2))
            {
                UnityEngine.Material obj = (UnityEngine.Material)ToLua.CheckObject <UnityEngine.Material>(L, 1);
                string arg0 = ToLua.ToString(L, 2);
                UnityEngine.Color[] arg1 = ToLua.ToStructArray <UnityEngine.Color>(L, 3);
                obj.SetColorArray(arg0, arg1);
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Material.SetColorArray"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Пример #2
0
 static public int SetColorArray(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         if (matchType(l, argc, 2, typeof(int), typeof(UnityEngine.Color[])))
         {
             UnityEngine.Material self = (UnityEngine.Material)checkSelf(l);
             System.Int32         a1;
             checkType(l, 2, out a1);
             UnityEngine.Color[] a2;
             checkArray(l, 3, out a2);
             self.SetColorArray(a1, a2);
             pushValue(l, true);
             return(1);
         }
         else if (matchType(l, argc, 2, typeof(string), typeof(UnityEngine.Color[])))
         {
             UnityEngine.Material self = (UnityEngine.Material)checkSelf(l);
             System.String        a1;
             checkType(l, 2, out a1);
             UnityEngine.Color[] a2;
             checkArray(l, 3, out a2);
             self.SetColorArray(a1, a2);
             pushValue(l, true);
             return(1);
         }
         pushValue(l, false);
         LuaDLL.lua_pushstring(l, "No matched override function to call");
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
    public void ApplyToMaterial(Material material)
    {
        material.SetInt("layerCount", layers.Length);

        // lambda's!
        material.SetColorArray("baseColors", layers.Select(x => x.tint).ToArray());
        material.SetFloatArray("baseStartHeights", layers.Select(x => x.startHeight).ToArray());
        material.SetFloatArray("baseBlends", layers.Select(x => x.blendStrength).ToArray());
        material.SetFloatArray("baseColorStrengths", layers.Select(x => x.tintStrength).ToArray());
        material.SetFloatArray("baseTextureScales", layers.Select(x => x.textureScale).ToArray());

        Texture2DArray texturesArray = GenerateTextureArray(layers.Select(x => x.texture).ToArray());
        material.SetTexture("baseTextures", texturesArray);

        UpdateMeshHeights(material, savedMinHeight, savedMaxHeight);
    }