3#include "graphics/GPUTypes.hpp"
4#include "graphics/Program.hpp"
5#include "resources/Font.hpp"
6#include "resources/Mesh.hpp"
28 return static_cast<Storage>(
static_cast<uint
>(t0) |
static_cast<uint
>(t1));
37 return bool(
static_cast<uint
>(t0) &
static_cast<uint
>(t1));
41using Data = std::vector<char>;
119 std::vector<std::string>
getLayeredPaths(
const std::string & name,
const std::string & suffix);
126 char *
getRawData(
const std::string & path,
size_t & size);
133 std::string
getString(
const std::string & filename);
187 Program *
getProgram(
const std::string & name,
const std::string & vertexName =
"",
const std::string & fragmentName=
"",
const std::string & tessControlName =
"",
const std::string & tessEvalName =
"");
213 const Data *
getData(
const std::string & filename);
259 FileInfos(
const std::string& apath,
const std::string& aname);
266 void getFiles(
const std::string & extension, std::vector<FileInfos> & files)
const;
281 ProgramInfos(
const std::string & vertex,
const std::string & fragment,
const std::string & tessControl,
const std::string & tessEval);
295 std::unordered_map<std::string, std::string>
_files;
297 std::unordered_map<std::string, Mesh>
_meshes;
298 std::unordered_map<std::string, Font>
_fonts;
299 std::unordered_map<std::string, Data>
_blobs;
Font loading and storage: texture atlas, codepoints supported, dimensions of each glyph.
Definition: Font.hpp:12
Provide utility functions to communicate with the driver and GPU.
Definition: GPU.hpp:20
Represents an image composed of pixels with values in [0,1]. Provide image loading/saving utilities,...
Definition: Image.hpp:8
Represents a geometric mesh composed of vertices, other attributes and triangles.
Definition: Mesh.hpp:15
Represents a group of shaders used for rendering.
Definition: Program.hpp:31
The Resources manager is responsible for all resources loading and setup.
Definition: ResourcesManager.hpp:48
std::unordered_map< std::string, Texture > _textures
Loaded textures, identified by name.
Definition: ResourcesManager.hpp:296
std::vector< std::string > getCubemapPaths(const std::string &name)
Definition: ResourcesManager.cpp:143
std::unordered_map< std::string, Program > _programs
Loaded shader programs, identified by name.
Definition: ResourcesManager.hpp:300
void reload()
Definition: ResourcesManager.cpp:644
void clean()
Definition: ResourcesManager.cpp:769
std::string getStringWithIncludes(const std::string &filename, std::vector< std::string > &names)
Definition: ResourcesManager.cpp:250
const Texture * getTexture(const std::string &name, const Layout &format, Storage options, const std::string &refName="")
Definition: ResourcesManager.cpp:352
Program * getProgram2D(const std::string &name)
Definition: ResourcesManager.cpp:624
static void saveRawDataToExternalFile(const std::string &path, char *rawContent, size_t size)
Definition: ResourcesManager.cpp:740
const Mesh * getMesh(const std::string &name, Storage options)
Definition: ResourcesManager.cpp:306
Program * getProgram(const std::string &name, const std::string &vertexName="", const std::string &fragmentName="", const std::string &tessControlName="", const std::string &tessEvalName="")
Definition: ResourcesManager.cpp:598
static char * loadRawDataFromExternalFile(const std::string &path, size_t &size)
Definition: ResourcesManager.cpp:708
Resources & operator=(const Resources &)=delete
void getFiles(const std::string &extension, std::vector< FileInfos > &files) const
Definition: ResourcesManager.cpp:683
void addResources(const std::string &path)
Definition: ResourcesManager.cpp:33
static void saveStringToExternalFile(const std::string &path, const std::string &content)
Definition: ResourcesManager.cpp:751
static bool externalFileExists(const std::string &path)
Definition: ResourcesManager.cpp:761
std::unordered_map< std::string, Mesh > _meshes
Loaded meshes, identified by name.
Definition: ResourcesManager.hpp:297
std::unordered_map< std::string, ProgramInfos > _progInfos
Additional info to support shader reloading.
Definition: ResourcesManager.hpp:301
static std::string loadStringFromExternalFile(const std::string &path)
Definition: ResourcesManager.cpp:725
std::unordered_map< std::string, Font > _fonts
Loaded font infos, identified by name.
Definition: ResourcesManager.hpp:298
std::unordered_map< std::string, Data > _blobs
Loaded binary blobs, identified by name.
Definition: ResourcesManager.hpp:299
Program * getProgramCompute(const std::string &name)
Definition: ResourcesManager.cpp:628
std::vector< std::string > getLayeredPaths(const std::string &name, const std::string &suffix)
Definition: ResourcesManager.cpp:159
std::string getString(const std::string &filename)
Definition: ResourcesManager.cpp:205
char * getRawData(const std::string &path, size_t &size)
Definition: ResourcesManager.cpp:199
Resources(Resources &&)=delete
std::unordered_map< std::string, std::string > _files
Listing of available files and their paths.
Definition: ResourcesManager.hpp:295
const Texture * getDefaultTexture(TextureShape shape)
Definition: ResourcesManager.cpp:542
std::string getImagePath(const std::string &name)
Definition: ResourcesManager.cpp:124
void parseArchive(const std::string &archivePath)
Definition: ResourcesManager.cpp:39
Font * getFont(const std::string &name)
Definition: ResourcesManager.cpp:663
static Resources & manager()
Definition: ResourcesManager.cpp:20
Resources & operator=(Resources &&)=delete
Resources(const Resources &)=delete
const Data * getData(const std::string &filename)
Definition: ResourcesManager.cpp:223
void parseDirectory(const std::string &directoryPath)
Definition: ResourcesManager.cpp:76
Represents a texture containing one or more images, stored on the CPU and/or GPU.
Definition: Texture.hpp:12
TextureShape
The shape of a texture: dimensions, layers organisation.
Definition: GPUTypes.hpp:153
Layout
The layout of a texture: components count and type.
Definition: GPUTypes.hpp:225
Storage
Storage and loading options.
Definition: ResourcesManager.hpp:14
@ FORCE_FRAME
For meshes, force computation of a local frame.
@ BOTH
Store on both the CPU and GPU.
Properties of a resource file.
Definition: ResourcesManager.hpp:251
std::string path
The file path.
Definition: ResourcesManager.hpp:252
std::string name
The file name, without the extension.
Definition: ResourcesManager.hpp:253
Definition: ResourcesManager.hpp:273
std::string fragmentName
Fragment shader filename.
Definition: ResourcesManager.hpp:289
std::string tessEvalName
Tessellation evaluation shader filename.
Definition: ResourcesManager.hpp:291
std::string vertexName
Vertex shader filename.
Definition: ResourcesManager.hpp:288
std::string tessContName
Tessellation control shader filename.
Definition: ResourcesManager.hpp:290
std::string computeName
Compute shader filename.
Definition: ResourcesManager.hpp:292