disable aspose3d due compatibility issues

This commit is contained in:
Pilzinsel64
2025-10-15 10:51:07 +02:00
parent 4b5f2bfddf
commit c4c62e958f
4 changed files with 221 additions and 221 deletions

View File

@@ -26,7 +26,7 @@
<OptionInfer>On</OptionInfer> <OptionInfer>On</OptionInfer>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<Version>2.0.2</Version> <Version>2.0.3</Version>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="OpenTK.Input" Version="4.9.4" /> <PackageReference Include="OpenTK.Input" Version="4.9.4" />

View File

@@ -1,250 +1,250 @@
Imports System.Globalization 'Imports System.Globalization
Imports System.IO 'Imports System.IO
Imports System.Threading 'Imports System.Threading
Imports Aspose.ThreeD 'Imports Aspose.ThreeD
Imports Aspose.ThreeD.Entities 'Imports Aspose.ThreeD.Entities
Imports Aspose.ThreeD.Shading 'Imports Aspose.ThreeD.Shading
Imports Aspose.ThreeD.Utilities 'Imports Aspose.ThreeD.Utilities
Namespace Aspose3DModule 'Namespace Aspose3DModule
Public Class Aspose3DLoader ' Public Class Aspose3DLoader
Private Shared hasActivatedMemoryPatching As Boolean = False ' Private Shared hasActivatedMemoryPatching As Boolean = False
Private Shared Sub ActivateMemoryPatching() ' Private Shared Sub ActivateMemoryPatching()
If Not hasActivatedMemoryPatching Then ' If Not hasActivatedMemoryPatching Then
LicenseHelper.AsposeModifyInMemory.ActivateMemoryPatching() ' LicenseHelper.AsposeModifyInMemory.ActivateMemoryPatching()
hasActivatedMemoryPatching = True ' hasActivatedMemoryPatching = True
End If ' End If
End Sub ' End Sub
Public Shared Function FromFile(fileName As String, LoadMaterials As Boolean, UpAxis As UpAxis) As Object3D ' Public Shared Function FromFile(fileName As String, LoadMaterials As Boolean, UpAxis As UpAxis) As Object3D
ActivateMemoryPatching() ' ActivateMemoryPatching()
'Create new Model ' 'Create new Model
Dim obj3d As New Object3D ' Dim obj3d As New Object3D
'Create new temporary CultureInfo ' 'Create new temporary CultureInfo
Dim curThread As Thread = Thread.CurrentThread ' Dim curThread As Thread = Thread.CurrentThread
Dim curCultInfo As CultureInfo = curThread.CurrentCulture ' Dim curCultInfo As CultureInfo = curThread.CurrentCulture
Dim newCultInfo As New CultureInfo(curCultInfo.Name) ' Dim newCultInfo As New CultureInfo(curCultInfo.Name)
newCultInfo.NumberFormat.NumberDecimalSeparator = "." ' newCultInfo.NumberFormat.NumberDecimalSeparator = "."
newCultInfo.NumberFormat.PercentDecimalSeparator = "." ' newCultInfo.NumberFormat.PercentDecimalSeparator = "."
newCultInfo.NumberFormat.CurrencyDecimalSeparator = "." ' newCultInfo.NumberFormat.CurrencyDecimalSeparator = "."
newCultInfo.NumberFormat.NumberGroupSeparator = "," ' newCultInfo.NumberFormat.NumberGroupSeparator = ","
newCultInfo.NumberFormat.PercentGroupSeparator = "," ' newCultInfo.NumberFormat.PercentGroupSeparator = ","
newCultInfo.NumberFormat.CurrencyGroupSeparator = "," ' newCultInfo.NumberFormat.CurrencyGroupSeparator = ","
curThread.CurrentCulture = newCultInfo ' curThread.CurrentCulture = newCultInfo
'Load Model from file ' 'Load Model from file
Dim scene As New Scene(fileName) ' Dim scene As New Scene
'Reset Cultur-Info ' 'Reset Cultur-Info
curThread.CurrentCulture = curCultInfo ' curThread.CurrentCulture = curCultInfo
'Triangulate the Model ' 'Triangulate the Model
PolygonModifier.Triangulate(scene) ' PolygonModifier.Triangulate(scene)
'Create Dictionary for Materials ' 'Create Dictionary for Materials
Dim dicMaterials As New Dictionary(Of Aspose.ThreeD.Shading.Material, Material) ' Dim dicMaterials As New Dictionary(Of Aspose.ThreeD.Shading.Material, Material)
'Create List of all avaiable Map-States ' 'Create List of all avaiable Map-States
Dim MapNames As String() = {Aspose.ThreeD.Shading.Material.MapDiffuse, Aspose.ThreeD.Shading.Material.MapAmbient, Aspose.ThreeD.Shading.Material.MapSpecular, Aspose.ThreeD.Shading.Material.MapEmissive, Aspose.ThreeD.Shading.Material.MapNormal} ' Dim MapNames As String() = {Aspose.ThreeD.Shading.Material.MapDiffuse, Aspose.ThreeD.Shading.Material.MapAmbient, Aspose.ThreeD.Shading.Material.MapSpecular, Aspose.ThreeD.Shading.Material.MapEmissive, Aspose.ThreeD.Shading.Material.MapNormal}
Dim ColorNames As String() = {"DiffuseColor", "AmbientColor", "SpecularColor", "EmissiveColor"} ' Dim ColorNames As String() = {"DiffuseColor", "AmbientColor", "SpecularColor", "EmissiveColor"}
For Each node As Node In scene.RootNode.ChildNodes ' For Each node As Node In scene.RootNode.ChildNodes
'Add new Materials, if not added ' 'Add new Materials, if not added
For Each mat As Aspose.ThreeD.Shading.Material In node.Materials ' For Each mat As Aspose.ThreeD.Shading.Material In node.Materials
If Not dicMaterials.ContainsKey(mat) Then ' If Not dicMaterials.ContainsKey(mat) Then
'Create new Material ' 'Create new Material
Dim newMat As New Material ' Dim newMat As New Material
'Get TextureBase ' 'Get TextureBase
Dim texBase As TextureBase = Nothing ' Dim texBase As TextureBase = Nothing
Dim curmnindex As Byte = 0 ' Dim curmnindex As Byte = 0
Do While texBase Is Nothing AndAlso curmnindex < MapNames.Length ' Do While texBase Is Nothing AndAlso curmnindex < MapNames.Length
texBase = mat.GetTexture(MapNames(curmnindex)) ' texBase = mat.GetTexture(MapNames(curmnindex))
curmnindex += 1 ' curmnindex += 1
Loop ' Loop
If texBase IsNot Nothing Then ' If texBase IsNot Nothing Then
If LoadMaterials Then ' If LoadMaterials Then
'Get Texture Image ' 'Get Texture Image
Dim imgFile As String = texBase.GetPropertyValue("FileName") ' Dim imgFile As String = texBase.GetPropertyValue("FileName")
imgFile = imgFile.Replace("/", "\") ' imgFile = imgFile.Replace("/", "\")
'Load and set Image ' 'Load and set Image
If imgFile <> "" Then ' If imgFile <> "" Then
Dim fs As New FileStream(imgFile, FileMode.Open, FileAccess.Read) ' Dim fs As New FileStream(imgFile, FileMode.Open, FileAccess.Read)
newMat.Image = Image.FromStream(fs) ' newMat.Image = Image.FromStream(fs)
fs.Close() ' fs.Close()
End If ' End If
End If ' End If
End If ' End If
'Get Texture Color ' 'Get Texture Color
Dim texcol As Vector3? = Nothing ' Dim texcol As Vector3? = Nothing
Dim curcnindex As Byte = 0 ' Dim curcnindex As Byte = 0
Do While texcol Is Nothing AndAlso curcnindex < ColorNames.Length ' Do While texcol Is Nothing AndAlso curcnindex < ColorNames.Length
texcol = mat.GetPropertyValue(ColorNames(curcnindex)) ' texcol = mat.GetPropertyValue(ColorNames(curcnindex))
curcnindex += 1 ' curcnindex += 1
Loop ' Loop
If texcol IsNot Nothing Then ' If texcol IsNot Nothing Then
newMat.Color = Color.FromArgb(texcol?.x, texcol?.y, texcol?.z) ' newMat.Color = Color.FromArgb(texcol?.x, texcol?.y, texcol?.z)
End If ' End If
'Add Material to Object3D ' 'Add Material to Object3D
obj3d.Materials.Add(mat.Name, newMat) ' obj3d.Materials.Add(mat.Name, newMat)
'Add Dictionary-Entry ' 'Add Dictionary-Entry
dicMaterials.Add(mat, newMat) ' dicMaterials.Add(mat, newMat)
End If ' End If
Next ' Next
'Get Aspose-Mesh ' 'Get Aspose-Mesh
Dim curMesh As Entities.Mesh = node.GetEntity(Of Entities.Mesh) ' Dim curMesh As Entities.Mesh = node.GetEntity(Of Entities.Mesh)
If curMesh IsNot Nothing Then ' If curMesh IsNot Nothing Then
'Create new Mesh ' 'Create new Mesh
Dim newMesh As New Mesh ' Dim newMesh As New Mesh
'Create Vertices ' 'Create Vertices
For Each vert As Vector4 In curMesh.ControlPoints ' For Each vert As Vector4 In curMesh.ControlPoints
'Create new Vertex ' 'Create new Vertex
'Set Vertex Data ' 'Set Vertex Data
Dim newVert As New Vertex With { ' Dim newVert As New Vertex With {
.X = vert.x, ' .X = vert.x,
.Y = vert.y, ' .Y = vert.y,
.Z = vert.z ' .Z = vert.z
} ' }
'Add new Vertex ' 'Add new Vertex
newMesh.Vertices.Add(newVert) ' newMesh.Vertices.Add(newVert)
Next ' Next
'Create Normals ' 'Create Normals
Dim veNormals As VertexElementNormal = curMesh.GetElement(VertexElementType.Normal) ' Dim veNormals As VertexElementNormal = curMesh.GetElement(VertexElementType.Normal)
If veNormals IsNot Nothing Then ' If veNormals IsNot Nothing Then
For Each n As Vector4 In veNormals.Data ' For Each n As Vector4 In veNormals.Data
'Create new Normal ' 'Create new Normal
'Set Normal Data ' 'Set Normal Data
Dim newNormal As New Normal With { ' Dim newNormal As New Normal With {
.X = n.x, ' .X = n.x,
.Y = n.y, ' .Y = n.y,
.Z = n.z ' .Z = n.z
} ' }
'Add new Normal ' 'Add new Normal
newMesh.Normals.Add(newNormal) ' newMesh.Normals.Add(newNormal)
Next ' Next
End If ' End If
'Create Normals ' 'Create Normals
Dim veUVs As VertexElementUV = curMesh.GetElement(VertexElementType.UV) ' Dim veUVs As VertexElementUV = curMesh.GetElement(VertexElementType.UV)
If veUVs IsNot Nothing Then ' If veUVs IsNot Nothing Then
For Each uv As Vector4 In veUVs.Data ' For Each uv As Vector4 In veUVs.Data
'Create new UV ' 'Create new UV
'Set UV Data ' 'Set UV Data
Dim newUV As New UV With { ' Dim newUV As New UV With {
.U = uv.x, ' .U = uv.x,
.V = uv.y ' .V = uv.y
} ' }
'Add new UV ' 'Add new UV
newMesh.UVs.Add(newUV) ' newMesh.UVs.Add(newUV)
Next ' Next
End If ' End If
'Create Normals ' 'Create Normals
Dim veVertexColor As VertexElementVertexColor = curMesh.GetElement(VertexElementType.VertexColor) ' Dim veVertexColor As VertexElementVertexColor = curMesh.GetElement(VertexElementType.VertexColor)
If veVertexColor IsNot Nothing Then ' If veVertexColor IsNot Nothing Then
For Each n As Vector4 In veVertexColor.Data ' For Each n As Vector4 In veVertexColor.Data
'Create new Normal ' 'Create new Normal
'Set Normal Data ' 'Set Normal Data
Dim newVC As New VertexColor With { ' Dim newVC As New VertexColor With {
.R = n.x, ' .R = n.x,
.G = n.y, ' .G = n.y,
.B = n.z, ' .B = n.z,
.A = n.w ' .A = n.w
} ' }
'Add new Normal ' 'Add new Normal
newMesh.VertexColors.Add(newVC) ' newMesh.VertexColors.Add(newVC)
Next ' Next
End If ' End If
'Get Material-Indicies ' 'Get Material-Indicies
Dim veMaterials As VertexElementMaterial = curMesh.GetElement(VertexElementType.Material) ' Dim veMaterials As VertexElementMaterial = curMesh.GetElement(VertexElementType.Material)
'Definde Index for VertexElement.Indicies ' 'Definde Index for VertexElement.Indicies
Dim veIndex As Integer = 0 ' Dim veIndex As Integer = 0
'Build Polygones ' 'Build Polygones
For iPoly = 0 To curMesh.Polygons.Count - 1 ' For iPoly = 0 To curMesh.Polygons.Count - 1
'Get current Polygon ' 'Get current Polygon
Dim poly As Integer() = curMesh.Polygons(iPoly) ' Dim poly As Integer() = curMesh.Polygons(iPoly)
'Create new Face ' 'Create new Face
Dim f As New Face ' Dim f As New Face
'Set Texture, if avaiable ' 'Set Texture, if avaiable
If veMaterials IsNot Nothing Then ' If veMaterials IsNot Nothing Then
f.Material = dicMaterials(node.Materials(veMaterials.Indices(iPoly))) ' f.Material = dicMaterials(node.Materials(veMaterials.Indices(iPoly)))
ElseIf node.Material IsNot Nothing Then ' ElseIf node.Material IsNot Nothing Then
f.Material = dicMaterials(node.Material) ' f.Material = dicMaterials(node.Material)
End If ' End If
For Each index As Integer In poly ' For Each index As Integer In poly
'Create new Point ' 'Create new Point
'Set Vertex ' 'Set Vertex
Dim p As New Point With { ' Dim p As New Point With {
.Vertex = newMesh.Vertices(index) ' .Vertex = newMesh.Vertices(index)
} ' }
'Set Normal ' 'Set Normal
If veNormals IsNot Nothing Then ' If veNormals IsNot Nothing Then
p.Normal = newMesh.Normals(veNormals.Indices(veIndex)) ' p.Normal = newMesh.Normals(veNormals.Indices(veIndex))
End If ' End If
'Set UV ' 'Set UV
If veUVs IsNot Nothing Then ' If veUVs IsNot Nothing Then
p.UV = newMesh.UVs(veUVs.Indices(veIndex)) ' p.UV = newMesh.UVs(veUVs.Indices(veIndex))
End If ' End If
'Set Vertex Color ' 'Set Vertex Color
If veVertexColor IsNot Nothing Then ' If veVertexColor IsNot Nothing Then
p.VertexColor = newMesh.VertexColors(veVertexColor.Indices(veIndex)) ' p.VertexColor = newMesh.VertexColors(veVertexColor.Indices(veIndex))
End If ' End If
'Add new Point ' 'Add new Point
f.Points.Add(p) ' f.Points.Add(p)
'Increment VertexElementIndicies-Index ' 'Increment VertexElementIndicies-Index
veIndex += 1 ' veIndex += 1
Next ' Next
'Add new Face ' 'Add new Face
newMesh.Faces.Add(f) ' newMesh.Faces.Add(f)
Next ' Next
'Add new Mesh ' 'Add new Mesh
obj3d.Meshes.Add(newMesh) ' obj3d.Meshes.Add(newMesh)
End If ' End If
Next ' Next
'Return the new Object3D ' 'Return the new Object3D
Return obj3d ' Return obj3d
End Function ' End Function
End Class ' End Class
End Namespace 'End Namespace

View File

@@ -87,25 +87,25 @@ Public Class File3DLoaderModule
AddressOf LoadViaAssimp, AddressOf LoadViaAssimp,
exts)) exts))
list.Add(New File3DLoaderModule("Aspose.3D", 'list.Add(New File3DLoaderModule("Aspose.3D",
AddressOf LoadViaAspose3D, ' AddressOf LoadViaAspose3D,
New Dictionary(Of String, String) From { ' New Dictionary(Of String, String) From {
{"obj", "OBJ"}, ' {"obj", "OBJ"},
{"dae", "DAE"}, ' {"dae", "DAE"},
{"fbx", "FBX"}, ' {"fbx", "FBX"},
{"stl", "STL"}, ' {"stl", "STL"},
{"3ds", "3DS"}, ' {"3ds", "3DS"},
{"3d", "3D"}, ' {"3d", "3D"},
{"gltf", "glTF"}, ' {"gltf", "glTF"},
{"drc", "DRC"}, ' {"drc", "DRC"},
{"rvm", "RVM"}, ' {"rvm", "RVM"},
{"pdf", "PDF"}, ' {"pdf", "PDF"},
{"x", "X"}, ' {"x", "X"},
{"jt", "JT"}, ' {"jt", "JT"},
{"dfx", "DFX"}, ' {"dfx", "DFX"},
{"ply", "PLY"}, ' {"ply", "PLY"},
{"3mf", "3MF"}, ' {"3mf", "3MF"},
{"ase", "ASE"}})) ' {"ase", "ASE"}}))
Return list.ToArray Return list.ToArray
End Function End Function
@@ -139,9 +139,9 @@ Public Class File3DLoaderModule
Return AssimpModule.AssimpLoader.FromFile(fileName, options.LoadMaterials, options.UpAxis) Return AssimpModule.AssimpLoader.FromFile(fileName, options.LoadMaterials, options.UpAxis)
End Function End Function
Private Shared Function LoadViaAspose3D(fileName As String, options As LoaderOptions) As Object3D 'Private Shared Function LoadViaAspose3D(fileName As String, options As LoaderOptions) As Object3D
Return Aspose3DModule.Aspose3DLoader.FromFile(fileName, options.LoadMaterials, options.UpAxis) ' Return Aspose3DModule.Aspose3DLoader.FromFile(fileName, options.LoadMaterials, options.UpAxis)
End Function 'End Function
Private Shared Sub ExportViaSimpleFileParser(o As Object3D, fileName As String) Private Shared Sub ExportViaSimpleFileParser(o As Object3D, fileName As String)
ObjModule.ObjFile.ToFile(fileName, o) ObjModule.ObjFile.ToFile(fileName, o)

View File

@@ -27,7 +27,7 @@
<OptionInfer>On</OptionInfer> <OptionInfer>On</OptionInfer>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<Version>2.0.1</Version> <Version>2.0.3</Version>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="System.Drawing.Common" Version="9.0.9" /> <PackageReference Include="System.Drawing.Common" Version="9.0.9" />