• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Simd.Vector4f类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Mono.Simd.Vector4f的典型用法代码示例。如果您正苦于以下问题:C# Vector4f类的具体用法?C# Vector4f怎么用?C# Vector4f使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Vector4f类属于Mono.Simd命名空间,在下文中一共展示了Vector4f类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: test_0_accessor_and_byref_var

 public static int test_0_accessor_and_byref_var()
 {
     Vector4f a = new Vector4f (1, 2, 3, 4);
     if (use_getter_with_byref (ref a) != 4)
         return 1;
     return 0;
 }
开发者ID:AveProjVstm,项目名称:MonoVstm,代码行数:7,代码来源:basic-simd.cs


示例2: Dp2Add

 public static Vector4f Dp2Add(Vector4f a, Vector4f b, Vector4f c)
 {
     Vector4f res = a * b;
     //XX we could use HorizontalAdd here
     res = res + res.Shuffle (ShuffleSel.XFromY) + c;
     return res.Shuffle (ShuffleSel.ExpandX);
 }
开发者ID:kumpera,项目名称:PixelMagic,代码行数:7,代码来源:SimdExtras.cs


示例3: Dot

        public static float Dot (ref Vector4f vector1, ref Vector4f vector2)
        {
            Vector4f t = vector1 * vector2;
		
            t = t.HorizontalAdd (t);		
            t = t.HorizontalAdd (t);
		
            return t.X;
        }
开发者ID:Avatarchik,项目名称:Voxe,代码行数:9,代码来源:SIMDMath.cs


示例4: Sample

        public Vector4f Sample(Vector4f coord)
        {
            int x = (int) (coord.X * tex.Width);
            int y = (int) (coord.Y * tex.Height);
            Vector4f color = tex.ReadColor (x, y);

            if (Tracing.Enabled) Console.WriteLine ("sampling {0} -> [{1}, {2}] -> {3}", coord, x, y, color);
            return color;
        }
开发者ID:kangaroo,项目名称:PixelMagic,代码行数:9,代码来源:Texture.cs


示例5: call_simd_fp

    public static void call_simd_fp()
    {
        Vector4f a = new Vector4f (20f, 22f, 23f, 24f);
        float b = 25f;
        Vector4f c = new Vector4f (26f, 27f, 28f, 29f);
        float d = 30f;

        b += d;
        a += c;
    }
开发者ID:AveProjVstm,项目名称:MonoVstm,代码行数:10,代码来源:basic-simd.cs


示例6: Quaternion

		public Quaternion (Vector3 vectorPart, float scalarPart)
		{
#if SIMD
			v4 = new Vector4f (vectorPart.X, vectorPart.Y, vectorPart.Z, scalarPart);
#else
			x = vectorPart.X;
			y = vectorPart.Y;
			z = vectorPart.Z;
			w = scalarPart;
#endif
		}
开发者ID:CodesInChaos,项目名称:Mono.GameMath,代码行数:11,代码来源:Quaternion.cs


示例7: AndNot

		public static unsafe Vector4f AndNot (this Vector4f v1, Vector4f v2)
		{
			Vector4f res = new Vector4f ();
			int *a = (int*)&v1;
			int *b = (int*)&v2;
			int *c = (int*)&res;
			*c++ = ~*a++ & *b++;
			*c++ = ~*a++ & *b++;
			*c++ = ~*a++ & *b++;
			*c = ~*a & *b;
			return res;
		}
开发者ID:REALTOBIZ,项目名称:mono,代码行数:12,代码来源:VectorOperations.cs


