Ejemplo n.º 1
0
        public void setdata_sets_data_from_the_top_left_of_a_larger_array()
        {
            var p = new Patch(3, 3);
            var f = Get4x4Heights();

            p.SetData(f, 4, 4, 0, 0, new Vector2(0f, 0f));

            Assert.IsTrue(Math.Abs(45 - p.Vertices.Select(v => v.Position.Y).Sum()) < 0.1, string.Format("expected sum of 45, got {0}", p.Vertices.Select(v => v.Position.Y).Sum()));
        }
Ejemplo n.º 2
0
        public void setdata_sets_texcoords_correctly_for_top_left_patch()
        {
            var p = new Patch(3, 3);
            var f = Get4x4Heights();

            p.SetData(f, 4, 4, 1, 1, new Vector2(0f, 0f));

            Assert.IsTrue(Math.Abs(p.Vertices[0].TextureCoordinate.X) < 0.001f);
            Assert.IsTrue(Math.Abs(p.Vertices[0].TextureCoordinate.Y) < 0.001f);

            Assert.IsTrue(Math.Abs((2f / 256f) - p.Vertices[8].TextureCoordinate.X) < 0.001f);
            Assert.IsTrue(Math.Abs((2f / 256f) - p.Vertices[8].TextureCoordinate.Y) < 0.001f);
        }