예제 #1
0
 public void ApplyAttributesToElement(ObjElement element)
 {
     element.ObjectName    = this.ObjectName;
     element.LevelOfDetail = this.LevelOfDetail;
     element.MapName       = this.MapName;
     element.MaterialName  = this.MaterialName;
 }
예제 #2
0
        public void WriteAttributesOfElement(StreamWriter stream, ObjElement element)
        {
            if (element.ObjectName != this.ObjectName)
            {
                this.ObjectName = element.ObjectName;

                if (string.IsNullOrEmpty(this.ObjectName))
                {
                    stream.WriteLine("o");
                }
                else
                {
                    stream.WriteLine("o {0}", this.ObjectName);
                }
            }

            if (element.LevelOfDetail != this.LevelOfDetail)
            {
                this.LevelOfDetail = element.LevelOfDetail;

                stream.WriteLine("lod {0}", this.LevelOfDetail);
            }

            if (element.MapName != this.MapName)
            {
                this.MapName = element.MapName;

                if (string.IsNullOrEmpty(this.MapName))
                {
                    stream.WriteLine("usemap off");
                }
                else
                {
                    stream.WriteLine("usemap {0}", this.MapName);
                }
            }

            if (element.MaterialName != this.MaterialName)
            {
                this.MaterialName = element.MaterialName;

                if (string.IsNullOrEmpty(this.MaterialName))
                {
                    stream.WriteLine("usemtl off");
                }
                else
                {
                    stream.WriteLine("usemtl {0}", this.MaterialName);
                }
            }
        }