本文整理汇总了C#中MegaModifiers.InitVertSource方法的典型用法代码示例。如果您正苦于以下问题:C# MegaModifiers.InitVertSource方法的具体用法?C# MegaModifiers.InitVertSource怎么用?C# MegaModifiers.InitVertSource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MegaModifiers
的用法示例。
在下文中一共展示了MegaModifiers.InitVertSource方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetSelection
public override void GetSelection(MegaModifiers mc)
{
if ( modselection == null || modselection.Length != mc.verts.Length )
{
modselection = new float[mc.verts.Length];
}
// we dont need to update if nothing changes
if ( useCurrentVerts )
{
for ( int i = 0; i < verts.Length; i++ )
{
float d = Vector3.Distance(origin, verts[i]) - radius;
if ( d < 0.0f )
modselection[i] = 1.0f;
else
{
float w = Mathf.Exp(-falloff * Mathf.Abs(d));
modselection[i] = w; //mc.cols[i][c];
}
}
}
else
{
for ( int i = 0; i < verts.Length; i++ )
{
float d = Vector3.Distance(origin, verts[i]) - radius;
if ( d < 0.0f )
modselection[i] = 1.0f;
else
{
float w = Mathf.Exp(-falloff * Mathf.Abs(d));
modselection[i] = w; //mc.cols[i][c];
}
}
}
//if ( weight == 1.0f )
// mc.selection = null; // Normal system
// We only need the copy if we are first mod
if ( (mc.dirtyChannels & MegaModChannel.Verts) == 0 )
{
mc.InitVertSource();
//verts.CopyTo(sverts, 0);
//mc.UpdateMesh = 1;
}
//Debug.Log("sel " + modselection.Length);
mc.selection = modselection;
}
示例2: GetSelection
public override void GetSelection(MegaModifiers mc)
{
if ( target )
{
origin = transform.worldToLocalMatrix.MultiplyPoint(target.position);
}
if ( modselection == null || modselection.Length != mc.verts.Length )
{
modselection = new float[mc.verts.Length];
}
if ( freezeSelection )
{
mc.selection = modselection;
return;
}
// we dont need to update if nothing changes
if ( volType == MegaVolumeType.Sphere )
{
if ( useCurrentVerts )
{
for ( int i = 0; i < verts.Length; i++ )
{
float d = Vector3.Distance(origin, verts[i]) - radius;
if ( d < 0.0f )
modselection[i] = weight;
else
{
float w = Mathf.Exp(-falloff * Mathf.Abs(d));
modselection[i] = w * weight; //mc.cols[i][c];
}
}
}
else
{
for ( int i = 0; i < verts.Length; i++ )
{
float d = Vector3.Distance(origin, verts[i]) - radius;
if ( d < 0.0f )
modselection[i] = weight;
else
{
float w = Mathf.Exp(-falloff * Mathf.Abs(d));
modselection[i] = w * weight; //mc.cols[i][c];
}
}
}
}
else
{
if ( useCurrentVerts )
{
for ( int i = 0; i < verts.Length; i++ )
{
float d = GetDistBox(verts[i]);
if ( d < 0.0f )
modselection[i] = weight;
else
{
float w = Mathf.Exp(-falloff * Mathf.Abs(d));
modselection[i] = w * weight; //mc.cols[i][c];
}
}
}
else
{
for ( int i = 0; i < verts.Length; i++ )
{
float d = GetDistBox(verts[i]);
if ( d < 0.0f )
modselection[i] = weight;
else
{
float w = Mathf.Exp(-falloff * Mathf.Abs(d));
modselection[i] = w * weight; //mc.cols[i][c];
}
}
}
}
//if ( weight == 1.0f )
// mc.selection = null; // Normal system
// We only need the copy if we are first mod
if ( (mc.dirtyChannels & MegaModChannel.Verts) == 0 )
{
mc.InitVertSource();
//verts.CopyTo(sverts, 0);
//mc.UpdateMesh = 1;
}
//Debug.Log("sel " + modselection.Length);
mc.selection = modselection;
}
示例3: GetSelection
//.........这里部分代码省略.........
{
for ( int i = 0; i < verts.Length; i++ )
{
float d = GetDistBox(vol, verts[i]);
float wg = modselection[i];
if ( d < 0.0f )
wg += vol.weight;
else
{
float w = Mathf.Exp(-vol.falloff * Mathf.Abs(d));
wg += w * vol.weight; //mc.cols[i][c];
}
if ( wg > 1.0f )
modselection[i] = 1.0f;
else
modselection[i] = wg;
}
}
else
{
for ( int i = 0; i < verts.Length; i++ )
{
float d = GetDistBox(vol, verts[i]);
float wg = modselection[i];
if ( d < 0.0f )
wg += vol.weight;
else
{
float w = Mathf.Exp(-vol.falloff * Mathf.Abs(d));
wg += w * vol.weight; //mc.cols[i][c];
}
if ( wg > 1.0f )
modselection[i] = 1.0f;
else
modselection[i] = wg;
}
}
}
else
{
if ( useCurrentVerts )
{
for ( int i = 0; i < verts.Length; i++ )
{
float d = Vector3.Distance(origin, verts[i]) - vol.radius;
float wg = modselection[i];
if ( d < 0.0f )
wg += vol.weight;
else
{
float w = Mathf.Exp(-vol.falloff * Mathf.Abs(d));
wg += w * vol.weight; //mc.cols[i][c];
}
if ( wg > 1.0f )
modselection[i] = 1.0f;
else
modselection[i] = wg;
}
}
else
{
for ( int i = 0; i < verts.Length; i++ )
{
float d = Vector3.Distance(origin, verts[i]) - vol.radius;
float wg = modselection[i];
if ( d < 0.0f )
wg += vol.weight;
else
{
float w = Mathf.Exp(-vol.falloff * Mathf.Abs(d));
wg += w * vol.weight; //mc.cols[i][c];
}
if ( wg > 1.0f )
modselection[i] = 1.0f;
else
modselection[i] = wg;
}
}
}
}
}
}
if ( (mc.dirtyChannels & MegaModChannel.Verts) == 0 )
{
mc.InitVertSource();
}
mc.selection = modselection;
}