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


C# MegaModifiers.ChangeSourceVerts方法代码示例

本文整理汇总了C#中MegaModifiers.ChangeSourceVerts方法的典型用法代码示例。如果您正苦于以下问题:C# MegaModifiers.ChangeSourceVerts方法的具体用法?C# MegaModifiers.ChangeSourceVerts怎么用?C# MegaModifiers.ChangeSourceVerts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MegaModifiers的用法示例。


在下文中一共展示了MegaModifiers.ChangeSourceVerts方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Modify

    // oPoints whould be verts
    public override void Modify(MegaModifiers mc)
    {
        if ( nonMorphedVerts != null && nonMorphedVerts.Length > 1 )
        {
            ModifyCompressed(mc);
            return;
        }

        framenum++;
        //Vector3[]	verts = mc.GetSourceVerts();
        mc.ChangeSourceVerts();
        //Vector3[]	sverts = mc.GetDestVerts();

        float fChannelPercent;
        Vector3	delt;

        // cycle through channels, searching for ones to use
        bool firstchan = true;
        bool morphed = false;

        float min = 0.0f;
        float max = 100.0f;

        if ( UseLimit )
        {
            min = Min;
            max = Max;
        }

        for ( int i = 0; i < chanBank.Count; i++ )
        {
            MegaMorphChan chan = chanBank[i];
            chan.UpdatePercent();

            //fChannelPercent = Mathf.Clamp(chan.Percent, 0.0f, 100.0f);
            if ( UseLimit )
            {
                fChannelPercent = Mathf.Clamp(chan.Percent, min, max);	//chan.mSpinmin, chan.mSpinmax);
            }
            else
            {
                if ( chan.mUseLimit )
                    fChannelPercent = Mathf.Clamp(chan.Percent, chan.mSpinmin, chan.mSpinmax);
                else
                    fChannelPercent = Mathf.Clamp(chan.Percent, 0.0f, 100.0f);
            }

            //if ( fChannelPercent > 0.0f )
            if ( fChannelPercent != 0.0f || (fChannelPercent == 0.0f && chan.fChannelPercent != 0.0f) )
            {
                chan.fChannelPercent = fChannelPercent;

                if ( chan.mTargetCache != null && chan.mTargetCache.Count > 0 && chan.mActiveOverride )	//&& fChannelPercent != 0.0f )
                {
                    morphed = true;
                    //if ( chanBank[i].mapping == null || chanBank[i].mapping.Length == 0 )
                    //{
                        //chanBank[i].ChannelMapping(this);
                    //}

                    if ( chan.mUseLimit )	//|| glUseLimit )
                    {
                        //if ( glUseLimit )
                            //fChannelPercent = Mathf.Lerp(glMIN, glMAX, fChannelPercent * 0.01f);
                        //else
                            ///fChannelPercent = Mathf.Lerp(chan.mSpinmin, chan.mSpinmax, fChannelPercent * 0.01f);
                    }

                    if ( firstchan )
                    {
                        firstchan = false;
                        //Debug.Log("diflen " + dif.Length + " opoints " + oPoints.Length);
                        for ( int pointnum = 0; pointnum < oPoints.Length; pointnum++ )
                        {
                            dif[pointnum] = oPoints[pointnum];
                        }
                    }

                    if ( chan.mTargetCache.Count == 1 )
                    {
                        //MegaMorphChan chan = chanBank[i];
                        // Compressed version
        #if false
                        if ( firstchan )
                        {
                            firstchan = false;
                            for ( int pointnum = 0; pointnum < oPoints.Length; pointnum++ )
                            {
                                dif[pointnum] = oPoints[pointnum];
                                delt = chan.mDeltas[pointnum];

                                dif[pointnum].x += delt.x * fChannelPercent;
                                dif[pointnum].y += delt.y * fChannelPercent;
                                dif[pointnum].z += delt.z * fChannelPercent;
                            }
                        }
                        else
        #endif
                        {
//.........这里部分代码省略.........
开发者ID:mobeid,项目名称:NP_SIMULATOR,代码行数:101,代码来源:MegaMorph.cs

示例2: ModifyCompressed

	public void ModifyCompressed(MegaModifiers mc)
	{
		framenum++;
		mc.ChangeSourceVerts();

		float fChannelPercent;
		Vector3	delt;

		// cycle through channels, searching for ones to use
		bool firstchan = true;
		bool morphed = false;

		for ( int i = 0; i < chanBank.Count; i++ )
		{
			MegaMorphChan chan = chanBank[i];
			chan.UpdatePercent();

			fChannelPercent = Mathf.Clamp(chan.Percent, 0.0f, 100.0f);

			if ( fChannelPercent > 0.0f || (fChannelPercent == 0.0f && chan.fChannelPercent != 0.0f) )
			{
				chan.fChannelPercent = fChannelPercent;

				if ( chan.mTargetCache != null && chan.mTargetCache.Count > 0 && chan.mActiveOverride )	//&& fChannelPercent != 0.0f )
				{
					morphed = true;
					//if ( chanBank[i].mapping == null || chanBank[i].mapping.Length == 0 )
					//{
						//chanBank[i].ChannelMapping(this);
					//}

					if ( chan.mUseLimit )	//|| glUseLimit )
					{
						//if ( glUseLimit )
							//fChannelPercent = Mathf.Lerp(glMIN, glMAX, fChannelPercent * 0.01f);
						//else
							fChannelPercent = Mathf.Lerp(chan.mSpinmin, chan.mSpinmax, fChannelPercent * 0.01f);
					}

					// New bit
					if ( firstchan )
					{
						firstchan = false;
						// Save a int array of morphedpoints and use that, then only dealing with changed info
						for ( int pointnum = 0; pointnum < morphedVerts.Length; pointnum++ )
						{
							// this will change when we remove points
							int p = morphedVerts[pointnum];
							dif[p] = oPoints[p];	//morphedVerts[pointnum]];
						}
					}
					// end new


					if ( chan.mTargetCache.Count == 1 )
					{
						//MegaMorphChan chan = chanBank[i];
						// Compressed version
#if false
						if ( firstchan )
						{
							firstchan = false;
							// Save a int array of morphedpoints and use that, then only dealing with changed info
							for ( int pointnum = 0; pointnum < morphedVerts.Length; pointnum++ )
							{
								// this will change when we remove points
								int p = morphedVerts[pointnum];
								dif[p] = oPoints[p];	//morphedVerts[pointnum]];
								delt = chan.mDeltas[p];	//morphedVerts[pointnum]];
								//delt = chan.mDeltas[pointnum];	//morphedVerts[pointnum]];

								dif[p].x += delt.x * fChannelPercent;
								dif[p].y += delt.y * fChannelPercent;
								dif[p].z += delt.z * fChannelPercent;
							}
						}
						else
#endif
						{
							// Save a int array of morphedpoints and use that, then only dealing with changed info
							for ( int pointnum = 0; pointnum < morphedVerts.Length; pointnum++ )
							{
								int p = morphedVerts[pointnum];
								delt = chan.mDeltas[p];	//morphedVerts[pointnum]];
								//delt = chan.mDeltas[pointnum];	//morphedVerts[pointnum]];

								dif[p].x += delt.x * fChannelPercent;
								dif[p].y += delt.y * fChannelPercent;
								dif[p].z += delt.z * fChannelPercent;
							}
						}
					}
					else
					{
						int totaltargs = chan.mTargetCache.Count;	// + 1;	// + 1;

						float fProgression = fChannelPercent;	//Mathf.Clamp(fChannelPercent, 0.0f, 100.0f);
						int segment = 1;
						while ( segment <= totaltargs && fProgression >= chan.GetTargetPercent(segment - 2) )
							segment++;
//.........这里部分代码省略.........
开发者ID:xiaopangoo,项目名称:MotionPlatform,代码行数:101,代码来源:MegaMorph.cs

示例3: Modify

    // oPoints whould be verts
    public override void Modify(MegaModifiers mc)
    {
        if ( source == null )
            return;

        if ( source.nonMorphedVerts != null && source.nonMorphedVerts.Length > 1 )
        {
            ModifyCompressed(mc);
            return;
        }

        framenum++;
        mc.ChangeSourceVerts();

        float fChannelPercent;
        Vector3	delt;

        // cycle through channels, searching for ones to use
        bool firstchan = true;
        bool morphed = false;

        float min = 0.0f;
        float max = 100.0f;

        if ( UseLimit )
        {
            min = Min;
            max = Max;
        }

        for ( int i = 0; i < source.chanBank.Count; i++ )
        {
            MegaMorphChan chan = source.chanBank[i];

            // This needs to be local chan list
            chan.UpdatePercent();

            if ( UseLimit )
            {
                fChannelPercent = Mathf.Clamp(chan.Percent, min, max);	//chan.mSpinmin, chan.mSpinmax);
            }
            else
            {
                if ( chan.mUseLimit )
                    fChannelPercent = Mathf.Clamp(chan.Percent, chan.mSpinmin, chan.mSpinmax);
                else
                    fChannelPercent = Mathf.Clamp(chan.Percent, 0.0f, 100.0f);
            }

            if ( fChannelPercent != 0.0f || (fChannelPercent == 0.0f && chan.fChannelPercent != 0.0f) )
            {
                chan.fChannelPercent = fChannelPercent;

                if ( chan.mTargetCache != null && chan.mTargetCache.Count > 0 && chan.mActiveOverride )	//&& fChannelPercent != 0.0f )
                {
                    morphed = true;

                    if ( chan.mUseLimit )	//|| glUseLimit )
                    {
                    }

                    if ( firstchan )
                    {
                        firstchan = false;
                        for ( int pointnum = 0; pointnum < source.oPoints.Length; pointnum++ )
                        {
                            dif[pointnum] = source.oPoints[pointnum];
                        }
                    }

                    if ( chan.mTargetCache.Count == 1 )
                    {
                        for ( int pointnum = 0; pointnum < source.oPoints.Length; pointnum++ )
                        {
                            delt = chan.mDeltas[pointnum];

                            dif[pointnum].x += delt.x * fChannelPercent;
                            dif[pointnum].y += delt.y * fChannelPercent;
                            dif[pointnum].z += delt.z * fChannelPercent;
                        }
                    }
                    else
                    {
                        int totaltargs = chan.mTargetCache.Count;	// + 1;	// + 1;

                        float fProgression = fChannelPercent;	//Mathf.Clamp(fChannelPercent, 0.0f, 100.0f);
                        int segment = 1;
                        while ( segment <= totaltargs && fProgression >= chan.GetTargetPercent(segment - 2) )
                            segment++;

                        if ( segment > totaltargs )
                            segment = totaltargs;

                        p4 = source.oPoints;

                        if ( segment == 1 )
                        {
                            p1 = source.oPoints;
                            p2 = chan.mTargetCache[0].points;	// mpoints
//.........这里部分代码省略.........
开发者ID:mobeid,项目名称:NP_SIMULATOR,代码行数:101,代码来源:MegaMorphRef.cs


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