Skip to content

Commit e023b3e

Browse files
committed
- Upload meshlet test with obj model
1 parent 1dc8423 commit e023b3e

18 files changed

+35456
-7
lines changed

MeshOptimizerGen/HelloMeshlets/HelloMeshlets.csproj

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,27 @@
33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
55
<TargetFramework>net8.0</TargetFramework>
6+
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
67
</PropertyGroup>
78

9+
<ItemGroup>
10+
<PackageReference Include="Evergine.Mathematics" Version="2025.3.18.659" />
11+
<PackageReference Include="Evergine.Common" Version="2025.3.18.7" />
12+
<PackageReference Include="Evergine.Framework" Version="2025.3.18.7" />
13+
</ItemGroup>
14+
815
<ItemGroup>
916
<ProjectReference Include="..\Evergine.Bindings.Meshoptimizer\Evergine.Bindings.MeshOptimizer.csproj" />
1017
</ItemGroup>
1118

19+
<ItemGroup>
20+
<Folder Include="Model\" />
21+
</ItemGroup>
22+
23+
<ItemGroup>
24+
<None Update="horse_statue_01_1k.obj">
25+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
26+
</None>
27+
</ItemGroup>
28+
1229
</Project>
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// Copyright © Plain Concepts S.L.U. All rights reserved. Use is subject to license terms.
2+
3+
using Evergine.Mathematics;
4+
using System.Collections.Generic;
5+
6+
namespace OBJRuntime.DataTypes
7+
{
8+
/// <summary>
9+
/// Represents the attributes of an OBJ file, including vertices, normals, texture coordinates, and other optional data.
10+
/// </summary>
11+
public class OBJAttrib
12+
{
13+
/// <summary>
14+
/// Gets or sets the list of vertex positions ('v' xyz).
15+
/// </summary>
16+
public List<Vector3> Vertices = new List<Vector3>();
17+
18+
/// <summary>
19+
/// Gets or sets the list of vertex weights ('v' w).
20+
/// </summary>
21+
public List<float> VertexWeights = new List<float>();
22+
23+
/// <summary>
24+
/// Gets or sets the list of vertex normals ('vn').
25+
/// </summary>
26+
public List<Vector3> Normals = new List<Vector3>();
27+
28+
/// <summary>
29+
/// Gets or sets the list of texture coordinates ('vt' (u, v)).
30+
/// </summary>
31+
public List<Vector2> Texcoords = new List<Vector2>();
32+
33+
/// <summary>
34+
/// Gets or sets the list of texture coordinate weights ('vt' w, if present; otherwise unused).
35+
/// </summary>
36+
public List<float> TexcoordWs = new List<float>();
37+
38+
/// <summary>
39+
/// Gets or sets the list of vertex colors, if present.
40+
/// </summary>
41+
public List<Vector3> Colors = new List<Vector3>();
42+
43+
/// <summary>
44+
/// Gets or sets the list of skin weights for vertices, used for skeletal animation.
45+
/// </summary>
46+
public List<OBJSkinWeight> SkinWeights = new List<OBJSkinWeight>();
47+
}
48+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Copyright © Plain Concepts S.L.U. All rights reserved. Use is subject to license terms.
2+
3+
namespace OBJRuntime.DataTypes
4+
{
5+
/// <summary>
6+
/// Represents an index structure used in OBJ files to support different indices for vertices, normals, and texture coordinates.
7+
/// </summary>
8+
public struct OBJIndex
9+
{
10+
/// <summary>
11+
/// Gets or sets the index of the vertex. A value of -1 indicates that the vertex is not used.
12+
/// </summary>
13+
public int VertexIndex;
14+
15+
/// <summary>
16+
/// Gets or sets the index of the normal. A value of -1 indicates that the normal is not used.
17+
/// </summary>
18+
public int NormalIndex;
19+
20+
/// <summary>
21+
/// Gets or sets the index of the texture coordinate. A value of -1 indicates that the texture coordinate is not used.
22+
/// </summary>
23+
public int TexcoordIndex;
24+
}
25+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright © Plain Concepts S.L.U. All rights reserved. Use is subject to license terms.
2+
3+
namespace OBJRuntime.DataTypes
4+
{
5+
/// <summary>
6+
/// Represents a joint and its associated weight used in skeletal animation for OBJ models.
7+
/// </summary>
8+
public struct OBJJointAndWeight
9+
{
10+
/// <summary>
11+
/// Gets or sets the identifier of the joint.
12+
/// </summary>
13+
public int JointId;
14+
15+
/// <summary>
16+
/// Gets or sets the weight value that determines the influence of the joint.
17+
/// Value typically ranges from 0 to 1, where 0 means no influence and 1 means full influence.
18+
/// </summary>
19+
public float Weight;
20+
}
21+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Copyright © Plain Concepts S.L.U. All rights reserved. Use is subject to license terms.
2+
3+
using System.Collections.Generic;
4+
5+
namespace OBJRuntime.DataTypes
6+
{
7+
/// <summary>
8+
/// Represents a collection of lines in an OBJ file.
9+
/// </summary>
10+
public class OBJLines
11+
{
12+
/// <summary>
13+
/// Gets or sets the list of indices for the vertices, normals, and texture coordinates of the lines.
14+
/// </summary>
15+
public List<OBJIndex> Indices = new List<OBJIndex>();
16+
17+
/// <summary>
18+
/// Gets or sets the list of vertex counts for each line.
19+
/// </summary>
20+
public List<int> NumLineVertices = new List<int>();
21+
}
22+
}
Lines changed: 243 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,243 @@
1+
// Copyright © Plain Concepts S.L.U. All rights reserved. Use is subject to license terms.
2+
3+
using Evergine.Mathematics;
4+
using System.Collections.Generic;
5+
6+
namespace OBJRuntime.DataTypes
7+
{
8+
/// <summary>
9+
/// Represents a material definition in the OBJ format, including properties for
10+
/// ambient, diffuse, and specular components, as well as texture and PBR extensions.
11+
/// </summary>
12+
public class OBJMaterial
13+
{
14+
/// <summary>
15+
/// Gets or sets the name of the material.
16+
/// </summary>
17+
public string Name = string.Empty;
18+
19+
/// <summary>
20+
/// Gets or sets the ambient color of the material.
21+
/// </summary>
22+
public Vector3 Ambient = Vector3.Zero;
23+
24+
/// <summary>
25+
/// Gets or sets the diffuse color of the material.
26+
/// </summary>
27+
public Vector3 Diffuse = Vector3.One;
28+
29+
/// <summary>
30+
/// Gets or sets the specular color of the material.
31+
/// </summary>
32+
public Vector3 Specular = Vector3.Zero;
33+
34+
/// <summary>
35+
/// Gets or sets the transmittance color of the material.
36+
/// </summary>
37+
public Vector3 Transmittance = Vector3.Zero;
38+
39+
/// <summary>
40+
/// Gets or sets the emission color of the material.
41+
/// </summary>
42+
public Vector3 Emission = Vector3.Zero;
43+
44+
/// <summary>
45+
/// Gets or sets the shininess of the material.
46+
/// </summary>
47+
public float Shininess = 1.0f;
48+
49+
/// <summary>
50+
/// Gets or sets the index of refraction of the material.
51+
/// </summary>
52+
public float Ior = 1.0f;
53+
54+
/// <summary>
55+
/// Gets or sets the dissolve factor of the material (1 = opaque, 0 = fully transparent).
56+
/// </summary>
57+
public float Dissolve = 1.0f;
58+
59+
/// <summary>
60+
/// Gets or sets the illumination model of the material.
61+
/// </summary>
62+
public int Illum = 0;
63+
64+
// Texture information
65+
66+
/// <summary>
67+
/// Gets or sets the texture name for the ambient map.
68+
/// </summary>
69+
public string AmbientTexname = string.Empty;
70+
71+
/// <summary>
72+
/// Gets or sets the texture name for the diffuse map.
73+
/// </summary>
74+
public string DiffuseTexname = string.Empty;
75+
76+
/// <summary>
77+
/// Gets or sets the texture name for the specular map.
78+
/// </summary>
79+
public string SpecularTexname = string.Empty;
80+
81+
/// <summary>
82+
/// Gets or sets the texture name for the specular highlight map.
83+
/// </summary>
84+
public string SpecularHighlightTexname = string.Empty;
85+
86+
/// <summary>
87+
/// Gets or sets the texture name for the bump map.
88+
/// </summary>
89+
public string BumpTexname = string.Empty;
90+
91+
/// <summary>
92+
/// Gets or sets the texture name for the displacement map.
93+
/// </summary>
94+
public string DisplacementTexname = string.Empty;
95+
96+
/// <summary>
97+
/// Gets or sets the texture name for the alpha map.
98+
/// </summary>
99+
public string AlphaTexname = string.Empty;
100+
101+
/// <summary>
102+
/// Gets or sets the texture name for the reflection map.
103+
/// </summary>
104+
public string ReflectionTexname = string.Empty;
105+
106+
/// <summary>
107+
/// Gets or sets the texture options for the ambient map.
108+
/// </summary>
109+
public OBJTextureOption AmbientTexopt = new OBJTextureOption();
110+
111+
/// <summary>
112+
/// Gets or sets the texture options for the diffuse map.
113+
/// </summary>
114+
public OBJTextureOption DiffuseTexopt = new OBJTextureOption();
115+
116+
/// <summary>
117+
/// Gets or sets the texture options for the specular map.
118+
/// </summary>
119+
public OBJTextureOption SpecularTexopt = new OBJTextureOption();
120+
121+
/// <summary>
122+
/// Gets or sets the texture options for the specular highlight map.
123+
/// </summary>
124+
public OBJTextureOption SpecularHighlightTexopt = new OBJTextureOption();
125+
126+
/// <summary>
127+
/// Gets or sets the texture options for the bump map.
128+
/// </summary>
129+
public OBJTextureOption BumpTexopt = new OBJTextureOption();
130+
131+
/// <summary>
132+
/// Gets or sets the texture options for the displacement map.
133+
/// </summary>
134+
public OBJTextureOption DisplacementTexopt = new OBJTextureOption();
135+
136+
/// <summary>
137+
/// Gets or sets the texture options for the alpha map.
138+
/// </summary>
139+
public OBJTextureOption AlphaTexopt = new OBJTextureOption();
140+
141+
/// <summary>
142+
/// Gets or sets the texture options for the reflection map.
143+
/// </summary>
144+
public OBJTextureOption ReflectionTexopt = new OBJTextureOption();
145+
146+
// PBR extension
147+
148+
/// <summary>
149+
/// Gets or sets the roughness value for PBR rendering.
150+
/// </summary>
151+
public float Roughness = 0.8f;
152+
153+
/// <summary>
154+
/// Gets or sets the metallic value for PBR rendering.
155+
/// </summary>
156+
public float Metallic = 0.0f;
157+
158+
/// <summary>
159+
/// Gets or sets the sheen value for PBR rendering.
160+
/// </summary>
161+
public float Sheen = 0.0f;
162+
163+
/// <summary>
164+
/// Gets or sets the clearcoat thickness for PBR rendering.
165+
/// </summary>
166+
public float ClearcoatThickness = 0.0f;
167+
168+
/// <summary>
169+
/// Gets or sets the clearcoat roughness for PBR rendering.
170+
/// </summary>
171+
public float ClearcoatRoughness = 0.0f;
172+
173+
/// <summary>
174+
/// Gets or sets the anisotropy value for PBR rendering.
175+
/// </summary>
176+
public float Anisotropy = 0.0f;
177+
178+
/// <summary>
179+
/// Gets or sets the anisotropy rotation value for PBR rendering.
180+
/// </summary>
181+
public float AnisotropyRotation = 0.0f;
182+
183+
/// <summary>
184+
/// Gets or sets the texture name for the roughness map.
185+
/// </summary>
186+
public string RoughnessTexname = string.Empty;
187+
188+
/// <summary>
189+
/// Gets or sets the texture name for the metallic map.
190+
/// </summary>
191+
public string MetallicTexname = string.Empty;
192+
193+
/// <summary>
194+
/// Gets or sets the texture name for the sheen map.
195+
/// </summary>
196+
public string SheenTexname = string.Empty;
197+
198+
/// <summary>
199+
/// Gets or sets the texture name for the emissive map.
200+
/// </summary>
201+
public string EmissiveTexname = string.Empty;
202+
203+
/// <summary>
204+
/// Gets or sets the texture name for the normal map.
205+
/// </summary>
206+
public string NormalTexname = string.Empty;
207+
208+
/// <summary>
209+
/// Gets or sets the texture options for the roughness map.
210+
/// </summary>
211+
public OBJTextureOption Roughness_texopt = new OBJTextureOption();
212+
213+
/// <summary>
214+
/// Gets or sets the texture options for the metallic map.
215+
/// </summary>
216+
public OBJTextureOption Metallic_texopt = new OBJTextureOption();
217+
218+
/// <summary>
219+
/// Gets or sets the texture options for the sheen map.
220+
/// </summary>
221+
public OBJTextureOption Sheen_texopt = new OBJTextureOption();
222+
223+
/// <summary>
224+
/// Gets or sets the texture options for the emissive map.
225+
/// </summary>
226+
public OBJTextureOption Emissive_texopt = new OBJTextureOption();
227+
228+
/// <summary>
229+
/// Gets or sets the texture options for the normal map.
230+
/// </summary>
231+
public OBJTextureOption Normal_texopt = new OBJTextureOption();
232+
233+
/// <summary>
234+
/// Gets or sets the padding value.
235+
/// </summary>
236+
public int Pad2;
237+
238+
/// <summary>
239+
/// Gets or sets the key-value pairs for unknown parameters.
240+
/// </summary>
241+
public Dictionary<string, string> UnknownParameter = new Dictionary<string, string>();
242+
}
243+
}

0 commit comments

Comments
 (0)