Mercurial > hg > forks > gldragon
diff dmutil.cpp @ 21:1404dfcee7b8
More work on scenefile and model loading support.
Can now load PLY models and simple scene definition files.
Converted dragon mesh to binary PLY format.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 22 Nov 2019 03:03:52 +0200 |
parents | a329f0216491 |
children | 03b86b9c2f29 |
line wrap: on
line diff
--- a/dmutil.cpp Fri Nov 22 00:14:16 2019 +0200 +++ b/dmutil.cpp Fri Nov 22 03:03:52 2019 +0200 @@ -73,6 +73,13 @@ } +std::string dmGetPath(const std::string &path) +{ + size_t dirsep = path.find_last_of("/\\"); + return (dirsep != std::string::npos) ? path.substr(0, dirsep + 1) : ""; +} + + bool dmReadText(const std::string &filename, std::string &buf, const int maxSize) { std::ifstream in(filename.c_str(), std::fstream::in);