void OnGUI()
    {
        float lineheight = 22.0f;
        float margin     = 0.0f;
        float labelWidth = 80.0f;
        float x          = 10.0f;
        float y          = 10.0f;

        if (!showGUI)
        {
            return;
        }

        DSPEGlowline     glowline   = cam.GetComponentInChildren <DSPEGlowline>();
        DSPEReflection   reflection = cam.GetComponentInChildren <DSPEReflection>();
        DSPEBloom        bloom      = cam.GetComponentInChildren <DSPEBloom>();
        DSPESurfaceLight slight     = cam.GetComponentInChildren <DSPESurfaceLight>();


        glowline.enabled = GUI.Toggle(new Rect(x, y, 150, lineheight), glowline.enabled, "glowline");
        y += lineheight + margin;

        bloom.enabled = GUI.Toggle(new Rect(x, y, 150, lineheight), bloom.enabled, "bloom");
        y            += lineheight + margin;

        reflection.enabled = GUI.Toggle(new Rect(x, y, 150, lineheight), reflection.enabled, "reflection");
        y += lineheight + margin;

        slight.enabled = GUI.Toggle(new Rect(x, y, 150, lineheight), slight.enabled, "surface light");
        y += lineheight + margin;

        GUI.Label(new Rect(x + 20, y, labelWidth, lineheight), "intensity:");
        GUI.TextField(new Rect(x + 20 + labelWidth, y, 50, lineheight), slight.intensity.ToString());
        slight.intensity = (float)GUI.HorizontalSlider(new Rect(x + 20 + labelWidth + 55, y, 100, lineheight), slight.intensity, 0.0f, 1.0f);
        y += lineheight + margin;

        GUI.Label(new Rect(x + 20, y, labelWidth, lineheight), "ray distance:");
        GUI.TextField(new Rect(x + 20 + labelWidth, y, 50, lineheight), slight.rayAdvance.ToString());
        slight.rayAdvance = (float)GUI.HorizontalSlider(new Rect(x + 20 + labelWidth + 55, y, 100, lineheight), slight.rayAdvance, 0.0f, 5.0f);
        y += lineheight + margin;

        y += 10.0f;

        GUI.Label(new Rect(x, y, 300, lineheight), "mouse drag & wheel: move camera");
        y += lineheight + margin;

        GUI.Label(new Rect(x, y, 300, lineheight), "space: show / hide GUI");
        y += lineheight + margin;

        GUI.Label(new Rect(x, y, 300, lineheight), "R: rotation on / off");
        y += lineheight + margin;

        //cbGridPatterns.Show();
    }
Esempio n. 2
0
    void OnGUI()
    {
        float lineheight = 22.0f;
        float margin     = 0.0f;
        float labelWidth = 130.0f;
        float x          = 10.0f;
        float y          = 10.0f;

        if (!showGUI)
        {
            return;
        }

        DSLight[] dslights = new DSLight[3] {
            lights[0].GetComponent <DSLight>(),
            lights[1].GetComponent <DSLight>(),
            lights[2].GetComponent <DSLight>(),
        };
        DSPEGlowline   glowline   = cam.GetComponentInChildren <DSPEGlowline>();
        DSPEGlowNormal glownormal = cam.GetComponentInChildren <DSPEGlowNormal>();
        DSPEReflection reflection = cam.GetComponentInChildren <DSPEReflection>();
        DSPEBloom      bloom      = cam.GetComponentInChildren <DSPEBloom>();


        dslights[0].castShadow = GUI.Toggle(new Rect(x, y, 150, lineheight), dslights[0].castShadow, "shadow");
        foreach (var dsl in dslights)
        {
            dsl.castShadow = dslights[0].castShadow;
        }
        y += lineheight + margin;

        glownormal.enabled = GUI.Toggle(new Rect(x, y, 150, lineheight), glownormal.enabled, "glownormal");
        y += lineheight + margin;

        glowline.enabled = GUI.Toggle(new Rect(x, y, 150, lineheight), glowline.enabled, "glowline");
        y += lineheight + margin;

        bloom.enabled = GUI.Toggle(new Rect(x, y, 150, lineheight), bloom.enabled, "bloom");
        y            += lineheight + margin;

        reflection.enabled = GUI.Toggle(new Rect(x, y, 150, lineheight), reflection.enabled, "reflection");
        y += lineheight + margin;
        x += 15.0f;
        GUI.Label(new Rect(x, y, labelWidth, lineheight), "intensity:");
        GUI.TextField(new Rect(x + labelWidth, y, 50, lineheight), reflection.m_intensity.ToString());
        reflection.m_intensity = (float)GUI.HorizontalSlider(new Rect(x + labelWidth + 55, y, 100, lineheight), reflection.m_intensity, 0.0f, 1.0f);
        y += lineheight + margin;

        GUI.Label(new Rect(x, y, labelWidth, lineheight), "march distance:");
        GUI.TextField(new Rect(x + labelWidth, y, 50, lineheight), reflection.m_raymarch_distance.ToString());
        reflection.m_raymarch_distance = (float)GUI.HorizontalSlider(new Rect(x + labelWidth + 55, y, 100, lineheight), reflection.m_raymarch_distance, 0.0f, 1.0f);
        y += lineheight + margin;

        GUI.Label(new Rect(x, y, labelWidth, lineheight), "ray diffusion:");
        GUI.TextField(new Rect(x + labelWidth, y, 50, lineheight), reflection.m_ray_diffusion.ToString());
        reflection.m_ray_diffusion = (float)GUI.HorizontalSlider(new Rect(x + labelWidth + 55, y, 100, lineheight), reflection.m_ray_diffusion, 0.0f, 0.2f);
        y += lineheight + margin;

        GUI.Label(new Rect(x, y, labelWidth, lineheight), "falloff distance:");
        GUI.TextField(new Rect(x + labelWidth, y, 50, lineheight), reflection.m_falloff_distance.ToString());
        reflection.m_falloff_distance = (float)GUI.HorizontalSlider(new Rect(x + labelWidth + 55, y, 100, lineheight), reflection.m_falloff_distance, 0.0f, 50.0f);
        y += lineheight + margin;

        GUI.Label(new Rect(x, y, labelWidth, lineheight), "max accumulation:");
        GUI.TextField(new Rect(x + labelWidth, y, 50, lineheight), reflection.m_max_accumulation.ToString());
        reflection.m_max_accumulation = (float)GUI.HorizontalSlider(new Rect(x + labelWidth + 55, y, 100, lineheight), reflection.m_max_accumulation, 1.0f, 100.0f);
        y += lineheight + margin;
        x -= 15.0f;

        y += 10.0f;

        GUI.Label(new Rect(x, y, 300, lineheight), "mouse drag & wheel: move camera");
        y += lineheight + margin;

        GUI.Label(new Rect(x, y, 300, lineheight), "space: show / hide GUI");
        y += lineheight + margin;

        GUI.Label(new Rect(x, y, 300, lineheight), "R: rotation on / off");
        y += lineheight + margin;

        //cbGridPatterns.Show();
    }