private void LoadFile(string fileName) { var objPath = Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\", "examples", $"{fileName}.{FileExtensions.Object}")); var normalsPath = Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\", "examples", $"{fileName}_{FileExtensions.Normal}.{FileExtensions.ImgType}")); var diffuseTexturePath = Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\", "examples", $"{fileName}_{FileExtensions.Diffuse}.{FileExtensions.ImgType}")); var specularTexturePath = Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\", "examples", $"{fileName}_{FileExtensions.Specular}.{FileExtensions.ImgType}")); var parser = new ObjParser(); parser.LoadObj(objPath); camera.Position = new Vector3(vm.XCameraPos, vm.YCameraPos, vm.ZCameraPos); camera.Target = Vector3.Zero; mesh = new RenderObj(parser.VertexList.Count, parser.FaceList.Count, parser.NormalList.Count, parser.TextureList.Count); mesh.NormalTexture = parser.LoadTexture(normalsPath); mesh.DiffuseTexture = parser.LoadTexture(diffuseTexturePath); mesh.SpecularTexture = parser.LoadTexture(specularTexturePath); mesh.Position = new Vector3(vm.XObjectPos, vm.YObjectPos, vm.ZObjectPos); for (var i = 0; i < parser.VertexList.Count; i++) { mesh.Vertices[i] = parser.VertexList[i].ToVector4(); } mesh.Faces = parser.FaceList.ToArray(); for (var i = 0; i < parser.NormalList.Count; i++) { mesh.Normals[i] = parser.NormalList[i].ToVector(); } for (var i = 0; i < parser.TextureList.Count; i++) { mesh.TextureCoordinates[i] = parser.TextureList[i].ToVector(); } UpdateAnimation(); }