Class ResourceLoader

Class Documentation

class ResourceLoader

Factory for ResourceFile objects. Implements creating, loading and saving files.

Maintains an internal cache that doesn’t let the same file to be loaded twice. Cache misses force file loading.

This just means you can load the same file multiple times without worrying about unnecessary copies.

All path arguments should be relative to Rootex root.

The resource creation API is internally synchronised (threadsafe).

Public Static Functions

static void Initialize()
static void Destroy()
static const HashMap<ResourceFile::Type, Vector<Weak<ResourceFile>>> &GetResources()
static const char *GetCreatableExtension(ResourceFile::Type type)
static void SaveResources(ResourceFile::Type type)
static void ClearDeadResources()
static Ref<TextResourceFile> CreateTextResourceFile(const String &path)
static Ref<LuaTextResourceFile> CreateLuaTextResourceFile(const String &path)
static Ref<AudioResourceFile> CreateAudioResourceFile(const String &path)
static Ref<ModelResourceFile> CreateModelResourceFile(const String &path)
static Ref<CollisionModelResourceFile> CreateCollisionModelResourceFile(const String &path)
static Ref<AnimatedModelResourceFile> CreateAnimatedModelResourceFile(const String &path)
static Ref<ImageResourceFile> CreateImageResourceFile(const String &path)
static Ref<ImageCubeResourceFile> CreateImageCubeResourceFile(const String &path)
static Ref<FontResourceFile> CreateFontResourceFile(const String &path)
static Ref<ParticleEffectResourceFile> CreateParticleEffectResourceFile(const String &path)
static Ref<MaterialResourceFile> CreateMaterialResourceFile(const String &path)
static Ref<BasicMaterialResourceFile> CreateBasicMaterialResourceFile(const String &path)
static Ref<InstancingBasicMaterialResourceFile> CreateInstancingBasicMaterialResourceFile(const String &path)
static Ref<AnimatedBasicMaterialResourceFile> CreateAnimatedBasicMaterialResourceFile(const String &path)
static Ref<SkyMaterialResourceFile> CreateSkyMaterialResourceFile(const String &path)
static Ref<CustomMaterialResourceFile> CreateCustomMaterialResourceFile(const String &path)
static Ref<DecalMaterialResourceFile> CreateDecalMaterialResourceFile(const String &path)
static Ref<ResourceFile> CreateResourceFile(const ResourceFile::Type &type, const String &path)
static Ref<TextResourceFile> CreateNewTextResourceFile(const String &path)
static Ref<BasicMaterialResourceFile> CreateNewBasicMaterialResourceFile(const String &path)
static Ref<AnimatedBasicMaterialResourceFile> CreateNewAnimatedBasicMaterialResourceFile(const String &path)
static int Preload(ResourceCollection paths, Atomic<int> &progress)

Load all the files passed in parallely. Return total tasks generated.

static void Persist(Ref<ResourceFile> res)

Add a resource to be kept alive till explicitly ordered to clear them. Internally synchronised.

static void ClearPersistentResources()