Rename to reflect behavior instead of copying Blowfish

feature-multiSDF
Andrew Cassidy 4 years ago
parent 1ed0cfacb7
commit a90d24c141

@ -44,11 +44,11 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="MaterialModifiers\ColorPropertyMaterialModifier.cs" />
<Compile Include="MaterialModifiers\FloatPropertyMaterialModifier.cs" />
<Compile Include="MaterialModifiers\MaterialModifier.cs" />
<Compile Include="MaterialModifiers\MaterialModifierCollection.cs" />
<Compile Include="MaterialModifiers\TexturePropertyMaterialModifier.cs" />
<Compile Include="MaterialModifiers\ColorMaterialProperty.cs" />
<Compile Include="MaterialModifiers\FloatMaterialProperty.cs" />
<Compile Include="MaterialModifiers\MaterialProperty.cs" />
<Compile Include="MaterialModifiers\MaterialPropertyCollection.cs" />
<Compile Include="MaterialModifiers\TextureMaterialProperty.cs" />
<Compile Include="ModuleConformalDecal.cs" />
<Compile Include="Logging.cs" />
<Compile Include="Properties\AssemblyInfo.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);
}

@ -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);
}

@ -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)

@ -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<MaterialModifier> _materialModifiers;
private List<TexturePropertyMaterialModifier> _texturePropertyMaterialModifiers;
private List<MaterialProperty> _materialModifiers;
private List<TextureMaterialProperty> _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<MaterialModifier>();
_texturePropertyMaterialModifiers = new List<TexturePropertyMaterialModifier>();
_materialModifiers = new List<MaterialProperty>();
_texturePropertyMaterialModifiers = new List<TextureMaterialProperty>();
//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) {

@ -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);
Loading…
Cancel
Save