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
         UnityEngine.StaticBatchingUtility o;
         o = new UnityEngine.StaticBatchingUtility();
         pushValue(l, true);
         pushValue(l, o);
         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
 }
 static public int constructor(IntPtr l)
 {
     UnityEngine.StaticBatchingUtility o;
     o = new UnityEngine.StaticBatchingUtility();
     pushObject(l, o);
     return(1);
 }
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.StaticBatchingUtility o;
         o = new UnityEngine.StaticBatchingUtility();
         pushValue(l, o);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
	static public int constructor(IntPtr l) {
		try {
			UnityEngine.StaticBatchingUtility o;
			o=new UnityEngine.StaticBatchingUtility();
			pushValue(l,true);
			pushValue(l,o);
			return 2;
		}
		catch(Exception e) {
			return error(l,e);
		}
	}
 static public int constructor(IntPtr l)
 {
     LuaDLL.lua_remove(l, 1);
     UnityEngine.StaticBatchingUtility o;
     if (matchType(l, 1))
     {
         o = new UnityEngine.StaticBatchingUtility();
         pushObject(l, o);
         return(1);
     }
     LuaDLL.luaL_error(l, "New object failed.");
     return(0);
 }
 public static int constructor(IntPtr l)
 {
     try {
         UnityEngine.StaticBatchingUtility o;
         o=new UnityEngine.StaticBatchingUtility();
         pushValue(l,o);
         return 1;
     }
     catch(Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return 0;
     }
 }
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.StaticBatchingUtility o;
         o = new UnityEngine.StaticBatchingUtility();
         pushValue(l, o);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
 private static void MakeBatch(List <MeshSubsetCombineUtility.MeshInstance> meshes, List <MeshSubsetCombineUtility.SubMeshInstance> subsets, List <GameObject> subsetGOs, Transform staticBatchRootTransform, int batchIndex)
 {
     if (meshes.Count >= 2)
     {
         MeshSubsetCombineUtility.MeshInstance[]    instanceArray = meshes.ToArray();
         MeshSubsetCombineUtility.SubMeshInstance[] submeshes     = subsets.ToArray();
         string meshName = "Combined Mesh";
         meshName = meshName + " (root: " + ((staticBatchRootTransform == null) ? "scene" : staticBatchRootTransform.name) + ")";
         if (batchIndex > 0)
         {
             meshName = meshName + " " + (batchIndex + 1);
         }
         Mesh combinedMesh = StaticBatchingUtility.InternalCombineVertices(instanceArray, meshName);
         StaticBatchingUtility.InternalCombineIndices(submeshes, combinedMesh);
         int subSetIndexForMaterial = 0;
         for (int i = 0; i < submeshes.Length; i++)
         {
             subSetIndexForMaterial++;
         }
     }
 }
