Example #1
0
        public static F3DEXTriangleWrapper GetTriangleWrapper(F3DEX_G_Tri2 triangle, int index)
        {
            Dictionary<F3DEX_G_Tri2, F3DEXTriangleWrapper> wrappers;
            if (index % 2 == 1)
                wrappers = _triangle2FirstWrappers;
            else
                wrappers = _triangle2SecondWrappers;

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

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

            return wrapper;
        }
Example #2
0
        public void TestF3DEX_G_Tri2()
        {
            //B13A3C3E 0024282C
            byte[] testVal = new byte[] { 0xB1, 0x3A, 0x3C, 0x3E, 0x00, 0x24, 0x28, 0x2C };

            F3DEX_G_Tri2 cmd = new F3DEX_G_Tri2(0, testVal);

            byte[] outVal = cmd.RawData;

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

            //B13A3C3E FF24282C
            testVal = new byte[] { 0xB1, 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);
        }
 public F3DEXTriangleWrapper(F3DEX_G_Tri2 triangle, int index)
 {
     Mode = TriangleMode.Double;
     DoubleIndex = index % 2; //Handle stupid user input
     DoubleTriangle = triangle;
 }