 |
ObjImporter Class |
ObjImporter can read 3D models from obj files.
Inheritance Hierarchy Namespace: Ab4d.SharpEngine.UtilitiesAssembly: Ab4d.SharpEngine (in Ab4d.SharpEngine.dll) Version: 4.0.9584+ba1aaa26d4181dd3fa8ed7b6398391d1affa36c8
SyntaxThe ObjImporter type exposes the following members.
Constructors| | Name | Description |
|---|
 | ObjImporter(IBitmapIO) |
Constructor that only takes an optional bitmapIO and will not create the textures immediately.
Also the no cache is used to read and store the textures.
|
 | ObjImporter(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.
|
 | ObjImporter(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.
|
 | ObjImporter(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.
|
 | ObjImporter(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| | Name | Description |
|---|
 | DetectEncodingFromByteOrderMarks |
Indicates whether to look for byte order marks at the beginning of the file to detect the text encoding (using in StreamReader constructor). Default value is true.
|
 | Errors |
Gets a list of errors that occur during obj file loading.
|
 | IgnoreErrors |
Gets or sets a Boolean that specifies if errors are ignored and reader tries to read as much data as possible.
The error texts are written to Errors list.
|
 | InvertYTextureCoordinate |
Gets or sets a boolean that specifies if Y texture coordinate is inverted. Default value is true.
|
 | NamedObjects |
Gets a dictionary that can be used to get a 3D object by its name (key = name, value = MeshModelNode)
|
 | ResolveResourceFunc |
Gets or sets a Func that returns stream from the specified resource name. This can be used to read resources from stream.
The returned stream will be closed by the ObjImporter.
|
 | UseTwoSidedMaterials |
When true (false by default), then BackMaterials is set to the same material as Material.
|
Top
Methods| | Name | Description |
|---|
 | Import(String) |
Imports the 3D models from objFileName file and returns the 3D model(s) as a GroupNode that contains MeshModelNodes and other GroupNodes.
The method will not return null but an empty GroupNode in case no model is read.
Textures directory is the same as obj file directory.
|
 | Import(Stream, FuncString, Stream) |
Imports the 3D models from stream and returns the 3D model(s) as a GroupNode that contains MeshModelNodes and other GroupNodes.
When the obj file have any additional resources (materials and textures), the resolveResourceFunc must be set to a method that converts resource names into Streams.
The method will not return null but an empty GroupNode in case no model is read.
|
 | Import(Stream, FuncString, Stream, Material) |
Imports the 3D models from stream and returns the 3D model(s) as a GroupNode that contains MeshModelNodes and other GroupNodes.
When the obj file have any additional resources (materials and textures), the resolveResourceFunc must be set a method that converts the resource name into Stream.
The method will not return null but an empty GroupNode in case no model is read.
|
 | Import(String, String, StandardMaterial) |
Imports the 3D models from objFileName file and returns the 3D model(s) as a GroupNode that contains MeshModelNodes and other GroupNodes.
The method will not return null but an empty GroupNode in case no model is read.
|
 | ImportAsync |
Imports the 3D models from objFileName in the background thread.
When generateGpuBuffers parameter is true (by default), then the vertex and index buffers will be also generated on the background thread.
The file returns the 3D model(s) as a GroupNode that contains MeshModelNodes and other GroupNodes.
The method will not return null but an empty GroupNode in case no model is read.
|
 | ReadObjFileData(Stream, Boolean) |
Reads the obj file from specified stream and returns the ObjFileData object.
|
 | ReadObjFileData(String, Boolean) |
Reads the objFileName file and returns the ObjFileData object.
When generateMeshes is true (false by default), then also SharpEngine Meshes are generated.
|
Top
See Also