C# Class HelixToolkit.Wpf.ObjReader

A Wavefront .obj file reader.
Inheritance: HelixToolkit.Wpf.ModelReader
Mostra file Open project: inventhelp/helix-toolkit Class Usage Examples

Private Properties

Property Type Description
AddFace void
AddGroup void
AddNormal void
AddTexCoord void
AddVertex void
BuildModel System.Windows.Media.Media3D.Model3DGroup
ColorParse Color
DoubleParse double
EnsureNewMesh void
GetMaterial System.Windows.Media.Media3D.Material
LoadMaterialLib void
SetMaterial void
SetSmoothingGroup void
Split IList
SplitLine void

Public Methods

Method Description
ObjReader ( Dispatcher dispatcher = null ) : System

Initializes a new instance of the ObjReader class.

Read ( Stream s ) : System.Windows.Media.Media3D.Model3DGroup

Reads the model from the specified stream.

Read ( string path ) : System.Windows.Media.Media3D.Model3DGroup

Reads the model from the specified path.

ReadZ ( string path ) : System.Windows.Media.Media3D.Model3DGroup

Reads a GZipStream compressed OBJ file.

This is a file format used by Helix Toolkit only. Use the GZipHelper class to compress an .obj file.

Private Methods

Method Description
AddFace ( string values ) : void

Adds a face.

Adds a polygonal face. The numbers are indexes into the arrays of vertex positions, texture coordinates, and normal vectors respectively. A number may be omitted if, for example, texture coordinates are not being defined in the model. There is no maximum number of vertices that a single polygon may contain. The .obj file specification says that each face must be flat and convex.

AddGroup ( string name ) : void

Adds a group with the specified name.

AddNormal ( string values ) : void

Adds a normal.

AddTexCoord ( string values ) : void

Adds a texture coordinate.

AddVertex ( string values ) : void

Adds a vertex.

BuildModel ( ) : System.Windows.Media.Media3D.Model3DGroup

Builds the model.

ColorParse ( string values ) : Color

Parses a color string.

DoubleParse ( string input ) : double

Parse a string containing a double value.

EnsureNewMesh ( ) : void

Ensures that a new mesh is created.

GetMaterial ( string materialName ) : System.Windows.Media.Media3D.Material

Gets the material with the specified name.

LoadMaterialLib ( string mtlFile ) : void

Loads a material library.

SetMaterial ( string materialName ) : void

Sets the material for the current group.

SetSmoothingGroup ( string values ) : void

Sets the smoothing group number.

Split ( string input ) : IList

Splits the specified string using whitespace(input) as separators.

SplitLine ( string line, string &keyword, string &arguments ) : void

Splits a line in keyword and arguments.

Method Details

ObjReader() public method

Initializes a new instance of the ObjReader class.
public ObjReader ( Dispatcher dispatcher = null ) : System
dispatcher System.Windows.Threading.Dispatcher The dispatcher.
return System

Read() public method

Reads the model from the specified stream.
public Read ( Stream s ) : System.Windows.Media.Media3D.Model3DGroup
s Stream The stream.
return System.Windows.Media.Media3D.Model3DGroup

Read() public method

Reads the model from the specified path.
public Read ( string path ) : System.Windows.Media.Media3D.Model3DGroup
path string The path.
return System.Windows.Media.Media3D.Model3DGroup

ReadZ() public method

Reads a GZipStream compressed OBJ file.
This is a file format used by Helix Toolkit only. Use the GZipHelper class to compress an .obj file.
public ReadZ ( string path ) : System.Windows.Media.Media3D.Model3DGroup
path string The path.
return System.Windows.Media.Media3D.Model3DGroup