The reflection probe is used to capture the surroundings into a texture which is passed to the shaders and used for reflections.
static void ReflectionProbe_texture(JSVCall vc) { UnityEngine.ReflectionProbe _this = (UnityEngine.ReflectionProbe)vc.csObj; var result = _this.texture; JSMgr.datax.setObject((int)JSApi.SetType.Rval, result); }
private void BakeCustomReflectionProbe(ReflectionProbe probe, bool usePreviousAssetPath) { string assetPath = ""; if (usePreviousAssetPath) { assetPath = AssetDatabase.GetAssetPath(probe.customBakedTexture); } string extension = !probe.hdr ? "png" : "exr"; if (string.IsNullOrEmpty(assetPath) || (Path.GetExtension(assetPath) != ("." + extension))) { ReflectionProbe probe2; string pathWithoutExtension = FileUtil.GetPathWithoutExtension(SceneManager.GetActiveScene().path); if (string.IsNullOrEmpty(pathWithoutExtension)) { pathWithoutExtension = "Assets"; } else if (!Directory.Exists(pathWithoutExtension)) { Directory.CreateDirectory(pathWithoutExtension); } string fileNameWithoutExtension = probe.name + (!probe.hdr ? "-reflection" : "-reflectionHDR") + "." + extension; fileNameWithoutExtension = Path.GetFileNameWithoutExtension(AssetDatabase.GenerateUniqueAssetPath(Path.Combine(pathWithoutExtension, fileNameWithoutExtension))); assetPath = EditorUtility.SaveFilePanelInProject("Save reflection probe's cubemap.", fileNameWithoutExtension, extension, "", pathWithoutExtension); if (string.IsNullOrEmpty(assetPath) || (this.IsCollidingWithOtherProbes(assetPath, probe, out probe2) && !EditorUtility.DisplayDialog("Cubemap is used by other reflection probe", string.Format("'{0}' path is used by the game object '{1}', do you really want to overwrite it?", assetPath, probe2.name), "Yes", "No"))) { return; } } EditorUtility.DisplayProgressBar("Reflection Probes", "Baking " + assetPath, 0.5f); if (!Lightmapping.BakeReflectionProbe(probe, assetPath)) { Debug.LogError("Failed to bake reflection probe to " + assetPath); } EditorUtility.ClearProgressBar(); }
static public int RenderProbe(IntPtr l) { try { int argc = LuaDLL.lua_gettop(l); if (argc == 1) { UnityEngine.ReflectionProbe self = (UnityEngine.ReflectionProbe)checkSelf(l); var ret = self.RenderProbe(); pushValue(l, true); pushValue(l, ret); return(2); } else if (argc == 2) { UnityEngine.ReflectionProbe self = (UnityEngine.ReflectionProbe)checkSelf(l); UnityEngine.RenderTexture a1; checkType(l, 2, out a1); var ret = self.RenderProbe(a1); pushValue(l, true); pushValue(l, ret); return(2); } pushValue(l, false); LuaDLL.lua_pushstring(l, "No matched override function to call"); return(2); } catch (Exception e) { return(error(l, e)); } }
static public int get_type(IntPtr l) { try { UnityEngine.ReflectionProbe self = (UnityEngine.ReflectionProbe)checkSelf(l); pushValue(l, true); pushEnum(l, (int)self.type); return(2); } catch (Exception e) { return(error(l, e)); } }
static public int get_updateFrequency(IntPtr l) { try { UnityEngine.ReflectionProbe self = (UnityEngine.ReflectionProbe)checkSelf(l); pushValue(l, true); pushValue(l, self.updateFrequency); return(2); } catch (Exception e) { return(error(l, e)); } }
static public int get_type(IntPtr l) { try { UnityEngine.ReflectionProbe self = (UnityEngine.ReflectionProbe)checkSelf(l); pushEnum(l, (int)self.type); return(1); } catch (Exception e) { LuaDLL.luaL_error(l, e.ToString()); return(0); } }
static public int constructor(IntPtr l) { try { UnityEngine.ReflectionProbe o; o=new UnityEngine.ReflectionProbe(); pushValue(l,true); pushValue(l,o); return 2; } catch(Exception e) { return error(l,e); } }
static public int get_textureHDRDecodeValues(IntPtr l) { try { UnityEngine.ReflectionProbe self = (UnityEngine.ReflectionProbe)checkSelf(l); pushValue(l, true); pushValue(l, self.textureHDRDecodeValues); return(2); } catch (Exception e) { return(error(l, e)); } }
static public int get_backgroundColor(IntPtr l) { try { UnityEngine.ReflectionProbe self = (UnityEngine.ReflectionProbe)checkSelf(l); pushValue(l, self.backgroundColor); return(1); } catch (Exception e) { LuaDLL.luaL_error(l, e.ToString()); return(0); } }
static public int get_boxProjection(IntPtr l) { try { UnityEngine.ReflectionProbe self = (UnityEngine.ReflectionProbe)checkSelf(l); pushValue(l, true); pushValue(l, self.boxProjection); return(2); } catch (Exception e) { return(error(l, e)); } }
static public int get_customBakedTexture(IntPtr l) { try { UnityEngine.ReflectionProbe self = (UnityEngine.ReflectionProbe)checkSelf(l); pushValue(l, true); pushValue(l, self.customBakedTexture); return(2); } catch (Exception e) { return(error(l, e)); } }
static public int get_customBakedTexture(IntPtr l) { try { UnityEngine.ReflectionProbe self = (UnityEngine.ReflectionProbe)checkSelf(l); pushValue(l, self.customBakedTexture); return(1); } catch (Exception e) { LuaDLL.luaL_error(l, e.ToString()); return(0); } }
static public int Reset(IntPtr l) { try { UnityEngine.ReflectionProbe self = (UnityEngine.ReflectionProbe)checkSelf(l); self.Reset(); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int constructor(IntPtr l) { try { UnityEngine.ReflectionProbe o; o = new UnityEngine.ReflectionProbe(); pushValue(l, true); pushValue(l, o); return(2); } catch (Exception e) { return(error(l, e)); } }
static public int RenderProbe(IntPtr l) { try { UnityEngine.ReflectionProbe self = (UnityEngine.ReflectionProbe)checkSelf(l); var ret = self.RenderProbe(); pushValue(l, true); pushValue(l, ret); return(2); } catch (Exception e) { return(error(l, e)); } }
static public int constructor(IntPtr l) { try { UnityEngine.ReflectionProbe o; o = new UnityEngine.ReflectionProbe(); pushValue(l, o); return(1); } catch (Exception e) { LuaDLL.luaL_error(l, e.ToString()); return(0); } }
static public int set_hdr(IntPtr l) { try { UnityEngine.ReflectionProbe self = (UnityEngine.ReflectionProbe)checkSelf(l); bool v; checkType(l, 2, out v); self.hdr = v; pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int set_clearFlags(IntPtr l) { try { UnityEngine.ReflectionProbe self = (UnityEngine.ReflectionProbe)checkSelf(l); UnityEngine.Rendering.ReflectionProbeClearFlags v; checkEnum(l, 2, out v); self.clearFlags = v; pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int set_blendDistance(IntPtr l) { try { UnityEngine.ReflectionProbe self = (UnityEngine.ReflectionProbe)checkSelf(l); float v; checkType(l, 2, out v); self.blendDistance = v; pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int set_timeSlicingMode(IntPtr l) { try { UnityEngine.ReflectionProbe self = (UnityEngine.ReflectionProbe)checkSelf(l); UnityEngine.Rendering.ReflectionProbeTimeSlicingMode v; checkEnum(l, 2, out v); self.timeSlicingMode = v; pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int set_customBakedTexture(IntPtr l) { try { UnityEngine.ReflectionProbe self = (UnityEngine.ReflectionProbe)checkSelf(l); UnityEngine.Texture v; checkType(l, 2, out v); self.customBakedTexture = v; pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int set_updateFrequency(IntPtr l) { try { UnityEngine.ReflectionProbe self = (UnityEngine.ReflectionProbe)checkSelf(l); int v; checkType(l, 2, out v); self.updateFrequency = v; pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int set_clearFlags(IntPtr l) { try { UnityEngine.ReflectionProbe self = (UnityEngine.ReflectionProbe)checkSelf(l); UnityEngine.Rendering.ReflectionProbeClearFlags v; checkEnum(l, 2, out v); self.clearFlags = v; return(0); } catch (Exception e) { LuaDLL.luaL_error(l, e.ToString()); return(0); } }
static public int set_backgroundColor(IntPtr l) { try { UnityEngine.ReflectionProbe self = (UnityEngine.ReflectionProbe)checkSelf(l); UnityEngine.Color v; checkType(l, 2, out v); self.backgroundColor = v; return(0); } catch (Exception e) { LuaDLL.luaL_error(l, e.ToString()); return(0); } }
static public int set_importance(IntPtr l) { try { UnityEngine.ReflectionProbe self = (UnityEngine.ReflectionProbe)checkSelf(l); int v; checkType(l, 2, out v); self.importance = v; return(0); } catch (Exception e) { LuaDLL.luaL_error(l, e.ToString()); return(0); } }
static public int set_timeSlicingMode(IntPtr l) { try { UnityEngine.ReflectionProbe self = (UnityEngine.ReflectionProbe)checkSelf(l); UnityEngine.Rendering.ReflectionProbeTimeSlicingMode v; checkEnum(l, 2, out v); self.timeSlicingMode = v; return(0); } catch (Exception e) { LuaDLL.luaL_error(l, e.ToString()); return(0); } }
static public int set_customBakedTexture(IntPtr l) { try { UnityEngine.ReflectionProbe self = (UnityEngine.ReflectionProbe)checkSelf(l); UnityEngine.Texture v; checkType(l, 2, out v); self.customBakedTexture = v; return(0); } catch (Exception e) { LuaDLL.luaL_error(l, e.ToString()); return(0); } }
static void ReflectionProbe_center(JSVCall vc) { if (vc.bGet) { UnityEngine.ReflectionProbe _this = (UnityEngine.ReflectionProbe)vc.csObj; var result = _this.center; JSApi.setVector3S((int)JSApi.SetType.Rval, result); } else { UnityEngine.Vector3 arg0 = (UnityEngine.Vector3)JSApi.getVector3S((int)JSApi.GetType.Arg); UnityEngine.ReflectionProbe _this = (UnityEngine.ReflectionProbe)vc.csObj; _this.center = arg0; } }
// fields // properties static void ReflectionProbe_type(JSVCall vc) { if (vc.bGet) { UnityEngine.ReflectionProbe _this = (UnityEngine.ReflectionProbe)vc.csObj; var result = _this.type; JSApi.setEnum((int)JSApi.SetType.Rval, (int)result); } else { UnityEngine.Rendering.ReflectionProbeType arg0 = (UnityEngine.Rendering.ReflectionProbeType)JSApi.getEnum((int)JSApi.GetType.Arg); UnityEngine.ReflectionProbe _this = (UnityEngine.ReflectionProbe)vc.csObj; _this.type = arg0; } }
static void ReflectionProbe_customBakedTexture(JSVCall vc) { if (vc.bGet) { UnityEngine.ReflectionProbe _this = (UnityEngine.ReflectionProbe)vc.csObj; var result = _this.customBakedTexture; JSMgr.datax.setObject((int)JSApi.SetType.Rval, result); } else { UnityEngine.Texture arg0 = (UnityEngine.Texture)JSMgr.datax.getObject((int)JSApi.GetType.Arg); UnityEngine.ReflectionProbe _this = (UnityEngine.ReflectionProbe)vc.csObj; _this.customBakedTexture = arg0; } }
static void ReflectionProbe_hdr(JSVCall vc) { if (vc.bGet) { UnityEngine.ReflectionProbe _this = (UnityEngine.ReflectionProbe)vc.csObj; var result = _this.hdr; JSApi.setBooleanS((int)JSApi.SetType.Rval, (System.Boolean)(result)); } else { System.Boolean arg0 = (System.Boolean)JSApi.getBooleanS((int)JSApi.GetType.Arg); UnityEngine.ReflectionProbe _this = (UnityEngine.ReflectionProbe)vc.csObj; _this.hdr = arg0; } }
static public int IsFinishedRendering(IntPtr l) { try { UnityEngine.ReflectionProbe self = (UnityEngine.ReflectionProbe)checkSelf(l); System.Int32 a1; checkType(l, 2, out a1); var ret = self.IsFinishedRendering(a1); pushValue(l, true); pushValue(l, ret); return(2); } catch (Exception e) { return(error(l, e)); } }
private void BakeCustomReflectionProbe(ReflectionProbe probe, bool usePreviousAssetPath) { string text = string.Empty; if (usePreviousAssetPath) { text = AssetDatabase.GetAssetPath(probe.customBakedTexture); } string text2 = (!probe.hdr) ? "png" : "exr"; if (string.IsNullOrEmpty(text) || Path.GetExtension(text) != "." + text2) { string text3 = FileUtil.GetPathWithoutExtension(EditorApplication.currentScene); if (string.IsNullOrEmpty(text3)) { text3 = "Assets"; } else { if (!Directory.Exists(text3)) { Directory.CreateDirectory(text3); } } string text4 = probe.name + ((!probe.hdr) ? "-reflection" : "-reflectionHDR") + "." + text2; text4 = Path.GetFileNameWithoutExtension(AssetDatabase.GenerateUniqueAssetPath(Path.Combine(text3, text4))); text = EditorUtility.SaveFilePanelInProject("Save reflection probe's cubemap.", text4, text2, string.Empty, text3); if (string.IsNullOrEmpty(text)) { return; } } EditorUtility.DisplayProgressBar("Reflection Probes", "Baking " + text, 0.5f); if (!Lightmapping.BakeReflectionProbe(probe, text)) { Debug.LogError("Failed to bake reflection probe to " + text); } EditorUtility.ClearProgressBar(); }
public void OnEnable() { this.m_SelectedReflectionProbe = EditorUtility.InstanceIDToObject(SessionState.GetInt("PreviewReflectionProbe", 0)) as ReflectionProbe; }
private static void RenderBoxGizmo(ReflectionProbe reflectionProbe, GizmoType gizmoType) { if (ReflectionProbeEditor.s_LastInteractedEditor == null) { return; } if (ReflectionProbeEditor.s_LastInteractedEditor.sceneViewEditing && EditMode.editMode == EditMode.SceneViewEditMode.ReflectionProbeBox) { Color color = Gizmos.color; Gizmos.color = ReflectionProbeEditor.kGizmoReflectionProbe; Gizmos.DrawCube(reflectionProbe.transform.position + reflectionProbe.center, -1f * reflectionProbe.size); Gizmos.color = color; } }
private float GetProbeIntensity(ReflectionProbe p) { if ((p == null) || (p.texture == null)) { return 1f; } float intensity = p.intensity; if (TextureUtil.GetTextureColorSpaceString(p.texture) == "Linear") { intensity = Mathf.LinearToGammaSpace(intensity); } return intensity; }
private bool IsCollidingWithOtherProbes(string targetPath, ReflectionProbe targetProbe, out ReflectionProbe collidingProbe) { ReflectionProbe[] probeArray = UnityEngine.Object.FindObjectsOfType<ReflectionProbe>().ToArray<ReflectionProbe>(); collidingProbe = null; foreach (ReflectionProbe probe in probeArray) { if (((probe != targetProbe) && (probe.customBakedTexture != null)) && (AssetDatabase.GetAssetPath(probe.customBakedTexture) == targetPath)) { collidingProbe = probe; return true; } } return false; }
public static extern bool BakeReflectionProbe(ReflectionProbe probe, string path);
internal static extern bool BakeReflectionProbeSnapshot(ReflectionProbe probe);
private static void RenderBoxGizmo(ReflectionProbe reflectionProbe, GizmoType gizmoType) { if ((s_LastInteractedEditor != null) && (s_LastInteractedEditor.sceneViewEditing && (UnityEditorInternal.EditMode.editMode == UnityEditorInternal.EditMode.SceneViewEditMode.ReflectionProbeBox))) { Color color = Gizmos.color; Gizmos.color = kGizmoReflectionProbe; Gizmos.DrawCube(reflectionProbe.transform.position + reflectionProbe.center, (Vector3) (-1f * reflectionProbe.size)); Gizmos.color = color; } }
private static void RenderBoxGizmo(ReflectionProbe reflectionProbe, GizmoType gizmoType) { if ((UnityEngine.Object) ReflectionProbeEditor.s_LastInteractedEditor == (UnityEngine.Object) null || !ReflectionProbeEditor.s_LastInteractedEditor.sceneViewEditing || UnityEditorInternal.EditMode.editMode != UnityEditorInternal.EditMode.SceneViewEditMode.ReflectionProbeBox) return; Color color = Gizmos.color; Gizmos.color = ReflectionProbeEditor.kGizmoReflectionProbe; Gizmos.DrawCube(reflectionProbe.transform.position + reflectionProbe.center, -1f * reflectionProbe.size); Gizmos.color = color; }
private float GetProbeIntensity(ReflectionProbe p) { if ((UnityEngine.Object) p == (UnityEngine.Object) null || (UnityEngine.Object) p.texture == (UnityEngine.Object) null) return 1f; float num = p.intensity; if (TextureUtil.GetTextureColorSpaceString(p.texture) == "Linear") num = Mathf.LinearToGammaSpace(num); return num; }
private void BakeCustomReflectionProbe(ReflectionProbe probe, bool usePreviousAssetPath) { string str1 = string.Empty; if (usePreviousAssetPath) str1 = AssetDatabase.GetAssetPath((UnityEngine.Object) probe.customBakedTexture); string extension = !probe.hdr ? "png" : "exr"; if (string.IsNullOrEmpty(str1) || Path.GetExtension(str1) != "." + extension) { string str2 = FileUtil.GetPathWithoutExtension(SceneManager.GetActiveScene().path); if (string.IsNullOrEmpty(str2)) str2 = "Assets"; else if (!Directory.Exists(str2)) Directory.CreateDirectory(str2); string path2 = probe.name + (!probe.hdr ? "-reflection" : "-reflectionHDR") + "." + extension; str1 = EditorUtility.SaveFilePanelInProject("Save reflection probe's cubemap.", Path.GetFileNameWithoutExtension(AssetDatabase.GenerateUniqueAssetPath(Path.Combine(str2, path2))), extension, string.Empty, str2); ReflectionProbe collidingProbe; if (string.IsNullOrEmpty(str1) || this.IsCollidingWithOtherProbes(str1, probe, out collidingProbe) && !EditorUtility.DisplayDialog("Cubemap is used by other reflection probe", string.Format("'{0}' path is used by the game object '{1}', do you really want to overwrite it?", (object) str1, (object) collidingProbe.name), "Yes", "No")) return; } EditorUtility.DisplayProgressBar("Reflection Probes", "Baking " + str1, 0.5f); if (!Lightmapping.BakeReflectionProbe(probe, str1)) Debug.LogError((object) ("Failed to bake reflection probe to " + str1)); EditorUtility.ClearProgressBar(); }
private bool IsCollidingWithOtherProbes(string targetPath, ReflectionProbe targetProbe, out ReflectionProbe collidingProbe) { ReflectionProbe[] array = ((IEnumerable<ReflectionProbe>) UnityEngine.Object.FindObjectsOfType<ReflectionProbe>()).ToArray<ReflectionProbe>(); collidingProbe = (ReflectionProbe) null; foreach (ReflectionProbe reflectionProbe in array) { if (!((UnityEngine.Object) reflectionProbe == (UnityEngine.Object) targetProbe) && !((UnityEngine.Object) reflectionProbe.customBakedTexture == (UnityEngine.Object) null) && AssetDatabase.GetAssetPath((UnityEngine.Object) reflectionProbe.customBakedTexture) == targetPath) { collidingProbe = reflectionProbe; return true; } } return false; }
public override void OnGUI(Rect rc) { EditorGUILayout.LabelField("Select Reflection Probe", EditorStyles.boldLabel, new GUILayoutOption[0]); EditorGUILayout.Space(); this.m_SelectedReflectionProbe = EditorGUILayout.ObjectField(string.Empty, (UnityEngine.Object) this.m_SelectedReflectionProbe, typeof (ReflectionProbe), true, new GUILayoutOption[0]) as ReflectionProbe; }
private float GetProbeIntensity(ReflectionProbe p) { if (p == null || p.texture == null) { return 1f; } float num = p.intensity; if (TextureUtil.GetTextureColorSpaceString(p.texture) == "Linear") { num = Mathf.LinearToGammaSpace(num); } return num; }