Beispiel #1
0
        private void DrawRenderingGUI()
        {
            string label = "Rendering";
            string id    = "rendering" + data.Id;

            GenericMenu menu = new GenericMenu();

            menu.AddItem(
                new GUIContent("Reset"),
                false,
                () => { data.Rendering.ResetFull(); });
            GEditorCommon.Foldout(label, false, id, () =>
            {
                GRendering settings = data.Rendering;
                EditorGUI.BeginChangeCheck();
                settings.CastShadow       = EditorGUILayout.Toggle("Cast Shadow", settings.CastShadow);
                settings.ReceiveShadow    = EditorGUILayout.Toggle("Receive Shadow", settings.ReceiveShadow);
                settings.DrawFoliage      = EditorGUILayout.Toggle("Draw Foliage", settings.DrawFoliage);
                GUI.enabled               = SystemInfo.supportsInstancing;
                settings.EnableInstancing = EditorGUILayout.Toggle("Enable Instancing", settings.EnableInstancing);
                GUI.enabled               = true;
                settings.BillboardStart   = EditorGUILayout.Slider("Billboard Start", settings.BillboardStart, 0f, GCommon.MAX_TREE_DISTANCE);
                settings.TreeDistance     = EditorGUILayout.Slider("Tree Distance", settings.TreeDistance, 0f, GCommon.MAX_TREE_DISTANCE);
                settings.GrassDistance    = EditorGUILayout.Slider("Grass Distance", settings.GrassDistance, 0f, GCommon.MAX_GRASS_DISTANCE);
                if (EditorGUI.EndChangeCheck())
                {
                    data.SetDirty(GTerrainData.DirtyFlags.Rendering);
                    if (settings.EnableInstancing)
                    {
                        GAnalytics.Record(GAnalytics.ENABLE_INSTANCING, true);
                    }
                }
            }, menu);
        }
 public void CopyTo(GRendering des)
 {
     des.CastShadow       = CastShadow;
     des.ReceiveShadow    = ReceiveShadow;
     des.DrawFoliage      = DrawFoliage;
     des.EnableInstancing = EnableInstancing;
     des.BillboardStart   = BillboardStart;
     des.TreeDistance     = TreeDistance;
     des.GrassDistance    = GrassDistance;
 }
Beispiel #3
0
        private void DrawRenderingGUI()
        {
            string label = "Rendering";
            string id    = "rendering" + data.Id;

            GenericMenu menu = new GenericMenu();

            menu.AddItem(
                new GUIContent("Reset"),
                false,
                () => { data.Rendering.ResetFull(); });
            GEditorCommon.Foldout(label, false, id, () =>
            {
                GRendering settings = data.Rendering;
                EditorGUI.BeginChangeCheck();
                GEditorCommon.Header("Terrain Shadow");
                settings.CastShadow    = EditorGUILayout.Toggle("Cast Shadow", settings.CastShadow);
                settings.ReceiveShadow = EditorGUILayout.Toggle("Receive Shadow", settings.ReceiveShadow);

                GEditorCommon.Header("Tree Rendering");
                settings.DrawTrees        = EditorGUILayout.Toggle("Draw", settings.DrawTrees);
                GUI.enabled               = SystemInfo.supportsInstancing;
                settings.EnableInstancing = EditorGUILayout.Toggle("Enable Instancing", settings.EnableInstancing);
                GUI.enabled               = true;
                settings.BillboardStart   = EditorGUILayout.Slider("Billboard Start", settings.BillboardStart, 0f, GCommon.MAX_TREE_DISTANCE);
                settings.TreeDistance     = EditorGUILayout.Slider("Tree Distance", settings.TreeDistance, 0f, GCommon.MAX_TREE_DISTANCE);
                GRuntimeSettings.Instance.renderingDefault.cullVolumeBias = EditorGUILayout.Slider("Cull Volume Bias", GRuntimeSettings.Instance.renderingDefault.cullVolumeBias, 0f, 100f);

                GEditorCommon.Header("Grass & Detail Rendering");
                settings.DrawGrasses    = EditorGUILayout.Toggle("Draw", settings.DrawGrasses);
                settings.GrassDistance  = EditorGUILayout.Slider("Grass Distance", settings.GrassDistance, 0f, GCommon.MAX_GRASS_DISTANCE);
                settings.GrassFadeStart = EditorGUILayout.Slider("Fade Start", settings.GrassFadeStart, 0f, 1f);

                if (EditorGUI.EndChangeCheck())
                {
                    data.SetDirty(GTerrainData.DirtyFlags.Rendering);
                    if (settings.EnableInstancing)
                    {
                        GAnalytics.Record(GAnalytics.ENABLE_INSTANCING, true);
                    }
                }

                GEditorCommon.Header("Topographic");
                GEditorSettings.Instance.topographic.enable = EditorGUILayout.Toggle("Enable", GEditorSettings.Instance.topographic.enable);
            }, menu);
        }