目录索引
译文
有了这两种属性,我们就可以在着色器中定义颜色与向量了。
现在假设我们想编写一个用于在运行时更改颜色的着色器,那么,为了能够修改颜色的 RGBA 值,我们就需要为着色器添加颜色属性。
声明颜色与向量类型的语法如下所示:
// name ("display name", Color) = (R, G, B, A)
// name ("display name", Vector) = (0, 0, 0, 1)
Shader "InspectorPath/shaderName"
{
Properties
{
_Color ("Tint", Color) = (1, 1, 1, 1)
_VPos ("Vertex Position", Vector) = (0, 0, 0, 1)
}
}
在上面的例子中,我们声明了两个属性,分别是名为“_Color”的颜色类型与名为“_VPos”的向量类型。
原文对照
With this property, we can define colors and vectors in our shader.
We are going to suppose that we want to create a shader that can change color in execution time, for this we would have to add a color property where we can modify the RGBA values of the shader.
To declare colors and vectors in our shader, use the following syntax:
// name ("display name", Color) = (R, G, B, A)
// name ("display name", Vector) = (0, 0, 0, 1)
Shader "InspectorPath/shaderName"
{
Properties
{
_Color ("Tint", Color) = (1, 1, 1, 1)
_VPos ("Vertex Position", Vector) = (0, 0, 0, 1)
}
}
In this previous example, we declared two properties, a “color” called _Color and a “vector” called _VPos.
© 版权声明
文章版权归作者所有,未经允许请勿转载。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。
THE END
暂无评论内容