Class ObjReader
- Namespace
- HelixToolkit.Wpf
- Assembly
- HelixToolkit.Wpf.dll
A Wavefront .obj file reader.
public sealed class ObjReader : ModelReader, IModelReader
- Inheritance
-
ObjReader
- Implements
- Inherited Members
Constructors
ObjReader(Dispatcher?)
Initializes a new instance of the ObjReader class.
public ObjReader(Dispatcher? dispatcher = null)
Parameters
dispatcherDispatcherThe dispatcher.
Properties
Groups
Gets the groups of the file.
public IList<ObjReader.Group> Groups { get; }
Property Value
IgnoreErrors
Gets or sets a value indicating whether to ignore errors.
public bool IgnoreErrors { get; set; }
Property Value
- bool
trueif errors should be ignored;falseif errors should throw an exception.
Remarks
The default value is on (true).
IsSmoothingDefault
Sets a value indicating whether smoothing is default.
public bool IsSmoothingDefault { set; }
Property Value
Remarks
The default value is smoothing=on (true).
Materials
Gets the materials in the imported material files.
public Dictionary<string, ObjReader.MaterialDefinition> Materials { get; }
Property Value
- Dictionary<string, ObjReader.MaterialDefinition>
The materials.
SkipTransparencyValues
Gets or sets a value indicating whether to skip transparency values in the material files.
public bool SkipTransparencyValues { get; set; }
Property Value
- bool
trueif transparency values should be skipped; otherwise,false.
Remarks
This option is added to allow disabling the
Tr values in files where it has been defined incorrectly.
The transparency values (Tr) are interpreted as 0 = transparent, 1 = opaque.
The dissolve values (d) are interpreted as 0 = transparent, 1 = opaque.
SwitchYZ
Gets or sets a value indicating whether to switch Y and Z coordinates.
public bool SwitchYZ { get; set; }
Property Value
Methods
Read(Stream)
Reads the model from the specified stream.
public override Model3DGroup Read(Stream s)
Parameters
sStreamThe stream.
Returns
- Model3DGroup
The model.
Read(Stream, Stream[])
Reads the model and any associated materials from streams
public Model3DGroup Read(Stream objStream, Stream[] mtlStreams)
Parameters
objStreamStreamA model stream from the obj file
mtlStreamsStream[]Array of Material streams referenced in the obj file
Returns
Read(string)
Reads the model from the specified path.
public override Model3DGroup? Read(string path)
Parameters
pathstringThe path.
Returns
- Model3DGroup
The model.
ReadZ(string)
Reads a GZipStream compressed OBJ file.
public Model3DGroup? ReadZ(string path)
Parameters
pathstringThe path.
Returns
- Model3DGroup
A Model3D object containing the model.
Remarks
This is a file format used by Helix Toolkit only. Use the GZipHelper class to compress an .obj file.