//Shader名称:(Hidden/) + Universal Render Pipeline/ + (路径)/ + 功能名称(首字母大写驼峰式)
Shader "Universal Render Pipeline/CodingSpecification"
//Shader "Hidden/Universal Render Pipeline/CodingSpecification"
{
Properties
{
//材质属性:_+首字母大写驼峰式
_MainTex ("Texture", 2D) = "white" {}
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 100
Pass
{
CGPROGRAM
#pragma vertex VertFunc
#pragma fragment FragFunc
// make fog work
#pragma multi_compile_fog
//外部宏定义:_+全大写_下划线式
#pragma shader_feature _NORMALMAP
//内部宏定义:全大写_下划线式
#define ADDITIONAL_LIGHT_CALCULATE_SHADOWS
#include "UnityCG.cginc"
//结构体定义:首字母大写驼峰式
struct Appdata
{
// 结构体字段:首字母小写驼峰式
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};
struct V2f
{
float2 uv : TEXCOORD0;
UNITY_FOG_COORDS(1)
float4 vertex : SV_POSITION;
};
//Uniform属性定义:_+首字母大写驼峰式
sampler2D _MainTex;
float4 _MainTex_ST;
//函数名:首字母大写驼峰式
V2f VertexFunc(Appdata v)
{
V2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
UNITY_TRANSFER_FOG(o,o.vertex);
return o;
}
fixed4 FragFunc(V2f i) : SV_Target
{
//局部变量:首字母小写驼峰式
fixed4 col = tex2D(_MainTex, i.uv);
UNITY_APPLY_FOG(i.fogCoord, col);
return col;
}
ENDCG
}
}
}
标签:MainTex,驼峰,vertex,Shader,大写,首字母,内容,释义
From: https://www.cnblogs.com/comradexiao/p/18467349