Table of Contents

Class ObjReader

Namespace
HelixToolkit.SharpDX
Assembly
HelixToolkit.SharpDX.dll

A Wavefront .obj file reader.

[Obsolete("Suggest to use HelixToolkit.SharpDX.Assimp")]
public class ObjReader : IModelReader
Inheritance
ObjReader
Implements
Inherited Members

Remarks

Constructors

ObjReader()

Initializes a new instance of the ObjReader class.

public ObjReader()

Properties

DefaultColor

Gets or sets the default color.

public Color DefaultColor { get; set; }

Property Value

Color

The default color.

Remarks

The default value is Colors.Gold.

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.

ModelInfo

Additional info how to treat the model

public ModelInfo ModelInfo { get; }

Property Value

ModelInfo

SkipTransparencyValues

Gets or sets a value indicating whether to skip transparency values ("Tr") 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

TexturePath

Gets or sets the path to the textures.

public string TexturePath { get; set; }

Property Value

string

The texture path.

Methods

Read(Stream, ModelInfo)

Reads the model from the specified stream.

public List<Object3D>? Read(Stream s, ModelInfo info = default)

Parameters

s Stream

The stream.

info ModelInfo

The model info.

Returns

List<Object3D>

The model.

Read(string, ModelInfo)

Reads the model from the specified path.

public List<Object3D>? Read(string path, ModelInfo info = default)

Parameters

path string

The path.

info ModelInfo

The model info.

Returns

List<Object3D>

The model.

ReadZ(string)

Reads a GZipStream compressed OBJ file.

public List<Object3D>? ReadZ(string path)

Parameters

path string

The path.

Returns

List<Object3D>

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.