示例#1
0
        public void Group_Default_Valid()
        {
            var obj = new ObjFile();

            obj.Groups.Add(new ObjGroup("a"));
            var point1 = new ObjPoint();

            point1.Vertices.Add(new ObjTriplet(1, 0, 0));
            obj.Points.Add(point1);
            obj.Groups[0].Points.Add(point1);
            var point2 = new ObjPoint();

            point2.Vertices.Add(new ObjTriplet(2, 0, 0));
            obj.Points.Add(point2);

            string text     = WriteObj(obj);
            string expected =
                @"g a
p 1
g default
p 2
";

            AssertExtensions.TextEqual(expected, text);
        }
示例#2
0
        public void RenderAttributes_LevelOfDetail_Valid()
        {
            var obj   = new ObjFile();
            var point = new ObjPoint();

            point.Vertices.Add(new ObjTriplet(1, 0, 0));
            point.LevelOfDetail = 2;
            obj.Points.Add(point);

            string text     = WriteObj(obj);
            string expected =
                @"lod 2
p 1
";

            AssertExtensions.TextEqual(expected, text);
        }
示例#3
0
        public void Element_Point_Valid()
        {
            var obj = new ObjFile();

            obj.Groups.Add(new ObjGroup("b"));
            obj.Vertices.Add(new ObjVertex(0, 0, 0));
            obj.Vertices.Add(new ObjVertex(0, 0, 0));
            obj.Vertices.Add(new ObjVertex(0, 0, 0));
            var point = new ObjPoint();

            point.Vertices.Add(new ObjTriplet(2, 0, 0));
            point.Vertices.Add(new ObjTriplet(3, 0, 0));
            obj.Points.Add(point);
            obj.Groups[0].Points.Add(point);
            point.ObjectName                     = "a";
            point.LevelOfDetail                  = 2;
            point.MapName                        = "c";
            point.MaterialName                   = "d";
            point.SmoothingGroupNumber           = 10;
            point.IsBevelInterpolationEnabled    = true;
            point.IsColorInterpolationEnabled    = true;
            point.IsDissolveInterpolationEnabled = true;

            string text     = WriteObj(obj);
            string expected =
                @"v 0.000000 0.000000 0.000000
v 0.000000 0.000000 0.000000
v 0.000000 0.000000 0.000000
g b
o a
lod 2
usemap c
usemtl d
s 10
bevel on
c_interp on
d_interp on
p 2 3
";

            AssertExtensions.TextEqual(expected, text);
        }
示例#4
0
        public void Group_Multiple_Valid()
        {
            var obj = new ObjFile();

            obj.Groups.Add(new ObjGroup("a"));
            obj.Groups.Add(new ObjGroup("b"));
            var point = new ObjPoint();

            point.Vertices.Add(new ObjTriplet(1, 0, 0));
            obj.Points.Add(point);
            obj.Groups[0].Points.Add(point);
            obj.Groups[1].Points.Add(point);

            string text     = WriteObj(obj);
            string expected =
                @"g a b
p 1
";

            AssertExtensions.TextEqual(expected, text);
        }
示例#5
0
        public void ObjectName_Valid()
        {
            var obj    = new ObjFile();
            var point1 = new ObjPoint();

            point1.Vertices.Add(new ObjTriplet(1, 0, 0));
            point1.ObjectName = "a";
            obj.Points.Add(point1);
            var point2 = new ObjPoint();

            point2.Vertices.Add(new ObjTriplet(1, 0, 0));
            obj.Points.Add(point2);

            string text     = WriteObj(obj);
            string expected =
                @"o a
p 1
o
p 1
";

            AssertExtensions.TextEqual(expected, text);
        }
示例#6
0
        public void RenderAttributes_DissolveInterpolation_Valid()
        {
            var obj    = new ObjFile();
            var point1 = new ObjPoint();

            point1.Vertices.Add(new ObjTriplet(1, 0, 0));
            point1.IsDissolveInterpolationEnabled = true;
            obj.Points.Add(point1);
            var point2 = new ObjPoint();

            point2.Vertices.Add(new ObjTriplet(1, 0, 0));
            point2.IsDissolveInterpolationEnabled = false;
            obj.Points.Add(point2);

            string text     = WriteObj(obj);
            string expected =
                @"d_interp on
p 1
d_interp off
p 1
";

            AssertExtensions.TextEqual(expected, text);
        }
示例#7
0
        public void SmoothingGroup_Valid(int number, string value)
        {
            var obj    = new ObjFile();
            var point1 = new ObjPoint();

            point1.Vertices.Add(new ObjTriplet(1, 0, 0));
            point1.SmoothingGroupNumber = 1;
            obj.Points.Add(point1);
            var point2 = new ObjPoint();

            point2.Vertices.Add(new ObjTriplet(1, 0, 0));
            point2.SmoothingGroupNumber = number;
            obj.Points.Add(point2);

            string text     = WriteObj(obj);
            string expected =
                @"s 1
p 1
s " + value + @"
p 1
";

            AssertExtensions.TextEqual(expected, text);
        }
示例#8
0
        public void RenderAttributes_UseMaterial_Valid(string value, string name)
        {
            var obj    = new ObjFile();
            var point1 = new ObjPoint();

            point1.Vertices.Add(new ObjTriplet(1, 0, 0));
            point1.MaterialName = "b";
            obj.Points.Add(point1);
            var point2 = new ObjPoint();

            point2.Vertices.Add(new ObjTriplet(1, 0, 0));
            point2.MaterialName = value;
            obj.Points.Add(point2);

            string text     = WriteObj(obj);
            string expected =
                @"usemtl b
p 1
usemtl " + name + @"
p 1
";

            AssertExtensions.TextEqual(expected, text);
        }
示例#9
0
 public Coin(ObjPoint fromOutpoint, TxObj fromTxOut)
 {
     this.Objpoint = fromOutpoint;
     this.TxObj    = fromTxOut;
 }