using System; using UnityEngine; namespace CTS { [Serializable] public class CTSTerrainTextureDetails { public bool m_isOpenInEditor; public int m_textureIdx; public string m_name = "Texture"; public float m_detailPower = 1f; public float m_snowReductionPower; public float m_geologicalPower = 1f; public bool m_triplanar; public Color m_tint = new Color(1f, 1f, 1f); public float m_tintBrightness = 1f; public float m_smoothness = 1f; public int m_albedoIdx = -1; public float m_albedoTilingClose = 15f; public float m_albedoTilingFar = 3f; [NonSerialized] public bool m_albedoWasChanged; public Vector4 m_albedoAverage; [SerializeField] private Texture2D m_albedoTexture; [NonSerialized] public bool m_smoothnessWasChanged; [SerializeField] private Texture2D m_smoothnessTexture; [NonSerialized] public bool m_roughnessWasChanged; [SerializeField] private Texture2D m_roughnessTexture; public int m_normalIdx = -1; public float m_normalStrength = 1f; [NonSerialized] public bool m_normalWasChanged; [SerializeField] private Texture2D m_normalTexture; public int m_heightIdx = -1; public float m_heightDepth = 8f; public float m_heightContrast = 1f; public float m_heightBlendClose = 1f; public float m_heightBlendFar = 1f; public float m_heightTesselationDepth; public float m_heightMin; public float m_heightMax = 1f; [NonSerialized] public bool m_heightWasChanged; [SerializeField] private Texture2D m_heightTexture; public int m_aoIdx = -1; public float m_aoPower = 1f; [NonSerialized] public bool m_aoWasChanged; [SerializeField] private Texture2D m_aoTexture; public int m_emissionIdx = -1; public float m_emissionStrength = 1f; [NonSerialized] public bool m_emissionWasChanged; [SerializeField] private Texture2D m_emissionTexture; public Texture2D Albedo { get { return m_albedoTexture; } set { if (CTSProfile.IsDifferentTexture(m_albedoTexture, value)) { m_albedoTexture = value; m_albedoWasChanged = true; if (m_albedoTexture != null) { m_name = m_albedoTexture.name; } else { m_name = "Missing Albedo"; } } } } public Texture2D Smoothness { get { return m_smoothnessTexture; } set { if (CTSProfile.IsDifferentTexture(m_smoothnessTexture, value)) { m_smoothnessTexture = value; m_smoothnessWasChanged = true; } } } public Texture2D Roughness { get { return m_roughnessTexture; } set { if (CTSProfile.IsDifferentTexture(m_roughnessTexture, value)) { m_roughnessTexture = value; m_roughnessWasChanged = true; } } } public Texture2D Normal { get { return m_normalTexture; } set { if (CTSProfile.IsDifferentTexture(m_normalTexture, value)) { m_normalTexture = value; m_normalWasChanged = true; } } } public Texture2D Height { get { return m_heightTexture; } set { if (CTSProfile.IsDifferentTexture(m_heightTexture, value)) { m_heightTexture = value; m_heightWasChanged = true; } } } public Texture2D AmbientOcclusion { get { return m_aoTexture; } set { if (CTSProfile.IsDifferentTexture(m_aoTexture, value)) { m_aoTexture = value; m_aoWasChanged = true; } } } public Texture2D Emission { get { return m_emissionTexture; } set { if (CTSProfile.IsDifferentTexture(m_emissionTexture, value)) { m_emissionTexture = value; m_emissionWasChanged = true; } } } public CTSTerrainTextureDetails() { } public CTSTerrainTextureDetails(CTSTerrainTextureDetails src) { m_isOpenInEditor = src.m_isOpenInEditor; m_textureIdx = src.m_textureIdx; m_name = src.m_name; m_detailPower = src.m_detailPower; m_snowReductionPower = src.m_snowReductionPower; m_geologicalPower = src.m_geologicalPower; m_triplanar = src.m_triplanar; m_tint = src.m_tint; m_tintBrightness = src.m_tintBrightness; m_smoothness = src.m_smoothness; m_albedoIdx = src.m_albedoIdx; m_albedoTilingClose = src.m_albedoTilingClose; m_albedoTilingFar = src.m_albedoTilingFar; m_albedoWasChanged = src.m_albedoWasChanged; m_albedoTexture = src.m_albedoTexture; m_normalIdx = src.m_normalIdx; m_normalStrength = src.m_normalStrength; m_normalWasChanged = src.m_normalWasChanged; m_normalTexture = src.m_normalTexture; m_heightIdx = src.m_heightIdx; m_heightDepth = src.m_heightDepth; m_heightTesselationDepth = src.m_heightTesselationDepth; m_heightContrast = src.m_heightContrast; m_heightBlendClose = src.m_heightBlendClose; m_heightBlendFar = src.m_heightBlendFar; m_heightWasChanged = src.m_heightWasChanged; m_heightTexture = src.m_heightTexture; m_aoIdx = src.m_aoIdx; m_aoPower = src.m_aoPower; m_aoWasChanged = src.m_aoWasChanged; m_aoTexture = src.m_aoTexture; m_emissionIdx = src.m_emissionIdx; m_emissionStrength = src.m_emissionStrength; m_emissionWasChanged = src.m_emissionWasChanged; m_emissionTexture = src.m_emissionTexture; m_smoothness = src.m_smoothness; m_roughnessTexture = src.m_roughnessTexture; } public void ResetChangedFlags() { m_albedoWasChanged = false; m_normalWasChanged = false; m_heightWasChanged = false; m_aoWasChanged = false; m_emissionWasChanged = false; } public bool TextureHasChanged() { if (m_albedoWasChanged) { return true; } if (m_normalWasChanged) { return true; } if (m_heightWasChanged) { return true; } if (m_aoWasChanged) { return true; } if (m_emissionWasChanged) { return true; } return false; } } }