Exemplo n.º 1
0
        public void ProcessFace_ThrowsWhenSubmeshCollecionIsEmpty()
        {
            Mesh             mesh   = new Mesh();
            ObjParsingWorker worker = new ObjParsingWorker();

            Assert.That(() => worker.ProcessFace(string.Empty, mesh), Throws.InvalidOperationException);
        }
Exemplo n.º 2
0
        public void ProcessFace_ShouldAddFaceItemWithoutVertex()
        {
            Mesh mesh = new Mesh();

            mesh.SubMeshes.Add(new SubMesh());
            ObjParsingWorker worker = new ObjParsingWorker();

            string line = "f ";

            worker.ProcessFace(line, mesh);

            Assert.That(mesh.SubMeshes.Last().Faces.First().Items.Count, Is.EqualTo(1));
            FaceItem faceItem = mesh.SubMeshes.Last().Faces.First().Items.First();

            Assert.That(faceItem.Vertex, Is.EqualTo(default(uint)));
        }
Exemplo n.º 3
0
        public void ProcessFace_ShouldAddFaceWithOneFaceItemWithVertex()
        {
            Mesh mesh = new Mesh();

            mesh.SubMeshes.Add(new SubMesh());
            ObjParsingWorker worker = new ObjParsingWorker();

            uint   value = 3;
            string line  = $"f {value}";

            worker.ProcessFace(line, mesh);

            Assert.That(mesh.SubMeshes.Last().Faces.First().Items.Count, Is.EqualTo(1));
            FaceItem faceItem = mesh.SubMeshes.Last().Faces.First().Items.First();

            Assert.That(faceItem.Vertex, Is.EqualTo(value));
        }
Exemplo n.º 4
0
        public void ProcessFace_ShouldAddFaceWithOneFaceItemWithVertexAndTexture()
        {
            Mesh mesh = new Mesh();

            mesh.SubMeshes.Add(new SubMesh());
            ObjParsingWorker worker = new ObjParsingWorker();

            uint   x    = 3;
            uint   y    = 4;
            string line = $"f {x}/{y}";

            worker.ProcessFace(line, mesh);

            Assert.That(mesh.SubMeshes.Last().Faces.First().Items.Count, Is.EqualTo(1));
            FaceItem faceItem = mesh.SubMeshes.Last().Faces.First().Items.First();

            Assert.That(faceItem.Vertex, Is.EqualTo(x));
            Assert.That(faceItem.Texture, Is.EqualTo(y));
        }