more work on gtk & code cleanup

This commit is contained in:
2025-06-16 15:30:56 +02:00
parent 6f7bb5d92c
commit a49a3b2beb
69 changed files with 374 additions and 268 deletions

View File

@@ -68,7 +68,7 @@ Namespace AssimpModule
Dim dicUVs = pc.DicUVs
Dim dicVertexColors = pc.DicVertexColors
trafo = trafo * node.Transform
trafo *= node.Transform
If node.HasMeshes Then
For Each meshIndex In node.MeshIndices
@@ -126,10 +126,10 @@ Namespace AssimpModule
For Each uvList As List(Of Vector3D) In m.TextureCoordinateChannels
For Each uv As Vector3D In uvList
If Not dicUVs.ContainsKey(uv) Then
Dim newUV As New UV
newUV.U = uv.X
newUV.V = uv.Y
Dim newUV As New UV With {
.U = uv.X,
.V = uv.Y
}
newMesh.UVs.Add(newUV)
dicUVs.Add(uv, newUV)
@@ -140,12 +140,12 @@ Namespace AssimpModule
For Each vcList As List(Of Color4D) In m.VertexColorChannels
For Each vc As Color4D In vcList
If Not dicVertexColors.ContainsKey(vc) Then
Dim newVC As New VertexColor
newVC.R = vc.R
newVC.G = vc.G
newVC.B = vc.B
newVC.A = vc.A
Dim newVC As New VertexColor With {
.R = vc.R,
.G = vc.G,
.B = vc.B,
.A = vc.A
}
newMesh.VertexColors.Add(newVC)
dicVertexColors.Add(vc, newVC)
@@ -298,15 +298,16 @@ Namespace AssimpModule
End If
For Each kvp As KeyValuePair(Of String, Material) In obj.Materials
Dim mat As New Assimp.Material
mat.Name = If(kvp.Key <> "", kvp.Key, "_" & mdl.Materials.Count)
Dim mat As New Assimp.Material With {
.Name = If(kvp.Key <> "", kvp.Key, "_" & mdl.Materials.Count)
}
mat.Opacity = mat.Opacity
Dim texslot As New TextureSlot
texslot.TextureIndex = mdl.Textures.Count
texslot.TextureType = TextureType.Diffuse
texslot.UVIndex = 0
Dim texslot As New TextureSlot With {
.TextureIndex = mdl.Textures.Count,
.TextureType = TextureType.Diffuse,
.UVIndex = 0
}
Dim ms As New MemoryStream
kvp.Value.Image.Save(ms, Imaging.ImageFormat.Png)
@@ -342,8 +343,9 @@ Namespace AssimpModule
If dicTexMesh.ContainsKey(f.Material) Then
m = dicTexMesh(f.Material)
Else
m = New Assimp.Mesh("Mesh_" & mdl.MeshCount + 1)
m.PrimitiveType = PrimitiveType.Triangle
m = New Assimp.Mesh("Mesh_" & mdl.MeshCount + 1) With {
.PrimitiveType = PrimitiveType.Triangle
}
If dicMatIndex.ContainsKey(f.Material) Then
m.MaterialIndex = dicMatIndex(f.Material)
End If
@@ -359,20 +361,22 @@ Namespace AssimpModule
newFace.Indices.Add(dicCounter(m))
If p.Vertex IsNot Nothing Then
Dim vert As New Vector3D
vert.X = p.Vertex.X
vert.Y = p.Vertex.Y
vert.Z = p.Vertex.Z
Dim vert As New Vector3D With {
.X = p.Vertex.X,
.Y = p.Vertex.Y,
.Z = p.Vertex.Z
}
m.Vertices.Add(vert)
Else
m.Vertices.Add(New Vector3D(0, 0, 0))
End If
If p.Normal IsNot Nothing Then
Dim norm As New Vector3D
norm.X = p.Normal.X
norm.Y = p.Normal.Y
norm.Z = p.Normal.Z
Dim norm As New Vector3D With {
.X = p.Normal.X,
.Y = p.Normal.Y,
.Z = p.Normal.Z
}
m.Normals.Add(norm)
Else
m.Normals.Add(New Vector3D(0, 0, 0))