镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content
chrisjanssonPublic

About

Wavefront .obj loader in C# .Net

Resources

Stars

113 stars

Watchers

11 watching

Forks

Latest commit

 

History

59 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ObjLoader Build statusNuGet version

Objloader is a simple Wavefront .obj and .mtl loader

Installation

Build the project and reference the .dll or reference the project directly as usual.

Loading a model

Either create the loader with the standard material stream provider, this will open the file read-only from the working directory.

var objLoaderFactory = new ObjLoaderFactory();
var objLoader = objLoaderFactory.Create();

Or provide your own:

//With the signature Func<string, Stream>
var objLoaderFactory = new ObjLoaderFactory();
var objLoader = objLoaderFactory.Create(materialFileName => File.Open(materialFileName);

Then it is just a matter of invoking the loader with a stream containing the model.

var fileStream = new FileStream("model.obj");
var result = objLoader.Load(fileStream);

The result object contains the loaded model in this form:

public class LoadResult  
{
    public IList<Vertex> Vertices { get; set; }
    public IList<Texture> Textures { get; set; }
    public IList<Normal> Normals { get; set; }
    public IList<Group> Groups { get; set; }
    public IList<Material> Materials { get; set; }
}

About

Wavefront .obj loader in C# .Net

Resources

Stars

113 stars

Watchers

11 watching

Forks

Releases

Packages

Used by

Contributors

Languages