當前位置: 首頁>>代碼示例>>C#>>正文


C# Vector4f.Shuffle方法代碼示例

本文整理匯總了C#中Mono.Simd.Vector4f.Shuffle方法的典型用法代碼示例。如果您正苦於以下問題:C# Vector4f.Shuffle方法的具體用法?C# Vector4f.Shuffle怎麽用?C# Vector4f.Shuffle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Mono.Simd.Vector4f的用法示例。


在下文中一共展示了Vector4f.Shuffle方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: test_0_shuffle_with_two_args_ps

	public static int test_0_shuffle_with_two_args_ps () {
		Vector4f a = new Vector4f (1, 2, 3, 4);
		Vector4f b = new Vector4f (5, 6, 7, 8);

		Vector4f c = a.Shuffle (b, ShuffleSel.ExpandY);
		if (c.X != 2)
			return 1;
		if (c.Y != 2)
			return 2;
		if (c.Z != 6)
			return 3;
		if (c.W != 6)
			return 4;
		return 0;
	}
開發者ID:Zman0169,項目名稱:mono,代碼行數:15,代碼來源:basic-simd.cs

示例2: test_0_packed_shuffle_with_reg_pressure

	public static int test_0_packed_shuffle_with_reg_pressure () {
		Vector4f v = new Vector4f (1, 2, 3, 4);
		Vector4f m0 = v + v, m1 = v - v, m2 = v * v, m3 = v + v + v;
		if (ff) v = v + v -v	;

		Vector4f r0 = v.Shuffle (ShuffleSel.XFromY | ShuffleSel.YFromW | ShuffleSel.ZFromX | ShuffleSel.WFromZ);
		Vector4f r1 = v.Shuffle (ShuffleSel.XFromY | ShuffleSel.YFromW | ShuffleSel.ZFromX | ShuffleSel.WFromZ);
		Vector4f x = v.Shuffle (ShuffleSel.XFromY | ShuffleSel.YFromW | ShuffleSel.ZFromX | ShuffleSel.WFromZ);
		Vector4f r2 = v.Shuffle (ShuffleSel.XFromY | ShuffleSel.YFromW | ShuffleSel.ZFromX | ShuffleSel.WFromZ);
		Vector4f r3 = v.Shuffle (ShuffleSel.XFromY | ShuffleSel.YFromW | ShuffleSel.ZFromX | ShuffleSel.WFromZ);
		Vector4f a = x;

		r0 = r0 * m0 + x;
		r1 = r1 * m1 + x;
		x = x - v + v;
		r2 = r2 * m2 + x;
		r3 = r3 * m3 + x;
		Vector4f result = r0 + r1 + r2 + r3;

		if (a.X != 2f)
			return 1;
		if (a.Y != 4f)
			return 2;
		if (a.Z != 1f)
			return 3;
		if (a.W != 3f)
			return 4;
		if (result.Y != result.Y)
			return 0;
		return 0;
	}
開發者ID:Zman0169,項目名稱:mono,代碼行數:31,代碼來源:basic-simd.cs

示例3: test_0_simple_packed_shuffle

	public static int test_0_simple_packed_shuffle () {
		Vector4f a = new Vector4f (1, 2, 3, 4);
		a = a.Shuffle(ShuffleSel.XFromY | ShuffleSel.YFromW | ShuffleSel.ZFromX | ShuffleSel.WFromZ);
		if (a.X != 2f)
			return 1;
		if (a.Y != 4f)
			return 2;
		if (a.Z != 1f)
			return 3;
		if (a.W != 3f)
			return 4;
		return 0;
	}
開發者ID:Zman0169,項目名稱:mono,代碼行數:13,代碼來源:basic-simd.cs

示例4: Cross

 public static void Cross (ref Vector4f a, ref Vector4f b, out Vector4f result)
 {
     result = (a * b.Shuffle ((ShuffleSel)0xc9) - b * a.Shuffle ((ShuffleSel)0xc9)).Shuffle ((ShuffleSel)0xc9);		
 }
開發者ID:Avatarchik,項目名稱:Voxe,代碼行數:4,代碼來源:SIMDMath.cs

示例5: Visit

        public void Visit(TernaryOp ins)
        {
            Vector4f a = ctx.ReadValue (ins.Source1);
            Vector4f b = ctx.ReadValue (ins.Source2);
            Vector4f c = ctx.ReadValue (ins.Source3);
            Vector4f res = new Vector4f ();
            switch (ins.Operation) {
            case TernaryOpKind.Cmp: {// a >= 0 ? b : c
                //m = a < [0,0,0,0]
                Vector4f mask = a.CompareLessThan (new Vector4f ()); //we change to a <b
                //res = (m & C) | (~m & B) -- this could be replaced by a blendps
                res = (mask & c) | mask.AndNot (b);
                break;
            }
            case TernaryOpKind.Mad: {// a *  b + c
                res = (a * b) + c;
                break;
            }
            case TernaryOpKind.SinCos: { // sin(a) , cos(a)
                //XXX maybe we should use the macro expansion provided in the driver docs for HLSL
                res.X = (float)Math.Cos (a.X);
                res.Y = (float)Math.Sin (a.X);
                break;
            }
            case TernaryOpKind.Lrp: //c + a * (b - c)
                //res = c + (a * (b - c));
                res = a * b + (Vector4f.One - a) * c;
                break;
            case TernaryOpKind.Dp2Add: //res = a.r * b.r + a.g * b.g + c.swizzle
             	res = a * b;
                //XX we could use Hadd here
                res = res + res.Shuffle (ShuffleSel.XFromY) + c;
                res = res.Shuffle (ShuffleSel.ExpandX);
                break;
            default:
                throw new Exception ("Cant handle " + ins.Operation);
            }

            if (Tracing.Enabled) Console.WriteLine ("{0} {1} {2} {3} => {4}/{5}/{6} == {7}", ins.Source1, ins.Operation, ins.Source2, ins.Source3, a, b, c, res);
            ctx.StoreValue (ins.Dest, res);
        }
開發者ID:kumpera,項目名稱:PixelMagic,代碼行數:41,代碼來源:Interpreter.cs


注:本文中的Mono.Simd.Vector4f.Shuffle方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。