Пример #1
0
        public static F3DZEXTriangleWrapper GetTriangleWrapper(F3DZEX_G_Tri2 triangle, int index)
        {
            Dictionary<F3DZEX_G_Tri2, F3DZEXTriangleWrapper> wrappers;
            if (index % 2 == 1)
                wrappers = _triangle2FirstWrappers;
            else
                wrappers = _triangle2SecondWrappers;

            if (wrappers.ContainsKey(triangle))
                return wrappers[triangle];

            F3DZEXTriangleWrapper wrapper = new F3DZEXTriangleWrapper(triangle, index);
            wrappers.Add(triangle, wrapper);

            return wrapper;
        }
Пример #2
0
 public F3DZEXTriangleWrapper(F3DZEX_G_Tri2 triangle, int index)
 {
     Mode = TriangleMode.Double;
     DoubleIndex = index % 2; //Handle stupid user input
     DoubleTriangle = triangle;
 }
Пример #3
0
        public void TestF3DZEX_G_Tri2()
        {
            //063A3C3E 0024282C
            byte[] testVal = new byte[] { 0x06, 0x3A, 0x3C, 0x3E, 0x00, 0x24, 0x28, 0x2C };

            F3DZEX_G_Tri2 cmd = new F3DZEX_G_Tri2(0, testVal);

            byte[] outVal = cmd.RawData;

            Assert.AreEqual(testVal.Length, outVal.Length);
            Assert.IsTrue(Enumerable.SequenceEqual(testVal, outVal));
            Assert.IsTrue(cmd.IsValid);

            //063A3C3E FF24282C
            testVal = new byte[] { 0x06, 0x3A, 0x3C, 0x3E, 0xFF, 0x24, 0x28, 0x2C };

            cmd.RawData = testVal;

            byte[] outVal2 = cmd.RawData;

            Assert.AreEqual(outVal.Length, outVal2.Length);
            Assert.IsTrue(Enumerable.SequenceEqual(outVal, outVal2));
            Assert.IsTrue(cmd.IsValid);
        }