- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from DomCR/obj-reader
Obj Reader
Showing
26 changed files
with
725 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -360,3 +360,5 @@ MigrationBackup/ | |
!MeshIO.OBJ | ||
/local | ||
/src/Tests/outFiles | ||
!src/Tests/inFiles/obj/ | ||
!src/Tests/inFiles/obj/*.obj |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule CSUtilities
updated
3 files
+18 −0 | CSUtilities/Extensions/EnumExtensions.cs | |
+21 −3 | CSUtilities/Extensions/IEnumerableExtensions.cs | |
+3 −1 | CSUtilities/Mutation.cs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" /> | ||
<PackageReference Include="xunit" Version="2.4.1" /> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
<PackageReference Include="coverlet.collector" Version="3.1.0"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\MeshIO.OBJ\MeshIO.OBJ.csproj" /> | ||
</ItemGroup> | ||
|
||
<Import Project="..\MeshIO.Tests.Shared\MeshIO.Tests.Shared.projitems" Label="Shared" /> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using MeshIO.Tests.Shared; | ||
using System.IO; | ||
using Xunit; | ||
using Xunit.Abstractions; | ||
|
||
namespace MeshIO.OBJ.Tests | ||
{ | ||
public class ObjReaderTest : IOTestsBase | ||
{ | ||
public static readonly TheoryData<string> Files; | ||
|
||
static ObjReaderTest() | ||
{ | ||
Files = new TheoryData<string>(); | ||
foreach (string file in Directory.GetFiles(FolderPath.InFilesObj, "*.obj")) | ||
{ | ||
Files.Add(file); | ||
} | ||
} | ||
|
||
public ObjReaderTest(ITestOutputHelper output) : base(output) { } | ||
|
||
[Theory] | ||
[MemberData(nameof(Files))] | ||
public void ReadTest(string test) | ||
{ | ||
Scene scene = null; | ||
using (ObjReader reader = new ObjReader(test)) | ||
{ | ||
reader.OnNotification += this.onNotification; | ||
scene = reader.Read(); | ||
} | ||
|
||
Assert.NotNull(scene); | ||
Assert.NotEmpty(scene.RootNode.Nodes); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
using CSMath; | ||
using System.Collections.Generic; | ||
|
||
namespace MeshIO.OBJ | ||
{ | ||
internal class ObjData | ||
{ | ||
public ObjTemplate Current { get; private set; } | ||
|
||
public ObjTemplate Placeholder { get; private set; } | ||
|
||
public List<ObjTemplate> Templates { get; private set; } = []; | ||
|
||
public ObjData() | ||
{ | ||
Placeholder = new ObjTemplate(string.Empty); | ||
} | ||
|
||
public void CreateIndexer(string line) | ||
{ | ||
this.MoveNext(); | ||
|
||
this.Current = new ObjTemplate(line); | ||
} | ||
|
||
public void MoveNext() | ||
{ | ||
if (this.Current == null) | ||
{ | ||
return; | ||
} | ||
|
||
this.Current.Vertices.AddRange(this.Placeholder.Vertices); | ||
this.Current.Normals.AddRange(this.Placeholder.Normals); | ||
this.Current.UVs.AddRange(this.Placeholder.UVs); | ||
|
||
this.Current.MeshPolygons.AddRange(this.Placeholder.MeshPolygons); | ||
this.Current.TexturePolygons.AddRange(this.Placeholder.TexturePolygons); | ||
this.Current.NormalPolygons.AddRange(this.Placeholder.NormalPolygons); | ||
|
||
this.Templates.Add(this.Current); | ||
|
||
this.Placeholder.Vertices.Clear(); | ||
this.Placeholder.Normals.Clear(); | ||
this.Placeholder.UVs.Clear(); | ||
|
||
this.Placeholder.MeshPolygons.Clear(); | ||
this.Placeholder.TexturePolygons.Clear(); | ||
this.Placeholder.NormalPolygons.Clear(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
namespace MeshIO.OBJ | ||
{ | ||
internal class ObjFileParser | ||
{ | ||
public static bool ParseToken(string text, out ObjFileToken token) | ||
{ | ||
token = ObjFileToken.Undefined; | ||
|
||
switch (text.ToLower()) | ||
{ | ||
case "o": | ||
token = ObjFileToken.Object; | ||
return true; | ||
case "v": | ||
token = ObjFileToken.Vertice; | ||
return true; | ||
case "f": | ||
token = ObjFileToken.Face; | ||
return true; | ||
case "vn": | ||
token = ObjFileToken.Normal; | ||
return true; | ||
case "vt": | ||
token = ObjFileToken.TextureVertice; | ||
return true; | ||
case "#": | ||
token = ObjFileToken.Comment; | ||
return true; | ||
default: | ||
return false; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
namespace MeshIO.OBJ | ||
{ | ||
internal enum ObjFileToken | ||
{ | ||
Undefined = 0, | ||
/// <summary> | ||
/// o | ||
/// </summary> | ||
Object, | ||
/// <summary> | ||
/// v | ||
/// </summary> | ||
Vertice, | ||
/// <summary> | ||
/// vt | ||
/// </summary> | ||
TextureVertice, | ||
/// <summary> | ||
/// vn | ||
/// </summary> | ||
Normal, | ||
/// <summary> | ||
/// f | ||
/// </summary> | ||
Face, | ||
/// <summary> | ||
/// # | ||
/// </summary> | ||
Comment | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,231 @@ | ||
using MeshIO.Core; | ||
using CSMath; | ||
using CSUtilities.Extensions; | ||
using MeshIO.Core; | ||
using MeshIO.Entities.Geometries; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Text.RegularExpressions; | ||
|
||
namespace MeshIO.OBJ | ||
{ | ||
public class ObjReader : ReaderBase | ||
{ | ||
public ObjReader() | ||
private readonly Regex _matchNoneWhiteSpaces; | ||
private readonly StreamReader _reader; | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="ObjReader"/> class for the specified file. | ||
/// </summary> | ||
/// <param name="path">The complete file path to read from</param> | ||
public ObjReader(string path) : this(File.OpenRead(path)) { } | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="ObjReader"/> class for the specified stream. | ||
/// </summary> | ||
/// <param name="stream">The stream to read from</param> | ||
public ObjReader(Stream stream) : base(stream) | ||
{ | ||
_reader = new StreamReader(stream); | ||
_matchNoneWhiteSpaces = new Regex(@"\s+", RegexOptions.Compiled); | ||
} | ||
|
||
/// <summary> | ||
/// Read the Obj file | ||
/// </summary> | ||
public override Scene Read() | ||
{ | ||
ObjData data = new ObjData(); | ||
Scene scene = new Scene(); | ||
|
||
while (!_reader.EndOfStream) | ||
{ | ||
string line = _reader.ReadLine(); | ||
if (string.IsNullOrEmpty(line) || !this.processLine(line, out ObjFileToken token, out string values)) | ||
{ | ||
continue; | ||
} | ||
|
||
switch (token) | ||
{ | ||
case ObjFileToken.Object: | ||
data.CreateIndexer(values); | ||
break; | ||
case ObjFileToken.Vertice: | ||
data.Placeholder.Vertices.Add(this.parseVertex(values)); | ||
break; | ||
case ObjFileToken.Normal: | ||
data.Placeholder.Normals.Add(this.parseNormal(values)); | ||
break; | ||
case ObjFileToken.TextureVertice: | ||
data.Placeholder.UVs.Add(this.parse<XYZ>(values)); | ||
break; | ||
case ObjFileToken.Face: | ||
this.parseFace(values, data); | ||
break; | ||
} | ||
} | ||
|
||
data.MoveNext(); | ||
this.processData(data, scene); | ||
|
||
return scene; | ||
} | ||
|
||
private void processData(ObjData data, Scene scene) | ||
{ | ||
foreach (ObjTemplate item in data.Templates) | ||
{ | ||
Mesh mesh = item.CreateMesh(); | ||
Node node = new Node(item.Name); | ||
node.Entities.Add(mesh); | ||
|
||
scene.RootNode.Nodes.Add(node); | ||
} | ||
} | ||
|
||
public void Read() | ||
private T parse<T>(string line) | ||
where T : IVector, new() | ||
{ | ||
T v = new T(); | ||
string[] arr = (string[])line.Split(' '); | ||
|
||
int i; | ||
for (i = 0; i < arr.Length; i++) | ||
{ | ||
v[i] = double.Parse(arr[i]); | ||
} | ||
|
||
if (arr.Length < v.Dimension) | ||
{ | ||
v[i] = 1.0d; | ||
} | ||
|
||
return v; | ||
} | ||
|
||
private void parseFace(string line, ObjData objdata) | ||
{ | ||
string[] data = line.Split(' '); | ||
List<int> vertices = new(); | ||
List<int> textures = new(); | ||
List<int> normals = new(); | ||
|
||
foreach (string item in data) | ||
{ | ||
List<string> indices = item.Split('/').ToList(); | ||
|
||
//vertex_index/texture_index/normal_index | ||
vertices.Add(int.Parse(indices[0])); | ||
|
||
if (indices.TryGet(1, out string texture)) | ||
{ | ||
textures.Add(int.Parse(texture)); | ||
} | ||
|
||
if (indices.TryGet(2, out string normal)) | ||
{ | ||
normals.Add(int.Parse(normal)); | ||
} | ||
} | ||
|
||
objdata.Placeholder.MeshPolygons.Add(createPolygon(vertices)); | ||
objdata.Placeholder.TexturePolygons.Add(createPolygon(textures)); | ||
objdata.Placeholder.NormalPolygons.Add(createPolygon(normals)); | ||
} | ||
|
||
public override void Dispose() | ||
protected Polygon createPolygon(List<int> arr) | ||
{ | ||
throw new NotImplementedException(); | ||
//Check if the arr are faces or quads | ||
if (arr.Count % 3 == 0) | ||
{ | ||
return new Triangle(arr[0], arr[1], arr[2]); | ||
} | ||
//Quads | ||
else if (arr.Count % 4 == 0) | ||
{ | ||
return new Triangle(arr[0], arr[1], arr[2]); | ||
} | ||
else | ||
{ | ||
throw new ArgumentException(); | ||
} | ||
} | ||
|
||
private XYZM parseVertex(string line) | ||
{ | ||
XYZM v = new XYZM(); | ||
string[] arr = (string[])line.Split(' '); | ||
|
||
v.X = double.Parse(arr[0]); | ||
v.Y = double.Parse(arr[1]); | ||
v.Z = double.Parse(arr[2]); | ||
|
||
if (arr.Length == 4) | ||
{ | ||
v.M = double.Parse(arr[3]); | ||
} | ||
else | ||
{ | ||
v.M = 1.0d; | ||
} | ||
|
||
return v; | ||
} | ||
|
||
private XYZ parseNormal(string line) | ||
{ | ||
XYZ v = new XYZ(); | ||
string[] arr = (string[])line.Split(' '); | ||
|
||
v.X = double.Parse(arr[0]); | ||
v.Y = double.Parse(arr[1]); | ||
v.Z = double.Parse(arr[2]); | ||
|
||
return v; | ||
} | ||
|
||
private bool processLine(string line, out ObjFileToken token, out string values) | ||
{ | ||
token = ObjFileToken.Undefined; | ||
values = string.Empty; | ||
if (line == null) | ||
{ | ||
return false; | ||
} | ||
|
||
line = _matchNoneWhiteSpaces.Replace(line, " ").Trim(); | ||
|
||
if (this.isComment(line)) | ||
{ | ||
return false; | ||
} | ||
|
||
string strToken = string.Empty; | ||
int indexOfSpace = line.IndexOf(' '); | ||
if (indexOfSpace == -1) | ||
{ | ||
strToken = line; | ||
} | ||
else | ||
{ | ||
strToken = line.Substring(0, indexOfSpace); | ||
values = line.Substring(indexOfSpace + 1); | ||
} | ||
|
||
if (!ObjFileParser.ParseToken(strToken, out token)) | ||
{ | ||
this.triggerNotification($"[{nameof(ObjReader)}] Unknown token: {strToken}", NotificationType.Warning); | ||
return false; | ||
} | ||
|
||
return true; | ||
} | ||
|
||
private bool isComment(string line) | ||
{ | ||
return line.StartsWith("#"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
using CSMath; | ||
using MeshIO.Entities.Geometries; | ||
using MeshIO.Entities.Geometries.Layers; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace MeshIO.OBJ | ||
{ | ||
internal class ObjTemplate | ||
{ | ||
public string Name { get; set; } | ||
|
||
public List<XYZM> Vertices { get; } = []; | ||
|
||
public List<XYZ> Normals { get; } = []; | ||
|
||
public List<XYZ> UVs { get; } = []; | ||
|
||
public List<Polygon> MeshPolygons { get; } = []; | ||
|
||
public List<Polygon> TexturePolygons { get; } = []; | ||
|
||
public List<Polygon> NormalPolygons { get; } = []; | ||
|
||
public ObjTemplate(string name) | ||
{ | ||
this.Name = name; | ||
} | ||
|
||
public Mesh CreateMesh() | ||
{ | ||
Mesh mesh = new Mesh(); | ||
|
||
mesh.Vertices.AddRange(Vertices.Select(v => v.Convert<XYZ>())); | ||
|
||
if (Normals.Any()) | ||
{ | ||
LayerElementNormal normals = new LayerElementNormal(MappingMode.ByPolygonVertex, ReferenceMode.IndexToDirect); | ||
normals.AddRange(this.Normals); | ||
mesh.Layers.Add(normals); | ||
} | ||
|
||
if (UVs.Any()) | ||
{ | ||
LayerElementUV uv = new LayerElementUV(MappingMode.ByPolygonVertex, ReferenceMode.IndexToDirect); | ||
uv.AddRange(this.UVs.Select(xy => xy.Convert<XY>())); | ||
mesh.Layers.Add(uv); | ||
} | ||
|
||
if (MeshPolygons.Any()) | ||
{ | ||
mesh.Polygons.AddRange(MeshPolygons); | ||
} | ||
|
||
return mesh; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,7 @@ | ||
# MeshIO.OBJ | ||
|
||
Module to read Wavefront OBJ files. | ||
|
||
## Features | ||
|
||
- Read **OBJ** files into a **Mesh** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# This is a title comment | ||
o Box | ||
v 0.5 0.5 0.5 | ||
v 0.5 0.5 -0.5 | ||
v 0.5 -0.5 0.5 | ||
v 0.5 -0.5 -0.5 | ||
v -0.5 0.5 -0.5 | ||
v -0.5 0.5 0.5 | ||
v -0.5 -0.5 -0.5 | ||
v -0.5 -0.5 0.5 | ||
v -0.5 0.5 -0.5 | ||
v 0.5 0.5 -0.5 | ||
v -0.5 0.5 0.5 | ||
v 0.5 0.5 0.5 | ||
v -0.5 -0.5 0.5 | ||
v 0.5 -0.5 0.5 | ||
v -0.5 -0.5 -0.5 | ||
v 0.5 -0.5 -0.5 | ||
v -0.5 0.5 0.5 | ||
v 0.5 0.5 0.5 | ||
v -0.5 -0.5 0.5 | ||
v 0.5 -0.5 0.5 | ||
v 0.5 0.5 -0.5 | ||
v -0.5 0.5 -0.5 | ||
v 0.5 -0.5 -0.5 | ||
v -0.5 -0.5 -0.5 | ||
vt 0 1 | ||
vt 1 1 | ||
vt 0 0 | ||
vt 1 0 | ||
vt 0 1 | ||
vt 1 1 | ||
vt 0 0 | ||
vt 1 0 | ||
vt 0 1 | ||
vt 1 1 | ||
vt 0 0 | ||
vt 1 0 | ||
vt 0 1 | ||
vt 1 1 | ||
vt 0 0 | ||
vt 1 0 | ||
vt 0 1 | ||
vt 1 1 | ||
vt 0 0 | ||
vt 1 0 | ||
vt 0 1 | ||
vt 1 1 | ||
vt 0 0 | ||
vt 1 0 | ||
vn 1 0 0 | ||
vn 1 0 0 | ||
vn 1 0 0 | ||
vn 1 0 0 | ||
vn -1 0 0 | ||
vn -1 0 0 | ||
vn -1 0 0 | ||
vn -1 0 0 | ||
vn 0 1 0 | ||
vn 0 1 0 | ||
vn 0 1 0 | ||
vn 0 1 0 | ||
vn 0 -1 0 | ||
vn 0 -1 0 | ||
vn 0 -1 0 | ||
vn 0 -1 0 | ||
vn 0 0 1 | ||
vn 0 0 1 | ||
vn 0 0 1 | ||
vn 0 0 1 | ||
vn 0 0 -1 | ||
vn 0 0 -1 | ||
vn 0 0 -1 | ||
vn 0 0 -1 | ||
f 1/1/1 3/3/3 2/2/2 | ||
f 3/3/3 4/4/4 2/2/2 | ||
f 5/5/5 7/7/7 6/6/6 | ||
f 7/7/7 8/8/8 6/6/6 | ||
f 9/9/9 11/11/11 10/10/10 | ||
f 11/11/11 12/12/12 10/10/10 | ||
f 13/13/13 15/15/15 14/14/14 | ||
f 15/15/15 16/16/16 14/14/14 | ||
f 17/17/17 19/19/19 18/18/18 | ||
f 19/19/19 20/20/20 18/18/18 | ||
f 21/21/21 23/23/23 22/22/22 | ||
f 23/23/23 24/24/24 22/22/22 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# 3ds Max Wavefront OBJ Exporter v0.99 - (c)2007 guruware | ||
# File Created: 04.04.2023 20:09:44 | ||
|
||
newmtl wire_008061138 | ||
Ns 32 | ||
d 1 | ||
Tr 0 | ||
Tf 1 1 1 | ||
illum 2 | ||
Ka 0.0314 0.2392 0.5412 | ||
Kd 0.0314 0.2392 0.5412 | ||
Ks 0.3500 0.3500 0.3500 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# 3ds Max Wavefront OBJ Exporter v0.99 - (c)2007 guruware | ||
# File Created: 04.04.2023 20:09:44 | ||
|
||
mtllib sample_basic_box.mtl | ||
|
||
# | ||
# object Box001 | ||
# | ||
|
||
v -5.0000 0.0000 5.0000 | ||
v -5.0000 0.0000 -5.0000 | ||
v 5.0000 0.0000 -5.0000 | ||
v 5.0000 0.0000 5.0000 | ||
v -5.0000 10.0000 5.0000 | ||
v 5.0000 10.0000 5.0000 | ||
v 5.0000 10.0000 -5.0000 | ||
v -5.0000 10.0000 -5.0000 | ||
# 8 vertices | ||
|
||
vn -0.5774 -0.5774 0.5774 | ||
vn -0.5774 -0.5774 -0.5774 | ||
vn 0.5774 -0.5774 -0.5774 | ||
vn 0.5774 -0.5774 0.5774 | ||
vn -0.5774 0.5774 0.5774 | ||
vn 0.5774 0.5774 0.5774 | ||
vn 0.5774 0.5774 -0.5774 | ||
vn -0.5774 0.5774 -0.5774 | ||
# 8 vertex normals | ||
|
||
vt 1.0000 0.0000 0.0000 | ||
vt 1.0000 1.0000 0.0000 | ||
vt 0.0000 1.0000 0.0000 | ||
vt 0.0000 0.0000 0.0000 | ||
# 4 texture coords | ||
|
||
o Box001 | ||
g Box001 | ||
usemtl wire_008061138 | ||
s 2 | ||
f 1/1/1 2/2/2 3/3/3 4/4/4 | ||
s 4 | ||
f 5/4/5 6/1/6 7/2/7 8/3/8 | ||
s 8 | ||
f 1/4/1 4/1/4 6/2/6 5/3/5 | ||
s 16 | ||
f 4/4/4 3/1/3 7/2/7 6/3/6 | ||
s 32 | ||
f 3/4/3 2/1/2 8/2/8 7/3/7 | ||
s 64 | ||
f 2/4/2 1/1/1 5/2/5 8/3/8 | ||
# 6 polygons | ||
|