示例8: SimdTest

        public void SimdTest()
        {
            Bounds bounds = new Bounds(new Vector3(1, 1, 1), new Vector3(3, 3, 3));
            const int positionX = 4;
            const int positionZ = 3;

            // Non-SIMD version
            Vector3Int bMin;
            Vector3Int bMax;
            Vector3Int myVec52 = new Vector3Int(Chunk.Vec5.X, Chunk.Vec5.X, Chunk.Vec5.X);
            {
                Vector3Int pom = new Vector3Int(positionX * EngineSettings.ChunkConfig.SizeX, 0, positionZ * EngineSettings.ChunkConfig.SizeZ);

                int minX = Mathf.Clamp(Mathf.FloorToInt(bounds.min.x) - pom.X - myVec52.X, 0, EngineSettings.ChunkConfig.MaskX);
                int minY = Mathf.Clamp(Mathf.FloorToInt(bounds.min.y) - myVec52.Y, 0, EngineSettings.ChunkConfig.SizeYTotal - 1);
                int minZ = Mathf.Clamp(Mathf.FloorToInt(bounds.min.z) - pom.Z - myVec52.Z, 0, EngineSettings.ChunkConfig.MaskZ);
                bMin = new Vector3Int(minX, minY, minZ);

                int maxX = Mathf.Clamp(Mathf.Clamp(bMin.X, 0, EngineSettings.ChunkConfig.MaskX), 0, EngineSettings.ChunkConfig.MaskX);
                int maxY = Mathf.Clamp(Mathf.Clamp(bMin.Y, 0, EngineSettings.ChunkConfig.SizeYTotal - 1), 0, EngineSettings.ChunkConfig.SizeYTotal-1);
                int maxZ = Mathf.Clamp(Mathf.Clamp(bMin.Z, 0, EngineSettings.ChunkConfig.MaskZ), 0, EngineSettings.ChunkConfig.MaskZ);
                bMax = new Vector3Int(maxX, maxY, maxZ);
            }

            // SIMD version
            Vector4i bMinv;
            Vector4i bMaxv;
            {
                Vector4f bMinf = new Vector4f(bounds.min.x, bounds.min.y, bounds.min.z, 0f);
                bMinv = bMinf.ConvertToIntTruncated();
                Vector4f bMaxf = new Vector4f(bounds.max.x, bounds.max.y, bounds.max.z, 0f);
                bMaxv = bMaxf.ConvertToInt();

                Vector4i pom = new Vector4i(positionX, 0, positionZ, 0)*Chunk.VecSize;
                bMinv -= pom;
                bMinv -= Chunk.Vec5;
                bMinv = bMinv.Max(Vector4i.Zero).Min(Chunk.VecSize1);
                    // Clamp to 0..size (x,z) or 0..height (y) respectively

                bMaxv -= pom;
                bMaxv += Chunk.Vec5;
                bMaxv = bMaxv.Max(Vector4i.Zero).Min(Chunk.VecSize1);
                    // Clamp to 0..size (x,z) or 0..height (y) respectively
            }

            Assert.AreEqual(bMin.X, bMinv.X);
            Assert.AreEqual(bMin.Y, bMinv.Y);
            Assert.AreEqual(bMin.Z, bMinv.Z);

            Assert.AreEqual(bMax.X, bMaxv.X);
            Assert.AreEqual(bMax.Y, bMaxv.Y);
            Assert.AreEqual(bMax.Z, bMaxv.Z);
        }
开发者ID:Avatarchik,项目名称:Voxe,代码行数:53,代码来源:UTSimd.cs


示例9: test_0_accessors

 public static int test_0_accessors()
 {
     Vector4f a = new Vector4f (1, 2, 3, 4);
     if (a.X != 1f)
         return 1;
     if (a.Y != 2f)
         return 2;
     if (a.Z != 3f)
         return 3;
     if (a.W != 4f)
         return 4;
     return 0;
 }
开发者ID:AveProjVstm,项目名称:MonoVstm,代码行数:13,代码来源:basic-simd.cs


示例10: test_0_vector4f_one_element_ctor

	static int test_0_vector4f_one_element_ctor () {
		Vector4f a = new Vector4f (99);

		if (a.X != 99)
			return 1;
		if (a.Y != 99)
			return 2;
		if (a.Z != 99)
			return 3;
		if (a.W != 99)
			return 4;
		return 0;
	}
开发者ID:Zman0169,项目名称:mono,代码行数:13,代码来源:basic-simd.cs


示例11: test_0_f_to_i_trunc

	public static int test_0_f_to_i_trunc () {
		var a = new Vector4f (1.1f, 2.2f, 3.5f, 4.6f);
		var b = a.ConvertToIntTruncated ();
		if (b.X != 1)
			return 1;
		if (b.Y != 2)
			return 2;
		if (b.Z != 3)
			return 3;
		if (b.W != 4)
			return 4;
		return 0;
	}
开发者ID:Zman0169,项目名称:mono,代码行数:13,代码来源:basic-simd.cs


示例12: test_0_set_vector4f_operator_neq

	public static int test_0_set_vector4f_operator_neq () {
		Vector4f a = new Vector4f(1, 2, 3, 4);
		Vector4f b = new Vector4f(1, 2, 3, 4);
		if (a != b)
			return 1;

		a = new Vector4f(1, 2, float.NaN, 4);
		b = new Vector4f(1, 2, float.NaN, 4);
		if (!(a != b)) //NaN is always !=
			return 2;

		a = new Vector4f(1, 2, float.NaN, 4);
		b = new Vector4f(1, 2, 10, 4);
		if (!(a != b))
			return 3;

		a = new Vector4f(1, 2, float.PositiveInfinity, 4);
		b = new Vector4f(1, 2, float.PositiveInfinity, 4);
		if (a != b)
			return 4;

		a = new Vector4f(1, 2, 20, 4);
		b = new Vector4f(1, 2, 30, 4);
		if (!(a != b))
			return 5;

		return 0;
	}
开发者ID:Zman0169,项目名称:mono,代码行数:28,代码来源:basic-simd.cs


示例13: 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


示例14: test_0_f_to_d

	public static int test_0_f_to_d () {
		var a = new Vector4f (1,2,3,4);
		var b = a.ConvertToDouble ();
		if (b.X != 1)
			return 1;
		if (b.Y != 2)
			return 2;
		return 0;
	}
开发者ID:Zman0169,项目名称:mono,代码行数:9,代码来源:basic-simd.cs


