texturepaths.h 887 B

1234567891011121314151617181920212223242526272829
  1. // Luanti
  2. // SPDX-License-Identifier: LGPL-2.1-or-later
  3. // Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
  4. #pragma once
  5. #include <string>
  6. #include <vector>
  7. // Texture paths get cached and this clears the Cache.
  8. void clearTextureNameCache();
  9. // Find out the full path of an image by trying different filename extensions.
  10. // If failed, return "".
  11. std::string getImagePath(std::string_view path);
  12. /* Gets the path to a texture by first checking if the texture exists
  13. * in texture_path and if not, using the data path.
  14. *
  15. * Checks all supported extensions by replacing the original extension.
  16. *
  17. * If not found, returns "".
  18. *
  19. * Utilizes a thread-safe cache.
  20. */
  21. std::string getTexturePath(const std::string &filename, bool *is_base_pack = nullptr);
  22. // Returns all dictionaries found from the "texture_path" setting.
  23. std::vector<std::string> getTextureDirs();