当前位置: 首页>>代码示例>>C#>>正文


C# MegaModifiers.InitVertSource方法代码示例

本文整理汇总了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;
    }
开发者ID:schonstal,项目名称:madness,代码行数:52,代码来源:MegaVolSelect.cs

示例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;
    }
开发者ID:jsr2k1,项目名称:gato-book-test,代码行数:99,代码来源:MegaVolSelect.cs

示例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;
    }
开发者ID:jsr2k1,项目名称:videojocjj,代码行数:101,代码来源:MegaMultiVolSelect.cs


注:本文中的MegaModifiers.InitVertSource方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。