mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-20 11:10:23 -06:00
Add call to asset function
This commit is contained in:
@@ -54,12 +54,16 @@
|
||||
#include <ghoul/misc/dictionary.h>
|
||||
#include <modules/kameleonvolume/kameleonvolumereader.h>
|
||||
#include <ext/json/json.hpp>
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
#include <openspace/engine/globals.h>
|
||||
#include <openspace/scene/assetmanager.h>
|
||||
|
||||
#include <ghoul/glm.h>
|
||||
|
||||
using Directory = ghoul::filesystem::Directory;
|
||||
using File = ghoul::filesystem::File;
|
||||
using RawPath = ghoul::filesystem::Directory::RawPath;
|
||||
using PrettyPrint = ghoul::DictionaryLuaFormatter::PrettyPrint;
|
||||
using Recursive = ghoul::filesystem::Directory::Recursive;
|
||||
using TestResult = openspace::documentation::TestResult;
|
||||
using json = nlohmann::json;
|
||||
@@ -615,7 +619,7 @@ const std::string Loader::createAssetFile(ghoul::Dictionary assetDictionary)
|
||||
Directory d = getAssetFolderDirectory();
|
||||
const std::string path = d.path();
|
||||
|
||||
ghoul::DictionaryLuaFormatter formatter;
|
||||
ghoul::DictionaryLuaFormatter formatter(PrettyPrint::Yes, " ");
|
||||
const std::string dictionaryString = formatter.format(assetDictionary);
|
||||
|
||||
std::string identifier = assetDictionary.value<std::string>(KeyIdentifier);
|
||||
@@ -642,7 +646,7 @@ const std::string Loader::createAssetFile(ghoul::Dictionary assetDictionary)
|
||||
|
||||
void Loader::loadCreatedAsset(const std::string& path)
|
||||
{
|
||||
|
||||
global::openSpaceEngine.assetManager().add(path);
|
||||
}
|
||||
|
||||
// void Loader::createVolumeDataItem(std::string absPath) {}
|
||||
|
||||
@@ -292,6 +292,20 @@ void OpenSpaceEngine::initialize() {
|
||||
LDEBUG("Registering Lua libraries");
|
||||
registerCoreClasses(global::scriptEngine);
|
||||
|
||||
// Set up asset loader
|
||||
std::unique_ptr<SynchronizationWatcher> w =
|
||||
std::make_unique<SynchronizationWatcher>();
|
||||
SynchronizationWatcher* rawWatcher = w.get();
|
||||
|
||||
global::openSpaceEngine._assetManager = std::make_unique<AssetManager>(
|
||||
std::make_unique<AssetLoader>(
|
||||
*global::scriptEngine.luaState(),
|
||||
rawWatcher,
|
||||
FileSys.absPath("${ASSETS}")
|
||||
),
|
||||
std::move(w)
|
||||
);
|
||||
|
||||
global::scriptEngine.addLibrary(global::openSpaceEngine._assetManager->luaLibrary());
|
||||
|
||||
for (OpenSpaceModule* module : global::moduleEngine.modules()) {
|
||||
@@ -316,20 +330,6 @@ void OpenSpaceEngine::initialize() {
|
||||
func();
|
||||
}
|
||||
|
||||
// Set up asset loader
|
||||
std::unique_ptr<SynchronizationWatcher> w =
|
||||
std::make_unique<SynchronizationWatcher>();
|
||||
SynchronizationWatcher* rawWatcher = w.get();
|
||||
|
||||
global::openSpaceEngine._assetManager = std::make_unique<AssetManager>(
|
||||
std::make_unique<AssetLoader>(
|
||||
*global::scriptEngine.luaState(),
|
||||
rawWatcher,
|
||||
FileSys.absPath("${ASSETS}")
|
||||
),
|
||||
std::move(w)
|
||||
);
|
||||
|
||||
global::openSpaceEngine._assetManager->initialize();
|
||||
scheduleLoadSingleAsset(global::configuration.asset);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user