public GameObject Load(LevelResAsset lightmapAsset) { GameObject obj2 = null; BinaryDomDocument document = null; if (lightmapAsset != null) { if (lightmapAsset.levelDom != null) { document = new BinaryDomDocument(lightmapAsset.levelDom.bytes); obj2 = Load(document); } else { return(null); } int length = lightmapAsset.lightmapFar.Length; LightmapData[] dataArray = new LightmapData[length]; for (int i = 0; i < length; i++) { dataArray[i] = new LightmapData { lightmapFar = lightmapAsset.lightmapFar[i], lightmapNear = lightmapAsset.lightmapNear[i] }; } LightmapSettings.lightmaps = dataArray; } return(obj2); }
void Raycast() { // RAY TO PLAYER'S FEET Ray ray = new Ray(transform.position, -Vector3.up); Debug.DrawRay(ray.origin, ray.direction * 5f, Color.magenta); RaycastHit hitInfo; if (Physics.Raycast(ray, out hitInfo, 5f, layerMask)) { // GET RENDERER OF OBJECT HIT Renderer hitRenderer = hitInfo.collider.GetComponent <Renderer>(); // GET LIGHTMAP APPLIED TO OBJECT LightmapData lightmapData = LightmapSettings.lightmaps[hitRenderer.lightmapIndex]; // STORE LIGHTMAP TEXTURE Texture2D lightmapTex = lightmapData.lightmapNear; // GET LIGHTMAP COORDINATE WHERE RAYCAST HITS Vector2 pixelUV = hitInfo.lightmapCoord; // GET COLOR AT THE LIGHTMAP COORDINATE Color surfaceColor = lightmapTex.GetPixelBilinear(pixelUV.x, pixelUV.y); // APPLY this.surfaceColor = surfaceColor; } }
public void LoadLightmap() { if (m_RendererInfo == null || m_RendererInfo.Count <= 0) { return; } var lightmaps = LightmapSettings.lightmaps; int preIndex = lightmaps.Length; var combinedLightmaps = new LightmapData[preIndex + m_Lightmaps.Length]; lightmaps.CopyTo(combinedLightmaps, 0); LightmapData lightMapData; for (int i = 0; i < m_Lightmaps.Length; i++) { lightMapData = new LightmapData(); #if UNITY_5_6_OR_NEWER lightMapData.lightmapColor = m_Lightmaps [i]; #else lightMapData.lightmapLight = m_Lightmaps [i]; #endif lightMapData.lightmapDir = m_Lightmaps [i]; combinedLightmaps [preIndex + i] = lightMapData; } LightmapSettings.lightmapsMode = lightmapsMode; LightmapSettings.lightmaps = combinedLightmaps; foreach (var item in m_RendererInfo) { item.renderer.lightmapIndex = preIndex + item.lightmapIndex; item.renderer.lightmapScaleOffset = item.lightmapOffsetScale; } }
void Awake() { if (m_RendererInfo == null || m_RendererInfo.Length == 0) { return; } var lightmaps = LightmapSettings.lightmaps; var combinedLightmaps = new LightmapData[lightmaps.Length + m_FarLightmaps.Length]; lightmaps.CopyTo(combinedLightmaps, 0); for (int i = 0; i < m_FarLightmaps.Length; i++) { combinedLightmaps[i + lightmaps.Length] = new LightmapData(); combinedLightmaps[i + lightmaps.Length].lightmapFar = m_FarLightmaps[i]; } for (int i = 0; i < m_NearLightmaps.Length; i++) { combinedLightmaps[i + lightmaps.Length].lightmapNear = m_NearLightmaps[i]; } ApplyRendererInfo(m_RendererInfo, lightmaps.Length); LightmapSettings.lightmapsMode = m_LightmapsMode; LightmapSettings.lightProbes = m_LightProbes; LightmapSettings.lightmaps = combinedLightmaps; }
// Perform a preview render. private void DoRenderObjectInLightmapPreview(Mesh cObjectMesh, Renderer cObjectRenderer) { if ((null == cObjectMesh) || (null == cObjectRenderer)) { return; } LightmapData cLightmapData = LightmapSettings.lightmaps[cObjectRenderer.lightmapIndex]; Texture2D cLightmapTex = (null != cLightmapData.lightmapColor) ? cLightmapData.lightmapColor : cLightmapData.lightmapDir; // Force texture filter to point. FilterMode eTextureFilter = cLightmapTex.filterMode; cLightmapTex.filterMode = FilterMode.Point; m_cMaterial.mainTexture = cLightmapTex; m_cMaterial.mainTextureOffset = new Vector2(cObjectRenderer.lightmapScaleOffset.z, cObjectRenderer.lightmapScaleOffset.w); m_cMaterial.mainTextureScale = new Vector2(cObjectRenderer.lightmapScaleOffset.x, cObjectRenderer.lightmapScaleOffset.y); // Draw preview. RenderMeshPreview(m_cFullQuadMesh, cObjectMesh, m_cPreviewUtility, m_cMaterial, m_cWireMaterial, m_vPreviewDir, -1); // Recover texture filter. cLightmapTex.filterMode = eTextureFilter; }
void LoadLightmap() { if (null == rendererList || rendererList.Length == 0) { Debug.Log(gameObject.name + " 的 光照信息为空"); return; } Renderer[] renders = GetComponentsInChildren <Renderer>(true); for (int r = 0, rLength = renders.Length; r < rLength; ++r) { renders[r].lightmapIndex = rendererList[r].lightmapIndex; renders[r].lightmapScaleOffset = rendererList[r].lightmapOffsetScale; } //#if UNITY_EDITOR if (null == lightmapTexs || lightmapTexs.Length == 0) { return; } LightmapSettings.lightmapsMode = LightmapsMode.NonDirectional; LightmapData[] ldata = new LightmapData[lightmapTexs.Length]; LightmapSettings.lightmaps = null; for (int t = 0, tLength = lightmapTexs.Length; t < tLength; ++t) { ldata[t] = new LightmapData(); ldata[t].lightmapFar = lightmapTexs[t]; } LightmapSettings.lightmaps = ldata; //#endif }
LightmapData[] LoadLightmaps() { if (lightingScenariosData.lightmaps == null || lightingScenariosData.lightmaps.Length == 0) { if (GLog.IsLogWarningEnabled) { GLog.LogWarning("No lightmaps stored in scenario "); } return(null); } var newLightmaps = new LightmapData[lightingScenariosData.lightmaps.Length]; for (int i = 0; i < newLightmaps.Length; i++) { newLightmaps[i] = new LightmapData(); newLightmaps[i].lightmapColor = lightingScenariosData.lightmaps[i]; if (lightingScenariosData.lightmapsMode != LightmapsMode.NonDirectional) { newLightmaps[i].lightmapDir = lightingScenariosData.lightmapsDir[i]; } } return(newLightmaps); }
public GameObject Load(LevelResAsset lightmapAsset) { GameObject result = null; if (lightmapAsset != null) { if (!(lightmapAsset.levelDom != null)) { return(null); } TextAsset levelDom = lightmapAsset.levelDom; BinaryDomDocument document = new BinaryDomDocument(levelDom.bytes); result = GameSerializer.Load(document); int num = lightmapAsset.lightmapFar.Length; LightmapData[] array = new LightmapData[num]; for (int i = 0; i < num; i++) { array[i] = new LightmapData { lightmapFar = lightmapAsset.lightmapFar[i], lightmapNear = lightmapAsset.lightmapNear[i] }; } LightmapSettings.lightmaps = array; } return(result); }
//恢复原始场景 public void RecoverSceneLightMap() { if (!m_isBrake) { return; } MoveFile(m_data.sceneLightMapPath, m_data.sceneConfigPath + "/" + m_data.sceneName + ".exr"); //MoveFile(m_data.sceneConfigPath + "/LightingData.asset",m_data.sceneLightDataAssetPath); string srcLightPath = m_data.sceneConfigPath + "/srcLightMap.exr"; if (File.Exists(srcLightPath)) { MoveFile(srcLightPath, m_data.sceneLightMapPath); //File.Move(srcLightPath,m_data.sceneLightMapPath); Texture2D tex = UnityEditor.AssetDatabase.LoadAssetAtPath(m_data.sceneLightMapPath, typeof(Texture2D)) as Texture2D; LightmapData mapData = new LightmapData(); mapData.lightmapColor = tex; LightmapSettings.lightmaps[0] = mapData; } foreach (var kv in m_data.m_sceneLightData) { kv.Key.lightmapIndex = kv.Value.lightIndex; kv.Key.lightmapScaleOffset = kv.Value.lightData; } UnityEditor.AssetDatabase.Refresh(); }
void SetLightMap() { DisposeLastLightmap(); LightmapSettings.lightmapsMode = LightmapsMode.NonDirectional; var lmCount = LightmapSettings.lightmaps.Length; LightmapData[] lightmapData = new LightmapData[lmCount]; if (lmCount > 0) { for (int i = 0; i < lmCount; ++i) { //if (d.lightmapColor != null) // Object.DestroyImmediate(d.lightmapColor, true); lightmapData[i] = new LightmapData(); var tex = _lightmaps[i].ToTexture2D(); tex.filterMode = FilterMode.Bilinear; lightmapData[i].lightmapColor = tex; } } LightmapSettings.lightmapsMode = LightmapsMode.NonDirectional; LightmapSettings.lightmaps = lightmapData; // Shader.se //Shader.SetGlobalTexture("_Lightmap", _lightmaps[0]); // Shader.set }
//public GameObject go_render; void Awake() { if (m_RendererInfo == null || m_RendererInfo.Length == 0) { return; } //// var lightmaps = LightmapSettings.lightmaps; var combinedLightmaps = new LightmapData[lightmaps.Length + m_LightmapsColor.Length]; lightmaps.CopyTo(combinedLightmaps, 0); for (int i = 0; i < m_LightmapsColor.Length; i++) { combinedLightmaps[i + lightmaps.Length] = new LightmapData(); combinedLightmaps[i + lightmaps.Length].lightmapColor = m_LightmapsColor[i]; combinedLightmaps[i + lightmaps.Length].lightmapDir = _lightmapsDir[i]; } Debug.Log("lightmaps len is " + lightmaps.Length); LightmapSettings.lightmaps = combinedLightmaps; //LightmapData data = new LightmapData(); //data.lightmapColor = m_LightmapsColor[0]; //LightmapSettings.lightmaps = new LightmapData[1] { data }; /// ApplyRendererInfo(m_RendererInfo, lightmaps.Length); }
public static void SetLightmap() { LightmapSaver[] dataHolders = FindObjectsOfType <LightmapSaver>(); LightmapData[] lightmapDataArr = new LightmapData[dataHolders.Length]; for (int i = 0; i < dataHolders.Length; i++) { var holder = dataHolders[i]; LightmapData lightData = new LightmapData(); lightData.lightmapColor = holder.lightmapColor; lightData.lightmapDir = holder.lightmapDir; lightmapDataArr[i] = lightData; } LightmapSettings.lightmaps = lightmapDataArr; for (int i = 0; i < dataHolders.Length; i++) { LightmapSaver holder = dataHolders[i]; for (int j = 0; j < holder.RendererData.Length; j++) { var data = holder.RendererData[j]; data.renderer.lightmapIndex = i; data.renderer.lightmapScaleOffset = data.lightmapScaleOffset; } } }
void OnDestroy() { #if !UNITY_5 if ((!Application.isEditor || Application.isPlaying) && globalLightmapRefCount != null) { int numLightmaps = LightmapSettings.lightmaps.Length; int numRefs = lightmapRefs.Count; for (int refIndex = 0; refIndex < numRefs; ++refIndex) { RefData refData = lightmapRefs[refIndex]; if (refData.index >= 0 && refData.index < globalLightmapRefCount.Length) { --globalLightmapRefCount[refData.index]; if (globalLightmapRefCount[refData.index] == 0) { LightmapData[] newLightmaps = new LightmapData[numLightmaps]; for (int lightmapIndex = 0; lightmapIndex < numLightmaps; ++lightmapIndex) { if (refData.index == lightmapIndex) { newLightmaps[lightmapIndex] = new LightmapData(); } else { newLightmaps[lightmapIndex] = LightmapSettings.lightmaps[lightmapIndex]; } } LightmapSettings.lightmaps = newLightmaps; } } } } #endif }
private void ApplyLightmaps() { try { if (m_Renderers == null || m_LightmapOffsetScales == null || m_Lightmaps == null || m_Renderers.Length <= 0 || m_Renderers.Length != m_LightmapOffsetScales.Length || m_Renderers.Length != m_Lightmaps.Length || m_LightmapOffsetScales.Length != m_Lightmaps.Length) { return; } var lightmaps = LightmapSettings.lightmaps; var combinedLightmaps = new LightmapData[m_Lightmaps.Length + lightmaps.Length]; Array.Copy(lightmaps, combinedLightmaps, lightmaps.Length); for (int i = 0; i < m_Lightmaps.Length; i++) { combinedLightmaps[lightmaps.Length + i] = new LightmapData { lightmapColor = m_Lightmaps[i] }; } ApplyRendererInfo(m_Renderers, m_LightmapOffsetScales, lightmaps.Length); LightmapSettings.lightmaps = combinedLightmaps; } catch (Exception e) { Log(e); } }
public void LoadSettings() { LightmapSettings.lightmapsMode = mode; int l1 = (lightmapFar == null) ? 0 : lightmapFar.Length; int l2 = (lightmapNear == null) ? 0 : lightmapNear.Length; int l = (l1 < l2) ? l2 : l1; LightmapData[] lightmaps = null; if (l > 0) { lightmaps = new LightmapData[l]; for (int i = 0; i < l; i++) { lightmaps[i] = new LightmapData(); if (i < l1) { lightmaps[i].lightmapColor = lightmapFar[i]; } if (i < l2) { lightmaps[i].lightmapDir = lightmapNear[i]; } } LightmapSettings.lightmaps = lightmaps; } }
void SetLightmapSettings() { for (int i = 0; i < LightmapSettings.lightmaps.Length; i++) { if (LightmapSettings.lightmaps[i].lightmapFar != null) { Resources.UnloadAsset(LightmapSettings.lightmaps[i].lightmapFar); } if (LightmapSettings.lightmaps[i].lightmapNear != null) { Resources.UnloadAsset(LightmapSettings.lightmaps[i].lightmapNear); } } rd = new LightmapData[lightmaps.Length]; for (int i = 0; i < lightmaps.Length; i++) { rd[i] = new LightmapData(); rd[i].lightmapFar = lightmaps[i]; } LightmapSettings.lightmaps = rd; LightmapSettings.lightProbes = lightProbes; if (!setOriginalLightmapsOnDestroy) { previousLightmapSettings = this; } }
private void ApplyLightmaps() { try { if (m_Renderers == null || m_LightmapOffsetScales == null || m_Lightmaps == null || m_Renderers.Length <= 0 || m_Renderers.Length != m_LightmapOffsetScales.Length || m_Renderers.Length != m_Lightmaps.Length || m_LightmapOffsetScales.Length != m_Lightmaps.Length) { return; } var lightmaps = LightmapSettings.lightmaps; var combinedLightmaps = new LightmapData[m_Lightmaps.Length + lightmaps.Length]; Array.Copy(lightmaps, combinedLightmaps, lightmaps.Length); for (int i = 0; i < m_Lightmaps.Length; i++) { combinedLightmaps[lightmaps.Length + i] = new LightmapData(); combinedLightmaps[lightmaps.Length + i].lightmapColor = m_Lightmaps[i]; } ApplyRendererInfo(m_Renderers, m_LightmapOffsetScales, lightmaps.Length); LightmapSettings.lightmaps = combinedLightmaps; } catch (Exception ex) { Plugin.logger.Error(ex.Message + "\n" + ex.StackTrace); } }
void Init() { if (m_RendererInfo == null || m_RendererInfo.Length == 0) { return; } var lightmaps = LightmapSettings.lightmaps; int[] offsetsindexes = new int[m_Lightmaps.Length]; int counttotal = lightmaps.Length; List <LightmapData> combinedLightmaps = new List <LightmapData>(); for (int i = 0; i < m_Lightmaps.Length; i++) { bool exists = false; for (int j = 0; j < lightmaps.Length; j++) { if (m_Lightmaps[i] == lightmaps[j].lightmapColor) { exists = true; offsetsindexes[i] = j; } } if (!exists) { offsetsindexes[i] = counttotal; var newlightmapdata = new LightmapData { lightmapColor = m_Lightmaps[i], lightmapDir = m_LightmapsDir.Length == m_Lightmaps.Length ? m_LightmapsDir[i] : default(Texture2D), shadowMask = m_ShadowMasks.Length == m_Lightmaps.Length ? m_ShadowMasks[i] : default(Texture2D), }; combinedLightmaps.Add(newlightmapdata); counttotal += 1; } } var combinedLightmaps2 = new LightmapData[counttotal]; lightmaps.CopyTo(combinedLightmaps2, 0); combinedLightmaps.ToArray().CopyTo(combinedLightmaps2, lightmaps.Length); bool directional = true; foreach (Texture2D t in m_LightmapsDir) { if (t == null) { directional = false; break; } } LightmapSettings.lightmapsMode = (m_LightmapsDir.Length == m_Lightmaps.Length && directional) ? LightmapsMode.CombinedDirectional : LightmapsMode.NonDirectional; ApplyRendererInfo(m_RendererInfo, offsetsindexes, m_LightInfo); LightmapSettings.lightmaps = combinedLightmaps2; }
void Start() { if ((DayNear.Length != DayFar.Length) || (NightNear.Length != NightFar.Length)) { Debug.Log("In order for LightMapSwitcher to work, the Near and Far LightMap lists must be of equal length"); return; } // Sort the Day and Night arrays in numerical order, so you can just blindly drag and drop them into the inspector DayNear = DayNear.OrderBy(t2d => t2d.name, new NaturalSortComparer <string>()).ToArray(); DayFar = DayFar.OrderBy(t2d => t2d.name, new NaturalSortComparer <string>()).ToArray(); NightNear = NightNear.OrderBy(t2d => t2d.name, new NaturalSortComparer <string>()).ToArray(); NightFar = NightFar.OrderBy(t2d => t2d.name, new NaturalSortComparer <string>()).ToArray(); // Put them in a LightMapData structure dayLightMaps = new LightmapData[DayNear.Length]; for (int i = 0; i < DayNear.Length; i++) { dayLightMaps[i] = new LightmapData(); dayLightMaps[i].lightmapDir = DayNear[i]; dayLightMaps[i].lightmapLight = DayFar[i]; } nightLightMaps = new LightmapData[NightNear.Length]; for (int i = 0; i < NightNear.Length; i++) { nightLightMaps[i] = new LightmapData(); nightLightMaps[i].lightmapDir = NightNear[i]; nightLightMaps[i].lightmapLight = NightFar[i]; } }
void SwapLightmap(int index) { // Swap lightmap texture Texture2D lightmapTexture = versions[index].texture; LightmapData data = new LightmapData { lightmapColor = lightmapTexture }; LightmapSettings.lightmaps = new LightmapData[] { data }; // Swap LightProbes LightProbes lightProbes = versions[index].lightProbes; LightmapSettings.lightProbes = lightProbes; // Swap environment reflection Cubemap source = versions[index].skybox; RenderSettings.customReflection = source; RenderSettings.defaultReflectionMode = DefaultReflectionMode.Custom; // Swap Reflection probes Texture texture = versions[index].reflectionProbeTexture; reflectionProbe.bakedTexture = texture; // Swap Environment Light rotation Vector3 rotation = versions[index].environmentLightRotation; environmentLight.transform.eulerAngles = rotation; }
private static AssetBundleManifest CreateAssetBundle(BuildAssetBundleOptions _option, BuildTarget _buildTarget) { PrepareToBuildAssetBundle(); RenderSettings.fog = true; RenderSettings.fogMode = FogMode.Linear; LightmapData[] lightMaps = new LightmapData[1]; lightMaps[0] = new LightmapData(); lightMaps[0].lightmapFar = new Texture2D(100, 100); LightmapSettings.lightmaps = lightMaps; LightmapSettings.lightmapsMode = LightmapsMode.NonDirectional; AssetBundleManifest manifest = BuildPipeline.BuildAssetBundles(Application.streamingAssetsPath + "/" + AssetBundleManager.path, _option, _buildTarget); RenderSettings.fog = false; LightmapSettings.lightmaps = new LightmapData[0]; return(manifest); }
LightmapData[] LoadLightmaps(int index) { if (lightingScenariosData[index].lightmaps == null || lightingScenariosData[index].lightmaps.Length == 0) { Debug.LogWarning("No lightmaps stored in scenario " + index); return(null); } var newLightmaps = new LightmapData[lightingScenariosData[index].lightmaps.Length]; for (int i = 0; i < newLightmaps.Length; i++) { newLightmaps[i] = new LightmapData(); newLightmaps[i].lightmapColor = lightingScenariosData[index].lightmaps[i]; if (lightingScenariosData[index].lightmapsMode != LightmapsMode.NonDirectional) { newLightmaps[i].lightmapDir = lightingScenariosData[index].lightmapsDir[i]; } if (lightingScenariosData[index].shadowMasks.Length > 0) { newLightmaps[i].shadowMask = lightingScenariosData[index].shadowMasks[i]; } } return(newLightmaps); }
void Start() { if ((phase1Dir.Length != phase1Color.Length) || (phase2Dir.Length != phase2Color.Length)) { Debug.Log("In order for LightMapSwitcher to work, the Near and Far LightMap lists must be of equal length"); return; } // Sort the arrays in numerical order, so you can just blindly drag and drop them into the inspector phase1Dir = phase1Dir.OrderBy(t2d => t2d.name, new NaturalSortComparer <string>()).ToArray(); phase1Color = phase1Color.OrderBy(t2d => t2d.name, new NaturalSortComparer <string>()).ToArray(); phase2Dir = phase2Dir.OrderBy(t2d => t2d.name, new NaturalSortComparer <string>()).ToArray(); phase2Color = phase2Color.OrderBy(t2d => t2d.name, new NaturalSortComparer <string>()).ToArray(); // Put above data into LightMapData structures phase1LightMaps = new LightmapData[phase1Dir.Length]; for (int i = 0; i < phase1Dir.Length; i++) { phase1LightMaps[i] = new LightmapData(); phase1LightMaps[i].lightmapDir = phase1Dir[i]; phase1LightMaps[i].lightmapColor = phase1Color[i]; } phase2LightMaps = new LightmapData[phase2Dir.Length]; for (int i = 0; i < phase2Dir.Length; i++) { phase2LightMaps[i] = new LightmapData(); phase2LightMaps[i].lightmapDir = phase2Dir[i]; phase2LightMaps[i].lightmapColor = phase2Color[i]; } SetToDay(); }
public void In( [FriendlyName("List", "The list to iterate over.")] LightmapData[] List, [FriendlyName("Current", "The item for the current loop iteration.")] out LightmapData Value ) { if (m_List == null) { m_List = List; m_CurrentIndex = 0; m_Done = false; } m_ImmediateDone = !(m_List != null && m_CurrentIndex == 0); Value = new LightmapData(); if (m_List != null) { if (m_CurrentIndex < m_List.Length) { Value = m_List[m_CurrentIndex]; } m_CurrentIndex++; // done iterating if (m_CurrentIndex > m_List.Length) { m_List = null; m_Done = true; } } }
public void Init(SceneConfig cfg) { Clear(); if (cfg == null) { return; } _Config = cfg; _CurSceneGuid = _CurSceneGuid + 1; _BlocksRootTran = _Config.transform.Find("BlockObjects"); if (null == _BlocksRootTran) { _BlocksRootTran = _Config.transform; } LightmapSettings.lightmapsMode = cfg._LightmapConfig._LightmapMode; var lightmapCount = cfg._TexCount; _SceneLightmapDatas = new LightmapData[lightmapCount]; for (int i = 0; i < lightmapCount; i++) { _LightmapIdx2RefCountDic.Add(i, 0); _SceneLightmapDatas[i] = new LightmapData(); } LoadAssetWithPlayerLight(cfg._LightmapConfig); }
void OnEnable() { LightmapData[] lightmaps = new LightmapData[farTextures.Length]; for (int i = 0; i < lightmaps.Length; i++) { lightmaps[i] = new LightmapData(); lightmaps[i].lightmapFar = farTextures[i]; lightmaps[i].lightmapNear = nearTextures[i]; } LightmapSettings.lightmaps = lightmaps; RenderSettings.ambientLight = ambientLight; RenderSettings.ambientIntensity = ambientIntensity; if (fog) { RenderSettings.fog = true; RenderSettings.fogMode = FogMode.Linear; RenderSettings.fogColor = fogColor; RenderSettings.fogStartDistance = fogStartDistance; RenderSettings.fogEndDistance = fogEndDistance; } }
public void Start() { if (Application.isPlaying) { LightmapSettings.lightmapsMode = mode; int l1 = (lightmapFar == null) ? 0 : lightmapFar.Length; int l2 = (lightmapNear == null) ? 0 : lightmapNear.Length; int l = (l1 < l2) ? l2 : l1; LightmapData[] lightmaps = null; if (l > 0) { lightmaps = new LightmapData[l]; for (int i = 0; i < l; i++) { lightmaps[i] = new LightmapData(); if (i < l1) { lightmaps[i].lightmapFar = lightmapFar[i]; } if (i < l2) { lightmaps[i].lightmapNear = lightmapNear[i]; } } } LightmapSettings.lightmaps = lightmaps; Destroy(this); } }
public void In( [FriendlyName("Value", "The variable you wish to use to set the target's value.")] LightmapData Value, [FriendlyName("Target", "The Target variable you wish to set.")] out LightmapData Target ) { Target = Value; }
private static AssetBundleManifest CreateAssetBundle(BuildAssetBundleOptions _option, BuildTarget _buildTarget) { #if !USE_ASSETBUNDLE throw new Exception("Add \"USE_ASSETBUNDLE\" symbol to scripting define symbol first!"); #endif PrepareToBuildAssetBundle(); RenderSettings.fog = true; RenderSettings.fogMode = FogMode.Linear; LightmapData[] lightMaps = new LightmapData[1]; lightMaps[0] = new LightmapData(); lightMaps[0].lightmapColor = new Texture2D(100, 100); LightmapSettings.lightmaps = lightMaps; LightmapSettings.lightmapsMode = LightmapsMode.NonDirectional; AssetBundleManifest manifest = BuildPipeline.BuildAssetBundles(Application.streamingAssetsPath + "/" + AssetBundleManager.path, _option, _buildTarget); RenderSettings.fog = false; LightmapSettings.lightmaps = new LightmapData[0]; return(manifest); }
public void Apply() { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown //IL_00a6: Unknown result type (might be due to invalid IL or missing references) if (lightProbes != null) { LightmapSettings.set_lightProbes(lightProbes); ShaderGlobal.lightProbe = true; } else { ShaderGlobal.lightProbe = false; } if (lightmapsFar != null && lightmapsFar.Length > 0) { LightmapData[] array = (LightmapData[])new LightmapData[lightmapsFar.Length]; int i = 0; for (int num = lightmapsFar.Length; i < num; i++) { array[i] = new LightmapData(); array[i].set_lightmapFar(lightmapsFar[i]); if (i < lightmapsNear.Length) { array[i].set_lightmapNear(lightmapsNear[i]); } } LightmapSettings.set_lightmapsMode(lightmapMode); LightmapSettings.set_lightmaps(array); } }