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
See the file format specifications at http://en.wikipedia.org/wiki/Obj http://en.wikipedia.org/wiki/Material_Template_Library http://www.martinreddy.net/gfx/3d/OBJ.spec http://www.eg-models.de/formats/Format_Obj.html
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
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.
ModelInfo
Additional info how to treat the model
public ModelInfo ModelInfo { get; }
Property Value
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
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
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
Returns
Read(string, ModelInfo)
Reads the model from the specified path.
public List<Object3D>? Read(string path, ModelInfo info = default)
Parameters
Returns
ReadZ(string)
Reads a GZipStream compressed OBJ file.
public List<Object3D>? ReadZ(string path)
Parameters
pathstringThe path.
Returns
Remarks
This is a file format used by Helix Toolkit only. Use the GZipHelper class to compress an .obj file.