本文整理汇总了C#中MegaModifiers.GetSourceUvs方法的典型用法代码示例。如果您正苦于以下问题:C# MegaModifiers.GetSourceUvs方法的具体用法?C# MegaModifiers.GetSourceUvs怎么用?C# MegaModifiers.GetSourceUvs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MegaModifiers
的用法示例。
在下文中一共展示了MegaModifiers.GetSourceUvs方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Modify
public override void Modify(MegaModifiers mc)
{
Vector2[] uvs = mc.GetSourceUvs();
Vector2[] newuvs = mc.GetDestUvs();
if ( uvs.Length > 0 )
{
Vector3 pos = -gizmoPos;
Vector3 scl = gizmoScale;
Vector3 rot = gizmoRot;
Matrix4x4 tm1 = Matrix4x4.identity;
Vector3 p = Vector3.zero;
for ( int i = 0; i < uvs.Length; i++ )
{
p.x = uvs[i].x - Offset.x - 0.5f;
p.z = uvs[i].y - Offset.z - 0.5f;
p.y = 0.0f;
float d = Mathf.Sqrt(p.x * p.x + p.z * p.z) * spiral;
rot = new Vector3(gizmoRot.x, gizmoRot.y + d, gizmoRot.z);
tm1 = Matrix4x4.TRS(pos, Quaternion.Euler(rot), scl);
p = tm1.MultiplyPoint(p);
newuvs[i].x = p.x;
newuvs[i].y = p.z;
}
}
}
示例2: Modify
//public override void Modify(ref Vector3[] sverts, ref Vector3[] verts)
public override void Modify(MegaModifiers mc)
{
Vector2[] uvs = mc.GetSourceUvs();
Vector2[] newuvs = mc.GetDestUvs();
if ( mat == null || twidth == 0.0f )
Init();
if ( uvs.Length > 0 )
{
//Debug.Log("twidth " + twidth);
xtiles = twidth / TileWidth;
ytiles = theight / TileHeight;
tuvw = (float)TileWidth / (float)twidth;
tuvh = (float)TileHeight / (float)theight;
maxframe = xtiles * ytiles;
Frame = Frame % maxframe;
int x = Frame % xtiles;
int y = Frame / xtiles;
float su = (x * tuvw);
float sv = (y * tuvh);
for ( int i = 0; i < uvs.Length; i++ )
{
Vector2 uv = Vector2.Scale(uvs[i] + off, scale);
if ( flipy ) uv.y = 1.0f - uv.y;
if ( flipx ) uv.x = 1.0f - uv.x;
uv.x = su + (tuvw * uv.x);
uv.y = 1.0f - (sv + (tuvh * uv.y));
newuvs[i] = uv;
}
}
}