MeshPtr createMesh(const std::string& fileName) { char* cstrFileName = new char[fileName.length()+1]; strcpy_s( cstrFileName, fileName.length()+1, fileName.c_str() ); printf("loading obj model %s from disk\n", cstrFileName); clock_t timeStart = clock(); objLoader objLoader; if ( objLoader.load(cstrFileName) == 0 ) { // could not load mesh. // TODO use place holder mesh. some red 3d text "PLACEHOLDER - MESH NOT FOUND" return std::shared_ptr<Mesh>( nullptr ); } clock_t timeEnd = clock() - timeStart; double timeSpent = timeEnd / (double)CLOCKS_PER_SEC; printf("%f seconds used to load from disk. \n", timeSpent); std::vector<glm::vec3> obj_vertex_coords; std::vector<glm::vec3> obj_vertex_normals; std::vector<glm::vec2> obj_texture_coords; MeshData_t meshData; puts("finished loading data into memory, now copying into internal vertex attrib lists"); //internal_load( objLoader, obj_vertex_coords, obj_vertex_normals, obj_texture_coords ); internal_load( objLoader, meshData ); puts("finished copy to int, now copy to internal mesh format"); MeshPtr m = std::shared_ptr<Mesh>( new Mesh(meshData) ); return m; }
image_init_result cassette_image_device::call_load() { return internal_load(false); }
image_init_result cassette_image_device::call_create(int format_type, util::option_resolution *format_options) { return internal_load(true); }