mirror of
https://github.com/projectM-visualizer/projectm.git
synced 2026-03-02 21:45:25 +00:00
Scanning textures/presets dirs for textures and scanning preset dir for presets. Scanning is now done recursively, so presets and textures can be organized into subdirectories instead of needing to be flattened into a single directory. On POSIX systems makes use of [ftw](https://linux.die.net/man/3/ftw) which should be relatively efficient. Otherwise falls back to recursing with `dirent` (for windows). Probably should have made an autoconf check for `ftw` instead of doing `#ifdef WIN32`. * Scan subdirectories in presets directory * remove preset subdir config * Recursively scan for textures too, add c++-17 compatibility * Refactor directory scanning code so it's reused by texture loader and preset loader. Make cross-platform (maybe) * filescanner in makefile * extension filter for file loader * make extensions match up' * need string.h * Add FileScanner.cpp to win build (maybe) * scan all dirs * #ifndef #ifdef is def fun * bogus comment * bleh * bleh * itunes plugin with c++17 * EyeTunes needs to know about the FileScanner Co-authored-by: milkdropper.com <milkdropper.com@gmail.com> Co-authored-by: milkdropper <59471060+milkdropper@users.noreply.github.com>
44 lines
1.2 KiB
C++
44 lines
1.2 KiB
C++
#ifndef TextureManager_HPP
|
|
#define TextureManager_HPP
|
|
|
|
#include <iostream>
|
|
#include <string>
|
|
#include <map>
|
|
#include <vector>
|
|
#include "projectM-opengl.h"
|
|
#include "Texture.hpp"
|
|
#include "FileScanner.hpp"
|
|
|
|
|
|
class TextureManager
|
|
{
|
|
std::string presetsURL;
|
|
std::map<std::string, Texture*> textures;
|
|
std::vector<Texture*> blurTextures;
|
|
Texture * mainTexture;
|
|
|
|
std::vector<std::string> random_textures;
|
|
TextureSamplerDesc loadTexture(const std::string name, const std::string imageUrl);
|
|
void ExtractTextureSettings(const std::string qualifiedName, GLint &_wrap_mode, GLint &_filter_mode, std::string & name);
|
|
std::vector<std::string> extensions;
|
|
|
|
public:
|
|
TextureManager(std::string _presetsURL, const int texsizeX, const int texsizeY,
|
|
std::string datadir = "");
|
|
~TextureManager();
|
|
|
|
void Clear();
|
|
void Preload();
|
|
TextureSamplerDesc tryLoadingTexture(const std::string name);
|
|
TextureSamplerDesc getTexture(const std::string fullName, const GLenum defaultWrap, const GLenum defaultFilter);
|
|
const Texture * getMainTexture() const;
|
|
const std::vector<Texture *> & getBlurTextures() const;
|
|
|
|
void updateMainTexture();
|
|
|
|
TextureSamplerDesc getRandomTextureName(std::string rand_name);
|
|
void clearRandomTextures();
|
|
};
|
|
|
|
#endif
|