Download vendor/libigl/include/igl/png/texture_from_file.cpp from AVSim/simulation-package: direct link, hf CLI and curl.
- Browser
- Download file 1.73 kB
-
https://huggingface.co/datasets/AVSim/simulation-package/resolve/main/vendor/libigl/include/igl/png/texture_from_file.cpp
- Command line
-
hf download hf://datasets/AVSim/simulation-package/vendor/libigl/include/igl/png/texture_from_file.cpp
-
curl -L -o texture_from_file.cpp https://huggingface.co/datasets/AVSim/simulation-package/resolve/main/vendor/libigl/include/igl/png/texture_from_file.cpp
1.73 kB
| // This file is part of libigl, a simple c++ geometry processing library. | |
| // | |
| // Copyright (C) 2014 Alec Jacobson <alecjacobson@gmail.com> | |
| // | |
| // This Source Code Form is subject to the terms of the Mozilla Public License | |
| // v. 2.0. If a copy of the MPL was not distributed with this file, You can | |
| // obtain one at http://mozilla.org/MPL/2.0/. | |
| //#include "../opengl2/texture_from_tga.h" | |
| IGL_INLINE bool igl::png::texture_from_file(const std::string filename, GLuint & id) | |
| { | |
| using namespace igl::opengl; | |
| using namespace std; | |
| // dirname, basename, extension and filename | |
| string d,b,ext,f; | |
| pathinfo(filename,d,b,ext,f); | |
| // Convert extension to lower case | |
| transform(ext.begin(), ext.end(), ext.begin(), ::tolower); | |
| //if(ext == "tga") | |
| //{ | |
| // return texture_from_tga(filename,id); | |
| //}else | |
| if(ext == "png") | |
| { | |
| return texture_from_png(filename,id); | |
| }else | |
| { | |
| // Convert to a temporary png file | |
| string tmp = "/var/tmp/.texture_from_file.png"; | |
| string command = STR(PATH_TO_CONVERT<<" \""<<filename<<"\" \""<<tmp<<"\""); | |
| try | |
| { | |
| if(system(command.c_str())==0) | |
| { | |
| return texture_from_file(tmp.c_str(),id); | |
| }else | |
| { | |
| cerr<<"texture_from_file: calling to convert ('"<<command<<"') failed..."<<endl; | |
| return false; | |
| } | |
| }catch(int e) | |
| { | |
| cerr<<"^"<<__FUNCTION__<<": Calling to convert crashed..."<<endl; | |
| return false; | |
| } | |
| return false; | |
| } | |
| } | |