Class for handling 2D texture arrays.

Inheritance: Texture
 static public int GetPixels32(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         if (argc == 2)
         {
             UnityEngine.Texture2DArray self = (UnityEngine.Texture2DArray)checkSelf(l);
             System.Int32 a1;
             checkType(l, 2, out a1);
             var ret = self.GetPixels32(a1);
             pushValue(l, true);
             pushValue(l, ret);
             return(2);
         }
         else if (argc == 3)
         {
             UnityEngine.Texture2DArray self = (UnityEngine.Texture2DArray)checkSelf(l);
             System.Int32 a1;
             checkType(l, 2, out a1);
             System.Int32 a2;
             checkType(l, 3, out a2);
             var ret = self.GetPixels32(a1, a2);
             pushValue(l, true);
             pushValue(l, ret);
             return(2);
         }
         pushValue(l, false);
         LuaDLL.lua_pushstring(l, "No matched override function to call");
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Beispiel #2
0
 static public int get_format(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
         UnityEngine.Texture2DArray self = (UnityEngine.Texture2DArray)checkSelf(l);
         pushValue(l, true);
         pushEnum(l, (int)self.format);
         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
 }
Beispiel #3
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
 }
Beispiel #4
0
 /// <summary>
 /// Read the data using the reader.
 /// </summary>
 /// <param name="reader">Reader.</param>
 public override object Read(ISaveGameReader reader)
 {
     UnityEngine.Texture2DArray texture2DArray = new UnityEngine.Texture2DArray(
         reader.ReadProperty <System.Int32>(),
         reader.ReadProperty <System.Int32>(),
         reader.ReadProperty <System.Int32>(),
         TextureFormat.ARGB32,
         true);
     ReadInto(texture2DArray, reader);
     return(texture2DArray);
 }
 static public int get_format(IntPtr l)
 {
     try {
         UnityEngine.Texture2DArray self = (UnityEngine.Texture2DArray)checkSelf(l);
         pushValue(l, true);
         pushEnum(l, (int)self.format);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int get_depth(IntPtr l)
 {
     try {
         UnityEngine.Texture2DArray self = (UnityEngine.Texture2DArray)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.depth);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
    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;
    }
 static public int constructor(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         UnityEngine.Texture2DArray o;
         if (argc == 6)
         {
             System.Int32 a1;
             checkType(l, 2, out a1);
             System.Int32 a2;
             checkType(l, 3, out a2);
             System.Int32 a3;
             checkType(l, 4, out a3);
             UnityEngine.TextureFormat a4;
             checkEnum(l, 5, out a4);
             System.Boolean a5;
             checkType(l, 6, out a5);
             o = new UnityEngine.Texture2DArray(a1, a2, a3, a4, a5);
             pushValue(l, true);
             pushValue(l, o);
             return(2);
         }
         else if (argc == 7)
         {
             System.Int32 a1;
             checkType(l, 2, out a1);
             System.Int32 a2;
             checkType(l, 3, out a2);
             System.Int32 a3;
             checkType(l, 4, out a3);
             UnityEngine.TextureFormat a4;
             checkEnum(l, 5, out a4);
             System.Boolean a5;
             checkType(l, 6, out a5);
             System.Boolean a6;
             checkType(l, 7, out a6);
             o = new UnityEngine.Texture2DArray(a1, a2, a3, a4, a5, a6);
             pushValue(l, true);
             pushValue(l, o);
             return(2);
         }
         return(error(l, "New object failed."));
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Beispiel #9
0
        /// <summary>
        /// Write the specified value using the writer.
        /// </summary>
        /// <param name="value">Value.</param>
        /// <param name="writer">Writer.</param>
        public override void Write(object value, ISaveGameWriter writer)
        {
            UnityEngine.Texture2DArray texture2DArray = (UnityEngine.Texture2DArray)value;
            writer.WriteProperty("width", texture2DArray.width);
            writer.WriteProperty("height", texture2DArray.height);
            writer.WriteProperty("depth", texture2DArray.depth);
            writer.WriteProperty("dimension", texture2DArray.dimension);
            writer.WriteProperty("filterMode", texture2DArray.filterMode);
            writer.WriteProperty("anisoLevel", texture2DArray.anisoLevel);
            writer.WriteProperty("wrapMode", texture2DArray.wrapMode);
#if UNITY_2017_1_OR_NEWER
            writer.WriteProperty("wrapModeU", texture2DArray.wrapModeU);
            writer.WriteProperty("wrapModeV", texture2DArray.wrapModeV);
            writer.WriteProperty("wrapModeW", texture2DArray.wrapModeW);
#endif
            writer.WriteProperty("mipMapBias", texture2DArray.mipMapBias);
            writer.WriteProperty("name", texture2DArray.name);
            writer.WriteProperty("hideFlags", texture2DArray.hideFlags);
        }
 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 Apply to call");
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int SetPixels(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         if (argc == 3)
         {
             UnityEngine.Texture2DArray self = (UnityEngine.Texture2DArray)checkSelf(l);
             UnityEngine.Color[]        a1;
             checkArray(l, 2, out a1);
             System.Int32 a2;
             checkType(l, 3, out a2);
             self.SetPixels(a1, a2);
             pushValue(l, true);
             return(1);
         }
         else if (argc == 4)
         {
             UnityEngine.Texture2DArray self = (UnityEngine.Texture2DArray)checkSelf(l);
             UnityEngine.Color[]        a1;
             checkArray(l, 2, out a1);
             System.Int32 a2;
             checkType(l, 3, out a2);
             System.Int32 a3;
             checkType(l, 4, out a3);
             self.SetPixels(a1, a2, a3);
             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));
     }
 }
Beispiel #12
0
 static public int constructor(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);
         UnityEngine.Texture2DArray o;
         if (matchType(l, argc, 2, typeof(int), typeof(int), typeof(int), typeof(UnityEngine.Experimental.Rendering.GraphicsFormat), typeof(UnityEngine.Experimental.Rendering.TextureCreationFlags)))
         {
             System.Int32 a1;
             checkType(l, 2, out a1);
             System.Int32 a2;
             checkType(l, 3, out a2);
             System.Int32 a3;
             checkType(l, 4, out a3);
             UnityEngine.Experimental.Rendering.GraphicsFormat a4;
             a4 = (UnityEngine.Experimental.Rendering.GraphicsFormat)LuaDLL.luaL_checkinteger(l, 5);
             UnityEngine.Experimental.Rendering.TextureCreationFlags a5;
             a5 = (UnityEngine.Experimental.Rendering.TextureCreationFlags)LuaDLL.luaL_checkinteger(l, 6);
             o  = new UnityEngine.Texture2DArray(a1, a2, a3, a4, a5);
             pushValue(l, true);
             pushValue(l, o);
             return(2);
         }
         else if (argc == 7)
         {
             System.Int32 a1;
             checkType(l, 2, out a1);
             System.Int32 a2;
             checkType(l, 3, out a2);
             System.Int32 a3;
             checkType(l, 4, out a3);
             UnityEngine.TextureFormat a4;
             a4 = (UnityEngine.TextureFormat)LuaDLL.luaL_checkinteger(l, 5);
             System.Boolean a5;
             checkType(l, 6, out a5);
             System.Boolean a6;
             checkType(l, 7, out a6);
             o = new UnityEngine.Texture2DArray(a1, a2, a3, a4, a5, a6);
             pushValue(l, true);
             pushValue(l, o);
             return(2);
         }
         else if (matchType(l, argc, 2, typeof(int), typeof(int), typeof(int), typeof(UnityEngine.TextureFormat), typeof(bool)))
         {
             System.Int32 a1;
             checkType(l, 2, out a1);
             System.Int32 a2;
             checkType(l, 3, out a2);
             System.Int32 a3;
             checkType(l, 4, out a3);
             UnityEngine.TextureFormat a4;
             a4 = (UnityEngine.TextureFormat)LuaDLL.luaL_checkinteger(l, 5);
             System.Boolean a5;
             checkType(l, 6, out a5);
             o = new UnityEngine.Texture2DArray(a1, a2, a3, a4, a5);
             pushValue(l, true);
             pushValue(l, o);
             return(2);
         }
         return(error(l, "New object failed."));
     }
     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
 }
