You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
700 B

  1. using UnityEngine;
  2. [ExecuteInEditMode]
  3. [RequireComponent(typeof(WaterBase))]
  4. public class Displace : MonoBehaviour
  5. {
  6. public void Awake()
  7. {
  8. if (enabled)
  9. OnEnable();
  10. else
  11. OnDisable();
  12. }
  13. public void OnEnable()
  14. {
  15. Shader.EnableKeyword("WATER_VERTEX_DISPLACEMENT_ON");
  16. Shader.DisableKeyword("WATER_VERTEX_DISPLACEMENT_OFF");
  17. }
  18. public void OnDisable()
  19. {
  20. Shader.EnableKeyword("WATER_VERTEX_DISPLACEMENT_OFF");
  21. Shader.DisableKeyword("WATER_VERTEX_DISPLACEMENT_ON");
  22. }
  23. /*
  24. public float GetOffsetAt(Vector3 pos, int displacementMapAmounts = 3)
  25. {
  26. return 0.0f;
  27. }
  28. public Vector3 GetNormalAt(Vector3 pos, float scale = 1.0F)
  29. {
  30. return Vector3.one;
  31. }
  32. */
  33. }