mirror of
https://github.com/imperialsushi/gutterball-3.git
synced 2025-06-15 05:07:42 +00:00
39 lines
No EOL
775 B
C#
39 lines
No EOL
775 B
C#
using UnityEngine;
|
|
|
|
[ExecuteInEditMode]
|
|
[RequireComponent(typeof(WaterBase))]
|
|
|
|
public class Displace : MonoBehaviour
|
|
{
|
|
private WaterBase waterBase = null;
|
|
|
|
public void Start()
|
|
{
|
|
if(!waterBase)
|
|
waterBase = (WaterBase) gameObject.GetComponent(typeof(WaterBase));
|
|
}
|
|
|
|
public void OnEnable()
|
|
{
|
|
Shader.EnableKeyword("WATER_VERTEX_DISPLACEMENT_ON");
|
|
Shader.DisableKeyword("WATER_VERTEX_DISPLACEMENT_OFF");
|
|
}
|
|
|
|
public void OnDisable()
|
|
{
|
|
Shader.EnableKeyword("WATER_VERTEX_DISPLACEMENT_OFF");
|
|
Shader.DisableKeyword("WATER_VERTEX_DISPLACEMENT_ON");
|
|
}
|
|
|
|
/*
|
|
public float GetOffsetAt(Vector3 pos, int displacementMapAmounts = 3)
|
|
{
|
|
return 0.0f;
|
|
}
|
|
|
|
public Vector3 GetNormalAt(Vector3 pos, float scale = 1.0F)
|
|
{
|
|
return Vector3.one;
|
|
}
|
|
*/
|
|
} |