diff --git a/VoxelTypeFunctions/DefaultVoxelTypeFunctions.cs b/VoxelTypeFunctions/DefaultVoxelTypeFunctions.cs index 6f004d5..c34c9d3 100644 --- a/VoxelTypeFunctions/DefaultVoxelTypeFunctions.cs +++ b/VoxelTypeFunctions/DefaultVoxelTypeFunctions.cs @@ -10,7 +10,7 @@ namespace UltimateTerrains [Serializable] public class DefaultVoxelTypeFunctions : AbstractVoxelTypeFunctions { - [SerializeField] private Color32 vertexColor = Color.red; + [SerializeField] private Color32 vertexColor = new Color32(255, 0, 0, 0); [SerializeField] private Vector4 uv2 = Vector4.zero; public override Color32 GetVertexColor(Vector3d meshWorldPosition, Vector3 vertexPosition, Vector3 vertexNormal) @@ -26,8 +26,10 @@ public override Vector4 GetVertexUVW2(Vector3d meshWorldPosition, Vector3 vertex public override void OnEditorGUI(UltimateTerrain uTerrain, VoxelType voxelType) { #if UNITY_EDITOR - vertexColor = EditorGUILayout.ColorField("Vertex Color:", vertexColor); - uv2 = EditorGUILayout.ColorField("UV2 (X = R, Y = G):", uv2); + var vColLabel = new GUIContent("Vertex Color:", "(RGBA) R <=> 1st texture, G <=> 2nd texture, B <=> 3rd texture, A <=> 4th texture"); + vertexColor = EditorGUILayout.ColorField(vColLabel, vertexColor); + var vUV2Label = new GUIContent("UV2 (X = R, Y = G):", "(RG) R <=> 5th texture, G <=> 6th texture"); + uv2 = EditorGUILayout.ColorField(vUV2Label, uv2); #endif } } diff --git a/VoxelTypeFunctions/TopSidesColorsVoxelTypeFunctions.cs b/VoxelTypeFunctions/TopSidesColorsVoxelTypeFunctions.cs index 9bdfcb5..589fe42 100644 --- a/VoxelTypeFunctions/TopSidesColorsVoxelTypeFunctions.cs +++ b/VoxelTypeFunctions/TopSidesColorsVoxelTypeFunctions.cs @@ -10,21 +10,37 @@ namespace UltimateTerrains [Serializable] public class TopSidesColorsVoxelTypeFunctions : AbstractVoxelTypeFunctions { - [SerializeField] private Color topColor = Color.clear; - [SerializeField] private Color sidesColor = Color.clear; - [SerializeField] private float slopeModificator; + [SerializeField] private Color32 topColor = new Color32(255, 0, 0, 0); + [SerializeField] private Vector4 topUv2 = Vector4.zero; + [SerializeField] private Color32 sidesColor = new Color32(0, 255, 0, 0); + [SerializeField] private Vector4 sidesUv2 = Vector4.zero; + [SerializeField] private float slopeModificator = 0.7f; public override Color32 GetVertexColor(Vector3d meshWorldPosition, Vector3 vertexPosition, Vector3 vertexNormal) { return Color.Lerp(sidesColor, topColor, vertexNormal.y + slopeModificator); } + public override Vector4 GetVertexUVW2(Vector3d meshWorldPosition, Vector3 vertexPosition, Vector3 vertexNormal) + { + return Vector4.Lerp(sidesUv2, topUv2, vertexNormal.y + slopeModificator); + } + public override void OnEditorGUI(UltimateTerrain uTerrain, VoxelType voxelType) { #if UNITY_EDITOR - topColor = EditorGUILayout.ColorField("Top Color:", topColor); - sidesColor = EditorGUILayout.ColorField("Sides Color:", sidesColor); - slopeModificator = EditorGUILayout.Slider("Slope modificator:", slopeModificator, -1f, 1f); + var vColLabel = new GUIContent("Top Color:", "(RGBA) R <=> 1st texture, G <=> 2nd texture, B <=> 3rd texture, A <=> 4th texture"); + topColor = EditorGUILayout.ColorField(vColLabel, topColor); + var vUV2Label = new GUIContent("Top UV2:", "(RG) R <=> 5th texture, G <=> 6th texture"); + topUv2 = EditorGUILayout.ColorField(vUV2Label, topUv2); + + vColLabel = new GUIContent("Sides Color:", "(RGBA) R <=> 1st texture, G <=> 2nd texture, B <=> 3rd texture, A <=> 4th texture"); + sidesColor = EditorGUILayout.ColorField(vColLabel, sidesColor); + vUV2Label = new GUIContent("Sides UV2:", "(RG) R <=> 5th texture, G <=> 6th texture"); + sidesUv2 = EditorGUILayout.ColorField(vUV2Label, sidesUv2); + + var slopeLabel = new GUIContent("Top min normal.y:", "Min normal.y of ground to be considered as Top. If normal.y is lower than this, it will be considered as Sides."); + slopeModificator = EditorGUILayout.Slider(slopeLabel, slopeModificator, -1f, 1f); #endif } } diff --git a/VoxelTypeFunctions/TopSidesNoLerpColorsVoxelTypeFunctions.cs b/VoxelTypeFunctions/TopSidesNoLerpColorsVoxelTypeFunctions.cs index 4578004..60be94d 100644 --- a/VoxelTypeFunctions/TopSidesNoLerpColorsVoxelTypeFunctions.cs +++ b/VoxelTypeFunctions/TopSidesNoLerpColorsVoxelTypeFunctions.cs @@ -1,5 +1,5 @@ -using UnityEngine; -using System; +using System; +using UnityEngine; #if UNITY_EDITOR using UnityEditor; @@ -10,11 +10,11 @@ namespace UltimateTerrains [Serializable] public class TopSidesNoLerpColorsVoxelTypeFunctions : AbstractVoxelTypeFunctions { - [SerializeField] private Color32 topColor = Color.clear; - [SerializeField] private Vector4 topUv2 = Color.clear; - [SerializeField] private Color32 sidesColor = Color.clear; - [SerializeField] private Vector4 sidesUv2 = Color.clear; - [SerializeField] private float slopeLimit = 0f; + [SerializeField] private Color32 topColor = new Color32(255, 0, 0, 0); + [SerializeField] private Vector4 topUv2 = Vector4.zero; + [SerializeField] private Color32 sidesColor = new Color32(0, 255, 0, 0); + [SerializeField] private Vector4 sidesUv2 = Vector4.zero; + [SerializeField] private float slopeLimit = 0.7f; public override Color32 GetVertexColor(Vector3d meshWorldPosition, Vector3 vertexPosition, Vector3 vertexNormal) { @@ -29,11 +29,18 @@ public override Vector4 GetVertexUVW2(Vector3d meshWorldPosition, Vector3 vertex public override void OnEditorGUI(UltimateTerrain uTerrain, VoxelType voxelType) { #if UNITY_EDITOR - topColor = EditorGUILayout.ColorField("Top Color:", topColor); - topUv2 = EditorGUILayout.ColorField("Top UV2 (x=r, y=g, z=b, w=a):", topUv2); - sidesColor = EditorGUILayout.ColorField("Sides Color:", sidesColor); - sidesUv2 = EditorGUILayout.ColorField("Sides UV2 (x=r, y=g, z=b, w=a):", sidesUv2); - slopeLimit = EditorGUILayout.Slider("Slope limit:", slopeLimit, -1f, 1f); + var vColLabel = new GUIContent("Top Color:", "(RGBA) R <=> 1st texture, G <=> 2nd texture, B <=> 3rd texture, A <=> 4th texture"); + topColor = EditorGUILayout.ColorField(vColLabel, topColor); + var vUV2Label = new GUIContent("Top UV2:", "(RG) R <=> 5th texture, G <=> 6th texture"); + topUv2 = EditorGUILayout.ColorField(vUV2Label, topUv2); + + vColLabel = new GUIContent("Sides Color:", "(RGBA) R <=> 1st texture, G <=> 2nd texture, B <=> 3rd texture, A <=> 4th texture"); + sidesColor = EditorGUILayout.ColorField(vColLabel, sidesColor); + vUV2Label = new GUIContent("Sides UV2:", "(RG) R <=> 5th texture, G <=> 6th texture"); + sidesUv2 = EditorGUILayout.ColorField(vUV2Label, sidesUv2); + + var slopeLabel = new GUIContent("Top min normal.y:", "Min normal.y of ground to be considered as Top. If normal.y is lower than this, it will be considered as Sides."); + slopeLimit = EditorGUILayout.Slider(slopeLabel, slopeLimit, -1f, 1f); #endif } }