Shader "Unlit/Test"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 100
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
#define PI 3.14159
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};
struct v2f
{
float2 uv : TEXCOORD0;
float4 vertex : SV_POSITION;
};
sampler2D _MainTex;
float4 _MainTex_ST;
float JuLi(float4 s,float4 s2,v2f i)
{
float d =abs((s2.y-s.y)*i.vertex.x+(s.x-s2.x)*i.vertex.y+s2.x*s.y-s2.y*s.x)/sqrt(pow(s2.y-s.y,2)+pow(s.x-s2.x,2));
return d;
}
v2f vert (appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
return o;
}
fixed4 frag (v2f i) : SV_Target
{
//角度和弧度之间转换
//角度=180*弧度/PI
//弧度=角度*PI/180
vector d1=vector(_ScreenParams.x/2,_ScreenParams.y/2+sqrt(19500),0,0);
vector d2=vector(_Screen
Unity3D Shader :图标
最新推荐文章于 2024-08-05 12:39:06 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)