Example #1
0
        private void OnAtmospherePresetChanged(Planetoid planetoid, Atmosphere atmosphere)
        {
            if (planetoid == null)
            {
                Debug.Log("Atmosphere: OnAtmospherePresetChanged planetoid is null!");
                return;
            }

            if (atmosphere == null)
            {
                Debug.Log("Atmosphere: OnAtmospherePresetChanged atmosphere is null!");
                return;
            }

            atmosphere.Bake();
            planetoid.ReSetupQuads();
        }
Example #2
0
        protected override void UI(int id)
        {
            scrollPosition = GUILayout.BeginScrollView(scrollPosition, false, true);

            if (Planetoid != null)
            {
                GUILayout.BeginVertical();

                GUILayout.Label("Planetoid stats: ", boldLabel);

                var highestLODLevel = Planetoid.Quads.Max((quad => quad.LODLevel)) + 1;

                GUILayoutExtensions.LabelWithSpace((Planetoid.gameObject.name + ": " + (Planetoid.Working ? "Generating..." : "Idle...")), -8);
                GUILayoutExtensions.LabelWithSpace("Highest LOD level: " + highestLODLevel, -8);

                if (Planetoid.CullingMethod == QuadCullingMethod.Custom)
                {
                    var quadsCount       = Planetoid.Quads.Count;
                    var quadsCulledCount = Planetoid.GetCulledQuadsCount();
                    var vertsRendered    = (quadsCount - quadsCulledCount) * QuadSettings.Vertices;

                    var quadsTexturesVideoMemoryUsage = CalculateTexturesVMU(quadsCount);

                    GUILayoutExtensions.LabelWithSpace("Quads count: " + quadsCount, -8);
                    GUILayoutExtensions.LabelWithSpace("Quads culled count: " + quadsCulledCount, -8);
                    GUILayoutExtensions.LabelWithSpace("Quads textures VMU (MB): " + quadsTexturesVideoMemoryUsage.ToString("0.00"), -8);
                    GUILayoutExtensions.LabelWithSpace("Verts rendered per frame (Only Quads): " + vertsRendered, -8);
                }

                GUILayout.EndVertical();

                GUILayout.BeginVertical();

                GUILayout.Space(10);

                GUILayout.Label("Planetoid parameters: ", boldLabel);

                if (GUILayout.Button("Resetup"))
                {
                    Planetoid.ReSetupQuads();
                }

                GUILayout.EndVertical();

                if (Planetoid.Atmosphere != null)
                {
                    GUILayout.Space(10);

                    GUILayout.BeginVertical();

                    GUILayout.Label("Atmosphere parameters: ", boldLabel);

                    GUILayout.Label("Preset: ");
                    Planetoid.Atmosphere.AtmosphereBase = (AtmosphereBase)GUILayout.SelectionGrid((int)Planetoid.Atmosphere.AtmosphereBase, System.Enum.GetNames(typeof(AtmosphereBase)), 2);

                    GUILayout.Space(10);

                    GUILayout.Label("Density: ");
                    float.TryParse(GUILayout.TextField(Planetoid.Atmosphere.Density.ToString("0.0")), out Planetoid.Atmosphere.Density);

                    GUILayout.Label("Height: ");
                    float.TryParse(GUILayout.TextField(Planetoid.Atmosphere.Height.ToString("0.0")), out Planetoid.Atmosphere.Height);

                    GUILayout.EndVertical();
                }
                else
                {
                    GUILayout.BeginVertical();

                    GUILayoutExtensions.LabelWithSpace("No Atmosphere!?", -8);

                    GUILayout.EndVertical();
                }
            }
            else
            {
                GUILayout.BeginVertical();

                GUILayoutExtensions.LabelWithSpace("No Planetoid!?", -8);

                GUILayout.EndVertical();
            }

            GUILayout.EndScrollView();
        }