93 lines
3.8 KiB
C#
93 lines
3.8 KiB
C#
using UnityEngine;
|
|
|
|
public class FullPlaneGUI : MonoBehaviour
|
|
{
|
|
public RealWaterSpeedManager speedManager;
|
|
|
|
public RealWaterNormalMap WaterPlane;
|
|
|
|
public GUIStyle Title;
|
|
|
|
public GameObject plane;
|
|
|
|
public GameObject refractionPlane;
|
|
|
|
public GameObject botPlane;
|
|
|
|
public GameObject botRefractionPlane;
|
|
|
|
public Texture2D x256;
|
|
|
|
public Texture2D x360;
|
|
|
|
public Texture2D x512;
|
|
|
|
public GUIStyle Normal;
|
|
|
|
public RealWaterCollider[] colliders = new RealWaterCollider[6];
|
|
|
|
private float inputForce = 1f;
|
|
|
|
private float inputForcePrev = 1f;
|
|
|
|
private float native_width = 1920f;
|
|
|
|
private float native_height = 1080f;
|
|
|
|
private void OnGUI()
|
|
{
|
|
float x = (float)Screen.width / native_width;
|
|
float y = (float)Screen.height / native_height;
|
|
GUI.matrix = Matrix4x4.TRS(new Vector3(0f, 0f, 0f), Quaternion.identity, new Vector3(x, y, 1f));
|
|
GUI.depth = 10;
|
|
GUI.Box(new Rect(38.399998f, 54f, 729.6f, 432f), "");
|
|
GUI.Label(new Rect(57.6f, 75.6f, 288f, 43.2f), "RealWater Settings", Title);
|
|
GUI.Label(new Rect(57.6f, 140.4f, 288f, 151.2f), "Image Size: (" + WaterPlane.GetRows() + "x" + WaterPlane.GetCols() + ")", Normal);
|
|
if (GUI.Button(new Rect(57.6f, 172.8f, 115.2f, 43.2f), "256x256"))
|
|
{
|
|
WaterPlane.normalMap = x256;
|
|
WaterPlane.Reset();
|
|
plane.GetComponent<Renderer>().material.SetTexture("_DetailNormalMap", x256);
|
|
botPlane.GetComponent<Renderer>().material.SetTexture("_DetailNormalMap", x256);
|
|
botRefractionPlane.GetComponent<Renderer>().material.SetTexture("_BumpMap", x256);
|
|
refractionPlane.GetComponent<Renderer>().material.SetTexture("_BumpMap", x256);
|
|
}
|
|
if (GUI.Button(new Rect(192f, 172.8f, 115.2f, 43.2f), "360x360"))
|
|
{
|
|
WaterPlane.normalMap = x360;
|
|
WaterPlane.Reset();
|
|
plane.GetComponent<Renderer>().material.SetTexture("_DetailNormalMap", x360);
|
|
botPlane.GetComponent<Renderer>().material.SetTexture("_DetailNormalMap", x360);
|
|
botRefractionPlane.GetComponent<Renderer>().material.SetTexture("_BumpMap", x360);
|
|
refractionPlane.GetComponent<Renderer>().material.SetTexture("_BumpMap", x360);
|
|
}
|
|
if (GUI.Button(new Rect(326.4f, 172.8f, 115.2f, 43.2f), "512x512"))
|
|
{
|
|
WaterPlane.normalMap = x512;
|
|
WaterPlane.Reset();
|
|
plane.GetComponent<Renderer>().material.SetTexture("_DetailNormalMap", x512);
|
|
botPlane.GetComponent<Renderer>().material.SetTexture("_DetailNormalMap", x512);
|
|
botRefractionPlane.GetComponent<Renderer>().material.SetTexture("_BumpMap", x512);
|
|
refractionPlane.GetComponent<Renderer>().material.SetTexture("_BumpMap", x512);
|
|
}
|
|
GUI.Label(new Rect(57.6f, 237.6f, 288f, 43.2f), "Speed: " + speedManager.Speed.ToString("F0") + " ", Normal);
|
|
speedManager.Speed = GUI.HorizontalSlider(new Rect(211.2f, 246.24f, 288f, 32.399998f), speedManager.Speed, 0f, 50f);
|
|
GUI.Label(new Rect(57.6f, 280.8f, 288f, 43.2f), "Damping: " + WaterPlane.Damping.ToString("F2"), Normal);
|
|
WaterPlane.Damping = GUI.HorizontalSlider(new Rect(211.2f, 285.12f, 288f, 32.399998f), WaterPlane.Damping, 0.8f, 0.99f);
|
|
GUI.Label(new Rect(57.6f, 324f, 288f, 43.2f), "Input Force: " + inputForce.ToString("F1"), Normal);
|
|
inputForce = GUI.HorizontalSlider(new Rect(230.4f, 329.4f, 288f, 32.399998f), inputForce, 0.1f, 1f);
|
|
if (inputForcePrev != inputForce)
|
|
{
|
|
for (int i = 0; i < 6; i++)
|
|
{
|
|
colliders[i].InputForce = inputForce;
|
|
}
|
|
inputForcePrev = inputForce;
|
|
}
|
|
GUI.Label(new Rect(57.6f, 367.2f, 288f, 43.2f), "Obstructions: ", Normal);
|
|
WaterPlane.obstructionSettings.ObstructionsEnabled = GUI.Toggle(new Rect(268.8f, 367.74f, 60.288f, 32.399998f), WaterPlane.obstructionSettings.ObstructionsEnabled, "");
|
|
GUI.Label(new Rect(57.6f, 410.4f, 288f, 43.2f), "Obstruction Texture: ", Normal);
|
|
WaterPlane.obstructionTextureSettings.ObstructionTexturesEnabled = GUI.Toggle(new Rect(268.8f, 410.94f, 60.288f, 32.399998f), WaterPlane.obstructionTextureSettings.ObstructionTexturesEnabled, "");
|
|
}
|
|
}
|