// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
#pragma once
#include "IStreamingHandler.h"
#include "Engine/Core/Enums.h"
#include "Engine/Core/Singleton.h"
#include "Engine/Core/Collections/Array.h"
///
/// Describes streamable resources group object.
///
class FLAXENGINE_API StreamingGroup
{
public:
DECLARE_ENUM_4(Type, Custom, Textures, Models, Audio);
protected:
Type _type;
IStreamingHandler* _handler;
public:
///
/// Initializes a new instance of the class.
///
/// The group type.
/// Group dedicated handler.
StreamingGroup(Type type, IStreamingHandler* handler);
public:
///
/// Gets the group type.
///
FORCE_INLINE Type GetType() const
{
return _type;
}
///
/// Gets the group type name.
///
FORCE_INLINE const Char* GetTypename() const
{
return ToString(_type);
}
///
/// Gets the group streaming handler used by this group.
///
FORCE_INLINE IStreamingHandler* GetHandler() const
{
return _handler;
}
};
///
/// Streaming groups manager.
///
class FLAXENGINE_API StreamingGroups : public Singleton
{
private:
StreamingGroup* _textures;
StreamingGroup* _models;
StreamingGroup* _skinnedModels;
StreamingGroup* _audio;
Array _groups;
Array _handlers;
public:
StreamingGroups();
~StreamingGroups();
public:
///
/// Gets textures group.
///
FORCE_INLINE StreamingGroup* Textures() const
{
return _textures;
}
///
/// Gets models group.
///
FORCE_INLINE StreamingGroup* Models() const
{
return _models;
}
///
/// Gets skinned models group.
///
FORCE_INLINE StreamingGroup* SkinnedModels() const
{
return _skinnedModels;
}
///
/// Gets audio group.
///
FORCE_INLINE StreamingGroup* Audio() const
{
return _audio;
}
public:
///
/// Gets all the groups.
///
FORCE_INLINE const Array& Groups() const
{
return _groups;
}
///
/// Gets all the handlers.
///
FORCE_INLINE const Array& Handlers() const
{
return _handlers;
}
public:
///
/// Adds the specified streaming group.
///
/// The group.
void Add(StreamingGroup* group);
};