2020-05-27 06:04:19 +00:00
|
|
|
using System;
|
|
|
|
using UnityEngine;
|
|
|
|
|
2020-06-19 23:35:10 +00:00
|
|
|
namespace ConformalDecals.MaterialProperties {
|
2020-06-04 07:12:09 +00:00
|
|
|
public abstract class MaterialProperty : ScriptableObject {
|
2020-06-05 07:29:23 +00:00
|
|
|
public string PropertyName {
|
2020-06-04 07:12:09 +00:00
|
|
|
get => _propertyName;
|
|
|
|
set {
|
|
|
|
_propertyName = value;
|
|
|
|
_propertyID = Shader.PropertyToID(_propertyName);
|
|
|
|
}
|
|
|
|
}
|
2020-05-27 06:04:19 +00:00
|
|
|
|
2020-06-04 07:12:09 +00:00
|
|
|
[SerializeField] protected int _propertyID;
|
|
|
|
[SerializeField] protected string _propertyName;
|
2020-05-27 06:04:19 +00:00
|
|
|
|
2020-07-03 02:40:00 +00:00
|
|
|
public abstract void Modify(Material material);
|
|
|
|
|
2020-06-04 07:12:09 +00:00
|
|
|
public virtual void ParseNode(ConfigNode node) {
|
2020-06-06 20:20:50 +00:00
|
|
|
if (node == null) throw new ArgumentNullException(nameof(node));
|
2020-05-27 06:04:19 +00:00
|
|
|
|
2020-06-05 07:29:23 +00:00
|
|
|
PropertyName = node.GetValue("name");
|
2020-05-27 06:04:19 +00:00
|
|
|
}
|
|
|
|
|
2020-07-03 02:40:00 +00:00
|
|
|
public virtual void Remove(Material material) { }
|
2020-05-27 06:04:19 +00:00
|
|
|
}
|
|
|
|
}
|