예제 #1
0
            // Token: 0x0600307F RID: 12415 RVA: 0x000CDF0C File Offset: 0x000CC10C
            public bool SortObject(MeshCombiner meshCombiner, ObjectOctree.LODLevel lod, CachedGameObject cachedGO, bool isChangeMode = false)
            {
                if (cachedGO.mr == null)
                {
                    return(false);
                }
                if (lod.meshObjectsHoldersLookup == null)
                {
                    lod.meshObjectsHoldersLookup = new Dictionary <CombineCondition, MeshObjectsHolder>();
                }
                CombineConditionSettings combineConditionSettings = meshCombiner.combineConditionSettings;

                Material[] sharedMaterials = cachedGO.mr.sharedMaterials;
                int        num             = Mathf.Min(cachedGO.mesh.subMeshCount, sharedMaterials.Length);
                int        i = 0;

                while (i < num)
                {
                    Material material;
                    if (!combineConditionSettings.sameMaterial)
                    {
                        material = combineConditionSettings.material;
                        goto IL_75;
                    }
                    material = sharedMaterials[i];
                    if (!(material == null))
                    {
                        goto IL_75;
                    }
IL_119:
                    i++;
                    continue;
IL_75:
                    CombineCondition combineCondition = default(CombineCondition);
                    combineCondition.ReadFromGameObject(combineConditionSettings, meshCombiner.copyBakedLighting && meshCombiner.validCopyBakedLighting, cachedGO.go, cachedGO.mr, material);
                    MeshObjectsHolder meshObjectsHolder;
                    if (!lod.meshObjectsHoldersLookup.TryGetValue(combineCondition, out meshObjectsHolder))
                    {
                        meshCombiner.foundCombineConditions.combineConditions.Add(combineCondition);
                        meshObjectsHolder = new MeshObjectsHolder(ref combineCondition, material);
                        lod.meshObjectsHoldersLookup.Add(combineCondition, meshObjectsHolder);
                    }
                    meshObjectsHolder.meshObjects.Add(new MeshObject(cachedGO, i));
                    if (isChangeMode && !meshObjectsHolder.hasChanged)
                    {
                        meshObjectsHolder.hasChanged = true;
                        lod.changedMeshObjectsHolders.Add(meshObjectsHolder);
                        goto IL_119;
                    }
                    goto IL_119;
                }
                return(true);
            }
예제 #2
0
        }                                     // Dummy constructor

        public MeshObjectsHolder(ref CombineCondition combineCondition, Material mat)
        {
        }                                                                                        // 0x0000000181390330-0x00000001813903F0
예제 #3
0
 public MeshObjectsHolder(ref CombineCondition combineCondition, Material mat)
 {
     // Debug.Log(useForLightmapping);
     this.mat = mat;
     this.combineCondition = combineCondition;
 }
예제 #4
0
            public bool SortObject(MeshCombiner meshCombiner, LODLevel lod, CachedGameObject cachedGO, bool isChangeMode = false)
            {
                if (cachedGO.mr == null)
                {
                    return(false);
                }

                if (lod.meshObjectsHoldersLookup == null)
                {
                    lod.meshObjectsHoldersLookup = new Dictionary <CombineCondition, MeshObjectsHolder>();
                }

                CombineConditionSettings combineConditions = meshCombiner.combineConditionSettings;

                Material[] mats = cachedGO.mr.sharedMaterials;

                // TODO check submeshes and material
                int length = Mathf.Min(cachedGO.mesh.subMeshCount, mats.Length);

                int rootInstanceId = -1;

                if (meshCombiner.combineMode == CombineMode.DynamicObjects)
                {
                    rootInstanceId = cachedGO.rootInstanceId;

                    if (rootInstanceId == -1)
                    {
                        cachedGO.GetRoot();
                        rootInstanceId = cachedGO.rootInstanceId;
                    }
                }

                for (int l = 0; l < length; l++)
                {
                    Material mat;

                    if (combineConditions.sameMaterial)
                    {
                        mat = mats[l];
                        if (mat == null)
                        {
                            continue;
                        }
                    }
                    else
                    {
                        mat = combineConditions.material;
                    }

                    CombineCondition combineCondition = new CombineCondition();
                    combineCondition.ReadFromGameObject(rootInstanceId, combineConditions, meshCombiner.copyBakedLighting && meshCombiner.validCopyBakedLighting, cachedGO.go, cachedGO.t, cachedGO.mr, mat);

                    MeshObjectsHolder meshObjectHolder;
                    if (!lod.meshObjectsHoldersLookup.TryGetValue(combineCondition, out meshObjectHolder))
                    {
                        meshCombiner.foundCombineConditions.combineConditions.Add(combineCondition);
                        meshObjectHolder = new MeshObjectsHolder(ref combineCondition, mat);
                        lod.meshObjectsHoldersLookup.Add(combineCondition, meshObjectHolder);
                    }

                    meshObjectHolder.meshObjects.Add(new MeshObject(cachedGO, l));

                    if (isChangeMode && !meshObjectHolder.hasChanged)
                    {
                        meshObjectHolder.hasChanged = true;
                        lod.changedMeshObjectsHolders.Add(meshObjectHolder);
                    }
                }

                return(true);
            }
예제 #5
0
 // Token: 0x060025B0 RID: 9648 RVA: 0x000BC329 File Offset: 0x000BA529
 public MeshObjectsHolder(ref CombineCondition combineCondition, Material mat)
 {
     this.mat = mat;
     this.combineCondition = combineCondition;
 }