//    int selected = 4;
    public override void OnInspectorGUI()
    {
        Brightness obj = (Brightness)target;

        GUILayout.BeginHorizontal();
        if (obj.GetComponent <Renderer>().lightmapIndex < LightmapSettings.lightmaps.Length && obj.GetComponent <Renderer>().lightmapIndex >= 0)
        {
            if (!LightmapManager.isReadable(LightmapSettings.lightmaps[obj.GetComponent <Renderer>().lightmapIndex].lightmapColor))
            {
                if (GUILayout.Button("Make Readable (Far)"))
                {
                    LightmapManager.SetIsReadable(LightmapSettings.lightmaps[obj.GetComponent <Renderer>().lightmapIndex].lightmapColor);
                }
            }

            if (!LightmapManager.isReadable(LightmapSettings.lightmaps[obj.GetComponent <Renderer>().lightmapIndex].lightmapDir))
            {
                if (GUILayout.Button("Make Readable (Near)"))
                {
                    LightmapManager.SetIsReadable(LightmapSettings.lightmaps[obj.GetComponent <Renderer>().lightmapIndex].lightmapDir);
                }
            }
        }
        GUILayout.EndHorizontal();
        GUILayout.Label("Brightness Level");
        obj.level = EditorGUILayout.Slider(obj.level, -1, 1);
        GUILayout.Label("Operate on (GPU/CPU)");
        obj.operateOn = (Brightness.OperateON)EditorGUILayout.EnumPopup(obj.operateOn);
        GUILayout.Label("Lightmap Options");
        obj.options = (Brightness.AdjustLightmap)EditorGUILayout.EnumPopup(obj.options);
        GUILayout.Label("Execute ON");
        obj.executeTrigger     = (Brightness.ExecuteON)EditorGUILayout.EnumPopup(obj.executeTrigger);
        obj.useSharedMaterials = EditorGUILayout.Toggle("Use Shared Materials", obj.useSharedMaterials);
        obj.timeScale          = EditorGUILayout.FloatField("Time Scale", obj.timeScale);
        obj.useCurve           = EditorGUILayout.Toggle("Use Curve", obj.useCurve);
        if (obj.useCurve)
        {
            obj.curve           = EditorGUILayout.CurveField("Curve", obj.curve);
            obj.loopCurve       = EditorGUILayout.Toggle("Loop Curve", obj.loopCurve);
            obj.startOnFirstKey = EditorGUILayout.Toggle("Start On 1st Key", obj.startOnFirstKey);

            if (obj.timeScale < 0)
            {
                obj.timeScale = 0;
            }
        }
        else
        {
            GUILayout.Label("Minimum Brightness");
            obj.Min = EditorGUILayout.Slider(obj.Min, -1, 1);
            GUILayout.Label("Maximum Brightness");
            obj.Max = EditorGUILayout.Slider(obj.Max, -1, 1);
        }
        //	if(GUILayout.Button("Write EXR"))
        //	{
        //		SaveExr.Save(LightmapSettings.lightmaps[obj.renderer.lightmapIndex].lightmapFar,"D:\test2.exr");

        //EXRWriter.writeEXR(LightmapSettings.lightmaps[obj.renderer.lightmapIndex].lightmapFar,"D:\\Test.exr");
        //	}
    }
Beispiel #2
0
    // int selected = 4;
    public override void OnInspectorGUI()
    {
        Blend obj = (Blend)target;

        GUILayout.BeginHorizontal();
        if (obj.GetComponent <Renderer>().lightmapIndex < LightmapSettings.lightmaps.Length && obj.GetComponent <Renderer>().lightmapIndex >= 0)
        {
            if (!LightmapManager.isReadable(LightmapSettings.lightmaps[obj.GetComponent <Renderer>().lightmapIndex].lightmapColor))
            {
                if (GUILayout.Button("Make Readable (Far)"))
                {
                    LightmapManager.SetIsReadable(LightmapSettings.lightmaps[obj.GetComponent <Renderer>().lightmapIndex].lightmapColor);
                }
            }

            if (!LightmapManager.isReadable(LightmapSettings.lightmaps[obj.GetComponent <Renderer>().lightmapIndex].lightmapDir))
            {
                if (GUILayout.Button("Make Readable (Near)"))
                {
                    LightmapManager.SetIsReadable(LightmapSettings.lightmaps[obj.GetComponent <Renderer>().lightmapIndex].lightmapDir);
                }
            }
        }
        GUILayout.EndHorizontal();
        GUILayout.Label("Operate on (GPU/CPU)");
        obj.operateOn = (Blend.OperateON)EditorGUILayout.EnumPopup(obj.operateOn);

        GUILayout.Label("Blend with");
        obj.BlendTexture = (Texture2D)EditorGUILayout.ObjectField(obj.BlendTexture, typeof(Texture2D), false, GUILayout.Height(75), GUILayout.Width(75));
        GUILayout.Label("Blend Level");
        obj.level = EditorGUILayout.Slider(obj.level, -1, 1);
        GUILayout.Label("Lightmap Options");
        obj.options = (Brightness.AdjustLightmap)EditorGUILayout.EnumPopup(obj.options);
        GUILayout.Label("Execute ON");
        obj.executeTrigger = (Brightness.ExecuteON)EditorGUILayout.EnumPopup(obj.executeTrigger);

        obj.useSharedMaterials = EditorGUILayout.Toggle("Use Shared Materials", obj.useSharedMaterials);
        obj.timeScale          = EditorGUILayout.FloatField("Time Scale", obj.timeScale);
        obj.useCurve           = EditorGUILayout.Toggle("Use Curve", obj.useCurve);
        if (obj.useCurve)
        {
            obj.curve           = EditorGUILayout.CurveField("Curve", obj.curve);
            obj.loopCurve       = EditorGUILayout.Toggle("Loop Curve", obj.loopCurve);
            obj.startOnFirstKey = EditorGUILayout.Toggle("Start On 1st Key", obj.startOnFirstKey);

            if (obj.timeScale < 0)
            {
                obj.timeScale = 0;
            }
        }
        else
        {
            GUILayout.Label("Minimum Change");
            obj.Min = EditorGUILayout.Slider(obj.Min, -1, 1);
            GUILayout.Label("Maximum Maximum");
            obj.Max = EditorGUILayout.Slider(obj.Max, -1, 1);
        }
    }
Beispiel #3
0
    public static LightmapManager Init()
    {
        LightmapManager lightmapManager = FindObjectOfType <LightmapManager>();

        if (lightmapManager == null)
        {
            lightmapManager = new GameObject("LightmapManager").AddComponent <LightmapManager>();
        }
        return(lightmapManager);
    }
Beispiel #4
0
 protected void LoadMainScene(int sceneID, string name, Action callback)
 {
     EventDispatcher.Broadcast <int, int>(SceneManagerEvent.SceneRelatedLoad, MySceneManager.Instance.CurSceneID, sceneID);
     AssetLoader.LoadScene(name, delegate(bool isFinished)
     {
         this.PreloadSceneChange(1f);
         LightmapManager.UpdateLightmap(sceneID);
         callback.Invoke();
     }, false, delegate(float loaded_percent)
     {
         this.PreloadSceneChange(loaded_percent);
     });
 }