In unity3d there is a piece of code for a vertex shader :
v2f vert(appdata_full v) {
v2f o;
o.pos = mul (UNITY_MATRIX_MVP, v.vertex);
o.uv = TRANSFORM_TEX(v.texcoord, _MainTex);
o.vertexColor = v.color * _TintColor;
return o;
}
In lines below :
o.uv = TRANSFORM_TEX(v.texcoord, _MainTex);
what is the main task of TRANSFORM_TEX function and what is it's equiavalent in CgFx !
It's just a Unity3D
specific macro, there's no Cg
equivalent.
You can find this macro definition in the file:
Unity\Editor\Data\CGIncludes\UnityCG.inc
It's defined this way:
// Transforms 2D UV by scale/bias property
#define TRANSFORM_TEX(tex,name) (tex.xy * name##_ST.xy + name##_ST.zw)
It scales and offsets texture coordinates.
XY
values controls the texture tiling and ZW
the offset.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With