Ejemplo n.º 1
0
        public void CleanupNotRequired()
        {
            IList <Vector2D> positions = new List <Vector2D>();

            positions.Add(new Vector2D(0, 0));
            positions.Add(new Vector2D(1, 1));
            positions.Add(new Vector2D(1, 0));

            GraphicsAssert.ListsAreEqual(positions, SimplePolygonAlgorithms.Cleanup(positions));
        }
Ejemplo n.º 2
0
        public void SubdivisionEllipsoidTessellatorTest()
        {
            Mesh sphere    = SubdivisionSphereTessellator.Compute(1, SubdivisionSphereVertexAttributes.All);
            Mesh ellipsoid = SubdivisionEllipsoidTessellator.Compute(Ellipsoid.UnitSphere, 1, SubdivisionEllipsoidVertexAttributes.All);

            GraphicsAssert.ListsAreEqual(
                ((IndicesUnsignedInt)sphere.Indices).Values,
                ((IndicesUnsignedInt)ellipsoid.Indices).Values);
            GraphicsAssert.ListsAreEqual(
                ((VertexAttributeDoubleVector3)sphere.Attributes["position"]).Values,
                ((VertexAttributeDoubleVector3)ellipsoid.Attributes["position"]).Values);
            GraphicsAssert.ListsAreEqual(
                ((VertexAttributeHalfFloatVector3)sphere.Attributes["normal"]).Values,
                ((VertexAttributeHalfFloatVector3)ellipsoid.Attributes["normal"]).Values);
            GraphicsAssert.ListsAreEqual(
                ((VertexAttributeHalfFloatVector2)sphere.Attributes["textureCoordinate"]).Values,
                ((VertexAttributeHalfFloatVector2)ellipsoid.Attributes["textureCoordinate"]).Values);
        }
Ejemplo n.º 3
0
        public void SubdivisionSphereTessellatorTest()
        {
            Mesh simpleSphere = SubdivisionSphereTessellatorSimple.Compute(1);

            Assert.AreEqual(IndicesType.UnsignedInt, simpleSphere.Indices.Datatype);
            Assert.AreEqual(1, simpleSphere.Attributes.Count);
            Assert.IsNotNull(simpleSphere.Attributes["position"] as VertexAttributeDoubleVector3);

            Mesh sphere = SubdivisionSphereTessellator.Compute(1, SubdivisionSphereVertexAttributes.All);

            Assert.AreEqual(IndicesType.UnsignedInt, sphere.Indices.Datatype);
            Assert.AreEqual(3, sphere.Attributes.Count);
            Assert.IsNotNull(sphere.Attributes["position"] as VertexAttributeDoubleVector3);
            Assert.IsNotNull(sphere.Attributes["normal"] as VertexAttributeHalfFloatVector3);
            Assert.IsNotNull(sphere.Attributes["textureCoordinate"] as VertexAttributeHalfFloatVector2);

            GraphicsAssert.ListsAreEqual(
                ((IndicesUnsignedInt)simpleSphere.Indices).Values,
                ((IndicesUnsignedInt)sphere.Indices).Values);
            GraphicsAssert.ListsAreEqual(
                ((VertexAttributeDoubleVector3)simpleSphere.Attributes["position"]).Values,
                ((VertexAttributeDoubleVector3)sphere.Attributes["position"]).Values);
        }