Table of Contents

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

dispatcher Dispatcher

The dispatcher.

Properties

Groups

Gets the groups of the file.

public IList<ObjReader.Group> Groups { get; }

Property Value

IList<ObjReader.Group>

The groups.

IgnoreErrors

Gets or sets a value indicating whether to ignore errors.

public bool IgnoreErrors { get; set; }

Property Value

bool

true if errors should be ignored; false if 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

bool

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

true if 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

bool

Methods

Read(Stream)

Reads the model from the specified stream.

public override Model3DGroup Read(Stream s)

Parameters

s Stream

The 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

objStream Stream

A model stream from the obj file

mtlStreams Stream[]

Array of Material streams referenced in the obj file

Returns

Model3DGroup

Read(string)

Reads the model from the specified path.

public override Model3DGroup? Read(string path)

Parameters

path string

The path.

Returns

Model3DGroup

The model.

ReadZ(string)

Reads a GZipStream compressed OBJ file.

public Model3DGroup? ReadZ(string path)

Parameters

path string

The 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.