mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-06 03:21:49 +00:00
Merge pull request #940 from MihailRis/fix-assets-pipeline
update assets pipeline (moving to animation branch)
This commit is contained in:
commit
2c6cffcf19
14 changed files with 211 additions and 110 deletions
|
|
@ -47,9 +47,10 @@ void AssetsLoader::add(
|
|||
AssetType tag,
|
||||
const std::string& filename,
|
||||
const std::string& alias,
|
||||
std::shared_ptr<AssetCfg> settings
|
||||
std::shared_ptr<AssetCfg> settings,
|
||||
bool overwrite
|
||||
) {
|
||||
if (enqueued.find({tag, alias}) != enqueued.end()){
|
||||
if (!overwrite && enqueued.find({tag, alias}) != enqueued.end()){
|
||||
return;
|
||||
}
|
||||
entries.push(aloader_entry {tag, filename, alias, std::move(settings)});
|
||||
|
|
@ -154,11 +155,12 @@ void AssetsLoader::processPreload(
|
|||
std::string defFolder = assets_def_folder(tag);
|
||||
std::string path = defFolder + "/" + name;
|
||||
if (map == nullptr) {
|
||||
add(tag, path, name);
|
||||
add(tag, path, name, nullptr, true);
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<AssetCfg> config = nullptr;
|
||||
map.at("path").get(path);
|
||||
logger.debug() << "processing preload " << util::quote(name) << " path: " << util::quote(path);
|
||||
switch (tag) {
|
||||
case AssetType::SOUND: {
|
||||
bool keepPCM = false;
|
||||
|
|
@ -196,7 +198,7 @@ void AssetsLoader::processPreload(
|
|||
default:
|
||||
break;
|
||||
}
|
||||
add(tag, path, name, std::move(config));
|
||||
add(tag, path, name, std::move(config), true);
|
||||
}
|
||||
|
||||
void AssetsLoader::processPreloadList(AssetType tag, const dv::value& list) {
|
||||
|
|
|
|||
|
|
@ -110,7 +110,8 @@ public:
|
|||
AssetType tag,
|
||||
const std::string& filename,
|
||||
const std::string& alias,
|
||||
std::shared_ptr<AssetCfg> settings = nullptr
|
||||
std::shared_ptr<AssetCfg> settings = nullptr,
|
||||
bool overwrite = false
|
||||
);
|
||||
|
||||
bool hasNext() const;
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include "debug/Logger.hpp"
|
||||
#include "alutil.hpp"
|
||||
#include "util/stringutil.hpp"
|
||||
#include "../MemoryPCMStream.hpp"
|
||||
|
||||
static debug::Logger logger("al-audio");
|
||||
|
|
@ -99,6 +100,8 @@ ALInputDevice::ALInputDevice(
|
|||
|
||||
if (deviceName) {
|
||||
deviceSpecifier = std::string(deviceName);
|
||||
logger.info() << "created input device with specifier "
|
||||
<< util::quote(deviceSpecifier);
|
||||
} else {
|
||||
logger.warning() << "could not retrieve input device specifier";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -211,12 +211,15 @@ void audio::initialize(
|
|||
return;
|
||||
}
|
||||
if (enabled) {
|
||||
logger.info() << "recording enabled; input device is "
|
||||
<< settings.inputDevice.get();
|
||||
const auto& targetDevice = settings.inputDevice.get();
|
||||
logger.info() << "recording enabled; target input device is "
|
||||
<< (targetDevice.empty() ? "not specified"
|
||||
: targetDevice);
|
||||
::input_device = backend->openInputDevice(
|
||||
settings.inputDevice.get(), 44100, 1, 16
|
||||
);
|
||||
if (::input_device != nullptr) {
|
||||
logger.error() << "could not create input device";
|
||||
::input_device->startCapture();
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -92,6 +92,17 @@ static int l_reconfig_packs(lua::State* L) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
/// @brief Get current content packs configuration
|
||||
static int l_get_content(lua::State* L) {
|
||||
const auto& configuration = content_control->getContentPacks();
|
||||
lua::createtable(L, configuration.size(), 0);
|
||||
for (int i = 0; i < configuration.size(); i++) {
|
||||
lua::pushlstring(L, configuration[i].id);
|
||||
lua::rawseti(L, i + 1);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/// @brief Get content sources list
|
||||
static int l_get_content_sources(lua::State* L) {
|
||||
const auto& sources = engine->getContentControl().getContentSources();
|
||||
|
|
@ -453,6 +464,7 @@ const luaL_Reg applib[] = {
|
|||
{"load_content", lua::wrap<l_load_content>},
|
||||
{"reset_content", lua::wrap<l_reset_content>},
|
||||
{"reconfig_packs", lua::wrap<l_reconfig_packs>},
|
||||
{"get_content", lua::wrap<l_get_content>},
|
||||
{"get_content_sources", lua::wrap<l_get_content_sources>},
|
||||
{"set_content_sources", lua::wrap<l_set_content_sources>},
|
||||
{"reset_content_sources", lua::wrap<l_reset_content_sources>},
|
||||
|
|
|
|||
|
|
@ -74,6 +74,11 @@ static void create_libs(State* L, StateType stateType) {
|
|||
getglobal(L, "__vc_app");
|
||||
setregistry(L, "app");
|
||||
|
||||
createtable(L, 0, 0);
|
||||
pushvalue(L, -1);
|
||||
setglobal(L, "__vc_internals");
|
||||
setregistry(L, "internals");
|
||||
|
||||
if (stateType == StateType::SCRIPT) {
|
||||
getregistry(L, "app");
|
||||
setglobal(L, "app");
|
||||
|
|
|
|||
|
|
@ -288,7 +288,23 @@ void scripting::on_content_load(Content* content) {
|
|||
lua::setfield(L, "properties");
|
||||
lua::pop(L);
|
||||
}
|
||||
load_script("post_content.lua", true);
|
||||
|
||||
lua::getregistry(L, "app");
|
||||
lua::setglobal(L, "__vc_app");
|
||||
lua::getregistry(L, "internals");
|
||||
lua::setglobal(L, "__vc_internals");
|
||||
try {
|
||||
load_script("post_content.lua", true);
|
||||
} catch (const std::exception&) {
|
||||
lua::pushnil(L);
|
||||
lua::setglobal(L, "__vc_app");
|
||||
throw;
|
||||
}
|
||||
lua::pushnil(L);
|
||||
lua::setglobal(L, "__vc_app");
|
||||
lua::pushnil(L);
|
||||
lua::setglobal(L, "__vc_internals");
|
||||
|
||||
load_script("stdcmd.lua", true);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ struct AudioSettings {
|
|||
NumberSetting volumeAmbient {1.0f, 0.0f, 1.0f, setting_format::percent};
|
||||
NumberSetting volumeMusic {1.0f, 0.0f, 1.0f, setting_format::percent};
|
||||
|
||||
StringSetting inputDevice {"auto"};
|
||||
StringSetting inputDevice {""};
|
||||
|
||||
FlagSetting acousticEffects {true};
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue