mirror of
https://github.com/drewcassidy/KSP-Conformal-Decals.git
synced 2024-09-01 18:23:54 +00:00
Add shader keyword support
This commit is contained in:
parent
14ea974a1d
commit
48819878dc
@ -0,0 +1,19 @@
|
|||||||
|
using ConformalDecals.Util;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace ConformalDecals.MaterialProperties {
|
||||||
|
public class MaterialKeywordProperty : MaterialProperty {
|
||||||
|
[SerializeField] public bool value = true;
|
||||||
|
|
||||||
|
public override void ParseNode(ConfigNode node) {
|
||||||
|
base.ParseNode(node);
|
||||||
|
|
||||||
|
ParseUtil.ParseBoolIndirect(ref value, node, "value");
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Modify(Material material) {
|
||||||
|
if (value) material.EnableKeyword(_propertyName);
|
||||||
|
else material.DisableKeyword(_propertyName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -67,6 +67,7 @@ namespace ConformalDecals.MaterialProperties {
|
|||||||
material.SetTexture(_propertyID, _texture);
|
material.SetTexture(_propertyID, _texture);
|
||||||
material.SetTextureOffset(_propertyID, _textureOffset);
|
material.SetTextureOffset(_propertyID, _textureOffset);
|
||||||
material.SetTextureScale(_propertyID, _textureScale * _scale);
|
material.SetTextureScale(_propertyID, _textureScale * _scale);
|
||||||
|
if (_propertyName != "_Decal") material.EnableKeyword("DECAL" + _propertyName.ToUpper());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetScale(Vector2 scale) {
|
public void SetScale(Vector2 scale) {
|
||||||
|
Loading…
Reference in New Issue
Block a user