InternalCombineVertices() private méthode

private InternalCombineVertices ( MeshSubsetCombineUtility meshes, string meshName ) : Mesh
meshes MeshSubsetCombineUtility
meshName string
Résultat Mesh
 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 #2
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 #4
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;
            }
        }