Car/Assets/Plugin/YogiGameCore/ShaderCommon/ShaderControlScripts/ScanPlaneControl.cs

23 lines
638 B
C#
Raw Permalink Normal View History

2024-12-31 07:57:41 +08:00
// Amplify Shader Editor - Visual Shader Editing Tool
// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
using UnityEngine;
[ExecuteInEditMode]
public class ScanPlaneControl : MonoBehaviour
{
private Transform m_transform;
private int m_planePropertyId;
void Awake()
{
m_planePropertyId = Shader.PropertyToID( "_PlaneClipNormals" );
m_transform = transform;
}
void Update ()
{
Plane plane = new Plane( m_transform.up, m_transform.position );
Vector4 planeNormals = new Vector4( plane.normal.x, plane.normal.y, plane.normal.z, plane.distance );
Shader.SetGlobalVector( m_planePropertyId, planeNormals );
}
}