void CheckForTerrain(ShadowReceiver receiver) { #if !UNITY_3_5 && !UNITY_3_4 && !UNITY_3_3 && !UNITY_3_2 && !UNITY_3_1 && !UNITY_3_0 && !UNITY_3_0_0 if (receiver.IsTerrain()) { if (receiver.GetTerrain().materialTemplate != null) { receiver.GetTerrain().materialTemplate.SetTexture("_ShadowTex", _Tex.GetTexture()); } } #endif }
void ApplyTerrainTextureMatrix(ShadowReceiver receiver) { bool standardTerrain = receiver.IsStandardTerrain(); if (standardTerrain) { if (receiver._terrainMaterial != null) { receiver.GetTerrain().materialTemplate.SetFloat("_UnityBugHack", Random.Range(0.0f, 1.0f)); receiver._terrainMaterial.SetMatrix("_GlobalProjector", _FinalMatrix); receiver._terrainMaterial.SetMatrix("_GlobalProjectorClip", _FinalClipMatrix); } } else { if (receiver._terrainMaterial != null) { receiver._terrainMaterial.SetMatrix("_GlobalProjector", _FinalMatrix); receiver._terrainMaterial.SetMatrix("_GlobalProjectorClip", _FinalClipMatrix); } receiver.GetTerrain().materialTemplate = receiver._terrainMaterial; } }