small tweaks

This commit is contained in:
Andrew Cassidy 2020-06-02 19:11:05 -07:00
parent d1e4d2ac4f
commit 5652f0dda1
3 changed files with 4 additions and 5 deletions

View File

@ -427,6 +427,5 @@ namespace ConformalDecals {
target.Render(decalMaterial, part.mpb, camera); target.Render(decalMaterial, part.mpb, camera);
} }
} }
} }
} }

View File

@ -17,6 +17,9 @@ namespace ConformalDecals {
// property block // property block
private readonly MaterialPropertyBlock _decalMPB; private readonly MaterialPropertyBlock _decalMPB;
private static readonly int normalID = Shader.PropertyToID("_BumpMap");
private static readonly int normalIDST = Shader.PropertyToID("_BumpMap_ST");
public ProjectionTarget(MeshRenderer targetRenderer, Mesh targetMesh, bool useBaseNormal) { public ProjectionTarget(MeshRenderer targetRenderer, Mesh targetMesh, bool useBaseNormal) {
target = targetRenderer.transform; target = targetRenderer.transform;
@ -26,10 +29,7 @@ namespace ConformalDecals {
_decalMPB = new MaterialPropertyBlock(); _decalMPB = new MaterialPropertyBlock();
if (useBaseNormal) { if (useBaseNormal && targetMaterial.HasProperty(normalID)) {
var normalID = Shader.PropertyToID("_BumpMap");
var normalIDST = Shader.PropertyToID("_BumpMap_ST");
var normal = targetMaterial.GetTexture(normalID); var normal = targetMaterial.GetTexture(normalID);
if (normal != null) { if (normal != null) {