예제 #1
0
        public void ParsePoints()
        {
            var mesh = new An8Mesh();

            mesh.Parse(
                @"
faces {
  3 0 4 5 ( ( 10 ) ( 13 ) ( 16 ) )
}
");

            var face = mesh.Faces[0];

            Assert.False(face.IsBackShown);
            Assert.False(face.HasNormalIndexes);
            Assert.False(face.HasTexCoordIndexes);
            Assert.Equal(3, face.PointIndexes.Length);
            Assert.Null(face.NormalIndexes);
            Assert.Null(face.TexCoordIndexes);
            Assert.Equal(4, face.MaterialIndex);
            Assert.Equal(5, face.FlatNormalIndex);
            Assert.Equal(10, face.PointIndexes[0]);
            Assert.Equal(13, face.PointIndexes[1]);
            Assert.Equal(16, face.PointIndexes[2]);
        }
예제 #2
0
        public void ParseNormalsAndTexCoords()
        {
            var mesh = new An8Mesh();

            mesh.Parse(
                @"
faces {
  3 7 4 5 ( ( 10 11 12 ) ( 13 14 15 ) ( 16 17 18 ) )
}
");

            var face = mesh.Faces[0];

            Assert.True(face.IsBackShown);
            Assert.True(face.HasNormalIndexes);
            Assert.True(face.HasTexCoordIndexes);
            Assert.Equal(3, face.PointIndexes.Length);
            Assert.Equal(3, face.NormalIndexes.Length);
            Assert.Equal(3, face.TexCoordIndexes.Length);
            Assert.Equal(4, face.MaterialIndex);
            Assert.Equal(5, face.FlatNormalIndex);
            Assert.Equal(10, face.PointIndexes[0]);
            Assert.Equal(11, face.NormalIndexes[0]);
            Assert.Equal(12, face.TexCoordIndexes[0]);
            Assert.Equal(13, face.PointIndexes[1]);
            Assert.Equal(14, face.NormalIndexes[1]);
            Assert.Equal(15, face.TexCoordIndexes[1]);
            Assert.Equal(16, face.PointIndexes[2]);
            Assert.Equal(17, face.NormalIndexes[2]);
            Assert.Equal(18, face.TexCoordIndexes[2]);
        }
        public void ParseEmpty()
        {
            var mesh = new An8Mesh();

            mesh.Parse(
                @"
");
        }
        public void ParseOther()
        {
            var mesh = new An8Mesh();

            mesh.Parse(
                @"
other { }
");
        }
        public void ParseMaterial()
        {
            var mesh = new An8Mesh();

            mesh.Parse(
                @"
material { }
");

            Assert.NotNull(mesh.Material);
        }
        public void ParseSmoothAngle()
        {
            var mesh = new An8Mesh();

            mesh.Parse(
                @"
smoothangle { 2.0 }
");

            Assert.Equal(2.0f, mesh.SmoothAngleThreshold);
        }
        public void ParseFaces()
        {
            var mesh = new An8Mesh();

            mesh.Parse(
                @"
faces {
  0 0 0 0 ( )
}
");

            Assert.Equal(1, mesh.Faces.Count);
        }
예제 #8
0
        public void ParseEmpty()
        {
            var mesh = new An8Mesh();

            mesh.Parse(
                @"
faces {
  0 0 0 0 ( )
}
");

            var face = mesh.Faces[0];
        }
        public void ParseFacesClear()
        {
            var mesh = new An8Mesh();

            mesh.Faces.Add(new An8Face());

            mesh.Parse(
                @"
faces {
}
");

            Assert.Equal(0, mesh.Faces.Count);
        }
        public void ParseTexCoordsClear()
        {
            var mesh = new An8Mesh();

            mesh.TexCoords.Add(new An8TexCoord());

            mesh.Parse(
                @"
texcoords {
}
");

            Assert.Equal(0, mesh.TexCoords.Count);
        }
        public void ParseEdgesClear()
        {
            var mesh = new An8Mesh();

            mesh.Edges.Add(new An8Edge());

            mesh.Parse(
                @"
edges {
}
");

            Assert.Equal(0, mesh.Edges.Count);
        }
        public void ParseNormalsClear()
        {
            var mesh = new An8Mesh();

            mesh.Normals.Add(new An8Point());

            mesh.Parse(
                @"
normals {
}
");

            Assert.Equal(0, mesh.Normals.Count);
        }
        public void ParsePointsClear()
        {
            var mesh = new An8Mesh();

            mesh.Points.Add(new An8Point());

            mesh.Parse(
                @"
points {
}
");

            Assert.Equal(0, mesh.Points.Count);
        }
        public void ParseMaterialList()
        {
            var mesh = new An8Mesh();

            mesh.Parse(
                @"
materiallist {
  materialname { ""abc"" }
}
");

            Assert.Equal(1, mesh.MaterialList.Count);
            Assert.Equal("abc", mesh.MaterialList[0]);
        }
        public void ParseMaterialListClear()
        {
            var mesh = new An8Mesh();

            mesh.MaterialList.Add(null);

            mesh.Parse(
                @"
materiallist {
}
");

            Assert.Equal(0, mesh.MaterialList.Count);
        }
        public void ParseTexCoords()
        {
            var mesh = new An8Mesh();

            mesh.Parse(
                @"
texcoords {
  ( 2.0 3.0 )
}
");

            Assert.Equal(1, mesh.TexCoords.Count);
            Assert.Equal(2.0f, mesh.TexCoords[0].U);
            Assert.Equal(3.0f, mesh.TexCoords[0].V);
        }
        public void ParsePoints()
        {
            var mesh = new An8Mesh();

            mesh.Parse(
                @"
points {
  ( 2.0 3.0 4.0 )
}
");

            Assert.Equal(1, mesh.Points.Count);
            Assert.Equal(2.0f, mesh.Points[0].X);
            Assert.Equal(3.0f, mesh.Points[0].Y);
            Assert.Equal(4.0f, mesh.Points[0].Z);
        }
        public void ParseNormals()
        {
            var mesh = new An8Mesh();

            mesh.Parse(
                @"
normals {
  ( 2.0 3.0 4.0 )
}
");

            Assert.Equal(1, mesh.Normals.Count);
            Assert.Equal(2.0f, mesh.Normals[0].X);
            Assert.Equal(3.0f, mesh.Normals[0].Y);
            Assert.Equal(4.0f, mesh.Normals[0].Z);
        }
        public void ParseEdges()
        {
            var mesh = new An8Mesh();

            mesh.Parse(
                @"
edges {
  ( 2 3 )
  ( 4 5 6 )
}
");

            Assert.Equal(2, mesh.Edges.Count);
            Assert.Equal(2, mesh.Edges[0].Index1);
            Assert.Equal(3, mesh.Edges[0].Index2);
            Assert.False(mesh.Edges[0].Sharpness.HasValue);
            Assert.Equal(4, mesh.Edges[1].Index1);
            Assert.Equal(5, mesh.Edges[1].Index2);
            Assert.True(mesh.Edges[1].Sharpness.HasValue);
            Assert.Equal(6, mesh.Edges[1].Sharpness.Value);
        }