Fix tile parsing and decal rotation

• Decals now respond to rotation and offset tools again
• Fix tile value parsing
• Fix broken normals when projecting on parts with no normal maps
This commit is contained in:
2020-06-10 12:20:47 -07:00
parent 86f68b3bf8
commit e2f54cb4f7
4 changed files with 37 additions and 5 deletions

View File

@ -1,4 +1,3 @@
using ConformalDecals.Util;
using UnityEngine;
using UnityEngine.Rendering;
@ -35,10 +34,8 @@ namespace ConformalDecals {
_decalMPB.SetVector(DecalPropertyIDs._DecalNormal, decalNormal);
_decalMPB.SetVector(DecalPropertyIDs._DecalTangent, decalTangent);
if (useBaseNormal && targetMaterial.HasProperty(DecalPropertyIDs._BumpMap)) {
var normal = targetMaterial.GetTexture(DecalPropertyIDs._BumpMap);
if (normal != null) {
if (useBaseNormal) {
if (targetMaterial.HasProperty(DecalPropertyIDs._BumpMap)) {
_decalMPB.SetTexture(DecalPropertyIDs._BumpMap, targetMaterial.GetTexture(DecalPropertyIDs._BumpMap));
var normalScale = targetMaterial.GetTextureScale(DecalPropertyIDs._BumpMap);
@ -46,6 +43,10 @@ namespace ConformalDecals {
_decalMPB.SetVector(DecalPropertyIDs._BumpMap_ST, new Vector4(normalScale.x, normalScale.y, normalOffset.x, normalOffset.y));
}
else {
Debug.Log("Using blank normal");
_decalMPB.SetTexture(DecalPropertyIDs._BumpMap, DecalConfig.BlankNormal);
}
}
}