Temporarily remove nonfunctional intersection code

Will probably fix at a later date, but its not needed for the plugin to work
This commit is contained in:
Andrew Cassidy 2020-06-08 02:16:30 -07:00
parent 0375d25105
commit 10300f7f80
No known key found for this signature in database
GPG Key ID: 963017B38FD477A1
2 changed files with 17 additions and 23 deletions

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:8c0cdc1e59cda8543d4982273469cf0bd577130fd451dc4ac219748f5e1ac9df oid sha256:1f8a1ff89feeae2d29fb7b378f6b65a2daea3962dfd8c36b136be8858487ec37
size 34816 size 34816

View File

@ -22,37 +22,31 @@ namespace ConformalDecals {
} }
public void Project(Matrix4x4 orthoMatrix, OrientedBounds projectorBounds, Transform projector, bool useBaseNormal) { public void Project(Matrix4x4 orthoMatrix, OrientedBounds projectorBounds, Transform projector, bool useBaseNormal) {
var targetBounds = _targetRenderer.bounds; _projectionEnabled = true;
if (projectorBounds.Intersects(targetBounds)) {
_projectionEnabled = true;
var targetMaterial = _targetRenderer.sharedMaterial; var targetMaterial = _targetRenderer.sharedMaterial;
var projectorToTargetMatrix = target.worldToLocalMatrix * projector.localToWorldMatrix; var projectorToTargetMatrix = target.worldToLocalMatrix * projector.localToWorldMatrix;
var projectionMatrix = orthoMatrix * projectorToTargetMatrix.inverse; var projectionMatrix = orthoMatrix * projectorToTargetMatrix.inverse;
var decalNormal = projectorToTargetMatrix.MultiplyVector(Vector3.back).normalized; var decalNormal = projectorToTargetMatrix.MultiplyVector(Vector3.back).normalized;
var decalTangent = projectorToTargetMatrix.MultiplyVector(Vector3.right).normalized; var decalTangent = projectorToTargetMatrix.MultiplyVector(Vector3.right).normalized;
_decalMPB.SetMatrix(DecalPropertyIDs._ProjectionMatrix, projectionMatrix); _decalMPB.SetMatrix(DecalPropertyIDs._ProjectionMatrix, projectionMatrix);
_decalMPB.SetVector(DecalPropertyIDs._DecalNormal, decalNormal); _decalMPB.SetVector(DecalPropertyIDs._DecalNormal, decalNormal);
_decalMPB.SetVector(DecalPropertyIDs._DecalTangent, decalTangent); _decalMPB.SetVector(DecalPropertyIDs._DecalTangent, decalTangent);
if (useBaseNormal && targetMaterial.HasProperty(DecalPropertyIDs._BumpMap)) { if (useBaseNormal && targetMaterial.HasProperty(DecalPropertyIDs._BumpMap)) {
var normal = targetMaterial.GetTexture(DecalPropertyIDs._BumpMap); var normal = targetMaterial.GetTexture(DecalPropertyIDs._BumpMap);
if (normal != null) { if (normal != null) {
_decalMPB.SetTexture(DecalPropertyIDs._BumpMap, targetMaterial.GetTexture(DecalPropertyIDs._BumpMap)); _decalMPB.SetTexture(DecalPropertyIDs._BumpMap, targetMaterial.GetTexture(DecalPropertyIDs._BumpMap));
var normalScale = targetMaterial.GetTextureScale(DecalPropertyIDs._BumpMap); var normalScale = targetMaterial.GetTextureScale(DecalPropertyIDs._BumpMap);
var normalOffset = targetMaterial.GetTextureOffset(DecalPropertyIDs._BumpMap); var normalOffset = targetMaterial.GetTextureOffset(DecalPropertyIDs._BumpMap);
_decalMPB.SetVector(DecalPropertyIDs._BumpMap_ST, new Vector4(normalScale.x, normalScale.y, normalOffset.x, normalOffset.y)); _decalMPB.SetVector(DecalPropertyIDs._BumpMap_ST, new Vector4(normalScale.x, normalScale.y, normalOffset.x, normalOffset.y));
}
} }
} }
else {
_projectionEnabled = false;
}
} }
public bool Render(Material decalMaterial, MaterialPropertyBlock partMPB, Camera camera) { public bool Render(Material decalMaterial, MaterialPropertyBlock partMPB, Camera camera) {