diff --git a/Source/ConformalDecals/ConformalDecals.csproj b/Source/ConformalDecals/ConformalDecals.csproj index f5ff08c..2a6cb23 100644 --- a/Source/ConformalDecals/ConformalDecals.csproj +++ b/Source/ConformalDecals/ConformalDecals.csproj @@ -44,11 +44,11 @@ - - - - - + + + + + diff --git a/Source/ConformalDecals/MaterialModifiers/ColorPropertyMaterialModifier.cs b/Source/ConformalDecals/MaterialModifiers/ColorMaterialProperty.cs similarity index 68% rename from Source/ConformalDecals/MaterialModifiers/ColorPropertyMaterialModifier.cs rename to Source/ConformalDecals/MaterialModifiers/ColorMaterialProperty.cs index 6cda4e2..ddd6241 100644 --- a/Source/ConformalDecals/MaterialModifiers/ColorPropertyMaterialModifier.cs +++ b/Source/ConformalDecals/MaterialModifiers/ColorMaterialProperty.cs @@ -2,10 +2,10 @@ using System; using UnityEngine; namespace ConformalDecals.MaterialModifiers { - public class ColorPropertyMaterialModifier : MaterialModifier { + public class ColorMaterialProperty : MaterialProperty { private readonly Color _color; - public ColorPropertyMaterialModifier(ConfigNode node) : base(node) { + public ColorMaterialProperty(ConfigNode node) : base(node) { _color = ParsePropertyColor(node, "color", false); } diff --git a/Source/ConformalDecals/MaterialModifiers/FloatPropertyMaterialModifier.cs b/Source/ConformalDecals/MaterialModifiers/FloatMaterialProperty.cs similarity index 68% rename from Source/ConformalDecals/MaterialModifiers/FloatPropertyMaterialModifier.cs rename to Source/ConformalDecals/MaterialModifiers/FloatMaterialProperty.cs index bf9ea66..2154eb2 100644 --- a/Source/ConformalDecals/MaterialModifiers/FloatPropertyMaterialModifier.cs +++ b/Source/ConformalDecals/MaterialModifiers/FloatMaterialProperty.cs @@ -2,10 +2,10 @@ using System; using UnityEngine; namespace ConformalDecals.MaterialModifiers { - public class FloatPropertyMaterialModifier : MaterialModifier { + public class FloatMaterialProperty : MaterialProperty { private readonly float _value; - public FloatPropertyMaterialModifier(ConfigNode node) : base(node) { + public FloatMaterialProperty(ConfigNode node) : base(node) { _value = ParsePropertyFloat(node, "value", false); } diff --git a/Source/ConformalDecals/MaterialModifiers/MaterialModifier.cs b/Source/ConformalDecals/MaterialModifiers/MaterialProperty.cs similarity index 97% rename from Source/ConformalDecals/MaterialModifiers/MaterialModifier.cs rename to Source/ConformalDecals/MaterialModifiers/MaterialProperty.cs index 83e5056..8b9e3f9 100644 --- a/Source/ConformalDecals/MaterialModifiers/MaterialModifier.cs +++ b/Source/ConformalDecals/MaterialModifiers/MaterialProperty.cs @@ -2,13 +2,13 @@ using System; using UnityEngine; namespace ConformalDecals.MaterialModifiers { - public abstract class MaterialModifier { + public abstract class MaterialProperty { public string PropertyName { get; } protected readonly int _propertyID; - protected MaterialModifier(ConfigNode node) { + protected MaterialProperty(ConfigNode node) { PropertyName = node.GetValue("name"); if (PropertyName == null) diff --git a/Source/ConformalDecals/MaterialModifiers/MaterialModifierCollection.cs b/Source/ConformalDecals/MaterialModifiers/MaterialPropertyCollection.cs similarity index 60% rename from Source/ConformalDecals/MaterialModifiers/MaterialModifierCollection.cs rename to Source/ConformalDecals/MaterialModifiers/MaterialPropertyCollection.cs index 532d897..023ea5e 100644 --- a/Source/ConformalDecals/MaterialModifiers/MaterialModifierCollection.cs +++ b/Source/ConformalDecals/MaterialModifiers/MaterialPropertyCollection.cs @@ -3,24 +3,24 @@ using System.Collections.Generic; using UnityEngine; namespace ConformalDecals.MaterialModifiers { - public class MaterialModifierCollection { + public class MaterialPropertyCollection { public Shader ShaderRef { get; } - public TexturePropertyMaterialModifier MainTexture { get; } + public TextureMaterialProperty MainTextureMaterial { get; } - private List _materialModifiers; - private List _texturePropertyMaterialModifiers; + private List _materialModifiers; + private List _texturePropertyMaterialModifiers; - public MaterialModifierCollection(ConfigNode node) { + public MaterialPropertyCollection(ConfigNode node) { var shaderString = node.GetValue("shader"); if (shaderString == null) - throw new FormatException($"Missing shader name in material"); + throw new FormatException("Missing shader name in material"); if (shaderString == string.Empty) - throw new FormatException($"Empty shader name in material"); + throw new FormatException("Empty shader name in material"); - _materialModifiers = new List(); - _texturePropertyMaterialModifiers = new List(); + _materialModifiers = new List(); + _texturePropertyMaterialModifiers = new List(); //TODO: USE SHABBY PROVIDED METHOD HERE INSTEAD ShaderRef = Shader.Find(shaderString); @@ -29,27 +29,27 @@ namespace ConformalDecals.MaterialModifiers { foreach (ConfigNode propertyNode in node.nodes) { try { - MaterialModifier modifier; + MaterialProperty property; switch (propertyNode.name) { case "FLOAT": - modifier = new FloatPropertyMaterialModifier(propertyNode); + property = new FloatMaterialProperty(propertyNode); break; case "COLOR": - modifier = new ColorPropertyMaterialModifier(propertyNode); + property = new ColorMaterialProperty(propertyNode); break; case "TEXTURE": - modifier = new TexturePropertyMaterialModifier(propertyNode); - var textureModifier = modifier as TexturePropertyMaterialModifier; + property = new TextureMaterialProperty(propertyNode); + var textureModifier = (TextureMaterialProperty) property; if (textureModifier.IsMain) { - if (MainTexture != null) { - MainTexture = textureModifier; + if (MainTextureMaterial == null) { + MainTextureMaterial = textureModifier; } else { Debug.LogWarning( $"Material texture property {textureModifier.TextureUrl} is marked as main, but material already has a main texture! \n" + - $"Defaulting to {MainTexture.TextureUrl}"); + $"Defaulting to {MainTextureMaterial.TextureUrl}"); } } @@ -58,10 +58,9 @@ namespace ConformalDecals.MaterialModifiers { default: throw new FormatException($"Invalid property type '{propertyNode.name}' in material"); - break; } - _materialModifiers.Add(modifier); + _materialModifiers.Add(property); } catch (Exception e) { diff --git a/Source/ConformalDecals/MaterialModifiers/TexturePropertyMaterialModifier.cs b/Source/ConformalDecals/MaterialModifiers/TextureMaterialProperty.cs similarity index 93% rename from Source/ConformalDecals/MaterialModifiers/TexturePropertyMaterialModifier.cs rename to Source/ConformalDecals/MaterialModifiers/TextureMaterialProperty.cs index f78cb8e..71375bc 100644 --- a/Source/ConformalDecals/MaterialModifiers/TexturePropertyMaterialModifier.cs +++ b/Source/ConformalDecals/MaterialModifiers/TextureMaterialProperty.cs @@ -2,7 +2,7 @@ using System; using UnityEngine; namespace ConformalDecals.MaterialModifiers { - public class TexturePropertyMaterialModifier : MaterialModifier { + public class TextureMaterialProperty : MaterialProperty { public string TextureUrl { get; } public Texture2D TextureRef { get; } @@ -15,7 +15,7 @@ namespace ConformalDecals.MaterialModifiers { public Rect TileRect { get; } - public TexturePropertyMaterialModifier(ConfigNode node) : base(node) { + public TextureMaterialProperty(ConfigNode node) : base(node) { TextureUrl = node.GetValue("textureURL"); var textureInfo = GameDatabase.Instance.GetTextureInfo(TextureUrl);