add 'advanced' post-effect load configuration
This commit is contained in:
@@ -147,14 +147,12 @@ void AssetsLoader::processPreload(
|
||||
add(tag, path, name);
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<AssetCfg> config = nullptr;
|
||||
map.at("path").get(path);
|
||||
switch (tag) {
|
||||
case AssetType::SOUND: {
|
||||
bool keepPCM = false;
|
||||
add(tag,
|
||||
path,
|
||||
name,
|
||||
std::make_shared<SoundCfg>(map.at("keep-pcm").get(keepPCM)));
|
||||
config = std::make_shared<SoundCfg>(map.at("keep-pcm").get(keepPCM));
|
||||
break;
|
||||
}
|
||||
case AssetType::ATLAS: {
|
||||
@@ -164,13 +162,19 @@ void AssetsLoader::processPreload(
|
||||
if (typeName == "separate") {
|
||||
type = AtlasType::SEPARATE;
|
||||
}
|
||||
add(tag, path, name, std::make_shared<AtlasCfg>(type));
|
||||
config = std::make_shared<AtlasCfg>(type);
|
||||
break;
|
||||
}
|
||||
case AssetType::POST_EFFECT: {
|
||||
bool advanced = false;
|
||||
map.at("advanced").get(advanced);
|
||||
config = std::make_shared<PostEffectCfg>(advanced);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
add(tag, path, name);
|
||||
break;
|
||||
}
|
||||
add(tag, path, name, std::move(config));
|
||||
}
|
||||
|
||||
void AssetsLoader::processPreloadList(AssetType tag, const dv::value& list) {
|
||||
|
||||
@@ -40,8 +40,7 @@ struct LayoutCfg : AssetCfg {
|
||||
struct SoundCfg : AssetCfg {
|
||||
bool keepPCM;
|
||||
|
||||
SoundCfg(bool keepPCM) : keepPCM(keepPCM) {
|
||||
}
|
||||
SoundCfg(bool keepPCM) : keepPCM(keepPCM) {}
|
||||
};
|
||||
|
||||
enum class AtlasType {
|
||||
@@ -51,8 +50,13 @@ enum class AtlasType {
|
||||
struct AtlasCfg : AssetCfg {
|
||||
AtlasType type;
|
||||
|
||||
AtlasCfg(AtlasType type) : type(type) {
|
||||
}
|
||||
AtlasCfg(AtlasType type) : type(type) {}
|
||||
};
|
||||
|
||||
struct PostEffectCfg : AssetCfg {
|
||||
bool advanced;
|
||||
|
||||
PostEffectCfg(bool advanced) : advanced(advanced) {}
|
||||
};
|
||||
|
||||
using aloader_func = std::function<
|
||||
|
||||
@@ -132,8 +132,13 @@ assetload::postfunc assetload::posteffect(
|
||||
vertexSource,
|
||||
fragmentSource
|
||||
);
|
||||
bool advanced = false;
|
||||
if (settings) {
|
||||
advanced = dynamic_cast<const PostEffectCfg*>(settings.get())->advanced;
|
||||
}
|
||||
assets->store(
|
||||
std::make_shared<PostEffect>(std::move(program), params), name
|
||||
std::make_shared<PostEffect>(advanced, std::move(program), params),
|
||||
name
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user