Click or drag to resize
Ab4d.SharpEngine logo

AssimpImporter Class

AssimpImporter can import 3D models from many 3D file formats into SceneNode objects for Ab4d.SharpEngine rendering engine.
Inheritance Hierarchy
SystemObject
  Ab4d.SharpEngine.AssimpAssimpImporter

Namespace: Ab4d.SharpEngine.Assimp
Assembly: Ab4d.SharpEngine.Assimp (in Ab4d.SharpEngine.Assimp.dll) Version: 2.0.8956+4c7684e186ca1be74e7a284fbe739d9a1b843d3c
Syntax
C#
public class AssimpImporter : IDisposable

The AssimpImporter type exposes the following members.

Constructors
 NameDescription
Public methodAssimpImporter(IBitmapIO) Constructor that only takes an optional bitmapIO and will not create the textures immediately. Also no cache is used to read and store the textures.
Public methodAssimpImporter(AssimpConverterTextureLoaderDelegate) Constructor that takes a custom texture loader delegate
Public methodAssimpImporter(IBitmapIO, Scene) Constructor with optional Scene object that when specified is used to cache the loaded textures. When Scene.GpuDevice is initialized, then the textures are immediately created. Otherwise the textures are created when materials with textures are initialized.
Public methodAssimpImporter(IBitmapIO, VulkanDevice) Constructor with optional gpuDevice object that when specified is used to create and cache the loaded textures. When gpuDevice is null, then the textures are created when materials with textures are initialized.
Top
Properties
 NameDescription
Public propertyAssimpConverter Gets the AssimpConverter that was used to convert Assimp scene into SceneNode objects.
Public propertyAssimpPostProcessSteps Gets or sets Assimp PostProcessSteps (see assimp documentation for more information). Default value is FlipUVs | GenerateSmoothNormals | Triangulate.
Public propertyAssimpVersion Gets the version of the native Assimp library.
Public propertyAssimpVersionString Gets the version string of the native Assimp library in the form "major.minor.patch"
Public propertyGenerateUniqueModelNames When true (by default) then unique object names are generated, e.g. when the objects from Assimp scene have the same name, the "__2", "__3", "__4", etc. suffixes added to the name (the first object does not have changed name).
Public propertyGitCommitHash Gets the Git commit hash that was generated from the latest source code commit. Returns zero when Assimp library was complied from a zip file from GitHub's releases.
Public propertyIsDisposed Gets or sets a Boolean that specifies if this instance of DXAssimpImporter has been disposed.
Public propertyIsVerboseLoggingEnabled Gets or sets a Boolean that specifies if verbose logging is enabled.
Public propertyLoggerCallback Gets or sets a logger callback action that takes two strings (message and data).
Public propertyNamedObjects Gets a dictionary that can be used to get a 3D object by its name (key = name, value = object)
Public propertyNativeAssimpScene Gets native ImportedAssimpFile that contains then native AssimpScene object that was created when the file was read. To preserve the native Assimp scene first set PreserveNativeResourcesAfterImporting to true. When no scene was imported or when the native Assimp scene is not preserved, then this property is null.
Public propertyPreserveNativeResourcesAfterImporting When true then native Assimp scene is preserved and can be accessed by NativeAssimpScene property.
Public propertyResolveResourceFunc ResolveResourceFunc sets a Func that takes a string (resource name) and returns a Stream. This can be used to read additional resources (materials and textures). The returned stream is automatically closed after it is used.
Public propertySupportedImporterFormats Gets an array of AssimpImporterDesc that provide detailed information on supported import file formats.
Public propertySupportedImportFileExtensions Gets an array of supported file extensions for importing (file extension are written without star and dot as prefix, g.e. "fxb", "obj", etc.)
Top
Methods
 NameDescription
Public methodDispose Disposes all unmanaged and managed resources. After calling Dispose, user cannot call any methods on this instance of AssimpImporter.
Public methodDisposeNativeAssimpScene Disposes the native assimp scene that was previously importer when PreserveNativeResourcesAfterImporting was true. If PreserveNativeResourcesAfterImporting was false, then the native assimp scene is automatically disposed after importing.
Public methodImport(String, String) Import method reads 3D models from the specified file and returns a GroupNode with imported 3D models. When PreserveNativeResourcesAfterImporting is true (false by default) then the native scene is stored into NativeAssimpScene property.
Public methodImport(Byte, String, String) Import method reads 3D models from the specified byte array and returns a GroupNode with imported 3D models. When PreserveNativeResourcesAfterImporting is true (false by default) then the native scene is stored into NativeAssimpScene property. To read additional resources that are used by the imported file (for example textures), set the ResolveResourceFunc.
Public methodImport(Stream, String, String) Import method reads 3D models from the specified file stream and returns a GroupNode with imported 3D models. When PreserveNativeResourcesAfterImporting is true (false by default) then the native scene is stored into NativeAssimpScene property. To read additional resources that are used by the imported file (for example textures), set the ResolveResourceFunc.
Public methodImportFileToNativeAssimpScene(String) ImportFileToNativeAssimpScene reads the specified file and returns ImportedAssimpFile with native Assimp's Scene object. Assimp's Scene object can be manually converted into SceneNodes by using AssimpConverter class. This method does not change the

NativeAssimpScene

property.
Public methodImportFileToNativeAssimpScene(Byte, String) ImportFileToNativeAssimpScene reads the specified byte array and returns ImportedAssimpFile with native Assimp's Scene object. Assimp's Scene object can be manually converted into SceneNodes by using AssimpConverter class. This method does not change the

NativeAssimpScene

property.
Public methodIsImportFormatSupported Checks if the file extension (e.g. ".dae" or ".obj") is supported for import.
Top
See Also