mirror of
https://github.com/drewcassidy/KSP-Conformal-Decals.git
synced 2024-09-01 18:23:54 +00:00
idk
This commit is contained in:
parent
f78093bbb6
commit
0b83155c42
@ -1,4 +1,5 @@
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
[ExecuteInEditMode]
|
||||
public class DecalProjectorTest : MonoBehaviour
|
||||
@ -23,9 +24,6 @@ public class DecalProjectorTest : MonoBehaviour
|
||||
void Awake()
|
||||
{
|
||||
_projectionMatrix = Matrix4x4.identity;
|
||||
_matrixID = Shader.PropertyToID("_ProjectionMatrix");
|
||||
_normalID = Shader.PropertyToID("_DecalNormal");
|
||||
_tangentID= Shader.PropertyToID("_DecalTangent");
|
||||
targetRenderer = target.GetComponent<MeshRenderer>();
|
||||
}
|
||||
|
||||
@ -40,8 +38,9 @@ public class DecalProjectorTest : MonoBehaviour
|
||||
var projectorToTarget = targetRenderer.worldToLocalMatrix * transform.localToWorldMatrix;
|
||||
_projectionMatrix = _OrthoMatrix * targetToProjector;
|
||||
|
||||
targetMaterial.SetMatrix(_matrixID, _projectionMatrix);
|
||||
targetMaterial.SetVector(_normalID, projectorToTarget.MultiplyVector(Vector3.back).normalized);
|
||||
targetMaterial.SetVector(_tangentID, projectorToTarget.MultiplyVector(Vector3.right).normalized);
|
||||
targetMaterial.SetMatrix("_ProjectionMatrix", _projectionMatrix);
|
||||
targetMaterial.SetVector("_DecalNormal", projectorToTarget.MultiplyVector(Vector3.back).normalized);
|
||||
targetMaterial.SetVector("_DecalTangent", projectorToTarget.MultiplyVector(Vector3.right).normalized);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user