示例15: CallMethodThatClobbersRegs

	static void CallMethodThatClobbersRegs () {
		Vector4f a = new Vector4f (9,9,9,9);
		Vector4f b = new Vector4f (9,9,9,9);
		a = a + b;
	}
开发者ID:Zman0169,项目名称:mono,代码行数:5,代码来源:basic-simd.cs


示例16: test_0_call_spills_regs_correctly

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

		CallMethodThatClobbersRegs ();

		bool b0 = a.X == 1f;
		bool b1 = b.X == 5f;
		if (!b0 || !b1)
			return 1;
		return 0;
	}
开发者ID:Zman0169,项目名称:mono,代码行数:12,代码来源:basic-simd.cs


示例17: test_0_bug_462457

	public static int test_0_bug_462457 ()
	{
		Vector4f sum = new Vector4f(0,0,0,0);
		Vector4f add = new Vector4f(1.0F,1.0F,1.0F,1.0F);

		for (int i = 0; i < 10; ++i)
				sum = sum + add;

		if (sum.X != 10f)
			return 1;
		return 0;
	}
开发者ID:Zman0169,项目名称:mono,代码行数:12,代码来源:basic-simd.cs


示例18: test_0_regs_pressure_fp_and_simd_share_bank_2

	public static int test_0_regs_pressure_fp_and_simd_share_bank_2 () {
		Vector4f a = new Vector4f (4, 3, 2, 1);
		float aF = 10f;
		Vector4f b = a + a;
		float bF = aF + aF;
		Vector4f c = b - a;
		float cF = bF - aF;
		Vector4f d = c - a;
		float dF = cF - aF;
		Vector4f e = a + b + c;
		float eF = aF + bF + cF;
		Vector4f f = d - b + a - c;
		float fF = dF - bF + aF - cF;
		Vector4f g = a - d * f - c + b;
		float gF = aF - dF * fF - cF + bF;
		Vector4f h = a * b - c + e;
		float hF = aF * bF - cF + eF;
		Vector4f i = h - g - f - e - d - c - b - a;
		float iF = hF - gF - fF - eF - dF - cF - bF - aF;
		Vector4f j = a + b + c + d + e + f + g + h + i;
		float jF = aF + bF + cF + dF + eF + fF + gF + hF + iF;
		Vector4f k = j - i - h + e + d - a + b - f + g;
		float kF = jF - iF - hF + eF + dF - aF + bF - fF + gF;
		Vector4f l = k * c - j * b - i * e + f - g; 
		float lF = kF * cF - jF * bF - iF * eF + fF - gF;
		Vector4f m = l - k + j - i + e + f;
		float mF = lF - kF + jF - iF + eF + fF;
		Vector4f n = m - j + g - i + e * b + a * d;
		float nF = mF - jF + gF - iF + eF * bF + aF * dF;
		Vector4f o = k + j + i * b;
		float oF = kF + jF + iF * bF;
		Vector4f p = m + j + i + e + l;
		float pF = mF + jF + iF + eF + lF;
		Vector4f q = l * m + j + k;
		float qF = lF * mF + jF + kF;
		Vector4f r = p * a + o * b + j * c + m * d + l * e;
		float rF = pF * aF + oF * bF + jF * cF + mF * dF + lF * eF;
		Vector4f s = a - b - c - d - e - f - g - h - i - j - k - l - m - p - o - q - r;
		float sF = aF - bF - cF - dF - eF - fF - gF - hF - iF - jF - kF - lF - mF - pF - oF - qF - rF;
		Vector4f t = a + b + c + d + e + f + g + h + i + j + k + l + m + p + o + q + r + s;
		float tF = aF + bF + cF + dF + eF + fF + gF + hF + iF + jF + kF + lF + mF + pF + oF + qF + rF + sF;

		if (t.X != 8f)
			return 1;

		if(tF != 14f)
			return 2;

		return 0;
	}
开发者ID:Zman0169,项目名称:mono,代码行数:50,代码来源:basic-simd.cs


示例19: test_0_simd_const_indexer_simple

	public static int test_0_simd_const_indexer_simple () {
		Vector4f v = new Vector4f (1, 2, 3, 4);
		
		if (v[0] != 1) 
			return 1;
		if (v[1] != 2) 
			return 2;
		if (v[2] != 3) 
			return 3;
		if (v[3] != 4) 
			return 4;
		return 0;
	}
开发者ID:Zman0169,项目名称:mono,代码行数:13,代码来源:basic-simd.cs


示例20: test_0_simd_var_indexer_simple

	public static int test_0_simd_var_indexer_simple () {
		Vector4f v = new Vector4f (1, 2, 3, 4);

		int index = 0;
		
		if (v[index++] != 1) 
			return 1;
		if (v[index++] != 2) 
			return 2;
		if (v[index++] != 3) 
			return 3;
		if (v[index] != 4) 
			return 4;
		return 0;
	}
开发者ID:Zman0169,项目名称:mono,代码行数:15,代码来源:basic-simd.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Simd.Vector4ui类代码示例发布时间:2022-05-26
下一篇:
C# Simd.Vector16b类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap