예제 #1
0
 public static void AreEqual(int2x4 expected, int2x4 actual)
 {
     AreEqual(expected.c0, actual.c0);
     AreEqual(expected.c1, actual.c1);
     AreEqual(expected.c2, actual.c2);
     AreEqual(expected.c3, actual.c3);
 }
예제 #2
0
 public static void AreEqual(int2x4 a, int2x4 b)
 {
     AreEqual(a.c0, b.c0);
     AreEqual(a.c1, b.c1);
     AreEqual(a.c2, b.c2);
     AreEqual(a.c3, b.c3);
 }
예제 #3
0
        private static float2x4 MiddlePosition(int2x4 position, float stepSize, int2 offset)
        {
            var p00 = math.float2(-0.5f, -0.5f) + offset;
            var p10 = math.float2(0.5f, -0.5f) + offset;
            var p01 = math.float2(-0.5f, 0.5f) + offset;
            var p11 = math.float2(0.5f, 0.5f) + offset;

            var point00 = math.float2x4(p00, p00, p00, p00);
            var point10 = math.float2x4(p10, p10, p10, p10);
            var point01 = math.float2x4(p01, p01, p01, p01);
            var point11 = math.float2x4(p11, p11, p11, p11);

            var point0 = math.float2x4(
                math.lerp(point00.c0, point01.c0, position.c0.y * stepSize),
                math.lerp(point00.c1, point01.c1, position.c1.y * stepSize),
                math.lerp(point00.c2, point01.c2, position.c2.y * stepSize),
                math.lerp(point00.c3, point01.c3, position.c3.y * stepSize)
                );

            var point1 = math.float2x4(
                math.lerp(point10.c0, point11.c0, position.c0.y * stepSize),
                math.lerp(point10.c1, point11.c1, position.c1.y * stepSize),
                math.lerp(point10.c2, point11.c2, position.c2.y * stepSize),
                math.lerp(point10.c3, point11.c3, position.c3.y * stepSize)
                );

            return(math.float2x4(
                       math.lerp(point0.c0, point1.c0, position.c0.x * stepSize),
                       math.lerp(point0.c1, point1.c1, position.c1.x * stepSize),
                       math.lerp(point0.c2, point1.c2, position.c2.x * stepSize),
                       math.lerp(point0.c3, point1.c3, position.c3.x * stepSize)
                       ));
        }
예제 #4
0
 public fp2x4(int2x4 v)
 {
     this.c0 = (fp2)v.c0;
     this.c1 = (fp2)v.c1;
     this.c2 = (fp2)v.c2;
     this.c3 = (fp2)v.c3;
 }
예제 #5
0
 public static int4 Index1DFrom2D(int2x4 position, int size)
 {
     return(math.int4(
                Index1DFrom2D(position.c0, size),
                Index1DFrom2D(position.c1, size),
                Index1DFrom2D(position.c2, size),
                Index1DFrom2D(position.c3, size)
                ));
 }
        private static void CustomVisit(ref int2x4 i)
        {
            LogVisit(i);
            GUILayout.Label(name);
            EditorGUI.indentLevel++;
            var field0 = EditorGUILayout.Vector2IntField("", ConvertToVector2Int(i[0]));
            var field1 = EditorGUILayout.Vector2IntField("", ConvertToVector2Int(i[1]));
            var field2 = EditorGUILayout.Vector2IntField("", ConvertToVector2Int(i[2]));
            var field3 = EditorGUILayout.Vector2IntField("", ConvertToVector2Int(i[3]));

            i[0] = ConvertVector2IntToInt2(field0);
            i[1] = ConvertVector2IntToInt2(field1);
            i[2] = ConvertVector2IntToInt2(field2);
            i[3] = ConvertVector2IntToInt2(field3);
            EditorGUI.indentLevel--;
        }
예제 #7
0
 public static fp2x4 fp2x4(int2x4 v)
 {
     return(new fp2x4(v));
 }