// 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); }
// Token: 0x060025B4 RID: 9652 RVA: 0x000BC7A0 File Offset: 0x000BA9A0 public void ReadFromGameObject(CombineConditionSettings combineConditions, bool copyBakedLighting, GameObject go, MeshRenderer mr, Material mat) { this.matInstanceId = (combineConditions.sameMaterial ? mat.GetInstanceID() : combineConditions.combineCondition.matInstanceId); this.lightmapIndex = (copyBakedLighting ? mr.lightmapIndex : (this.lightmapIndex = -1)); this.shadowCastingMode = (combineConditions.sameShadowCastingMode ? mr.shadowCastingMode : combineConditions.combineCondition.shadowCastingMode); this.receiveShadows = (combineConditions.sameReceiveShadows ? mr.receiveShadows : combineConditions.combineCondition.receiveShadows); this.lightProbeUsage = (combineConditions.sameLightProbeUsage ? mr.lightProbeUsage : combineConditions.combineCondition.lightProbeUsage); this.reflectionProbeUsage = (combineConditions.sameReflectionProbeUsage ? mr.reflectionProbeUsage : combineConditions.combineCondition.reflectionProbeUsage); this.probeAnchor = (combineConditions.sameProbeAnchor ? mr.probeAnchor : combineConditions.combineCondition.probeAnchor); this.motionVectorGenerationMode = (combineConditions.sameMotionVectorGenerationMode ? mr.motionVectorGenerationMode : combineConditions.combineCondition.motionVectorGenerationMode); this.layer = (combineConditions.sameLayer ? go.layer : combineConditions.combineCondition.layer); }
public void ReadFromGameObject(int rootInstanceId, CombineConditionSettings combineConditions, bool copyBakedLighting, GameObject go, Transform t, MeshRenderer mr, Material mat) { matInstanceId = (combineConditions.sameMaterial ? mat.GetInstanceID() : combineConditions.combineCondition.matInstanceId); lightmapIndex = (copyBakedLighting ? mr.lightmapIndex : lightmapIndex = -1); shadowCastingMode = (combineConditions.sameShadowCastingMode ? mr.shadowCastingMode : combineConditions.combineCondition.shadowCastingMode); receiveShadows = (combineConditions.sameReceiveShadows ? mr.receiveShadows : combineConditions.combineCondition.receiveShadows); lightmapScale = (combineConditions.sameLightmapScale ? GetLightmapScale(mr) : combineConditions.combineCondition.lightmapScale); lightProbeUsage = (combineConditions.sameLightProbeUsage ? mr.lightProbeUsage : combineConditions.combineCondition.lightProbeUsage); reflectionProbeUsage = (combineConditions.sameReflectionProbeUsage ? mr.reflectionProbeUsage : combineConditions.combineCondition.reflectionProbeUsage); probeAnchor = (combineConditions.sameProbeAnchor ? mr.probeAnchor : combineConditions.combineCondition.probeAnchor); motionVectorGenerationMode = (combineConditions.sameMotionVectorGenerationMode ? mr.motionVectorGenerationMode : combineConditions.combineCondition.motionVectorGenerationMode); layer = (combineConditions.sameLayer ? go.layer : combineConditions.combineCondition.layer); #if UNITY_EDITOR #if !UNITY_2017 && !UNITY_2018 && !UNITY_2019_1 receiveGI = (combineConditions.sameReceiveGI ? mr.receiveGI : combineConditions.combineCondition.receiveGI); #endif staticEditorFlags = (combineConditions.sameStaticEditorFlags ? UnityEditor.GameObjectUtility.GetStaticEditorFlags(go) : combineConditions.combineCondition.staticEditorFlags); #endif this.rootInstanceId = rootInstanceId; // Debug.Log(go.name + " " + shadowCastingMode); }
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); }