Beispiel #13
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();
    }
Beispiel #14
0
        /// <summary>
        /// Read the data into the specified value.
        /// </summary>
        /// <param name="value">Value.</param>
        /// <param name="reader">Reader.</param>
        public override void ReadInto(object value, ISaveGameReader reader)
        {
            UnityEngine.Texture2DArray texture2DArray = (UnityEngine.Texture2DArray)value;
            foreach (string property in reader.Properties)
            {
                switch (property)
                {
                case "width":
                    reader.ReadProperty <System.Int32>();
                    break;

                case "height":
                    reader.ReadProperty <System.Int32>();
                    break;

                case "depth":
                    reader.ReadProperty <System.Int32>();
                    break;

                case "dimension":
                    reader.ReadProperty <UnityEngine.Rendering.TextureDimension>();
                    break;

                case "filterMode":
                    texture2DArray.filterMode = reader.ReadProperty <UnityEngine.FilterMode>();
                    break;

                case "anisoLevel":
                    texture2DArray.anisoLevel = reader.ReadProperty <System.Int32>();
                    break;

                case "wrapMode":
                    texture2DArray.wrapMode = reader.ReadProperty <UnityEngine.TextureWrapMode>();
                    break;

                case "wrapModeU":
#if UNITY_2017_1_OR_NEWER
                    texture2DArray.wrapModeU = reader.ReadProperty <UnityEngine.TextureWrapMode>();
#else
                    reader.ReadProperty <UnityEngine.TextureWrapMode>();
#endif
                    break;

                case "wrapModeV":
#if UNITY_2017_1_OR_NEWER
                    texture2DArray.wrapModeV = reader.ReadProperty <UnityEngine.TextureWrapMode>();
#else
                    reader.ReadProperty <UnityEngine.TextureWrapMode>();
#endif
                    break;

                case "wrapModeW":
#if UNITY_2017_1_OR_NEWER
                    texture2DArray.wrapModeW = reader.ReadProperty <UnityEngine.TextureWrapMode>();
#else
                    reader.ReadProperty <UnityEngine.TextureWrapMode>();
#endif
                    break;

                case "mipMapBias":
                    texture2DArray.mipMapBias = reader.ReadProperty <System.Single>();
                    break;

                case "name":
                    texture2DArray.name = reader.ReadProperty <System.String>();
                    break;

                case "hideFlags":
                    texture2DArray.hideFlags = reader.ReadProperty <UnityEngine.HideFlags>();
                    break;
                }
            }
        }
 static public int constructor(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         UnityEngine.Texture2DArray o;
         if (argc == 8)
         {
             System.Int32 a1;
             checkType(l, 3, out a1);
             System.Int32 a2;
             checkType(l, 4, out a2);
             System.Int32 a3;
             checkType(l, 5, out a3);
             UnityEngine.TextureFormat a4;
             checkEnum(l, 6, out a4);
             System.Boolean a5;
             checkType(l, 7, out a5);
             System.Boolean a6;
             checkType(l, 8, out a6);
             o = new UnityEngine.Texture2DArray(a1, a2, a3, a4, a5, a6);
             pushValue(l, true);
             pushValue(l, o);
             return(2);
         }
         else if (matchType(l, "ctor__Int32__Int32__Int32__GraphicsFormat__TextureCreationFlags", argc, 2, typeof(int), typeof(int), typeof(int), typeof(UnityEngine.Experimental.Rendering.GraphicsFormat), typeof(UnityEngine.Experimental.Rendering.TextureCreationFlags)))
         {
             System.Int32 a1;
             checkType(l, 3, out a1);
             System.Int32 a2;
             checkType(l, 4, out a2);
             System.Int32 a3;
             checkType(l, 5, out a3);
             UnityEngine.Experimental.Rendering.GraphicsFormat a4;
             checkEnum(l, 6, out a4);
             UnityEngine.Experimental.Rendering.TextureCreationFlags a5;
             checkEnum(l, 7, out a5);
             o = new UnityEngine.Texture2DArray(a1, a2, a3, a4, a5);
             pushValue(l, true);
             pushValue(l, o);
             return(2);
         }
         else if (matchType(l, "ctor__Int32__Int32__Int32__TextureFormat__Boolean", argc, 2, typeof(int), typeof(int), typeof(int), typeof(UnityEngine.TextureFormat), typeof(bool)))
         {
             System.Int32 a1;
             checkType(l, 3, out a1);
             System.Int32 a2;
             checkType(l, 4, out a2);
             System.Int32 a3;
             checkType(l, 5, out a3);
             UnityEngine.TextureFormat a4;
             checkEnum(l, 6, out a4);
             System.Boolean a5;
             checkType(l, 7, out a5);
             o = new UnityEngine.Texture2DArray(a1, a2, a3, a4, a5);
             pushValue(l, true);
             pushValue(l, o);
             return(2);
         }
         return(error(l, "New object failed."));
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 extern private static bool Internal_CreateImpl([Writable] Texture2DArray mono, int w, int h, int d, int mipCount, GraphicsFormat format, TextureCreationFlags flags);