Click or drag to resize
Ab4d.SharpEngine logo

ReaderObj Class

ReaderObj can read 3D models from obj files.
Inheritance Hierarchy
SystemObject
  Ab4d.SharpEngine.UtilitiesReaderObj

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

The ReaderObj type exposes the following members.

Constructors
 NameDescription
Public methodReaderObj(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.
Public methodReaderObj(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 methodReaderObj(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 propertyDetectEncodingFromByteOrderMarks 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.
Public propertyErrors Gets a list of errors that occur during obj file loading.
Public propertyIgnoreErrors 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.
Public propertyNamedObjects Gets a dictionary that can be used to get a 3D object by its name (key = name, value = MeshModelNode)
Public propertyResolveResourceFunc 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 ReaderObj.
Top
Methods
 NameDescription
Public methodReadObjFileData(Stream) Reads the obj file from specified stream and returns the ObjFileData object.
Public methodReadObjFileData(String) Reads the objFileName file and returns the ObjFileData object.
Public methodReadSceneNodes(String) Reads 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.
Public methodReadSceneNodes(Stream, FuncString, Stream) Reads 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.
Public methodReadSceneNodes(Stream, FuncString, Stream, Material) Reads 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.
Public methodReadSceneNodes(String, String, StandardMaterial) Reads 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.
Top
See Also