|
|
|
@ -20,9 +20,10 @@ namespace ConformalDecals {
|
|
|
|
|
_decalMPB = new MaterialPropertyBlock();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Project(Matrix4x4 orthoMatrix, Transform projector, bool useBaseNormal) {
|
|
|
|
|
_projectionEnabled = true;
|
|
|
|
|
public void Project(Matrix4x4 orthoMatrix, Transform projector, Bounds projectorBounds, bool useBaseNormal) {
|
|
|
|
|
|
|
|
|
|
if (projectorBounds.Intersects(_targetRenderer.bounds)) {
|
|
|
|
|
_projectionEnabled = true;
|
|
|
|
|
var targetMaterial = _targetRenderer.sharedMaterial;
|
|
|
|
|
var projectorToTargetMatrix = target.worldToLocalMatrix * projector.localToWorldMatrix;
|
|
|
|
|
|
|
|
|
@ -46,6 +47,10 @@ namespace ConformalDecals {
|
|
|
|
|
_decalMPB.SetTexture(DecalPropertyIDs._BumpMap, DecalConfig.BlankNormal);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
_projectionEnabled = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool Render(Material decalMaterial, MaterialPropertyBlock partMPB, Camera camera) {
|
|
|
|
|
if (_projectionEnabled) {
|
|
|
|
|