more work on gtk & code cleanup
This commit is contained in:
@@ -118,12 +118,12 @@ Namespace Aspose3DModule
|
||||
'Create Vertices
|
||||
For Each vert As Vector4 In curMesh.ControlPoints
|
||||
'Create new Vertex
|
||||
Dim newVert As New Vertex
|
||||
|
||||
'Set Vertex Data
|
||||
newVert.X = vert.x
|
||||
newVert.Y = vert.y
|
||||
newVert.Z = vert.z
|
||||
Dim newVert As New Vertex With {
|
||||
.X = vert.x,
|
||||
.Y = vert.y,
|
||||
.Z = vert.z
|
||||
}
|
||||
|
||||
'Add new Vertex
|
||||
newMesh.Vertices.Add(newVert)
|
||||
@@ -134,12 +134,12 @@ Namespace Aspose3DModule
|
||||
If veNormals IsNot Nothing Then
|
||||
For Each n As Vector4 In veNormals.Data
|
||||
'Create new Normal
|
||||
Dim newNormal As New Normal
|
||||
|
||||
'Set Normal Data
|
||||
newNormal.X = n.x
|
||||
newNormal.Y = n.y
|
||||
newNormal.Z = n.z
|
||||
Dim newNormal As New Normal With {
|
||||
.X = n.x,
|
||||
.Y = n.y,
|
||||
.Z = n.z
|
||||
}
|
||||
|
||||
'Add new Normal
|
||||
newMesh.Normals.Add(newNormal)
|
||||
@@ -151,11 +151,11 @@ Namespace Aspose3DModule
|
||||
If veUVs IsNot Nothing Then
|
||||
For Each uv As Vector4 In veUVs.Data
|
||||
'Create new UV
|
||||
Dim newUV As New UV
|
||||
|
||||
'Set UV Data
|
||||
newUV.U = uv.x
|
||||
newUV.V = uv.y
|
||||
Dim newUV As New UV With {
|
||||
.U = uv.x,
|
||||
.V = uv.y
|
||||
}
|
||||
|
||||
'Add new UV
|
||||
newMesh.UVs.Add(newUV)
|
||||
@@ -167,13 +167,13 @@ Namespace Aspose3DModule
|
||||
If veVertexColor IsNot Nothing Then
|
||||
For Each n As Vector4 In veVertexColor.Data
|
||||
'Create new Normal
|
||||
Dim newVC As New VertexColor
|
||||
|
||||
'Set Normal Data
|
||||
newVC.R = n.x
|
||||
newVC.G = n.y
|
||||
newVC.B = n.z
|
||||
newVC.A = n.w
|
||||
Dim newVC As New VertexColor With {
|
||||
.R = n.x,
|
||||
.G = n.y,
|
||||
.B = n.z,
|
||||
.A = n.w
|
||||
}
|
||||
|
||||
'Add new Normal
|
||||
newMesh.VertexColors.Add(newVC)
|
||||
@@ -203,10 +203,10 @@ Namespace Aspose3DModule
|
||||
|
||||
For Each index As Integer In poly
|
||||
'Create new Point
|
||||
Dim p As New Point
|
||||
|
||||
'Set Vertex
|
||||
p.Vertex = newMesh.Vertices(index)
|
||||
Dim p As New Point With {
|
||||
.Vertex = newMesh.Vertices(index)
|
||||
}
|
||||
|
||||
'Set Normal
|
||||
If veNormals IsNot Nothing Then
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -68,11 +68,11 @@ Public Class File3DLoaderModule
|
||||
End Property
|
||||
|
||||
Private Shared Function GetLoaderModules() As File3DLoaderModule()
|
||||
Dim list As New List(Of File3DLoaderModule)
|
||||
|
||||
list.Add(New File3DLoaderModule("Simple File Parser",
|
||||
Dim list As New List(Of File3DLoaderModule) From {
|
||||
New File3DLoaderModule("Simple File Parser",
|
||||
AddressOf LoadViaSimpleFileParser,
|
||||
New Dictionary(Of String, String) From {{"obj", "OBJ"}}))
|
||||
New Dictionary(Of String, String) From {{"obj", "OBJ"}})
|
||||
}
|
||||
|
||||
AssimpModule.AssimpLoader.LoadAssimpLibs()
|
||||
Dim exts As New Dictionary(Of String, String)
|
||||
@@ -111,11 +111,11 @@ Public Class File3DLoaderModule
|
||||
End Function
|
||||
|
||||
Private Shared Function GetExporterModules() As File3DLoaderModule()
|
||||
Dim list As New List(Of File3DLoaderModule)
|
||||
|
||||
list.Add(New File3DLoaderModule("Simple File Parser",
|
||||
Dim list As New List(Of File3DLoaderModule) From {
|
||||
New File3DLoaderModule("Simple File Parser",
|
||||
AddressOf ExportViaSimpleFileParser,
|
||||
New Dictionary(Of String, String) From {{"obj", "OBJ"}}))
|
||||
New Dictionary(Of String, String) From {{"obj", "OBJ"}})
|
||||
}
|
||||
|
||||
AssimpModule.AssimpLoader.LoadAssimpLibs()
|
||||
Dim exts As New Dictionary(Of String, String)
|
||||
|
||||
Reference in New Issue
Block a user