public ObjLoader Create(MaterialStreamProvider materialStreamProvider) { var dataStore = new DataStore(_name); var faceParser = new FaceParser(dataStore); var groupParser = new GroupParser(dataStore); var normalParser = new NormalParser(dataStore); var textureParser = new TextureParser(dataStore); var vertexParser = new VertexParser(dataStore); var materialLibraryLoader = new MaterialLibraryLoader(dataStore); var materialLibraryLoaderFacade = new MaterialLibraryLoaderFacade(materialLibraryLoader, materialStreamProvider); var materialLibraryParser = new MaterialLibraryParser(materialLibraryLoaderFacade); var useMaterialParser = new UseMaterialParser(dataStore); return(new ObjLoader(dataStore, faceParser, groupParser, normalParser, textureParser, vertexParser, materialLibraryParser, useMaterialParser)); }
public override void BuildMesh(Mesh mesh) { if (parser is NormalParser) { NormalParser p = parser as NormalParser; List <Vector3> ns = new List <Vector3> (); for (int i = 0; i < p.normals.Count; i++) { ns.Add( new Vector3( p.normals[i].x, p.normals[i].y, p.normals[i].z ) ); } mesh.normals = ns.ToArray(); } }
public void SetUp() { _textureDataStore = new DataStore(); _faceParser = new FaceParser(_textureDataStore); _groupParser = new GroupParser(_textureDataStore); _normalParser = new NormalParser(_textureDataStore); _textureParser = new TextureParser(_textureDataStore); _vertexParser = new VertexParser(_textureDataStore); _materialStreamProviderSpy = new MaterialStreamProviderSpy(); _materialStreamProviderSpy.StreamToReturn = CreateMemoryStreamFromString(MaterialLibraryString); _materialLibraryLoader = new MaterialLibraryLoader(_textureDataStore); _materialLibraryLoaderFacade = new MaterialLibraryLoaderFacade(_materialLibraryLoader, _materialStreamProviderSpy); _materialLibraryParser = new MaterialLibraryParser(_materialLibraryLoaderFacade); _useMaterialParser = new UseMaterialParser(_textureDataStore); _loader = new Loader.Loaders.ObjLoader(_textureDataStore, _faceParser, _groupParser, _normalParser, _textureParser, _vertexParser, _materialLibraryParser, _useMaterialParser); }
public ObjLoader( DataStore dataStore, FaceParser faceParser, GroupParser groupParser, NormalParser normalParser, TextureParser textureParser, VertexParser vertexParser, MaterialLibraryParser materialLibraryParser, UseMaterialParser useMaterialParser) { _dataStore = dataStore; SetupTypeParsers( vertexParser, faceParser, normalParser, textureParser, groupParser, materialLibraryParser, useMaterialParser); }
public void SetUp() { _normalDataStoreMock = new NormalDataStoreMock(); _normalParser = new NormalParser(_normalDataStoreMock); }