Apply() private method

private Apply ( ) : void
return void
Ejemplo n.º 1
0
 static public int Apply(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         int argc = LuaDLL.lua_gettop(l);
         if (argc == 1)
         {
             UnityEngine.Texture2DArray self = (UnityEngine.Texture2DArray)checkSelf(l);
             self.Apply();
             pushValue(l, true);
             return(1);
         }
         else if (argc == 2)
         {
             UnityEngine.Texture2DArray self = (UnityEngine.Texture2DArray)checkSelf(l);
             System.Boolean             a1;
             checkType(l, 2, out a1);
             self.Apply(a1);
             pushValue(l, true);
             return(1);
         }
         else if (argc == 3)
         {
             UnityEngine.Texture2DArray self = (UnityEngine.Texture2DArray)checkSelf(l);
             System.Boolean             a1;
             checkType(l, 2, out a1);
             System.Boolean a2;
             checkType(l, 3, out a2);
             self.Apply(a1, a2);
             pushValue(l, true);
             return(1);
         }
         pushValue(l, false);
         LuaDLL.lua_pushstring(l, "No matched override function Apply to call");
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
    Texture2DArray GenerateTextureArray(Texture2D[] textures)
    {
        Texture2DArray textureArray = new Texture2DArray(
            // width, height, depth, format, mipmap
            textureSize, textureSize, textures.Length, textureFormat, true
        );

        for(int i = 0; i < textures.Length; i++) {
            textureArray.SetPixels(textures[i].GetPixels(), i);
        }
        textureArray.Apply();
        return textureArray;
    }
Ejemplo n.º 3
0
        static void GifImport()
        {
            string           path         = AssetDatabase.GetAssetPath(Selection.activeObject);
            List <Texture2D> array        = GetGifFrames(path);
            Texture2DArray   arrayTexture = new Texture2DArray(array.First().width, array.First().height, array.Count, TextureFormat.RGBA32, true, false);

            for (int i = 0; i < array.Count; i++)
            {
                arrayTexture.SetPixels(array[i].GetPixels(0), i, 0);
            }
            arrayTexture.Apply();
            AssetDatabase.CreateAsset(arrayTexture, path.Replace(".gif", ".asset"));
        }
 static public int Apply(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         if (argc == 1)
         {
             UnityEngine.Texture2DArray self = (UnityEngine.Texture2DArray)checkSelf(l);
             self.Apply();
             pushValue(l, true);
             return(1);
         }
         else if (argc == 2)
         {
             UnityEngine.Texture2DArray self = (UnityEngine.Texture2DArray)checkSelf(l);
             System.Boolean             a1;
             checkType(l, 2, out a1);
             self.Apply(a1);
             pushValue(l, true);
             return(1);
         }
         else if (argc == 3)
         {
             UnityEngine.Texture2DArray self = (UnityEngine.Texture2DArray)checkSelf(l);
             System.Boolean             a1;
             checkType(l, 2, out a1);
             System.Boolean a2;
             checkType(l, 3, out a2);
             self.Apply(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));
     }
 }
Ejemplo n.º 5
0
    void BuildTextureArray(TextureFormat format = TextureFormat.RGBA32, Color defaultColor = default(Color), bool linear = false)
    {
        int maxWidth = 0;
        int maxHeight = 0;
        foreach (var texture in textureList)
        {
            maxWidth = Mathf.Max(maxWidth, texture.width);
            maxHeight = Mathf.Max(maxHeight, texture.height);
        }

        textureArray = new Texture2DArray(maxWidth, maxHeight, textureList.Count, format, true, linear);

        for (int i = 0; i < textureList.Count; i++)
        {
            if (textureList[i].width < maxWidth || textureList[i].height < maxHeight)
                TextureScale.Bilinear(textureList[i], maxWidth, maxHeight);

            textureArray.SetPixels(textureList[i].GetPixels(), i);
        }
        textureArray.Apply();
    }