/// <summary> /// The export model. /// </summary> /// <param name="writer">The writer.</param> /// <param name="model">The model.</param> /// <param name="transform">The transform.</param> protected override void ExportModel(ObjWriters writer, GeometryModel3D model, Transform3D transform) { writer.ObjWriter.WriteLine("o object{0}", this.objectNo++); writer.ObjWriter.WriteLine("g group{0}", this.groupNo++); if (this.exportedMaterials.ContainsKey(model.Material)) { string matName = this.exportedMaterials[model.Material]; writer.ObjWriter.WriteLine("usemtl {0}", matName); } else { string matName = string.Format("mat{0}", this.matNo++); writer.ObjWriter.WriteLine("usemtl {0}", matName); this.ExportMaterial(writer.MaterialsWriter, matName, model.Material, model.BackMaterial); this.exportedMaterials.Add(model.Material, matName); } var mesh = model.Geometry as MeshGeometry3D; this.ExportMesh(writer.ObjWriter, mesh, Transform3DHelper.CombineTransform(transform, model.Transform)); }
/// <summary> /// Closes the specified writer. /// </summary> /// <param name="writer">The writer.</param> protected override void Close(ObjWriters writer) { writer.ObjWriter.Close(); writer.MaterialsWriter.Close(); }