Ejemplo n.º 1
0
void CylinderTest::wireframe() {
    Trade::MeshData3D cylinder = Cylinder::wireframe(2, 8, 0.5f);

    CORRADE_COMPARE_AS(cylinder.positions(0), (std::vector<Vector3>{
        {0.0f, -0.5f, 1.0f},
        {1.0f, -0.5f, 0.0f},
        {0.0f, -0.5f, -1.0f},
        {-1.0f, -0.5f, 0.0f},
        {0.707107f, -0.5f, 0.707107f},
        {0.707107f, -0.5f, -0.707107f},
        {-0.707107f, -0.5f, -0.707107f},
        {-0.707107f, -0.5f, 0.707107f},

        {0.0f, 0.0f, 1.0f},
        {1.0f, 0.0f, 0.0f},
        {0.0f, 0.0f, -1.0f},
        {-1.0f, 0.0f, 0.0f},
        {0.707107f, 0.0f, 0.707107f},
        {0.707107f, 0.0f, -0.707107f},
        {-0.707107f, 0.0f, -0.707107f},
        {-0.707107f, 0.0f, 0.707107f},

        {0.0f, 0.5f, 1.0f},
        {1.0f, 0.5f, 0.0f},
        {0.0f, 0.5f, -1.0f},
        {-1.0f, 0.5f, 0.0f},
        {0.707107f, 0.5f, 0.707107f},
        {0.707107f, 0.5f, -0.707107f},
        {-0.707107f, 0.5f, -0.707107f},
        {-0.707107f, 0.5f, 0.707107f}
    }), TestSuite::Compare::Container);

    CORRADE_COMPARE(cylinder.normalArrayCount(), 0);

    CORRADE_COMPARE_AS(cylinder.indices(), (std::vector<UnsignedInt>{
        0, 4, 1, 5, 2, 6, 3, 7,
        4, 1, 5, 2, 6, 3, 7, 0,

        0, 8, 1, 9, 2, 10, 3, 11,

        8, 12, 9, 13, 10, 14, 11, 15,
        12, 9, 13, 10, 14, 11, 15, 8,

        8, 16, 9, 17, 10, 18, 11, 19,

        16, 20, 17, 21, 18, 22, 19, 23,
        20, 17, 21, 18, 22, 19, 23, 16
    }), TestSuite::Compare::Container);
}
Ejemplo n.º 2
0
void UVSphereTest::wireframe() {
    Trade::MeshData3D sphere = UVSphere::wireframe(4, 8);

    CORRADE_COMPARE_AS(sphere.positions(0), (std::vector<Vector3>{
        {0.0f, -1.0f, 0.0f},

        {0.0f, -0.707107f, 0.707107f},
        {0.707107f, -0.707107f, 0.0f},
        {0.0f, -0.707107f, -0.707107f},
        {-0.707107f, -0.707107f, 0.0f},

        {0.0f, 0.0f, 1.0f},
        {1.0f, 0.0f, 0.0f},
        {0.0f, 0.0f, -1.0f},
        {-1.0f, 0.0f, 0.0f},
        {0.707107f, 0.0f, 0.707107f},
        {0.707107f, 0.0f, -0.707107f},
        {-0.707107f, 0.0f, -0.707107f},
        {-0.707107f, 0.0f, 0.707107f},

        {0.0f, 0.707107f, 0.707107f},
        {0.707107f, 0.707107f, 0.0f},
        {0.0f, 0.707107f, -0.707107f},
        {-0.707107f, 0.707107f, 0.0f},

        {0.0f, 1.0f, 0.0f}
    }), TestSuite::Compare::Container);

    CORRADE_COMPARE(sphere.normalArrayCount(), 0);

    CORRADE_COMPARE_AS(sphere.indices(), (std::vector<UnsignedInt>{
        0, 1, 0, 2, 0, 3, 0, 4,
        1, 5, 2, 6, 3, 7, 4, 8,

        5, 9, 6, 10, 7, 11, 8, 12,
        9, 6, 10, 7, 11, 8, 12, 5,

        5, 13, 6, 14, 7, 15, 8, 16,
        13, 17, 14, 17, 15, 17, 16, 17
    }), TestSuite::Compare::Container);
}
Ejemplo n.º 3
0
void CapsuleTest::wireframe3D() {
    Trade::MeshData3D capsule = Capsule3D::wireframe(2, 2, 8, 0.5f);

    CORRADE_COMPARE_AS(capsule.positions(0), (std::vector<Vector3>{
        {0.0f, -1.5f, 0.0f},

        {0.0f, -1.20711f, 0.707107f},
        {0.707107f, -1.20711f, 0.0f},
        {0.0f, -1.20711f, -0.707107f},
        {-0.707107f, -1.20711f, 0.0f},

        {0.0f, -0.5f, 1.0f},
        {1.0f, -0.5f, 0.0f},
        {0.0f, -0.5f, -1.0f},
        {-1.0f, -0.5f, 0.0f},
        {0.707107f, -0.5f, 0.707107f},
        {0.707107f, -0.5f, -0.707107f},
        {-0.707107f, -0.5f, -0.707107f},
        {-0.707107f, -0.5f, 0.707107f},

        {0.0f, 0.0f, 1.0f},
        {1.0f, 0.0f, 0.0f},
        {0.0f, 0.0f, -1.0f},
        {-1.0f, 0.0f, 0.0f},
        {0.707107f, 0.0f, 0.707107f},
        {0.707107f, 0.0f, -0.707107f},
        {-0.707107f, 0.0f, -0.707107f},
        {-0.707107f, 0.0f, 0.707107f},

        {0.0f, 0.5f, 1.0f},
        {1.0f, 0.5f, 0.0f},
        {0.0f, 0.5f, -1.0f},
        {-1.0f, 0.5f, 0.0f},
        {0.707107f, 0.5f, 0.707107f},
        {0.707107f, 0.5f, -0.707107f},
        {-0.707107f, 0.5f, -0.707107f},
        {-0.707107f, 0.5f, 0.707107f},

        {0.0f, 1.20711f, 0.707107f},
        {0.707107f, 1.20711f, 0.0f},
        {0.0f, 1.20711f, -0.707107f},
        {-0.707107f, 1.20711f, 0.0f},

        {0.0f, 1.5f, 0.0f}
    }), TestSuite::Compare::Container);

    CORRADE_COMPARE(capsule.normalArrayCount(), 0);

    CORRADE_COMPARE_AS(capsule.indices(), (std::vector<UnsignedInt>{
        0, 1, 0, 2, 0, 3, 0, 4,
        1, 5, 2, 6, 3, 7, 4, 8,
        5, 9, 6, 10, 7, 11, 8, 12,
        9, 6, 10, 7, 11, 8, 12, 5,

        5, 13, 6, 14, 7, 15, 8, 16,

        13, 17, 14, 18, 15, 19, 16, 20,
        17, 14, 18, 15, 19, 16, 20, 13,

        13, 21, 14, 22, 15, 23, 16, 24,

        21, 25, 22, 26, 23, 27, 24, 28,
        25, 22, 26, 23, 27, 24, 28, 21,
        21, 29, 22, 30, 23, 31, 24, 32,
        29, 33, 30, 33, 31, 33, 32, 33
    }), TestSuite::Compare::Container);
}