Exemple #9
0
        private static void MakeBatch(List <MeshSubsetCombineUtility.MeshInstance> meshes, List <MeshSubsetCombineUtility.SubMeshInstance> subsets, List <GameObject> subsetGOs, Transform staticBatchRootTransform, int batchIndex)
        {
            if (meshes.Count < 2)
            {
                return;
            }
            MeshSubsetCombineUtility.MeshInstance[]    meshes2 = meshes.ToArray();
            MeshSubsetCombineUtility.SubMeshInstance[] array   = subsets.ToArray();
            string text = "Combined Mesh";

            text = text + " (root: " + ((!(staticBatchRootTransform != null)) ? "scene" : staticBatchRootTransform.name) + ")";
            if (batchIndex > 0)
            {
                text = text + " " + (batchIndex + 1);
            }
            Mesh mesh = StaticBatchingUtility.InternalCombineVertices(meshes2, text);

            StaticBatchingUtility.InternalCombineIndices(array, mesh);
            int num = 0;

            for (int i = 0; i < array.Length; i++)
            {
                MeshSubsetCombineUtility.SubMeshInstance subMeshInstance = array[i];
                GameObject gameObject = subsetGOs[i];
                Mesh       sharedMesh = mesh;
                MeshFilter meshFilter = (MeshFilter)gameObject.GetComponent(typeof(MeshFilter));
                meshFilter.sharedMesh = sharedMesh;
                Renderer component = gameObject.GetComponent <Renderer>();
                component.SetSubsetIndex(subMeshInstance.subMeshIndex, num);
                component.staticBatchRootTransform = staticBatchRootTransform;
                component.enabled = false;
                component.enabled = true;
                MeshRenderer meshRenderer = component as MeshRenderer;
                if (meshRenderer != null)
                {
                    meshRenderer.additionalVertexStreams = null;
                }
                num++;
            }
        }
 private static void MakeBatch(List <MeshSubsetCombineUtility.MeshContainer> meshes, Transform staticBatchRootTransform, int batchIndex)
 {
     if (meshes.Count >= 2)
     {
         List <MeshSubsetCombineUtility.MeshInstance>    list  = new List <MeshSubsetCombineUtility.MeshInstance>();
         List <MeshSubsetCombineUtility.SubMeshInstance> list2 = new List <MeshSubsetCombineUtility.SubMeshInstance>();
         foreach (MeshSubsetCombineUtility.MeshContainer current in meshes)
         {
             list.Add(current.instance);
             list2.AddRange(current.subMeshInstances);
         }
         string text = "Combined Mesh";
         text = text + " (root: " + ((!(staticBatchRootTransform != null)) ? "scene" : staticBatchRootTransform.name) + ")";
         if (batchIndex > 0)
         {
             text = text + " " + (batchIndex + 1);
         }
         Mesh mesh = StaticBatchingUtility.InternalCombineVertices(list.ToArray(), text);
         StaticBatchingUtility.InternalCombineIndices(list2.ToArray(), mesh);
         int num = 0;
         foreach (MeshSubsetCombineUtility.MeshContainer current2 in meshes)
         {
             MeshFilter meshFilter = (MeshFilter)current2.gameObject.GetComponent(typeof(MeshFilter));
             meshFilter.sharedMesh = mesh;
             int      num2      = current2.subMeshInstances.Count <MeshSubsetCombineUtility.SubMeshInstance>();
             Renderer component = current2.gameObject.GetComponent <Renderer>();
             component.SetStaticBatchInfo(num, num2);
             component.staticBatchRootTransform = staticBatchRootTransform;
             component.enabled = false;
             component.enabled = true;
             MeshRenderer meshRenderer = component as MeshRenderer;
             if (meshRenderer != null)
             {
                 meshRenderer.additionalVertexStreams = null;
             }
             num += num2;
         }
     }
 }
Exemple #11
0
        private static void MakeBatch(List <MeshSubsetCombineUtility.MeshInstance> meshes, List <MeshSubsetCombineUtility.SubMeshInstance> subsets, List <GameObject> subsetGOs, Transform staticBatchRootTransform, int batchIndex)
        {
            if (meshes.Count < 2)
            {
                return;
            }
            MeshSubsetCombineUtility.MeshInstance[]    array1 = meshes.ToArray();
            MeshSubsetCombineUtility.SubMeshInstance[] array2 = subsets.ToArray();
            string meshName = "Combined Mesh" + " (root: " + (!((Object)staticBatchRootTransform != (Object)null) ? "scene" : staticBatchRootTransform.name) + ")";

            if (batchIndex > 0)
            {
                meshName = meshName + " " + (object)(batchIndex + 1);
            }
            Mesh combinedMesh = StaticBatchingUtility.InternalCombineVertices(array1, meshName);

            StaticBatchingUtility.InternalCombineIndices(array2, combinedMesh);
            int subSetIndexForMaterial = 0;

            for (int index = 0; index < array2.Length; ++index)
            {
                MeshSubsetCombineUtility.SubMeshInstance subMeshInstance = array2[index];
                GameObject subsetGo = subsetGOs[index];
                Mesh       mesh     = combinedMesh;
                ((MeshFilter)subsetGo.GetComponent(typeof(MeshFilter))).sharedMesh = mesh;
                Renderer component = subsetGo.GetComponent <Renderer>();
                component.SetSubsetIndex(subMeshInstance.subMeshIndex, subSetIndexForMaterial);
                component.staticBatchRootTransform = staticBatchRootTransform;
                component.enabled = false;
                component.enabled = true;
                MeshRenderer meshRenderer = component as MeshRenderer;
                if ((Object)meshRenderer != (Object)null)
                {
                    meshRenderer.additionalVertexStreams = (Mesh)null;
                }
                ++subSetIndexForMaterial;
            }
        }