From c8dff5c2170577093901d4c8823db8443b5cd2cd Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Mon, 4 May 2020 22:56:12 +0200 Subject: [PATCH 01/48] First pass of asset cleanup --- include/openspace/scene/asset.h | 2 +- include/openspace/scene/assetloader.h | 2 +- include/openspace/scene/assetmanager.h | 10 +- src/scene/asset.cpp | 219 ++++++++++--------------- src/scene/assetloader.cpp | 26 +-- src/scene/assetmanager.cpp | 2 +- 6 files changed, 111 insertions(+), 150 deletions(-) diff --git a/include/openspace/scene/asset.h b/include/openspace/scene/asset.h index 13b7fe650f..6df0769dcc 100644 --- a/include/openspace/scene/asset.h +++ b/include/openspace/scene/asset.h @@ -134,7 +134,7 @@ public: bool isRequested() const; bool shouldBeInitialized() const; - std::string resolveLocalResource(std::string resourceName); + std::string resolveLocalResource(std::string resourceName) const; private: void setState(State state); diff --git a/include/openspace/scene/assetloader.h b/include/openspace/scene/assetloader.h index ea32931835..0b06a38f50 100644 --- a/include/openspace/scene/assetloader.h +++ b/include/openspace/scene/assetloader.h @@ -177,7 +177,7 @@ private: void setUpAssetLuaTable(Asset* asset); void tearDownAssetLuaTable(Asset* asset); - std::shared_ptr getAsset(std::string name); + std::shared_ptr getAsset(const std::string& name); ghoul::filesystem::Directory currentDirectory() const; void setCurrentAsset(std::shared_ptr asset); diff --git a/include/openspace/scene/assetmanager.h b/include/openspace/scene/assetmanager.h index d279219463..0265723f1c 100644 --- a/include/openspace/scene/assetmanager.h +++ b/include/openspace/scene/assetmanager.h @@ -41,12 +41,10 @@ class SynchronizationWatcher; /** * Interface for managing assets. - * The asset manager interface is only concerned with "top level" assets, - * i.e. assets that are loaded using setTargetAssetState, and not their dependencies. - * However, an asset is not considered synchronized before all its deps are - * synchronized. - * Also, setting a target state of an asset to Unloaded will only unload an asset - * from the system if it is not a dependency of a loaded asset. + * The asset manager interface is only concerned with "top level" assets, and not their + * dependencies. However, an asset is not considered synchronized before all its deps are + * synchronized. Also, setting a target state of an asset to Unloaded will only unload an + * asset from the system if it is not a dependency of a loaded asset. */ class AssetManager : AssetListener { diff --git a/src/scene/asset.cpp b/src/scene/asset.cpp index 5cbd502e03..4e58363c4e 100644 --- a/src/scene/asset.cpp +++ b/src/scene/asset.cpp @@ -34,7 +34,7 @@ #include namespace { - const constexpr char* _loggerCat = "Asset"; + constexpr const char* _loggerCat = "Asset"; float syncProgress(const std::vector>& assets) { @@ -62,7 +62,7 @@ namespace { } return static_cast(nSyncedBytes) / static_cast(nTotalBytes); } -} +} // namespace namespace openspace { @@ -74,9 +74,7 @@ Asset::Asset(AssetLoader* loader, SynchronizationWatcher* watcher) , _assetName("Root Asset") {} -Asset::Asset(AssetLoader* loader, SynchronizationWatcher* watcher, - std::string assetPath -) +Asset::Asset(AssetLoader* loader, SynchronizationWatcher* watcher, std::string assetPath) : _state(State::Unloaded) , _loader(loader) , _synchronizationWatcher(watcher) @@ -84,10 +82,9 @@ Asset::Asset(AssetLoader* loader, SynchronizationWatcher* watcher, , _assetPath(std::move(assetPath)) {} -std::string Asset::resolveLocalResource(std::string resourceName) { - std::string assetDir = assetDirectory(); - return assetDir + ghoul::filesystem::FileSystem::PathSeparator + - std::move(resourceName); +std::string Asset::resolveLocalResource(std::string resourceName) const { + std::string dir = assetDirectory(); + return dir + ghoul::filesystem::FileSystem::PathSeparator + std::move(resourceName); } Asset::State Asset::state() const { @@ -127,18 +124,17 @@ void Asset::setState(Asset::State state) { void Asset::requiredAssetChangedState(Asset::State childState) { if (!isLoaded()) { // Prohibit state change to SyncResolved if additional requirements - // may still be added. + // may still be added return; } if (isInitialized()) { - // Do not do anything if this asset was already initialized. - // This may happen if there are multiple requirement paths from - // this asset to the same child, which causes this method to be - // called more than once. + // Do not do anything if this asset was already initialized. This may happen if + // there are multiple requirement paths from this asset to the same child, which + // causes this method to be called more than once return; } - if (state() == State::InitializationFailed) { - // Do not do anything if the asset failed to initialize. + if (_state == State::InitializationFailed) { + // Do not do anything if the asset failed to initialize return; } if (childState == State::SyncResolved) { @@ -153,14 +149,10 @@ void Asset::requiredAssetChangedState(Asset::State childState) { void Asset::requestedAssetChangedState(Asset* child, Asset::State childState) { if (child->hasInitializedParent()) { - if (childState == State::Loaded && - child->state() == State::Loaded) - { + if (childState == State::Loaded && child->state() == State::Loaded) { child->startSynchronizations(); } - if (childState == State::SyncResolved && - child->state() == State::SyncResolved) - { + if (childState == State::SyncResolved && child->state() == State::SyncResolved) { child->initialize(); } } @@ -212,14 +204,12 @@ bool Asset::isSyncResolveReady() { std::vector> requiredAssets = this->requiredAssets(); auto unsynchronizedAsset = std::find_if( - requiredAssets.begin(), - requiredAssets.end(), - [](std::shared_ptr& a) { - return !a->isSynchronized(); - } + requiredAssets.cbegin(), + requiredAssets.cend(), + [](const std::shared_ptr& a) { return !a->isSynchronized(); } ); - if (unsynchronizedAsset != requiredAssets.end()) { + if (unsynchronizedAsset != requiredAssets.cend()) { // Not considered resolved if there is one or more unresolved children return false; } @@ -228,15 +218,13 @@ bool Asset::isSyncResolveReady() { ownSynchronizations(); auto unresolvedOwnSynchronization = std::find_if( - syncs.begin(), - syncs.end(), - [](const std::shared_ptr& s) { - return !s->isResolved(); - } + syncs.cbegin(), + syncs.cend(), + [](const std::shared_ptr& s) { return !s->isResolved(); } ); // To be considered resolved, all own synchronizations need to be resolved - return unresolvedOwnSynchronization == syncs.end(); + return unresolvedOwnSynchronization == syncs.cend(); } const std::vector>& @@ -274,28 +262,22 @@ std::vector> Asset::requiredSubTreeAssets() const { } bool Asset::isLoaded() const { - State s = state(); - return s != State::Unloaded && s != State::LoadingFailed; + return _state != State::Unloaded && _state != State::LoadingFailed; } bool Asset::isSynchronized() const { - State s = state(); - return s == State::SyncResolved || - s == State::Initialized || - s == State::InitializationFailed; + return _state == State::SyncResolved || _state == State::Initialized || + _state == State::InitializationFailed; } bool Asset::isSyncingOrResolved() const { - State s = state(); - return s == State::Synchronizing || - s == State::SyncResolved || - s == State::Initialized || - s == State::InitializationFailed; + return _state == State::Synchronizing || _state == State::SyncResolved || + _state == State::Initialized || _state == State::InitializationFailed; } bool Asset::hasLoadedParent() { { - std::vector>::iterator it = _requiringAssets.begin(); + auto it = _requiringAssets.begin(); while (it != _requiringAssets.end()) { std::shared_ptr parent = it->lock(); if (!parent) { @@ -309,7 +291,7 @@ bool Asset::hasLoadedParent() { } } { - std::vector>::iterator it = _requestingAssets.begin(); + auto it = _requestingAssets.begin(); while (it != _requestingAssets.end()) { std::shared_ptr parent = it->lock(); if (!parent) { @@ -371,8 +353,7 @@ bool Asset::hasInitializedParent() const { } bool Asset::isInitialized() const { - State s = state(); - return s == State::Initialized; + return _state == State::Initialized; } bool Asset::startSynchronizations() { @@ -386,27 +367,27 @@ bool Asset::startSynchronizations() { // Do not attempt to resync if this is already done if (isSyncingOrResolved()) { - return state() != State::SyncResolved; + return _state != State::SyncResolved; } setState(State::Synchronizing); bool childFailed = false; - // Start synchronization of all children first. + // Start synchronization of all children first for (const std::shared_ptr& child : requiredAssets()) { if (!child->startSynchronizations()) { childFailed = true; } } - // Now synchronize its own synchronizations. + // Now synchronize its own synchronizations for (const std::shared_ptr& s : ownSynchronizations()) { if (!s->isResolved()) { s->start(); } } - // If all syncs are resolved (or no syncs exist), mark as resolved. + // If all syncs are resolved (or no syncs exist), mark as resolved if (!isInitialized() && isSyncResolveReady()) { setState(State::SyncResolved); } @@ -414,13 +395,15 @@ bool Asset::startSynchronizations() { } bool Asset::cancelAllSynchronizations() { - bool cancelledAnySync = false; - for (const std::shared_ptr& child : childAssets()) { - const bool cancelled = child->cancelAllSynchronizations(); - if (cancelled) { - cancelledAnySync = true; + const std::vector>& children = childAssets(); + bool cancelledAnySync = std::any_of( + children.cbegin(), + children.cend(), + [](const std::shared_ptr& child) { + return child->cancelAllSynchronizations(); } - } + ); + for (const std::shared_ptr& s : ownSynchronizations()) { if (s->isSyncing()) { cancelledAnySync = true; @@ -438,13 +421,16 @@ bool Asset::cancelUnwantedSynchronizations() { if (hasSyncingOrResolvedParent()) { return false; } - bool cancelledAnySync = false; - for (const std::shared_ptr& child : childAssets()) { - bool cancelled = child->cancelUnwantedSynchronizations(); - if (cancelled) { - cancelledAnySync = true; + + const std::vector>& children = childAssets(); + bool cancelledAnySync = std::any_of( + children.begin(), + children.end(), + [](const std::shared_ptr& child) { + return child->cancelUnwantedSynchronizations(); } - } + ); + for (const std::shared_ptr& s : ownSynchronizations()) { if (s->isSyncing()) { cancelledAnySync = true; @@ -478,7 +464,7 @@ bool Asset::load() { return true; } - bool loaded = loader()->loadAsset(shared_from_this()); + const bool loaded = loader()->loadAsset(shared_from_this()); setState(loaded ? State::Loaded : State::LoadingFailed); return loaded; } @@ -537,12 +523,12 @@ bool Asset::initialize() { "Failed to initialize asset {}; {}: {}", id(), e.component, e.message )); // TODO: rollback; - setState(Asset::State::InitializationFailed); + setState(State::InitializationFailed); return false; } // 4. Update state - setState(Asset::State::Initialized); + setState(State::Initialized); // 5. Call dependency lua onInitialize of this and requirements for (const std::shared_ptr& child : _requiredAssets) { @@ -552,13 +538,10 @@ bool Asset::initialize() { catch (const ghoul::lua::LuaRuntimeException& e) { LERROR(fmt::format( "Failed to initialize required asset {} of {}; {}: {}", - child->id(), - id(), - e.component, - e.message + child->id(), id(), e.component, e.message )); // TODO: rollback; - setState(Asset::State::InitializationFailed); + setState(State::InitializationFailed); return false; } } @@ -572,10 +555,7 @@ bool Asset::initialize() { catch (const ghoul::lua::LuaRuntimeException& e) { LERROR(fmt::format( "Failed to initialize requested asset {} of {}; {}: {}", - child->id(), - id(), - e.component, - e.message + child->id(), id(), e.component, e.message )); // TODO: rollback; } @@ -592,10 +572,7 @@ bool Asset::initialize() { catch (const ghoul::lua::LuaRuntimeException& e) { LERROR(fmt::format( "Failed to initialize required asset {} of {}; {}: {}", - id(), - p->id(), - e.component, - e.message + id(), p->id(), e.component, e.message )); // TODO: rollback; } @@ -709,13 +686,11 @@ AssetLoader* Asset::loader() const { bool Asset::requires(const Asset* asset) const { const auto it = std::find_if( - _requiredAssets.begin(), - _requiredAssets.end(), - [asset](std::shared_ptr dep) { - return dep.get() == asset; - } + _requiredAssets.cbegin(), + _requiredAssets.cend(), + [asset](const std::shared_ptr dep) { return dep.get() == asset; } ); - return it != _requiredAssets.end(); + return it != _requiredAssets.cend(); } void Asset::require(std::shared_ptr child) { @@ -723,12 +698,12 @@ void Asset::require(std::shared_ptr child) { throw ghoul::RuntimeError("Cannot require child asset when already loaded"); } - const auto it = std::find(_requiredAssets.begin(), _requiredAssets.end(), child); - - if (it != _requiredAssets.end()) { + const auto it = std::find(_requiredAssets.cbegin(), _requiredAssets.cend(), child); + if (it != _requiredAssets.cend()) { // Do nothing if the requirement already exists. return; } + _requiredAssets.push_back(child); child->_requiringAssets.push_back(shared_from_this()); @@ -761,12 +736,12 @@ void Asset::unrequire(Asset* child) { } const auto childIt = std::find_if( - _requiredAssets.begin(), - _requiredAssets.end(), + _requiredAssets.cbegin(), + _requiredAssets.cend(), [child](const std::shared_ptr& asset) { return asset.get() == child; } ); - if (childIt == _requiredAssets.end()) { + if (childIt == _requiredAssets.cend()) { // Do nothing if the request node not exist. return; } @@ -774,14 +749,11 @@ void Asset::unrequire(Asset* child) { _requiredAssets.erase(childIt); const auto parentIt = std::find_if( - child->_requiringAssets.begin(), - child->_requiringAssets.end(), - [this](std::weak_ptr a) { - return a.lock().get() == this; - } + child->_requiringAssets.cbegin(), + child->_requiringAssets.cend(), + [this](const std::weak_ptr a) { return a.lock().get() == this; } ); - - if (parentIt == child->_requiringAssets.end()) { + if (parentIt == child->_requiringAssets.cend()) { return; } @@ -793,12 +765,12 @@ void Asset::unrequire(Asset* child) { } void Asset::request(std::shared_ptr child) { - const auto it = std::find(_requestedAssets.begin(), _requestedAssets.end(), child); - - if (it != _requestedAssets.end()) { + const auto it = std::find(_requestedAssets.cbegin(), _requestedAssets.cend(), child); + if (it != _requestedAssets.cend()) { // Do nothing if the request already exists. return; } + _requestedAssets.push_back(child); child->_requestingAssets.push_back(shared_from_this()); @@ -817,12 +789,11 @@ void Asset::request(std::shared_ptr child) { void Asset::unrequest(Asset* child) { const auto childIt = std::find_if( - _requestedAssets.begin(), - _requestedAssets.end(), + _requestedAssets.cbegin(), + _requestedAssets.cend(), [child](const std::shared_ptr& asset) { return asset.get() == child; } ); - - if (childIt == _requestedAssets.end()) { + if (childIt == _requestedAssets.cend()) { // Do nothing if the request node not exist. return; } @@ -830,14 +801,11 @@ void Asset::unrequest(Asset* child) { _requestedAssets.erase(childIt); const auto parentIt = std::find_if( - child->_requestingAssets.begin(), - child->_requestingAssets.end(), - [this](std::weak_ptr a) { - return a.lock().get() == this; - } + child->_requestingAssets.cbegin(), + child->_requestingAssets.cend(), + [this](const std::weak_ptr a) { return a.lock().get() == this; } ); - - if (parentIt == child->_requestingAssets.end()) { + if (parentIt == child->_requestingAssets.cend()) { return; } @@ -850,13 +818,11 @@ void Asset::unrequest(Asset* child) { bool Asset::requests(Asset* asset) const { const auto it = std::find_if( - _requestedAssets.begin(), - _requestedAssets.end(), - [asset](const std::shared_ptr& dep) { - return dep.get() == asset; - } + _requestedAssets.cbegin(), + _requestedAssets.cend(), + [asset](const std::shared_ptr& dep) { return dep.get() == asset; } ); - return it != _requiredAssets.end(); + return it != _requiredAssets.cend(); } const std::vector>& Asset::requiredAssets() const { @@ -867,8 +833,7 @@ std::vector> Asset::requiringAssets() const { std::vector> assets; assets.reserve(_requiringAssets.size()); for (const std::weak_ptr& a : _requiringAssets) { - std::shared_ptr shared = a.lock(); - if (shared) { + if (std::shared_ptr shared = a.lock(); shared) { assets.push_back(shared); } } @@ -920,13 +885,11 @@ bool Asset::isRequested() const { bool Asset::shouldBeInitialized() const { std::vector> parents = parentAssets(); const auto initializedAsset = std::find_if( - parents.begin(), - parents.end(), - [](const std::shared_ptr& a) { - return a->state() == State::Initialized; - } + parents.cbegin(), + parents.cend(), + [](const std::shared_ptr& a) { return a->state() == State::Initialized; } ); - return initializedAsset != parents.end(); + return initializedAsset != parents.cend(); } } // namespace openspace diff --git a/src/scene/assetloader.cpp b/src/scene/assetloader.cpp index 6d4b7c95c0..9425fa530d 100644 --- a/src/scene/assetloader.cpp +++ b/src/scene/assetloader.cpp @@ -35,7 +35,6 @@ #include #include - #include "assetloader_lua.inl" namespace { @@ -85,7 +84,7 @@ namespace { } return PathType::RelativeToAssetRoot; } -} +} // namespace namespace openspace { @@ -270,7 +269,8 @@ bool AssetLoader::loadAsset(std::shared_ptr asset) { try { ghoul::lua::runScriptFile(*_luaState, asset->assetFilePath()); - } catch (const ghoul::lua::LuaRuntimeException& e) { + } + catch (const ghoul::lua::LuaRuntimeException& e) { LERROR(fmt::format( "Could not load asset '{}': {}", asset->assetFilePath(), e.message) ); @@ -293,14 +293,18 @@ void AssetLoader::unloadAsset(Asset* asset) { } _onDeinitializationFunctionRefs[asset].clear(); - for (const auto& it : _onDependencyInitializationFunctionRefs[asset]) { + for (const std::pair>& it : + _onDependencyInitializationFunctionRefs[asset]) + { for (int ref : it.second) { luaL_unref(*_luaState, LUA_REGISTRYINDEX, ref); } } _onDependencyInitializationFunctionRefs.erase(asset); - for (const auto& it : _onDependencyDeinitializationFunctionRefs[asset]) { + for (const std::pair>& it : + _onDependencyDeinitializationFunctionRefs[asset]) + { for (int ref : it.second) { luaL_unref(*_luaState, LUA_REGISTRYINDEX, ref); } @@ -374,9 +378,9 @@ std::string AssetLoader::generateAssetPath(const std::string& baseDirectory, return ghoul::filesystem::File(FileSys.absPath(fullAssetPath)); } -std::shared_ptr AssetLoader::getAsset(std::string name) { +std::shared_ptr AssetLoader::getAsset(const std::string& name) { ghoul::filesystem::Directory directory = currentDirectory(); - std::string path = generateAssetPath(directory, std::move(name)); + std::string path = generateAssetPath(directory, name); // Check if asset is already loaded. const auto it = _trackedAssets.find(path); @@ -765,13 +769,9 @@ void AssetLoader::addLuaDependencyTable(Asset* dependant, Asset* dependency) { } void AssetLoader::addAssetListener(AssetListener* listener) { - auto it = std::find( - _assetListeners.begin(), - _assetListeners.end(), - listener - ); + const auto it = std::find(_assetListeners.cbegin(), _assetListeners.cend(), listener); - if (it == _assetListeners.end()) { + if (it == _assetListeners.cend()) { _assetListeners.push_back(listener); } } diff --git a/src/scene/assetmanager.cpp b/src/scene/assetmanager.cpp index e64409fadd..5e1eb28324 100644 --- a/src/scene/assetmanager.cpp +++ b/src/scene/assetmanager.cpp @@ -63,7 +63,7 @@ bool AssetManager::update() { const std::string& path = c.first; const bool add = c.second; if (add) { - std::shared_ptr asset = _assetLoader->add(path); + _assetLoader->add(path); } } // Remove assets From b4eb168c7659ee421a352cf5d3b5e716ca6f4592 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Mon, 4 May 2020 23:21:18 +0200 Subject: [PATCH 02/48] Turning shared_ptr into pointers (part 1) --- include/openspace/scene/assetlistener.h | 4 ++-- include/openspace/scene/assetloader.h | 10 +++++----- include/openspace/scene/assetmanager.h | 4 ++-- modules/sync/tasks/syncassettask.cpp | 4 ++-- src/scene/asset.cpp | 2 +- src/scene/assetloader.cpp | 24 ++++++++++++------------ src/scene/assetmanager.cpp | 4 ++-- 7 files changed, 26 insertions(+), 26 deletions(-) diff --git a/include/openspace/scene/assetlistener.h b/include/openspace/scene/assetlistener.h index 60061fd263..a1adaade1e 100644 --- a/include/openspace/scene/assetlistener.h +++ b/include/openspace/scene/assetlistener.h @@ -33,10 +33,10 @@ class AssetListener { public: virtual ~AssetListener() = default; virtual void assetStateChanged(std::shared_ptr asset, Asset::State state) = 0; - virtual void assetRequested(std::shared_ptr parent, + virtual void assetRequested(Asset* parent, std::shared_ptr child) = 0; - virtual void assetUnrequested(std::shared_ptr parent, + virtual void assetUnrequested(Asset* parent, std::shared_ptr child) = 0; }; diff --git a/include/openspace/scene/assetloader.h b/include/openspace/scene/assetloader.h index 0b06a38f50..0192441189 100644 --- a/include/openspace/scene/assetloader.h +++ b/include/openspace/scene/assetloader.h @@ -110,7 +110,7 @@ public: /** * Load an asset */ - bool loadAsset(std::shared_ptr asset); + bool loadAsset(Asset* asset); /** * Unload an asset @@ -162,12 +162,12 @@ public: /** * Notify listeners about new requests */ - void assetRequested(std::shared_ptr parent, std::shared_ptr child); + void assetRequested(Asset* parent, std::shared_ptr child); /** * Notify listeners about removed requests */ - void assetUnrequested(std::shared_ptr parent, std::shared_ptr child); + void assetUnrequested(Asset* parent, std::shared_ptr child); private: std::shared_ptr require(const std::string& identifier); @@ -180,7 +180,7 @@ private: std::shared_ptr getAsset(const std::string& name); ghoul::filesystem::Directory currentDirectory() const; - void setCurrentAsset(std::shared_ptr asset); + void setCurrentAsset(Asset* asset); void addLuaDependencyTable(Asset* dependant, Asset* dependency); // Lua functions @@ -209,7 +209,7 @@ private: // Member variables std::shared_ptr _rootAsset; - std::shared_ptr _currentAsset; + Asset* _currentAsset = nullptr; std::unordered_map> _trackedAssets; SynchronizationWatcher* _synchronizationWatcher; std::string _assetRootDirectory; diff --git a/include/openspace/scene/assetmanager.h b/include/openspace/scene/assetmanager.h index 0265723f1c..282b8b1623 100644 --- a/include/openspace/scene/assetmanager.h +++ b/include/openspace/scene/assetmanager.h @@ -62,9 +62,9 @@ public: std::shared_ptr rootAsset(); void assetStateChanged(std::shared_ptr asset, Asset::State state) override; - void assetRequested(std::shared_ptr parent, + void assetRequested(Asset* parent, std::shared_ptr child) override; - void assetUnrequested(std::shared_ptr parent, + void assetUnrequested(Asset* parent, std::shared_ptr child) override; bool update(); diff --git a/modules/sync/tasks/syncassettask.cpp b/modules/sync/tasks/syncassettask.cpp index d6792ffbe0..f98301e120 100644 --- a/modules/sync/tasks/syncassettask.cpp +++ b/modules/sync/tasks/syncassettask.cpp @@ -85,8 +85,8 @@ public: LERROR(fmt::format("Failed to sync asset: {}", asset->id())); } } - void assetRequested(std::shared_ptr, std::shared_ptr) override {}; - void assetUnrequested(std::shared_ptr, std::shared_ptr) override {}; + void assetRequested(Asset*, std::shared_ptr) override {}; + void assetUnrequested(Asset*, std::shared_ptr) override {}; }; SyncAssetTask::SyncAssetTask(const ghoul::Dictionary& dictionary) { diff --git a/src/scene/asset.cpp b/src/scene/asset.cpp index 4e58363c4e..5bbd46a42f 100644 --- a/src/scene/asset.cpp +++ b/src/scene/asset.cpp @@ -464,7 +464,7 @@ bool Asset::load() { return true; } - const bool loaded = loader()->loadAsset(shared_from_this()); + const bool loaded = loader()->loadAsset(this); setState(loaded ? State::Loaded : State::LoadingFailed); return loaded; } diff --git a/src/scene/assetloader.cpp b/src/scene/assetloader.cpp index 9425fa530d..56fc0b824e 100644 --- a/src/scene/assetloader.cpp +++ b/src/scene/assetloader.cpp @@ -96,7 +96,7 @@ AssetLoader::AssetLoader(ghoul::lua::LuaState* luaState, , _assetRootDirectory(std::move(assetRootDirectory)) , _luaState(luaState) { - setCurrentAsset(_rootAsset); + setCurrentAsset(_rootAsset.get()); // Create _assets table. lua_newtable(*_luaState); @@ -250,9 +250,9 @@ void AssetLoader::tearDownAssetLuaTable(Asset* asset) { lua_settop(*_luaState, top); } -bool AssetLoader::loadAsset(std::shared_ptr asset) { +bool AssetLoader::loadAsset(Asset* asset) { int top = lua_gettop(*_luaState); - std::shared_ptr parentAsset = _currentAsset; + Asset* parentAsset = _currentAsset; setCurrentAsset(asset); defer { @@ -446,14 +446,14 @@ int AssetLoader::onDeinitializeDependencyLua(Asset* dependant, Asset* dependency std::shared_ptr AssetLoader::require(const std::string& identifier) { std::shared_ptr asset = getAsset(identifier); - std::shared_ptr dependant = _currentAsset; + Asset* dependant = _currentAsset; dependant->require(asset); return asset; } std::shared_ptr AssetLoader::request(const std::string& identifier) { std::shared_ptr asset = getAsset(identifier); - std::shared_ptr parent = _currentAsset; + Asset* parent = _currentAsset; parent->request(asset); assetRequested(parent, asset); return asset; @@ -461,7 +461,7 @@ std::shared_ptr AssetLoader::request(const std::string& identifier) { void AssetLoader::unrequest(const std::string& identifier) { std::shared_ptr asset = has(identifier); - std::shared_ptr parent = _currentAsset; + Asset* parent = _currentAsset; parent->unrequest(asset.get()); assetUnrequested(parent, asset); } @@ -476,13 +476,13 @@ ghoul::filesystem::Directory AssetLoader::currentDirectory() const { } std::shared_ptr AssetLoader::add(const std::string& identifier) { - setCurrentAsset(_rootAsset); + setCurrentAsset(_rootAsset.get()); return request(identifier); } void AssetLoader::remove(const std::string& identifier) { - setCurrentAsset(_rootAsset); + setCurrentAsset(_rootAsset.get()); unrequest(identifier); } @@ -608,13 +608,13 @@ int AssetLoader::syncedResourceLua(Asset* asset) { return 1; } -void AssetLoader::setCurrentAsset(std::shared_ptr asset) { +void AssetLoader::setCurrentAsset(Asset* asset) { int top = lua_gettop(*_luaState); _currentAsset = asset; // Set `asset` lua global to point to the current asset table - if (asset == _rootAsset) { + if (asset == _rootAsset.get()) { lua_pushnil(*_luaState); lua_setglobal(*_luaState, AssetGlobalVariableName); lua_settop(*_luaState, top); @@ -790,7 +790,7 @@ void AssetLoader::assetStateChanged(std::shared_ptr asset, Asset::State s } } -void AssetLoader::assetRequested(std::shared_ptr parent, +void AssetLoader::assetRequested(Asset* parent, std::shared_ptr child) { for (AssetListener* listener : _assetListeners) { @@ -798,7 +798,7 @@ void AssetLoader::assetRequested(std::shared_ptr parent, } } -void AssetLoader::assetUnrequested(std::shared_ptr parent, +void AssetLoader::assetUnrequested(Asset* parent, std::shared_ptr child) { for (AssetListener* listener : _assetListeners) { diff --git a/src/scene/assetmanager.cpp b/src/scene/assetmanager.cpp index 5e1eb28324..5fa07a3a27 100644 --- a/src/scene/assetmanager.cpp +++ b/src/scene/assetmanager.cpp @@ -87,12 +87,12 @@ void AssetManager::assetStateChanged(std::shared_ptr, Asset::State) { //LINFO(asset->id() << " changed state to " << static_cast(state)); } -void AssetManager::assetRequested(std::shared_ptr, std::shared_ptr) { +void AssetManager::assetRequested(Asset*, std::shared_ptr) { // Potential todo: notify user about asset request //LINFO(parent->id() << " requested " << child->id()); } -void AssetManager::assetUnrequested(std::shared_ptr, std::shared_ptr) { +void AssetManager::assetUnrequested(Asset*, std::shared_ptr) { // Potential todo: notify user about asset unrequest //LINFO(parent->id() << " unrequested " << child->id()); } From 875404246fc38caba2d260862c17e9208867a7a8 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Tue, 5 May 2020 00:00:48 +0200 Subject: [PATCH 03/48] Add meta information to Asset class --- include/openspace/scene/asset.h | 13 +++++++ include/openspace/scene/assetlistener.h | 2 +- include/openspace/scene/assetloader.h | 2 +- include/openspace/scene/assetmanager.h | 2 +- modules/sync/tasks/syncassettask.cpp | 2 +- src/scene/asset.cpp | 7 ++-- src/scene/assetloader.cpp | 48 +++++++++++++++++++++---- src/scene/assetmanager.cpp | 2 +- 8 files changed, 64 insertions(+), 14 deletions(-) diff --git a/include/openspace/scene/asset.h b/include/openspace/scene/asset.h index 6df0769dcc..a063e71b01 100644 --- a/include/openspace/scene/asset.h +++ b/include/openspace/scene/asset.h @@ -51,6 +51,15 @@ public: using StateChangeCallback = std::function; using CallbackHandle = size_t; + struct MetaInformation { + std::string name; + std::string version; + std::string description; + std::string author; + std::string url; + std::string license; + }; + /** * Root asset constructor */ @@ -136,6 +145,8 @@ public: std::string resolveLocalResource(std::string resourceName) const; + void setMetaInformation(MetaInformation metaInformation); + private: void setState(State state); @@ -157,6 +168,8 @@ private: // Absolute path to asset file std::string _assetPath; + MetaInformation _metaInformation; + // Required assets std::vector> _requiredAssets; diff --git a/include/openspace/scene/assetlistener.h b/include/openspace/scene/assetlistener.h index a1adaade1e..b507c82f23 100644 --- a/include/openspace/scene/assetlistener.h +++ b/include/openspace/scene/assetlistener.h @@ -32,7 +32,7 @@ namespace openspace { class AssetListener { public: virtual ~AssetListener() = default; - virtual void assetStateChanged(std::shared_ptr asset, Asset::State state) = 0; + virtual void assetStateChanged(Asset* asset, Asset::State state) = 0; virtual void assetRequested(Asset* parent, std::shared_ptr child) = 0; diff --git a/include/openspace/scene/assetloader.h b/include/openspace/scene/assetloader.h index 0192441189..0f6ad9bbee 100644 --- a/include/openspace/scene/assetloader.h +++ b/include/openspace/scene/assetloader.h @@ -157,7 +157,7 @@ public: /** * Notify listeners about asset state change */ - void assetStateChanged(std::shared_ptr asset, Asset::State state); + void assetStateChanged(Asset* asset, Asset::State state); /** * Notify listeners about new requests diff --git a/include/openspace/scene/assetmanager.h b/include/openspace/scene/assetmanager.h index 282b8b1623..42d6b311c8 100644 --- a/include/openspace/scene/assetmanager.h +++ b/include/openspace/scene/assetmanager.h @@ -61,7 +61,7 @@ public: void removeAll(); std::shared_ptr rootAsset(); - void assetStateChanged(std::shared_ptr asset, Asset::State state) override; + void assetStateChanged(Asset* asset, Asset::State state) override; void assetRequested(Asset* parent, std::shared_ptr child) override; void assetUnrequested(Asset* parent, diff --git a/modules/sync/tasks/syncassettask.cpp b/modules/sync/tasks/syncassettask.cpp index f98301e120..2e23c5e61b 100644 --- a/modules/sync/tasks/syncassettask.cpp +++ b/modules/sync/tasks/syncassettask.cpp @@ -77,7 +77,7 @@ documentation::Documentation SyncAssetTask::documentation() { class RequestListener : public AssetListener { public: virtual ~RequestListener() = default; - void assetStateChanged(std::shared_ptr asset, Asset::State state) override { + void assetStateChanged(Asset* asset, Asset::State state) override { if (state == Asset::State::LoadingFailed) { LERROR(fmt::format("Failed to load asset: {}", asset->id())); } diff --git a/src/scene/asset.cpp b/src/scene/asset.cpp index 5bbd46a42f..9cd55f9b54 100644 --- a/src/scene/asset.cpp +++ b/src/scene/asset.cpp @@ -87,6 +87,10 @@ std::string Asset::resolveLocalResource(std::string resourceName) const { return dir + ghoul::filesystem::FileSystem::PathSeparator + std::move(resourceName); } +void Asset::setMetaInformation(MetaInformation metaInformation) { + _metaInformation = std::move(metaInformation); +} + Asset::State Asset::state() const { return _state; } @@ -105,8 +109,7 @@ void Asset::setState(Asset::State state) { } _state = state; - std::shared_ptr thisAsset = shared_from_this(); - _loader->assetStateChanged(thisAsset, state); + _loader->assetStateChanged(this, state); for (const std::weak_ptr& requiringAsset : _requiringAssets) { if (std::shared_ptr a = requiringAsset.lock()) { diff --git a/src/scene/assetloader.cpp b/src/scene/assetloader.cpp index 56fc0b824e..e360f20f5a 100644 --- a/src/scene/assetloader.cpp +++ b/src/scene/assetloader.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include "assetloader_lua.inl" @@ -54,6 +55,14 @@ namespace { constexpr const char* DirectoryConstantName = "directory"; constexpr const char* FilePathConstantName = "filePath"; + constexpr const char* MetaInformationKey = "meta"; + constexpr const char* MetaInformationName = "Name"; + constexpr const char* MetaInformationVersion = "Version"; + constexpr const char* MetaInformationDescription = "Description"; + constexpr const char* MetaInformationAuthor = "Author"; + constexpr const char* MetaInformationURL = "URL"; + constexpr const char* MetaInformationLicense = "License"; + constexpr const char* ExportsTableName = "_exports"; constexpr const char* AssetTableName = "_asset"; constexpr const char* DependantsTableName = "_dependants"; @@ -278,6 +287,35 @@ bool AssetLoader::loadAsset(Asset* asset) { return false; } + // Extract meta information from the asset file if it was provided + // 1. Load the asset table + lua_getglobal(*_luaState, AssetGlobalVariableName); + ghoul_assert(lua_istable(*_luaState, -1), "Expected 'asset' table"); + lua_getfield(*_luaState, -1, MetaInformationKey); + if (!lua_isnil(*_luaState, -1)) { + // The 'meta' object exist; quick sanity check that it is a table + if (!lua_istable(*_luaState, -1)) { + LWARNING(fmt::format( + "When loading asset '{}', encountered a '{}' entry that was not a table", + asset->assetFilePath(), MetaInformationKey + )); + } + else { + // The 'meta' object exists and it is a table + ghoul::Dictionary metaDict; + ghoul::lua::luaDictionaryFromState(*_luaState, metaDict); + + Asset::MetaInformation meta; + metaDict.getValue(MetaInformationName, meta.name); + metaDict.getValue(MetaInformationVersion, meta.version); + metaDict.getValue(MetaInformationDescription, meta.description); + metaDict.getValue(MetaInformationAuthor, meta.author); + metaDict.getValue(MetaInformationURL, meta.url); + metaDict.getValue(MetaInformationLicense, meta.license); + asset->setMetaInformation(std::move(meta)); + } + } + lua_settop(*_luaState, top); return true; } @@ -784,23 +822,19 @@ void AssetLoader::removeAssetListener(AssetListener* listener) { )); } -void AssetLoader::assetStateChanged(std::shared_ptr asset, Asset::State state) { +void AssetLoader::assetStateChanged(Asset* asset, Asset::State state) { for (AssetListener* listener : _assetListeners) { listener->assetStateChanged(asset, state); } } -void AssetLoader::assetRequested(Asset* parent, - std::shared_ptr child) -{ +void AssetLoader::assetRequested(Asset* parent, std::shared_ptr child) { for (AssetListener* listener : _assetListeners) { listener->assetRequested(parent, child); } } -void AssetLoader::assetUnrequested(Asset* parent, - std::shared_ptr child) -{ +void AssetLoader::assetUnrequested(Asset* parent, std::shared_ptr child) { for (AssetListener* listener : _assetListeners) { listener->assetUnrequested(parent, child); } diff --git a/src/scene/assetmanager.cpp b/src/scene/assetmanager.cpp index 5fa07a3a27..18d9089a2f 100644 --- a/src/scene/assetmanager.cpp +++ b/src/scene/assetmanager.cpp @@ -82,7 +82,7 @@ bool AssetManager::update() { return false; } -void AssetManager::assetStateChanged(std::shared_ptr, Asset::State) { +void AssetManager::assetStateChanged(Asset*, Asset::State) { // Potential todo: notify user about asset stage change //LINFO(asset->id() << " changed state to " << static_cast(state)); } From 5a410840279880e440551e1795ed8e1fe608d9ae Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Tue, 5 May 2020 00:29:46 +0200 Subject: [PATCH 04/48] Add loading of meta information from assets --- data/assets/default.scene | 9 ++ data/assets/scene/solarsystem/planets.asset | 10 +++ .../solarsystem/planets/earth/earth.asset | 10 +++ .../planets/earth/satellites/satellites.asset | 2 +- .../satellites/satellites_interesting.asset | 12 +-- data/assets/util/webgui.asset | 10 +++ include/openspace/scene/asset.h | 4 +- include/openspace/scene/scene.h | 13 --- include/openspace/scene/scenelicense.h | 56 ------------ include/openspace/scene/scenelicensewriter.h | 7 +- src/CMakeLists.txt | 2 - src/engine/openspaceengine.cpp | 5 +- src/scene/asset.cpp | 4 + src/scene/scene.cpp | 9 -- src/scene/scenelicense.cpp | 87 ------------------- src/scene/scenelicensewriter.cpp | 37 +++++--- 16 files changed, 83 insertions(+), 194 deletions(-) delete mode 100644 include/openspace/scene/scenelicense.h delete mode 100644 src/scene/scenelicense.cpp diff --git a/data/assets/default.scene b/data/assets/default.scene index 31a2e83d4f..ef529c05bc 100644 --- a/data/assets/default.scene +++ b/data/assets/default.scene @@ -18,3 +18,12 @@ end) asset.onDeinitialize(function () openspace.removeInterestingNodes({ "Earth", "Mars", "Moon", "Sun" }) end) + +asset.meta = { + Name = "Default scene", + Version = "1.0", + Description = [[ Bla bla, something something asteroids ]], + Author = "OpenSpace Team", + URL = "http://openspaceproject.com", + License = "MIT license" +} diff --git a/data/assets/scene/solarsystem/planets.asset b/data/assets/scene/solarsystem/planets.asset index a631b33339..f2ebb05379 100644 --- a/data/assets/scene/solarsystem/planets.asset +++ b/data/assets/scene/solarsystem/planets.asset @@ -22,3 +22,13 @@ asset.request('./planets/uranus/major_moons') asset.request('./planets/neptune/neptune') asset.request('./planets/neptune/major_moons') + + +asset.meta = { + Name = "Planets", + Version = "1.0", + Description = [[ Collection of planets in the solar system ]], + Author = "OpenSpace Team", + URL = "http://openspaceproject.com", + License = "MIT license" +} diff --git a/data/assets/scene/solarsystem/planets/earth/earth.asset b/data/assets/scene/solarsystem/planets/earth/earth.asset index 7b26c55ecc..b7b763a937 100644 --- a/data/assets/scene/solarsystem/planets/earth/earth.asset +++ b/data/assets/scene/solarsystem/planets/earth/earth.asset @@ -329,3 +329,13 @@ local EarthLabel = { assetHelper.registerSceneGraphNodesAndExport(asset, { Earth, EarthLabel }) + + +asset.meta = { + Name = "Earth", + Version = "1.0", + Description = [[ Earth is a special planet with special needs ]], + Author = "OpenSpace Team", + URL = "http://openspaceproject.com", + License = "MIT license" +} diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/satellites.asset b/data/assets/scene/solarsystem/planets/earth/satellites/satellites.asset index 44c81c4ef8..601b4033f4 100644 --- a/data/assets/scene/solarsystem/planets/earth/satellites/satellites.asset +++ b/data/assets/scene/solarsystem/planets/earth/satellites/satellites.asset @@ -1 +1 @@ -asset.request('./satellites_interesting') +asset.require('./satellites_interesting') diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/satellites_interesting.asset b/data/assets/scene/solarsystem/planets/earth/satellites/satellites_interesting.asset index 7d257cfc8b..71151f4358 100644 --- a/data/assets/scene/solarsystem/planets/earth/satellites/satellites_interesting.asset +++ b/data/assets/scene/solarsystem/planets/earth/satellites/satellites_interesting.asset @@ -1,6 +1,6 @@ -asset.request('./misc/brightest') -asset.request('./communications/geostationary') -asset.request('./navigation/gps') -asset.request('./misc/spacestations') -asset.request('./misc/iss') -asset.request('./misc/tle-new') +asset.require('./misc/brightest') +asset.require('./communications/geostationary') +asset.require('./navigation/gps') +asset.require('./misc/spacestations') +asset.require('./misc/iss') +asset.require('./misc/tle-new') diff --git a/data/assets/util/webgui.asset b/data/assets/util/webgui.asset index 13baac61cb..1ee2056cd5 100644 --- a/data/assets/util/webgui.asset +++ b/data/assets/util/webgui.asset @@ -82,3 +82,13 @@ end asset.export("setCefRoute", setCefRoute) + + +asset.meta = { + Name = "WebGUI", + Version = "0.1", + Description = [[ insert CEF rant ]], + Author = "OpenSpace Team", + URL = "http://openspaceproject.com", + License = "MIT license" +} diff --git a/include/openspace/scene/asset.h b/include/openspace/scene/asset.h index a063e71b01..4a842c4c1f 100644 --- a/include/openspace/scene/asset.h +++ b/include/openspace/scene/asset.h @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -146,6 +147,7 @@ public: std::string resolveLocalResource(std::string resourceName) const; void setMetaInformation(MetaInformation metaInformation); + std::optional metaInformation() const; private: void setState(State state); @@ -168,7 +170,7 @@ private: // Absolute path to asset file std::string _assetPath; - MetaInformation _metaInformation; + std::optional _metaInformation; // Required assets std::vector> _requiredAssets; diff --git a/include/openspace/scene/scene.h b/include/openspace/scene/scene.h index f9bfbf4e4e..8a19bbfbe2 100644 --- a/include/openspace/scene/scene.h +++ b/include/openspace/scene/scene.h @@ -28,7 +28,6 @@ #include #include -#include #include #include #include @@ -134,8 +133,6 @@ public: */ void unregisterNode(SceneGraphNode* node); - void addSceneLicense(SceneLicense license); - /** * Mark the node registry as dirty */ @@ -146,14 +143,6 @@ public: */ const std::vector& allSceneGraphNodes() const; - /** - * Generate JSON about the license information for the scenegraph nodes that are - * contained in this scene - * \param path The file path that will contain the documentation about the licenses - * used in this scene - */ - std::string generateSceneLicenseDocumentationJson(); - /** * Returns a map from identifier to scene graph node. */ @@ -261,8 +250,6 @@ private: std::vector _interestingTimes; - std::vector _licenses; - std::mutex _programUpdateLock; std::set _programsToUpdate; std::vector> _programs; diff --git a/include/openspace/scene/scenelicense.h b/include/openspace/scene/scenelicense.h deleted file mode 100644 index 297ee415a8..0000000000 --- a/include/openspace/scene/scenelicense.h +++ /dev/null @@ -1,56 +0,0 @@ -/***************************************************************************************** - * * - * OpenSpace * - * * - * Copyright (c) 2014-2020 * - * * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this * - * software and associated documentation files (the "Software"), to deal in the Software * - * without restriction, including without limitation the rights to use, copy, modify, * - * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to * - * permit persons to whom the Software is furnished to do so, subject to the following * - * conditions: * - * * - * The above copyright notice and this permission notice shall be included in all copies * - * or substantial portions of the Software. * - * * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, * - * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * - * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF * - * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * - * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * - ****************************************************************************************/ - -#ifndef __OPENSPACE_CORE___SCENELICENSE___H__ -#define __OPENSPACE_CORE___SCENELICENSE___H__ - -#include -#include - -namespace ghoul { class Dictionary; } - -namespace openspace { - -namespace documentation { struct Documentation; } - -struct SceneLicense { - // module must not be empty - SceneLicense(const ghoul::Dictionary& dictionary, std::string m); - - std::string module; - - std::string name; - std::string attribution; - std::string url; - std::string licenseText; - - static documentation::Documentation Documentation(); -}; - -void writeSceneLicenseDocumentation(const std::vector& licenses, - const std::string& file, const std::string& type); - -} // namespace openspace - -#endif // __OPENSPACE_CORE___SCENELICENSE___H__ diff --git a/include/openspace/scene/scenelicensewriter.h b/include/openspace/scene/scenelicensewriter.h index 00a056f85a..8a10eb56bf 100644 --- a/include/openspace/scene/scenelicensewriter.h +++ b/include/openspace/scene/scenelicensewriter.h @@ -31,15 +31,10 @@ namespace openspace { -struct SceneLicense; - class SceneLicenseWriter : public DocumentationGenerator { public: - SceneLicenseWriter(std::vector licenses); + SceneLicenseWriter(); std::string generateJson() const override; - -private: - const std::vector& _licenses; }; } // namespace openspace diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index dde2ceb7e2..b5642e724a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -157,7 +157,6 @@ set(OPENSPACE_SOURCE ${OPENSPACE_BASE_DIR}/src/scene/scene.cpp ${OPENSPACE_BASE_DIR}/src/scene/scene_lua.inl ${OPENSPACE_BASE_DIR}/src/scene/sceneinitializer.cpp - ${OPENSPACE_BASE_DIR}/src/scene/scenelicense.cpp ${OPENSPACE_BASE_DIR}/src/scene/scenelicensewriter.cpp ${OPENSPACE_BASE_DIR}/src/scene/scenegraphnode.cpp ${OPENSPACE_BASE_DIR}/src/scene/scenegraphnode_doc.inl @@ -346,7 +345,6 @@ set(OPENSPACE_HEADER ${OPENSPACE_BASE_DIR}/include/openspace/scene/scale.h ${OPENSPACE_BASE_DIR}/include/openspace/scene/scene.h ${OPENSPACE_BASE_DIR}/include/openspace/scene/sceneinitializer.h - ${OPENSPACE_BASE_DIR}/include/openspace/scene/scenelicense.h ${OPENSPACE_BASE_DIR}/include/openspace/scene/scenelicensewriter.h ${OPENSPACE_BASE_DIR}/include/openspace/scene/scenegraphnode.h ${OPENSPACE_BASE_DIR}/include/openspace/scene/timeframe.h diff --git a/src/engine/openspaceengine.cpp b/src/engine/openspaceengine.cpp index 2ed17ecb9a..0cfe7c1295 100644 --- a/src/engine/openspaceengine.cpp +++ b/src/engine/openspaceengine.cpp @@ -1035,7 +1035,7 @@ void OpenSpaceEngine::writeSceneDocumentation() { _documentationJson += "{\"name\":\"Scene License Information\","; _documentationJson += "\"identifier\":\"sceneLicense"; _documentationJson += "\",\"data\":"; - _documentationJson += _scene->generateSceneLicenseDocumentationJson(); + _documentationJson += SceneLicenseWriter().generateJson(); _documentationJson += "},"; _documentationJson += "{\"name\":\"Scene Properties\","; _documentationJson += "\"identifier\":\"propertylist";// + _scene->jsonName(); @@ -1050,8 +1050,7 @@ void OpenSpaceEngine::writeSceneDocumentation() { DocEng.addHandlebarTemplates(global::keybindingManager.templatesToRegister()); //TODO this is in efficaiant, here i am just instaning the class to get //at a member variable which is staticly defined. How do i just get that - const std::vector licenses; - SceneLicenseWriter writer(licenses); + SceneLicenseWriter writer; DocEng.addHandlebarTemplates(writer.templatesToRegister()); DocEng.addHandlebarTemplates(global::rootPropertyOwner.templatesToRegister()); diff --git a/src/scene/asset.cpp b/src/scene/asset.cpp index 9cd55f9b54..242f0029ef 100644 --- a/src/scene/asset.cpp +++ b/src/scene/asset.cpp @@ -91,6 +91,10 @@ void Asset::setMetaInformation(MetaInformation metaInformation) { _metaInformation = std::move(metaInformation); } +std::optional Asset::metaInformation() const { + return _metaInformation; +} + Asset::State Asset::state() const { return _state; } diff --git a/src/scene/scene.cpp b/src/scene/scene.cpp index 59334604ef..ab119610fa 100644 --- a/src/scene/scene.cpp +++ b/src/scene/scene.cpp @@ -146,10 +146,6 @@ void Scene::updateNodeRegistry() { _dirtyNodeRegistry = false; } -void Scene::addSceneLicense(SceneLicense license) { - _licenses.push_back(std::move(license)); -} - void Scene::sortTopologically() { _topologicallySortedNodes.insert( _topologicallySortedNodes.end(), @@ -597,11 +593,6 @@ const std::vector& Scene::interestingTimes() const { return _interestingTimes; } -std::string Scene::generateSceneLicenseDocumentationJson() { - SceneLicenseWriter writer(_licenses); - return writer.generateJson(); -} - scripting::LuaLibrary Scene::luaLibrary() { return { "", diff --git a/src/scene/scenelicense.cpp b/src/scene/scenelicense.cpp deleted file mode 100644 index 3be1824641..0000000000 --- a/src/scene/scenelicense.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/***************************************************************************************** - * * - * OpenSpace * - * * - * Copyright (c) 2014-2020 * - * * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this * - * software and associated documentation files (the "Software"), to deal in the Software * - * without restriction, including without limitation the rights to use, copy, modify, * - * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to * - * permit persons to whom the Software is furnished to do so, subject to the following * - * conditions: * - * * - * The above copyright notice and this permission notice shall be included in all copies * - * or substantial portions of the Software. * - * * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, * - * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * - * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF * - * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * - * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * - ****************************************************************************************/ - -#include - -#include -#include - -namespace { - constexpr const char* LicenseKeyName = "Name"; - constexpr const char* LicenseKeyAttribution = "Attribution"; - constexpr const char* LicenseKeyUrl = "URL"; - constexpr const char* LicenseKeyLicenseText = "License"; -} // namespace - -namespace openspace { - -documentation::Documentation SceneLicense::Documentation() { - using namespace documentation; - - return { - "License Information", - "core_license", - { - { - LicenseKeyName, - new StringVerifier, - Optional::No, - "A short, descriptive name for the license employed for this node." - }, - { - LicenseKeyAttribution, - new StringVerifier, - Optional::No, - "The organization that shall be attributed to the licensed content." - }, - { - LicenseKeyUrl, - new StringVerifier, - Optional::Yes, - "The URL pointing to the original license." - }, - { - LicenseKeyLicenseText, - new StringVerifier, - Optional::No, - "The full text of the license agreements." - } - } - }; -} - -SceneLicense::SceneLicense(const ghoul::Dictionary& dictionary, std::string m) - : module(std::move(m)) -{ - ghoul_assert(!module.empty(), "Module name must not be empty"); - - documentation::testSpecificationAndThrow(Documentation(), dictionary, "SceneLicense"); - - name = dictionary.value(LicenseKeyName); - attribution = dictionary.value(LicenseKeyAttribution); - dictionary.getValue(LicenseKeyUrl, url); - licenseText = dictionary.value(LicenseKeyLicenseText); -} - -} // namespace openspace diff --git a/src/scene/scenelicensewriter.cpp b/src/scene/scenelicensewriter.cpp index 9dc82ea163..de546670bf 100644 --- a/src/scene/scenelicensewriter.cpp +++ b/src/scene/scenelicensewriter.cpp @@ -24,13 +24,17 @@ #include -#include +#include +#include +#include +#include + #include #include namespace openspace { -SceneLicenseWriter::SceneLicenseWriter(std::vector licenses) +SceneLicenseWriter::SceneLicenseWriter() : DocumentationGenerator( "Scene Licenses", "sceneLicense", @@ -38,24 +42,37 @@ SceneLicenseWriter::SceneLicenseWriter(std::vector licenses) { "sceneLicenseTemplate", "${WEB}/documentation/scenelicense.hbs" } } ) - , _licenses(std::move(licenses)) {} std::string SceneLicenseWriter::generateJson() const { std::stringstream json; json << "["; - for (const SceneLicense& license : _licenses) { + + std::vector> assets = + global::openSpaceEngine.assetManager().rootAsset()->subTreeAssets(); + + for (const std::shared_ptr& asset : assets) { + std::optional meta = asset->metaInformation(); + + if (!meta.has_value()) { + continue; + } + constexpr const char* replStr = R"("{}": "{}", )"; constexpr const char* replStr2 = R"("{}": "{}")"; json << "{"; - json << fmt::format(replStr, "module", escapedJson(license.module)); - json << fmt::format(replStr, "name", escapedJson(license.name)); - json << fmt::format(replStr, "attribution", escapedJson(license.attribution)); - json << fmt::format(replStr, "url", escapedJson(license.url)); - json << fmt::format(replStr2, "licenseText", escapedJson(license.licenseText)); + //json << fmt::format(replStr, "module", escapedJson(license.module)); + json << fmt::format(replStr, "name", escapedJson(meta->name)); + json << fmt::format(replStr, "version", escapedJson(meta->version)); + json << fmt::format(replStr, "description", escapedJson(meta->description)); + //json << fmt::format(replStr, "attribution", escapedJson(license.attribution)); + json << fmt::format(replStr, "author", escapedJson(meta->author)); + json << fmt::format(replStr, "url", escapedJson(meta->url)); + //json << fmt::format(replStr2, "licenseText", escapedJson(license.licenseText)); + json << fmt::format(replStr2, "license", escapedJson(meta->license)); json << "}"; - if (&license != &(_licenses.back())) { + if (&asset != &(assets.back())) { json << ","; } } From fa56e9ecf44bcb325919b7049d711591a86a5649 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Wed, 6 May 2020 16:21:47 +0200 Subject: [PATCH 05/48] Some more cleanup of the assets --- include/openspace/scene/asset.h | 2 +- include/openspace/scene/assetlistener.h | 7 +- include/openspace/scene/assetloader.h | 15 +- include/openspace/scene/assetmanager.h | 8 +- .../openspace/util/synchronizationwatcher.h | 1 - modules/sync/tasks/syncassettask.cpp | 19 --- src/scene/assetloader.cpp | 145 ++++++++---------- src/scene/assetloader_lua.inl | 4 - src/util/synchronizationwatcher.cpp | 13 +- 9 files changed, 78 insertions(+), 136 deletions(-) diff --git a/include/openspace/scene/asset.h b/include/openspace/scene/asset.h index 4a842c4c1f..94e9600697 100644 --- a/include/openspace/scene/asset.h +++ b/include/openspace/scene/asset.h @@ -38,7 +38,7 @@ class AssetLoader; class Asset : public std::enable_shared_from_this { public: - enum class State : unsigned int { + enum class State { Unloaded, LoadingFailed, Loaded, diff --git a/include/openspace/scene/assetlistener.h b/include/openspace/scene/assetlistener.h index b507c82f23..62041a919f 100644 --- a/include/openspace/scene/assetlistener.h +++ b/include/openspace/scene/assetlistener.h @@ -33,11 +33,8 @@ class AssetListener { public: virtual ~AssetListener() = default; virtual void assetStateChanged(Asset* asset, Asset::State state) = 0; - virtual void assetRequested(Asset* parent, - std::shared_ptr child) = 0; - - virtual void assetUnrequested(Asset* parent, - std::shared_ptr child) = 0; + virtual void assetRequested(Asset* parent, std::shared_ptr child) = 0; + virtual void assetUnrequested(Asset* parent, std::shared_ptr child) = 0; }; } // namespace openspace diff --git a/include/openspace/scene/assetloader.h b/include/openspace/scene/assetloader.h index 0f6ad9bbee..e2da7ac1bc 100644 --- a/include/openspace/scene/assetloader.h +++ b/include/openspace/scene/assetloader.h @@ -87,15 +87,10 @@ public: void untrackAsset(Asset* asset); /** - * Return the asset identified by the identifier, - * if the asset is tracked. Otherwise return nullptr. - */ - std::shared_ptr has(const std::string& identifier) const; - - /** - * Return the lua state + * Return the asset identified by the identifier, + * if the asset is tracked. Otherwise return nullptr. */ - ghoul::lua::LuaState* luaState(); + std::shared_ptr has(const std::string& identifier) const; /** * Return the root asset @@ -103,8 +98,8 @@ public: std::shared_ptr rootAsset() const; /** - * Return the asset root directory - */ + * Return the asset root directory + */ const std::string& assetRootDirectory() const; /** diff --git a/include/openspace/scene/assetmanager.h b/include/openspace/scene/assetmanager.h index 42d6b311c8..91addbc4ef 100644 --- a/include/openspace/scene/assetmanager.h +++ b/include/openspace/scene/assetmanager.h @@ -61,11 +61,9 @@ public: void removeAll(); std::shared_ptr rootAsset(); - void assetStateChanged(Asset* asset, Asset::State state) override; - void assetRequested(Asset* parent, - std::shared_ptr child) override; - void assetUnrequested(Asset* parent, - std::shared_ptr child) override; + void assetStateChanged(Asset* asset, Asset::State state); + void assetRequested(Asset* parent, std::shared_ptr child); + void assetUnrequested(Asset* parent, std::shared_ptr child); bool update(); scripting::LuaLibrary luaLibrary(); diff --git a/include/openspace/util/synchronizationwatcher.h b/include/openspace/util/synchronizationwatcher.h index fe8bac8e40..2e3632de66 100644 --- a/include/openspace/util/synchronizationwatcher.h +++ b/include/openspace/util/synchronizationwatcher.h @@ -69,7 +69,6 @@ public: void notify(); private: - WatchHandle generateWatchHandle(); std::mutex _mutex; std::unordered_map _watchedSyncs; std::vector _pendingNotifications; diff --git a/modules/sync/tasks/syncassettask.cpp b/modules/sync/tasks/syncassettask.cpp index 2e23c5e61b..96ef7bc3a1 100644 --- a/modules/sync/tasks/syncassettask.cpp +++ b/modules/sync/tasks/syncassettask.cpp @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include @@ -74,21 +73,6 @@ documentation::Documentation SyncAssetTask::documentation() { }; } -class RequestListener : public AssetListener { -public: - virtual ~RequestListener() = default; - void assetStateChanged(Asset* asset, Asset::State state) override { - if (state == Asset::State::LoadingFailed) { - LERROR(fmt::format("Failed to load asset: {}", asset->id())); - } - if (state == Asset::State::SyncRejected) { - LERROR(fmt::format("Failed to sync asset: {}", asset->id())); - } - } - void assetRequested(Asset*, std::shared_ptr) override {}; - void assetUnrequested(Asset*, std::shared_ptr) override {}; -}; - SyncAssetTask::SyncAssetTask(const ghoul::Dictionary& dictionary) { documentation::testSpecificationAndThrow( documentation(), @@ -125,9 +109,6 @@ void SyncAssetTask::perform(const Task::ProgressCallback& progressCallback) { AssetLoader loader(&luaState, &watcher, "${ASSETS}"); - RequestListener listener; - loader.addAssetListener(&listener); - loader.add(_asset); loader.rootAsset()->startSynchronizations(); diff --git a/src/scene/assetloader.cpp b/src/scene/assetloader.cpp index e360f20f5a..66c2d6fde1 100644 --- a/src/scene/assetloader.cpp +++ b/src/scene/assetloader.cpp @@ -72,7 +72,7 @@ namespace { constexpr const char* AssetFileSuffix = "asset"; constexpr const char* SceneFileSuffix = "scene"; - enum class PathType : int { + enum class PathType { RelativeToAsset = 0, RelativeToAssetRoot, Absolute @@ -132,37 +132,35 @@ void AssetLoader::untrackAsset(Asset* asset) { } void AssetLoader::setUpAssetLuaTable(Asset* asset) { - /* - Set up lua table: - AssetInfo - |- Exports (table) - |- Asset - | |- localResource - | |- syncedResource - | |- require - | |- request - | |- exists - | |- export - | |- onInitialize - | |- onDeinitialize - | |- directory - |- Dependants (table) + // Set up lua table: + // AssetInfo + // |- Exports (table) + // |- Asset + // | |- localResource + // | |- syncedResource + // | |- require + // | |- request + // | |- exists + // | |- export + // | |- onInitialize + // | |- onDeinitialize + // | |- directory + // |- Dependants (table) + // + // where Dependency is a table: + // Dependency + // |- onInitialize + // |- onDeinitialize - where Dependency is a table: - Dependency - |- onInitialize - |- onDeinitialize - */ - - int top = lua_gettop(*_luaState); + const int top = lua_gettop(*_luaState); // Push the global table of AssetInfos to the lua stack. lua_rawgeti(*_luaState, LUA_REGISTRYINDEX, _assetsTableRef); - int globalTableIndex = lua_gettop(*_luaState); + const int globalTableIndex = lua_gettop(*_luaState); // Create a AssetInfo table for the current asset. lua_newtable(*_luaState); - int assetInfoTableIndex = lua_gettop(*_luaState); + const int assetInfoTableIndex = lua_gettop(*_luaState); // Register empty Exports table for the current asset. // (string => exported object) @@ -172,7 +170,7 @@ void AssetLoader::setUpAssetLuaTable(Asset* asset) { // Create Asset table // (string => lua functions) lua_newtable(*_luaState); - int assetTableIndex = lua_gettop(*_luaState); + const int assetTableIndex = lua_gettop(*_luaState); // Register local resource function // string localResource(string path) @@ -199,7 +197,7 @@ void AssetLoader::setUpAssetLuaTable(Asset* asset) { lua_setfield(*_luaState, assetTableIndex, RequestFunctionName); // Register exists function - // bool exsists(string path) + // bool exists(string path) lua_pushlightuserdata(*_luaState, asset); lua_pushcclosure(*_luaState, &assetloader::exists, 1); lua_setfield(*_luaState, assetTableIndex, ExistsFunctionName); @@ -247,10 +245,10 @@ void AssetLoader::setUpAssetLuaTable(Asset* asset) { } void AssetLoader::tearDownAssetLuaTable(Asset* asset) { - int top = lua_gettop(*_luaState); + const int top = lua_gettop(*_luaState); // Push the global table of AssetInfos to the lua stack. lua_rawgeti(*_luaState, LUA_REGISTRYINDEX, _assetsTableRef); - int globalTableIndex = lua_gettop(*_luaState); + const int globalTableIndex = lua_gettop(*_luaState); lua_pushnil(*_luaState); @@ -260,7 +258,7 @@ void AssetLoader::tearDownAssetLuaTable(Asset* asset) { } bool AssetLoader::loadAsset(Asset* asset) { - int top = lua_gettop(*_luaState); + const int top = lua_gettop(*_luaState); Asset* parentAsset = _currentAsset; setCurrentAsset(asset); @@ -372,37 +370,32 @@ std::string AssetLoader::generateAssetPath(const std::string& baseDirectory, // Construct the full path including the .asset extension std::string assetSuffix = std::string(".") + AssetFileSuffix; - bool hasAssetSuffix = + const bool hasAssetSuffix = (assetPath.size() > assetSuffix.size()) && (assetPath.substr(assetPath.size() - assetSuffix.size()) == assetSuffix); - std::string fullAssetPath = + const std::string fullAssetPath = hasAssetSuffix ? prefix + assetPath : prefix + assetPath + assetSuffix; bool fullAssetPathExists = FileSys.fileExists(FileSys.absPath(fullAssetPath)); // Construct the full path including the .scene extension - std::string sceneSuffix = std::string(".") + SceneFileSuffix; - bool hasSceneSuffix = + const std::string sceneSuffix = std::string(".") + SceneFileSuffix; + const bool hasSceneSuffix = (assetPath.size() > sceneSuffix.size()) && (assetPath.substr(assetPath.size() - sceneSuffix.size()) == sceneSuffix); - std::string fullScenePath = + const std::string fullScenePath = hasSceneSuffix ? prefix + assetPath : prefix + assetPath + sceneSuffix; - bool fullScenePathExists = FileSys.fileExists(FileSys.absPath(fullScenePath)); + const bool fullScenePathExists = FileSys.fileExists(FileSys.absPath(fullScenePath)); if (fullAssetPathExists && fullScenePathExists) { - LWARNING( - fmt::format( - "'{}' and '{}' file found with non-specific request '{}'. Loading '{}'. " - "Explicitly add extension to suppress this warning.", - fullAssetPath, - fullScenePath, - prefix + assetPath, - fullAssetPath - ) - ); + LWARNING(fmt::format( + "'{}' and '{}' file found with non-specific request '{}'. Loading '{}'. " + "Explicitly add extension to suppress this warning.", + fullAssetPath, fullScenePath, prefix + assetPath, fullAssetPath + )); return ghoul::filesystem::File(FileSys.absPath(fullAssetPath)); } @@ -418,14 +411,13 @@ std::string AssetLoader::generateAssetPath(const std::string& baseDirectory, std::shared_ptr AssetLoader::getAsset(const std::string& name) { ghoul::filesystem::Directory directory = currentDirectory(); - std::string path = generateAssetPath(directory, name); + const std::string path = generateAssetPath(directory, name); // Check if asset is already loaded. const auto it = _trackedAssets.find(path); if (it != _trackedAssets.end()) { - std::shared_ptr a = it->second.lock(); - if (a != nullptr) { + if (std::shared_ptr a = it->second.lock(); a != nullptr) { return a; } } @@ -443,7 +435,7 @@ std::shared_ptr AssetLoader::getAsset(const std::string& name) { int AssetLoader::onInitializeLua(Asset* asset) { ghoul::lua::checkArgumentsAndThrow(*_luaState, 1, "lua::onInitialize"); - int referenceIndex = luaL_ref(*_luaState, LUA_REGISTRYINDEX); + const int referenceIndex = luaL_ref(*_luaState, LUA_REGISTRYINDEX); _onInitializationFunctionRefs[asset].push_back(referenceIndex); lua_settop(*_luaState, 0); @@ -453,7 +445,7 @@ int AssetLoader::onInitializeLua(Asset* asset) { int AssetLoader::onDeinitializeLua(Asset* asset) { ghoul::lua::checkArgumentsAndThrow(*_luaState, 1, "lua::onDeinitialize"); - int referenceIndex = luaL_ref(*_luaState, LUA_REGISTRYINDEX); + const int referenceIndex = luaL_ref(*_luaState, LUA_REGISTRYINDEX); _onDeinitializationFunctionRefs[asset].push_back(referenceIndex); lua_settop(*_luaState, 0); @@ -463,9 +455,8 @@ int AssetLoader::onDeinitializeLua(Asset* asset) { int AssetLoader::onInitializeDependencyLua(Asset* dependant, Asset* dependency) { ghoul::lua::checkArgumentsAndThrow(*_luaState, 1, "lua::onInitializeDependency"); - int referenceIndex = luaL_ref(*_luaState, LUA_REGISTRYINDEX); - _onDependencyInitializationFunctionRefs[dependant][dependency] - .push_back(referenceIndex); + const int refIndex = luaL_ref(*_luaState, LUA_REGISTRYINDEX); + _onDependencyInitializationFunctionRefs[dependant][dependency].push_back(refIndex); lua_settop(*_luaState, 0); return 0; @@ -474,9 +465,8 @@ int AssetLoader::onInitializeDependencyLua(Asset* dependant, Asset* dependency) int AssetLoader::onDeinitializeDependencyLua(Asset* dependant, Asset* dependency) { ghoul::lua::checkArgumentsAndThrow(*_luaState, 1, "lua::onDeinitializeDependency"); - int referenceIndex = luaL_ref(*_luaState, LUA_REGISTRYINDEX); - _onDependencyDeinitializationFunctionRefs[dependant][dependency] - .push_back(referenceIndex); + const int refIndex = luaL_ref(*_luaState, LUA_REGISTRYINDEX); + _onDependencyDeinitializationFunctionRefs[dependant][dependency].push_back(refIndex); lua_settop(*_luaState, 0); return 0; @@ -484,8 +474,7 @@ int AssetLoader::onDeinitializeDependencyLua(Asset* dependant, Asset* dependency std::shared_ptr AssetLoader::require(const std::string& identifier) { std::shared_ptr asset = getAsset(identifier); - Asset* dependant = _currentAsset; - dependant->require(asset); + _currentAsset->require(asset); return asset; } @@ -518,7 +507,6 @@ std::shared_ptr AssetLoader::add(const std::string& identifier) { return request(identifier); } - void AssetLoader::remove(const std::string& identifier) { setCurrentAsset(_rootAsset.get()); unrequest(identifier); @@ -535,10 +523,6 @@ std::shared_ptr AssetLoader::has(const std::string& identifier) const { return it->second.lock(); } -ghoul::lua::LuaState* AssetLoader::luaState() { - return _luaState; -} - std::shared_ptr AssetLoader::rootAsset() const { return _rootAsset; } @@ -562,7 +546,7 @@ void AssetLoader::callOnInitialize(Asset* asset) { } void AssetLoader::callOnDeinitialize(Asset * asset) { - std::vector& funs = _onDeinitializationFunctionRefs[asset]; + const std::vector& funs = _onDeinitializationFunctionRefs[asset]; for (auto it = funs.rbegin(); it != funs.rend(); it++) { lua_rawgeti(*_luaState, LUA_REGISTRYINDEX, *it); if (lua_pcall(*_luaState, 0, 0, 0) != LUA_OK) { @@ -595,7 +579,9 @@ void AssetLoader::callOnDependencyInitialize(Asset* asset, Asset* dependant) { } void AssetLoader::callOnDependencyDeinitialize(Asset* asset, Asset* dependant) { - std::vector& funs = _onDependencyDeinitializationFunctionRefs[dependant][asset]; + const std::vector& funs = + _onDependencyDeinitializationFunctionRefs[dependant][asset]; + for (auto it = funs.rbegin(); it != funs.rend(); it++) { lua_rawgeti(*_luaState, LUA_REGISTRYINDEX, *it); if (lua_pcall(*_luaState, 0, 0, 0) != LUA_OK) { @@ -618,8 +604,7 @@ int AssetLoader::localResourceLua(Asset* asset) { 1, ghoul::lua::PopValue::Yes ); - std::string resolved = asset->resolveLocalResource(resourceName); - + const std::string resolved = asset->resolveLocalResource(resourceName); lua_pushstring(*_luaState, resolved.c_str()); ghoul_assert(lua_gettop(*_luaState) == 1, "Incorrect number of items left on stack"); @@ -635,7 +620,7 @@ int AssetLoader::syncedResourceLua(Asset* asset) { std::shared_ptr sync = ResourceSynchronization::createFromDictionary(d); - std::string absolutePath = sync->directory(); + const std::string absolutePath = sync->directory(); asset->addSynchronization(sync); @@ -647,7 +632,7 @@ int AssetLoader::syncedResourceLua(Asset* asset) { } void AssetLoader::setCurrentAsset(Asset* asset) { - int top = lua_gettop(*_luaState); + const int top = lua_gettop(*_luaState); _currentAsset = asset; // Set `asset` lua global to point to the current asset table @@ -688,14 +673,14 @@ int AssetLoader::requireLua(Asset* dependant) { lua_rawgeti(*_luaState, LUA_REGISTRYINDEX, _assetsTableRef); lua_getfield(*_luaState, -1, dependency->id().c_str()); lua_getfield(*_luaState, -1, ExportsTableName); - int exportsTableIndex = lua_gettop(*_luaState); + const int exportsTableIndex = lua_gettop(*_luaState); // Get the dependency table lua_rawgeti(*_luaState, LUA_REGISTRYINDEX, _assetsTableRef); lua_getfield(*_luaState, -1, dependency->id().c_str()); lua_getfield(*_luaState, -1, DependantsTableName); lua_getfield(*_luaState, -1, dependant->id().c_str()); - int dependencyTableIndex = lua_gettop(*_luaState); + const int dependencyTableIndex = lua_gettop(*_luaState); lua_pushvalue(*_luaState, exportsTableIndex); lua_pushvalue(*_luaState, dependencyTableIndex); @@ -711,7 +696,7 @@ int AssetLoader::requireLua(Asset* dependant) { int AssetLoader::requestLua(Asset* parent) { ghoul::lua::checkArgumentsAndThrow(*_luaState, 1, "lua::request"); - std::string assetName = luaL_checkstring(*_luaState, 1); + const std::string assetName = luaL_checkstring(*_luaState, 1); lua_settop(*_luaState, 0); std::shared_ptr child = request(assetName); @@ -723,7 +708,7 @@ int AssetLoader::requestLua(Asset* parent) { lua_getfield(*_luaState, -1, child->id().c_str()); lua_getfield(*_luaState, -1, DependantsTableName); lua_getfield(*_luaState, -1, parent->id().c_str()); - int dependencyTableIndex = lua_gettop(*_luaState); + const int dependencyTableIndex = lua_gettop(*_luaState); lua_pushvalue(*_luaState, dependencyTableIndex); @@ -737,10 +722,10 @@ int AssetLoader::requestLua(Asset* parent) { int AssetLoader::existsLua(Asset*) { ghoul::lua::checkArgumentsAndThrow(*_luaState, 1, "lua::exists"); - std::string assetName = luaL_checkstring(*_luaState, 1); + const std::string assetName = luaL_checkstring(*_luaState, 1); - ghoul::filesystem::Directory directory = currentDirectory(); - std::string path = generateAssetPath(directory, assetName); + const ghoul::filesystem::Directory directory = currentDirectory(); + const std::string path = generateAssetPath(directory, assetName); lua_settop(*_luaState, 0); lua_pushboolean(*_luaState, FileSys.fileExists(path)); @@ -751,12 +736,12 @@ int AssetLoader::existsLua(Asset*) { int AssetLoader::exportAssetLua(Asset* asset) { ghoul::lua::checkArgumentsAndThrow(*_luaState, 2, "lua::exportAsset"); - std::string exportName = luaL_checkstring(*_luaState, 1); + const std::string exportName = luaL_checkstring(*_luaState, 1); lua_rawgeti(*_luaState, LUA_REGISTRYINDEX, _assetsTableRef); lua_getfield(*_luaState, -1, asset->id().c_str()); lua_getfield(*_luaState, -1, ExportsTableName); - int exportsTableIndex = lua_gettop(*_luaState); + const int exportsTableIndex = lua_gettop(*_luaState); // push the second argument lua_pushvalue(*_luaState, 2); @@ -768,7 +753,7 @@ int AssetLoader::exportAssetLua(Asset* asset) { } void AssetLoader::addLuaDependencyTable(Asset* dependant, Asset* dependency) { - int top = lua_gettop(*_luaState); + const int top = lua_gettop(*_luaState); const std::string dependantId = dependant->id(); const std::string dependencyId = dependency->id(); diff --git a/src/scene/assetloader_lua.inl b/src/scene/assetloader_lua.inl index 347b7c98cd..15b223f1e6 100644 --- a/src/scene/assetloader_lua.inl +++ b/src/scene/assetloader_lua.inl @@ -108,10 +108,6 @@ int syncedResource(lua_State* state) { return asset->loader()->syncedResourceLua(asset); } -int noOperation(lua_State*) { - return 0; -} - int exportAsset(lua_State* state) { Asset* asset = reinterpret_cast(lua_touserdata(state, lua_upvalueindex(1))); return asset->loader()->exportAssetLua(asset); diff --git a/src/util/synchronizationwatcher.cpp b/src/util/synchronizationwatcher.cpp index 1cf518f3ad..86db87b078 100644 --- a/src/util/synchronizationwatcher.cpp +++ b/src/util/synchronizationwatcher.cpp @@ -34,19 +34,14 @@ SynchronizationWatcher::WatchHandle SynchronizationWatcher::watchSynchronization { std::lock_guard guard(_mutex); - WatchHandle watchHandle = generateWatchHandle(); + WatchHandle watchHandle = nextWatchHandle++; ResourceSynchronization::CallbackHandle cbh = synchronization->addStateChangeCallback( [this, synchronization, watchHandle, cb = std::move(callback)] (ResourceSynchronization::State state) { std::lock_guard g(_mutex); - _pendingNotifications.push_back({ - synchronization, - state, - watchHandle, - cb - }); + _pendingNotifications.push_back({ synchronization, state, watchHandle, cb }); } ); @@ -98,8 +93,4 @@ void SynchronizationWatcher::notify() { } } -SynchronizationWatcher::WatchHandle SynchronizationWatcher::generateWatchHandle() { - return nextWatchHandle++; -} - } // namespace openspace From 01f0a864dc312c19185f67937244def2027dfd29 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Wed, 6 May 2020 20:33:27 +0200 Subject: [PATCH 06/48] Yet more cleanup of Asset-related files --- include/openspace/scene/asset.h | 3 +- .../openspace/util/resourcesynchronization.h | 6 +-- .../openspace/util/synchronizationwatcher.h | 6 --- modules/imgui/src/guiassetcomponent.cpp | 4 +- src/engine/openspaceengine.cpp | 7 ++-- src/scene/asset.cpp | 38 ++++++++++--------- src/util/resourcesynchronization.cpp | 6 +-- 7 files changed, 33 insertions(+), 37 deletions(-) diff --git a/include/openspace/scene/asset.h b/include/openspace/scene/asset.h index 94e9600697..b7b7793b49 100644 --- a/include/openspace/scene/asset.h +++ b/include/openspace/scene/asset.h @@ -81,8 +81,7 @@ public: void addSynchronization(std::shared_ptr synchronization); void clearSynchronizations(); - const std::vector>& - ownSynchronizations() const; + std::vector ownSynchronizations() const; void syncStateChanged(ResourceSynchronization* sync, ResourceSynchronization::State state); diff --git a/include/openspace/util/resourcesynchronization.h b/include/openspace/util/resourcesynchronization.h index 605f049dc1..9a96ea6d2c 100644 --- a/include/openspace/util/resourcesynchronization.h +++ b/include/openspace/util/resourcesynchronization.h @@ -68,9 +68,9 @@ public: State state() const; const std::string& name() const; - bool isResolved(); - bool isRejected(); - bool isSyncing(); + bool isResolved() const; + bool isRejected() const; + bool isSyncing() const; CallbackHandle addStateChangeCallback(StateChangeCallback cb); void removeStateChangeCallback(CallbackHandle id); diff --git a/include/openspace/util/synchronizationwatcher.h b/include/openspace/util/synchronizationwatcher.h index 2e3632de66..d830218cb8 100644 --- a/include/openspace/util/synchronizationwatcher.h +++ b/include/openspace/util/synchronizationwatcher.h @@ -53,12 +53,6 @@ public: ResourceSynchronization::StateChangeCallback callback; }; - /*using SyncStateChangeCallback = - std::function, - ResourceSynchronization::State - )>;*/ - WatchHandle watchSynchronization( std::shared_ptr synchronization, ResourceSynchronization::StateChangeCallback callback diff --git a/modules/imgui/src/guiassetcomponent.cpp b/modules/imgui/src/guiassetcomponent.cpp index 34fb9d629a..35d8a60317 100644 --- a/modules/imgui/src/guiassetcomponent.cpp +++ b/modules/imgui/src/guiassetcomponent.cpp @@ -107,7 +107,7 @@ void GuiAssetComponent::renderTree(const Asset& asset, const std::string& relati const std::vector>& requested = asset.requestedAssets(); const std::vector>& required = asset.requiredAssets(); - const std::vector>& resourceSyncs = + const std::vector& resourceSyncs = asset.ownSynchronizations(); if (requested.empty() && required.empty() && resourceSyncs.empty()) { @@ -126,7 +126,7 @@ void GuiAssetComponent::renderTree(const Asset& asset, const std::string& relati } if (!resourceSyncs.empty() && ImGui::TreeNode("Resource Synchronizations")) { - for (const std::shared_ptr& sync : resourceSyncs) { + for (ResourceSynchronization* sync : resourceSyncs) { std::string resourceText = sync->directory() + " " + syncStateToString(sync->state()); if (sync->state() == ResourceSynchronization::State::Syncing) { diff --git a/src/engine/openspaceengine.cpp b/src/engine/openspaceengine.cpp index 0cfe7c1295..66c45fec15 100644 --- a/src/engine/openspaceengine.cpp +++ b/src/engine/openspaceengine.cpp @@ -762,12 +762,11 @@ void OpenSpaceEngine::loadSingleAsset(const std::string& assetPath) { std::vector> allAssets = _assetManager->rootAsset()->subTreeAssets(); - std::unordered_set> resourceSyncs; + std::unordered_set resourceSyncs; for (const std::shared_ptr& a : allAssets) { - std::vector> syncs = - a->ownSynchronizations(); + std::vector syncs = a->ownSynchronizations(); - for (const std::shared_ptr& s : syncs) { + for (ResourceSynchronization* s : syncs) { ZoneScopedN("Update resource synchronization") if (s->state() == ResourceSynchronization::State::Syncing) { diff --git a/src/scene/asset.cpp b/src/scene/asset.cpp index 242f0029ef..4a5a9bad0c 100644 --- a/src/scene/asset.cpp +++ b/src/scene/asset.cpp @@ -33,19 +33,19 @@ #include #include +namespace openspace { + namespace { constexpr const char* _loggerCat = "Asset"; - float syncProgress(const std::vector>& assets) - { + float syncProgress(const std::vector>& assets) { size_t nTotalBytes = 0; size_t nSyncedBytes = 0; - for (const std::shared_ptr& a : assets) { - const std::vector>& s = - a->ownSynchronizations(); + for (const std::shared_ptr& a : assets) { + const std::vector& s = a->ownSynchronizations(); - for (const std::shared_ptr& sync : s) { + for (ResourceSynchronization* sync : s) { if (sync->nTotalBytesIsKnown()) { nTotalBytes += sync->nTotalBytes(); nSyncedBytes += sync->nSynchronizedBytes(); @@ -64,7 +64,6 @@ namespace { } } // namespace -namespace openspace { Asset::Asset(AssetLoader* loader, SynchronizationWatcher* watcher) : _state(State::SyncResolved) @@ -221,23 +220,28 @@ bool Asset::isSyncResolveReady() { return false; } - const std::vector>& syncs = - ownSynchronizations(); + const std::vector& syncs = ownSynchronizations(); auto unresolvedOwnSynchronization = std::find_if( syncs.cbegin(), syncs.cend(), - [](const std::shared_ptr& s) { return !s->isResolved(); } + [](ResourceSynchronization* s) { return !s->isResolved(); } ); // To be considered resolved, all own synchronizations need to be resolved return unresolvedOwnSynchronization == syncs.cend(); } -const std::vector>& -Asset::ownSynchronizations() const -{ - return _synchronizations; +std::vector Asset::ownSynchronizations() const { + std::vector res; + res.reserve(_synchronizations.size()); + std::transform( + _synchronizations.begin(), _synchronizations.end(), + std::back_inserter(res), + std::mem_fn(&std::shared_ptr::get) + ); + + return res; } std::vector> Asset::subTreeAssets() const { @@ -389,7 +393,7 @@ bool Asset::startSynchronizations() { } // Now synchronize its own synchronizations - for (const std::shared_ptr& s : ownSynchronizations()) { + for (ResourceSynchronization* s : ownSynchronizations()) { if (!s->isResolved()) { s->start(); } @@ -411,7 +415,7 @@ bool Asset::cancelAllSynchronizations() { } ); - for (const std::shared_ptr& s : ownSynchronizations()) { + for (ResourceSynchronization* s : ownSynchronizations()) { if (s->isSyncing()) { cancelledAnySync = true; s->cancel(); @@ -438,7 +442,7 @@ bool Asset::cancelUnwantedSynchronizations() { } ); - for (const std::shared_ptr& s : ownSynchronizations()) { + for (ResourceSynchronization* s : ownSynchronizations()) { if (s->isSyncing()) { cancelledAnySync = true; s->cancel(); diff --git a/src/util/resourcesynchronization.cpp b/src/util/resourcesynchronization.cpp index 2fb379ce09..7199b7a82a 100644 --- a/src/util/resourcesynchronization.cpp +++ b/src/util/resourcesynchronization.cpp @@ -95,15 +95,15 @@ ResourceSynchronization::State ResourceSynchronization::state() const { return _state; } -bool ResourceSynchronization::isResolved() { +bool ResourceSynchronization::isResolved() const { return _state == State::Resolved; } -bool ResourceSynchronization::isRejected() { +bool ResourceSynchronization::isRejected() const { return _state == State::Rejected; } -bool ResourceSynchronization::isSyncing() { +bool ResourceSynchronization::isSyncing() const { return _state == State::Syncing; } From 340444ce0d92a32029996eb5bce11ff53a52908e Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Wed, 6 May 2020 21:40:23 +0200 Subject: [PATCH 07/48] Cleanup AssetManager class --- ext/ghoul | 2 +- include/openspace/scene/assetloader.h | 13 +++++---- include/openspace/scene/assetmanager.h | 22 +++++++------- modules/imgui/src/guiassetcomponent.cpp | 2 +- modules/sync/tasks/syncassettask.cpp | 6 ++-- src/engine/openspaceengine.cpp | 14 ++------- src/scene/assetloader.cpp | 16 +++++++---- src/scene/assetmanager.cpp | 38 ++++++++++++------------- src/scene/scenelicensewriter.cpp | 2 +- src/util/synchronizationwatcher.cpp | 6 ++-- 10 files changed, 60 insertions(+), 61 deletions(-) diff --git a/ext/ghoul b/ext/ghoul index df1522a1fe..767fa3e42e 160000 --- a/ext/ghoul +++ b/ext/ghoul @@ -1 +1 @@ -Subproject commit df1522a1fe6f02b4d03cd36478d9d36f4384e93e +Subproject commit 767fa3e42e1831ade7deb5b4b099c2c5a823c9f9 diff --git a/include/openspace/scene/assetloader.h b/include/openspace/scene/assetloader.h index e2da7ac1bc..29b114076c 100644 --- a/include/openspace/scene/assetloader.h +++ b/include/openspace/scene/assetloader.h @@ -55,9 +55,9 @@ int exportAsset(lua_State* state); } // namespace assetloader class Asset; +class AssetListener; class ResourceSynchronization; class SynchronizationWatcher; -class AssetListener; class AssetLoader { public: @@ -92,10 +92,11 @@ public: */ std::shared_ptr has(const std::string& identifier) const; - /** - * Return the root asset - */ - std::shared_ptr rootAsset() const; + /// Return the root asset + const Asset& rootAsset() const; + + /// Return the root asset + Asset& rootAsset(); /** * Return the asset root directory @@ -190,7 +191,7 @@ private: int syncedResourceLua(Asset* asset); int exportAssetLua(Asset* asset); - // Friend c closures (callable from lua, and maps to lua functions above) + // Friend C closures (callable from Lua, and maps to Lua functions above) friend int assetloader::onInitialize(lua_State* state); friend int assetloader::onDeinitialize(lua_State* state); friend int assetloader::onInitializeDependency(lua_State* state); diff --git a/include/openspace/scene/assetmanager.h b/include/openspace/scene/assetmanager.h index 91addbc4ef..8ed157d56d 100644 --- a/include/openspace/scene/assetmanager.h +++ b/include/openspace/scene/assetmanager.h @@ -27,9 +27,12 @@ #include +#include +#include +#include #include -#include #include +#include namespace openspace { @@ -46,11 +49,9 @@ class SynchronizationWatcher; * synchronized. Also, setting a target state of an asset to Unloaded will only unload an * asset from the system if it is not a dependency of a loaded asset. */ - class AssetManager : AssetListener { public: - AssetManager(std::unique_ptr loader, - std::unique_ptr syncWatcher); + AssetManager(ghoul::lua::LuaState* state, std::string assetRootDirectory); virtual ~AssetManager() = default; @@ -59,11 +60,12 @@ public: void add(const std::string& path); void remove(const std::string& path); void removeAll(); - std::shared_ptr rootAsset(); + const Asset& rootAsset() const; + Asset& rootAsset(); - void assetStateChanged(Asset* asset, Asset::State state); - void assetRequested(Asset* parent, std::shared_ptr child); - void assetUnrequested(Asset* parent, std::shared_ptr child); + void assetStateChanged(Asset* asset, Asset::State state) override; + void assetRequested(Asset* parent, std::shared_ptr child) override; + void assetUnrequested(Asset* parent, std::shared_ptr child) override; bool update(); scripting::LuaLibrary luaLibrary(); @@ -73,8 +75,8 @@ private: std::mutex _pendingInitializationsMutex; std::vector> _pendingInitializations; - std::unique_ptr _synchronizationWatcher; - std::unique_ptr _assetLoader; + SynchronizationWatcher _synchronizationWatcher; + AssetLoader _assetLoader; }; } // namespace openspace diff --git a/modules/imgui/src/guiassetcomponent.cpp b/modules/imgui/src/guiassetcomponent.cpp index 35d8a60317..9e9be668e7 100644 --- a/modules/imgui/src/guiassetcomponent.cpp +++ b/modules/imgui/src/guiassetcomponent.cpp @@ -79,7 +79,7 @@ void GuiAssetComponent::render() { std::string rootPath; - for (const std::shared_ptr& a : assetManager.rootAsset()->childAssets()) { + for (const std::shared_ptr& a : assetManager.rootAsset().childAssets()) { renderTree(*a, rootPath); } diff --git a/modules/sync/tasks/syncassettask.cpp b/modules/sync/tasks/syncassettask.cpp index 96ef7bc3a1..2822b09651 100644 --- a/modules/sync/tasks/syncassettask.cpp +++ b/modules/sync/tasks/syncassettask.cpp @@ -110,10 +110,10 @@ void SyncAssetTask::perform(const Task::ProgressCallback& progressCallback) { AssetLoader loader(&luaState, &watcher, "${ASSETS}"); loader.add(_asset); - loader.rootAsset()->startSynchronizations(); + loader.rootAsset().startSynchronizations(); std::vector> allAssets = - loader.rootAsset()->subTreeAssets(); + loader.rootAsset().subTreeAssets(); while (true) { bool inProgress = false; @@ -126,7 +126,7 @@ void SyncAssetTask::perform(const Task::ProgressCallback& progressCallback) { inProgress = true; } } - progressCallback(loader.rootAsset()->requestedSynchronizationProgress()); + progressCallback(loader.rootAsset().requestedSynchronizationProgress()); std::this_thread::sleep_for(ProgressPollInterval); watcher.notify(); if (!inProgress) { diff --git a/src/engine/openspaceengine.cpp b/src/engine/openspaceengine.cpp index 66c45fec15..42c7a7e5e8 100644 --- a/src/engine/openspaceengine.cpp +++ b/src/engine/openspaceengine.cpp @@ -341,17 +341,9 @@ void OpenSpaceEngine::initialize() { } // Set up asset loader - std::unique_ptr w = - std::make_unique(); - SynchronizationWatcher* rawWatcher = w.get(); - global::openSpaceEngine._assetManager = std::make_unique( - std::make_unique( - global::scriptEngine.luaState(), - rawWatcher, - FileSys.absPath("${ASSETS}") - ), - std::move(w) + global::scriptEngine.luaState(), + FileSys.absPath("${ASSETS}") ); global::scriptEngine.addLibrary(global::openSpaceEngine._assetManager->luaLibrary()); @@ -760,7 +752,7 @@ void OpenSpaceEngine::loadSingleAsset(const std::string& assetPath) { _loadingScreen->postMessage("Synchronizing assets"); std::vector> allAssets = - _assetManager->rootAsset()->subTreeAssets(); + _assetManager->rootAsset().subTreeAssets(); std::unordered_set resourceSyncs; for (const std::shared_ptr& a : allAssets) { diff --git a/src/scene/assetloader.cpp b/src/scene/assetloader.cpp index 66c2d6fde1..b35aacad8b 100644 --- a/src/scene/assetloader.cpp +++ b/src/scene/assetloader.cpp @@ -107,7 +107,7 @@ AssetLoader::AssetLoader(ghoul::lua::LuaState* luaState, { setCurrentAsset(_rootAsset.get()); - // Create _assets table. + // Create _assets table lua_newtable(*_luaState); _assetsTableRef = luaL_ref(*_luaState, LUA_REGISTRYINDEX); } @@ -397,16 +397,16 @@ std::string AssetLoader::generateAssetPath(const std::string& baseDirectory, fullAssetPath, fullScenePath, prefix + assetPath, fullAssetPath )); - return ghoul::filesystem::File(FileSys.absPath(fullAssetPath)); + return FileSys.absPath(fullAssetPath); } if (fullScenePathExists) { - return ghoul::filesystem::File(FileSys.absPath(fullScenePath)); + return FileSys.absPath(fullScenePath); } // We don't check whether the file exists here as the error will be more // comprehensively logged by Lua either way - return ghoul::filesystem::File(FileSys.absPath(fullAssetPath)); + return FileSys.absPath(fullAssetPath); } std::shared_ptr AssetLoader::getAsset(const std::string& name) { @@ -523,8 +523,12 @@ std::shared_ptr AssetLoader::has(const std::string& identifier) const { return it->second.lock(); } -std::shared_ptr AssetLoader::rootAsset() const { - return _rootAsset; +const Asset& AssetLoader::rootAsset() const { + return *_rootAsset; +} + +Asset& AssetLoader::rootAsset() { + return *_rootAsset; } const std::string& AssetLoader::assetRootDirectory() const { diff --git a/src/scene/assetmanager.cpp b/src/scene/assetmanager.cpp index 18d9089a2f..a1540deebe 100644 --- a/src/scene/assetmanager.cpp +++ b/src/scene/assetmanager.cpp @@ -36,23 +36,19 @@ namespace openspace { -AssetManager::AssetManager(std::unique_ptr loader, - std::unique_ptr syncWatcher) - : _synchronizationWatcher(std::move(syncWatcher)) - , _assetLoader(std::move(loader)) +AssetManager::AssetManager(ghoul::lua::LuaState* state, std::string assetRootDirectory) + : _assetLoader(state, &_synchronizationWatcher, std::move(assetRootDirectory)) {} void AssetManager::initialize() { - _assetLoader->addAssetListener(this); - std::shared_ptr rootAsset = _assetLoader->rootAsset(); - rootAsset->initialize(); + _assetLoader.addAssetListener(this); + _assetLoader.rootAsset().initialize(); } void AssetManager::deinitialize() { - _assetLoader->rootAsset()->deinitialize(); - _assetLoader->rootAsset()->unload(); - _assetLoader->removeAssetListener(this); - _assetLoader = nullptr; + _assetLoader.rootAsset().deinitialize(); + _assetLoader.rootAsset().unload(); + _assetLoader.removeAssetListener(this); } bool AssetManager::update() { @@ -63,21 +59,21 @@ bool AssetManager::update() { const std::string& path = c.first; const bool add = c.second; if (add) { - _assetLoader->add(path); + _assetLoader.add(path); } } // Remove assets for (const std::pair& c : _pendingStateChangeCommands) { const std::string& path = c.first; const bool remove = !c.second; - if (remove && _assetLoader->has(path)) { - _assetLoader->remove(path); + if (remove && _assetLoader.has(path)) { + _assetLoader.remove(path); } } _pendingStateChangeCommands.clear(); // Change state based on synchronizations - _synchronizationWatcher->notify(); + _synchronizationWatcher.notify(); return false; } @@ -110,15 +106,19 @@ void AssetManager::removeAll() { _pendingStateChangeCommands.clear(); std::vector> allAssets = - _assetLoader->rootAsset()->requestedAssets(); + _assetLoader.rootAsset().requestedAssets(); for (const std::shared_ptr& a : allAssets) { _pendingStateChangeCommands[a->assetFilePath()] = false; } } -std::shared_ptr AssetManager::rootAsset() { - return _assetLoader->rootAsset(); +const Asset& AssetManager::rootAsset() const { + return _assetLoader.rootAsset(); +} + +Asset& AssetManager::rootAsset() { + return _assetLoader.rootAsset(); } scripting::LuaLibrary AssetManager::luaLibrary() { @@ -144,4 +144,4 @@ scripting::LuaLibrary AssetManager::luaLibrary() { }; } -} +} // namespace openspace diff --git a/src/scene/scenelicensewriter.cpp b/src/scene/scenelicensewriter.cpp index de546670bf..90319fe9d6 100644 --- a/src/scene/scenelicensewriter.cpp +++ b/src/scene/scenelicensewriter.cpp @@ -49,7 +49,7 @@ std::string SceneLicenseWriter::generateJson() const { json << "["; std::vector> assets = - global::openSpaceEngine.assetManager().rootAsset()->subTreeAssets(); + global::openSpaceEngine.assetManager().rootAsset().subTreeAssets(); for (const std::shared_ptr& asset : assets) { std::optional meta = asset->metaInformation(); diff --git a/src/util/synchronizationwatcher.cpp b/src/util/synchronizationwatcher.cpp index 86db87b078..2fe4377611 100644 --- a/src/util/synchronizationwatcher.cpp +++ b/src/util/synchronizationwatcher.cpp @@ -32,7 +32,7 @@ SynchronizationWatcher::WatchHandle SynchronizationWatcher::watchSynchronization std::shared_ptr synchronization, ResourceSynchronization::StateChangeCallback callback) { - std::lock_guard guard(_mutex); + std::lock_guard guard(_mutex); WatchHandle watchHandle = nextWatchHandle++; @@ -51,7 +51,7 @@ SynchronizationWatcher::WatchHandle SynchronizationWatcher::watchSynchronization } void SynchronizationWatcher::unwatchSynchronization(WatchHandle watchHandle) { - std::lock_guard guard(_mutex); + std::lock_guard guard(_mutex); const auto it = _watchedSyncs.find(watchHandle); if (it == _watchedSyncs.end()) { @@ -79,7 +79,7 @@ void SynchronizationWatcher::unwatchSynchronization(WatchHandle watchHandle) { void SynchronizationWatcher::notify() { std::vector notifications; { - std::lock_guard guard(_mutex); + std::lock_guard guard(_mutex); notifications = _pendingNotifications; _pendingNotifications.clear(); } From befef58e8073bcdf8bf27463d2b436869fb443b2 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Wed, 6 May 2020 21:54:02 +0200 Subject: [PATCH 08/48] More cleanup --- include/openspace/scene/assetloader.h | 2 +- modules/imgui/src/guiassetcomponent.cpp | 29 ++++++++++++------------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/include/openspace/scene/assetloader.h b/include/openspace/scene/assetloader.h index 29b114076c..f3d8977b2e 100644 --- a/include/openspace/scene/assetloader.h +++ b/include/openspace/scene/assetloader.h @@ -214,7 +214,7 @@ private: // State change listeners std::vector _assetListeners; - // References to lua values + // References to Lua values std::unordered_map> _onInitializationFunctionRefs; std::unordered_map> _onDeinitializationFunctionRefs; std::unordered_map>> diff --git a/modules/imgui/src/guiassetcomponent.cpp b/modules/imgui/src/guiassetcomponent.cpp index 9e9be668e7..3b190f40b7 100644 --- a/modules/imgui/src/guiassetcomponent.cpp +++ b/modules/imgui/src/guiassetcomponent.cpp @@ -39,14 +39,14 @@ namespace { using State = openspace::Asset::State; switch (state) { - case State::Loaded: return "Loaded"; - case State::LoadingFailed: return "LoadingFailed"; - case State::Synchronizing: return "Synchronizing"; - case State::SyncRejected: return "SyncRejected"; - case State::SyncResolved: return "SyncResolved"; - case State::Initialized: return "Initialized"; - case State::InitializationFailed: return "InitializationFailed"; - default: return "Unknown"; + case State::Loaded: return "Loaded"; + case State::LoadingFailed: return "LoadingFailed"; + case State::Synchronizing: return "Synchronizing"; + case State::SyncRejected: return "SyncRejected"; + case State::SyncResolved: return "SyncResolved"; + case State::Initialized: return "Initialized"; + case State::InitializationFailed: return "InitializationFailed"; + default: return "Unknown"; } } @@ -54,14 +54,14 @@ namespace { using State = openspace::ResourceSynchronization::State; switch (state) { - case State::Unsynced: return "Unsynced"; - case State::Syncing: return "Syncing"; - case State::Resolved: return "Resolved"; - case State::Rejected: return "Rejected"; - default: return "Unknown"; + case State::Unsynced: return "Unsynced"; + case State::Syncing: return "Syncing"; + case State::Resolved: return "Resolved"; + case State::Rejected: return "Rejected"; + default: return "Unknown"; } } -} +} // namespace namespace openspace::gui { @@ -69,7 +69,6 @@ GuiAssetComponent::GuiAssetComponent() : GuiComponent("Assets") {} - void GuiAssetComponent::render() { bool e = _isEnabled; ImGui::Begin("Assets", &e); From d3cce906c1e07392f42ef6214f8c32b0b01d5462 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Thu, 7 May 2020 13:08:34 +0200 Subject: [PATCH 09/48] Memory hygiene cleanup --- include/openspace/scene/asset.h | 2 +- include/openspace/scene/assetloader.h | 3 +-- src/scene/asset.cpp | 34 +++++++++++++-------------- src/scene/assetloader.cpp | 4 ++-- 4 files changed, 21 insertions(+), 22 deletions(-) diff --git a/include/openspace/scene/asset.h b/include/openspace/scene/asset.h index b7b7793b49..c27a142f98 100644 --- a/include/openspace/scene/asset.h +++ b/include/openspace/scene/asset.h @@ -79,7 +79,7 @@ public: AssetLoader* loader() const; State state() const; - void addSynchronization(std::shared_ptr synchronization); + void addSynchronization(std::unique_ptr synchronization); void clearSynchronizations(); std::vector ownSynchronizations() const; diff --git a/include/openspace/scene/assetloader.h b/include/openspace/scene/assetloader.h index f3d8977b2e..d404b1417d 100644 --- a/include/openspace/scene/assetloader.h +++ b/include/openspace/scene/assetloader.h @@ -54,7 +54,6 @@ int exportAsset(lua_State* state); } // namespace assetloader -class Asset; class AssetListener; class ResourceSynchronization; class SynchronizationWatcher; @@ -221,7 +220,7 @@ private: _onDependencyInitializationFunctionRefs; std::unordered_map>> _onDependencyDeinitializationFunctionRefs; - int _assetsTableRef; + int _assetsTableRef = 0; }; } // namespace openspace diff --git a/src/scene/asset.cpp b/src/scene/asset.cpp index 4a5a9bad0c..ef19dea0ba 100644 --- a/src/scene/asset.cpp +++ b/src/scene/asset.cpp @@ -164,8 +164,10 @@ void Asset::requestedAssetChangedState(Asset* child, Asset::State childState) { } } -void Asset::addSynchronization(std::shared_ptr synchronization) { - _synchronizations.push_back(synchronization); +void Asset::addSynchronization(std::unique_ptr synchronization) { + std::shared_ptr sync = std::move(synchronization); + + _synchronizations.push_back(sync); // Set up callback for synchronization state change // The synchronization watcher will make sure that callbacks @@ -173,9 +175,9 @@ void Asset::addSynchronization(std::shared_ptr synchron SynchronizationWatcher::WatchHandle watch = _synchronizationWatcher->watchSynchronization( - synchronization, - [this, synchronization](ResourceSynchronization::State state) { - syncStateChanged(synchronization.get(), state); + sync, + [this, sync](ResourceSynchronization::State state) { + syncStateChanged(sync.get(), state); } ); _syncWatches.push_back(watch); @@ -199,7 +201,7 @@ void Asset::syncStateChanged(ResourceSynchronization* sync, } else if (state == ResourceSynchronization::State::Rejected) { LERROR(fmt::format( - "Failed to synchronize resource '{}'' in asset '{}'", sync->name(), id() + "Failed to synchronize resource '{}' in asset '{}'", sync->name(), id() )); setState(State::SyncRejected); @@ -209,7 +211,7 @@ void Asset::syncStateChanged(ResourceSynchronization* sync, bool Asset::isSyncResolveReady() { std::vector> requiredAssets = this->requiredAssets(); - auto unsynchronizedAsset = std::find_if( + const auto unsynchronizedAsset = std::find_if( requiredAssets.cbegin(), requiredAssets.cend(), [](const std::shared_ptr& a) { return !a->isSynchronized(); } @@ -220,16 +222,14 @@ bool Asset::isSyncResolveReady() { return false; } - const std::vector& syncs = ownSynchronizations(); - - auto unresolvedOwnSynchronization = std::find_if( - syncs.cbegin(), - syncs.cend(), - [](ResourceSynchronization* s) { return !s->isResolved(); } + const auto unresolvedOwnSynchronization = std::find_if( + _synchronizations.cbegin(), + _synchronizations.cend(), + [](const std::shared_ptr& s) { return !s->isResolved(); } ); // To be considered resolved, all own synchronizations need to be resolved - return unresolvedOwnSynchronization == syncs.cend(); + return unresolvedOwnSynchronization == _synchronizations.cend(); } std::vector Asset::ownSynchronizations() const { @@ -393,7 +393,7 @@ bool Asset::startSynchronizations() { } // Now synchronize its own synchronizations - for (ResourceSynchronization* s : ownSynchronizations()) { + for (const std::shared_ptr& s : _synchronizations) { if (!s->isResolved()) { s->start(); } @@ -415,7 +415,7 @@ bool Asset::cancelAllSynchronizations() { } ); - for (ResourceSynchronization* s : ownSynchronizations()) { + for (const std::shared_ptr& s : _synchronizations) { if (s->isSyncing()) { cancelledAnySync = true; s->cancel(); @@ -442,7 +442,7 @@ bool Asset::cancelUnwantedSynchronizations() { } ); - for (ResourceSynchronization* s : ownSynchronizations()) { + for (const std::shared_ptr& s : _synchronizations) { if (s->isSyncing()) { cancelledAnySync = true; s->cancel(); diff --git a/src/scene/assetloader.cpp b/src/scene/assetloader.cpp index b35aacad8b..cd8b0d8077 100644 --- a/src/scene/assetloader.cpp +++ b/src/scene/assetloader.cpp @@ -621,12 +621,12 @@ int AssetLoader::syncedResourceLua(Asset* asset) { ghoul::Dictionary d; ghoul::lua::luaDictionaryFromState(*_luaState, d); - std::shared_ptr sync = + std::unique_ptr sync = ResourceSynchronization::createFromDictionary(d); const std::string absolutePath = sync->directory(); - asset->addSynchronization(sync); + asset->addSynchronization(std::move(sync)); lua_settop(*_luaState, 0); lua_pushstring(*_luaState, absolutePath.c_str()); From d1e5670ce5183fafc222c75e89be9056aa8dcd8e Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Sat, 9 May 2020 18:33:01 +0200 Subject: [PATCH 10/48] More cleanup of asset ownership --- include/openspace/scene/asset.h | 15 ++- modules/imgui/src/guiassetcomponent.cpp | 10 +- modules/sync/tasks/syncassettask.cpp | 5 +- src/engine/openspaceengine.cpp | 5 +- src/scene/asset.cpp | 139 +++++++++++++----------- src/scene/assetmanager.cpp | 5 +- src/scene/scenelicensewriter.cpp | 4 +- 7 files changed, 94 insertions(+), 89 deletions(-) diff --git a/include/openspace/scene/asset.h b/include/openspace/scene/asset.h index c27a142f98..25eb53860f 100644 --- a/include/openspace/scene/asset.h +++ b/include/openspace/scene/asset.h @@ -129,15 +129,14 @@ public: void request(std::shared_ptr child); void unrequest(Asset* child); - const std::vector>& requestedAssets() const; - std::vector> requestingAssets() const; - const std::vector>& requiredAssets() const; - std::vector> requiringAssets() const; + std::vector requestedAssets() const; + std::vector requestingAssets() const; + std::vector requiredAssets() const; + std::vector requiringAssets() const; - std::vector> requiredSubTreeAssets() const; - std::vector> subTreeAssets() const; - std::vector> childAssets() const; - std::vector> parentAssets() const; + std::vector requiredSubTreeAssets() const; + std::vector subTreeAssets() const; + std::vector childAssets() const; bool isRequired() const; bool isRequested() const; diff --git a/modules/imgui/src/guiassetcomponent.cpp b/modules/imgui/src/guiassetcomponent.cpp index 3b190f40b7..0ccf5fa399 100644 --- a/modules/imgui/src/guiassetcomponent.cpp +++ b/modules/imgui/src/guiassetcomponent.cpp @@ -78,7 +78,7 @@ void GuiAssetComponent::render() { std::string rootPath; - for (const std::shared_ptr& a : assetManager.rootAsset().childAssets()) { + for (Asset* a : assetManager.rootAsset().childAssets()) { renderTree(*a, rootPath); } @@ -103,8 +103,8 @@ void GuiAssetComponent::renderTree(const Asset& asset, const std::string& relati assetText += " (" + std::to_string(prog) + "%)"; } - const std::vector>& requested = asset.requestedAssets(); - const std::vector>& required = asset.requiredAssets(); + std::vector requested = asset.requestedAssets(); + std::vector required = asset.requiredAssets(); const std::vector& resourceSyncs = asset.ownSynchronizations(); @@ -113,12 +113,12 @@ void GuiAssetComponent::renderTree(const Asset& asset, const std::string& relati ImGui::Text("%s", assetText.c_str()); } else if (ImGui::TreeNode(assetPath.c_str(), "%s", assetText.c_str())) { - for (const std::shared_ptr& child : required) { + for (const Asset* child : required) { renderTree(*child, assetDirectory); } if (!requested.empty() && ImGui::TreeNode("Requested assets")) { - for (const std::shared_ptr& child : requested) { + for (const Asset* child : requested) { renderTree(*child, assetDirectory); } ImGui::TreePop(); diff --git a/modules/sync/tasks/syncassettask.cpp b/modules/sync/tasks/syncassettask.cpp index 2822b09651..5ea8a551b1 100644 --- a/modules/sync/tasks/syncassettask.cpp +++ b/modules/sync/tasks/syncassettask.cpp @@ -112,12 +112,11 @@ void SyncAssetTask::perform(const Task::ProgressCallback& progressCallback) { loader.add(_asset); loader.rootAsset().startSynchronizations(); - std::vector> allAssets = - loader.rootAsset().subTreeAssets(); + std::vector allAssets = loader.rootAsset().subTreeAssets(); while (true) { bool inProgress = false; - for (const std::shared_ptr& asset : allAssets) { + for (const Asset* asset : allAssets) { Asset::State state = asset->state(); if (state == Asset::State::Unloaded || state == Asset::State::Loaded || diff --git a/src/engine/openspaceengine.cpp b/src/engine/openspaceengine.cpp index 42c7a7e5e8..f1a4a7f55d 100644 --- a/src/engine/openspaceengine.cpp +++ b/src/engine/openspaceengine.cpp @@ -751,11 +751,10 @@ void OpenSpaceEngine::loadSingleAsset(const std::string& assetPath) { _loadingScreen->setPhase(LoadingScreen::Phase::Synchronization); _loadingScreen->postMessage("Synchronizing assets"); - std::vector> allAssets = - _assetManager->rootAsset().subTreeAssets(); + std::vector allAssets = _assetManager->rootAsset().subTreeAssets(); std::unordered_set resourceSyncs; - for (const std::shared_ptr& a : allAssets) { + for (const Asset* a : allAssets) { std::vector syncs = a->ownSynchronizations(); for (ResourceSynchronization* s : syncs) { diff --git a/src/scene/asset.cpp b/src/scene/asset.cpp index ef19dea0ba..9470b97183 100644 --- a/src/scene/asset.cpp +++ b/src/scene/asset.cpp @@ -38,11 +38,11 @@ namespace openspace { namespace { constexpr const char* _loggerCat = "Asset"; - float syncProgress(const std::vector>& assets) { + float syncProgress(const std::vector& assets) { size_t nTotalBytes = 0; size_t nSyncedBytes = 0; - for (const std::shared_ptr& a : assets) { + for (const Asset* a : assets) { const std::vector& s = a->ownSynchronizations(); for (ResourceSynchronization* sync : s) { @@ -209,12 +209,12 @@ void Asset::syncStateChanged(ResourceSynchronization* sync, } bool Asset::isSyncResolveReady() { - std::vector> requiredAssets = this->requiredAssets(); + std::vector requiredAssets = this->requiredAssets(); const auto unsynchronizedAsset = std::find_if( requiredAssets.cbegin(), requiredAssets.cend(), - [](const std::shared_ptr& a) { return !a->isSynchronized(); } + [](Asset* a) { return !a->isSynchronized(); } ); if (unsynchronizedAsset != requiredAssets.cend()) { @@ -244,31 +244,31 @@ std::vector Asset::ownSynchronizations() const { return res; } -std::vector> Asset::subTreeAssets() const { - std::unordered_set> assets({ shared_from_this() }); - for (const std::shared_ptr& c : childAssets()) { - if (c.get() == this) { +std::vector Asset::subTreeAssets() const { + std::unordered_set assets({ this }); + for (Asset* c : childAssets()) { + if (c == this) { throw ghoul::RuntimeError(fmt::format( "Detected cycle in asset inclusion for {} at {}", _assetName, _assetPath )); } - const std::vector>& subTree = c->subTreeAssets(); + std::vector subTree = c->subTreeAssets(); std::copy(subTree.begin(), subTree.end(), std::inserter(assets, assets.end())); } - std::vector> assetVector(assets.begin(), assets.end()); + std::vector assetVector(assets.begin(), assets.end()); return assetVector; } -std::vector> Asset::requiredSubTreeAssets() const { - std::unordered_set> assets({ shared_from_this() }); +std::vector Asset::requiredSubTreeAssets() const { + std::unordered_set assets({ this }); for (const std::shared_ptr& dep : _requiredAssets) { - const std::vector>& subTree = - dep->requiredSubTreeAssets(); + std::vector subTree = dep->requiredSubTreeAssets(); + std::copy(subTree.begin(), subTree.end(), std::inserter(assets, assets.end())); } - std::vector> assetVector(assets.begin(), assets.end()); + std::vector assetVector(assets.begin(), assets.end()); return assetVector; } @@ -372,7 +372,7 @@ bool Asset::startSynchronizations() { LWARNING(fmt::format("Cannot start synchronizations of unloaded asset {}", id())); return false; } - for (const std::shared_ptr& child : requestedAssets()) { + for (Asset* child : requestedAssets()) { child->startSynchronizations(); } @@ -386,7 +386,7 @@ bool Asset::startSynchronizations() { bool childFailed = false; // Start synchronization of all children first - for (const std::shared_ptr& child : requiredAssets()) { + for (Asset* child : requiredAssets()) { if (!child->startSynchronizations()) { childFailed = true; } @@ -406,11 +406,11 @@ bool Asset::startSynchronizations() { } bool Asset::cancelAllSynchronizations() { - const std::vector>& children = childAssets(); + const std::vector& children = childAssets(); bool cancelledAnySync = std::any_of( children.cbegin(), children.cend(), - [](const std::shared_ptr& child) { + [](Asset* child) { return child->cancelAllSynchronizations(); } ); @@ -433,11 +433,11 @@ bool Asset::cancelUnwantedSynchronizations() { return false; } - const std::vector>& children = childAssets(); + const std::vector& children = childAssets(); bool cancelledAnySync = std::any_of( children.begin(), children.end(), - [](const std::shared_ptr& child) { + [](Asset* child) { return child->cancelUnwantedSynchronizations(); } ); @@ -461,12 +461,12 @@ bool Asset::restartAllSynchronizations() { } float Asset::requiredSynchronizationProgress() const { - const std::vector>& assets = requiredSubTreeAssets(); + std::vector assets = requiredSubTreeAssets(); return syncProgress(assets); } float Asset::requestedSynchronizationProgress() { - const std::vector>& assets = subTreeAssets(); + std::vector assets = subTreeAssets(); return syncProgress(assets); } @@ -488,11 +488,11 @@ void Asset::unload() { setState(State::Unloaded); loader()->unloadAsset(this); - for (const std::shared_ptr& child : requiredAssets()) { - unrequire(child.get()); + for (Asset* child : requiredAssets()) { + unrequire(child); } - for (const std::shared_ptr& child : requestedAssets()) { - unrequest(child.get()); + for (Asset* child : requestedAssets()) { + unrequest(child); } } @@ -666,7 +666,7 @@ void Asset::deinitialize() { } // 2 and 1. Deinitialize unwanted requirements and requests - for (const std::shared_ptr& dependency : childAssets()) { + for (Asset* dependency : childAssets()) { dependency->deinitializeIfUnwanted(); } } @@ -836,53 +836,57 @@ bool Asset::requests(Asset* asset) const { return it != _requiredAssets.cend(); } -const std::vector>& Asset::requiredAssets() const { - return _requiredAssets; +std::vector Asset::requiredAssets() const { + std::vector res; + res.reserve(_requiredAssets.size()); + for (const std::shared_ptr& a : _requiredAssets) { + res.push_back(a.get()); + } + return res; } -std::vector> Asset::requiringAssets() const { - std::vector> assets; - assets.reserve(_requiringAssets.size()); +std::vector Asset::requiringAssets() const { + std::vector res; + res.reserve(_requiringAssets.size()); for (const std::weak_ptr& a : _requiringAssets) { if (std::shared_ptr shared = a.lock(); shared) { - assets.push_back(shared); + res.push_back(shared.get()); } } - return assets; + return res; } -const std::vector>& Asset::requestedAssets() const { - return _requestedAssets; +std::vector Asset::requestedAssets() const { + std::vector res; + res.reserve(_requestedAssets.size()); + for (const std::shared_ptr& a : _requestedAssets) { + res.push_back(a.get()); + } + return res; } -std::vector> Asset::requestingAssets() const { - std::vector> assets; - assets.reserve(_requestingAssets.size()); +std::vector Asset::requestingAssets() const { + std::vector res; + res.reserve(_requestingAssets.size()); for (const std::weak_ptr& a : _requestingAssets) { - std::shared_ptr shared = a.lock(); - if (shared) { - assets.push_back(shared); + if (std::shared_ptr shared = a.lock(); shared) { + res.push_back(shared.get()); } } - return assets; + return res; } -std::vector> Asset::childAssets() const { - std::vector> children; +std::vector Asset::childAssets() const { + std::vector children; children.reserve(_requiredAssets.size() + _requestedAssets.size()); - children.insert(children.end(), _requiredAssets.begin(), _requiredAssets.end()); - children.insert(children.end(), _requestedAssets.begin(), _requestedAssets.end()); - return children; -} -std::vector> Asset::parentAssets() const { - std::vector> parents; - std::vector> requiring = requiringAssets(); - std::vector> requesting = requestingAssets(); - parents.reserve(requiring.size() + requesting.size()); - parents.insert(parents.end(), requiring.begin(), requiring.end()); - parents.insert(parents.end(), requesting.begin(), requesting.end()); - return parents; + for (const std::shared_ptr& a : _requiredAssets) { + children.push_back(a.get()); + } + for (const std::shared_ptr& a : _requestedAssets) { + children.push_back(a.get()); + } + return children; } bool Asset::isRequired() const { @@ -894,13 +898,20 @@ bool Asset::isRequested() const { } bool Asset::shouldBeInitialized() const { - std::vector> parents = parentAssets(); - const auto initializedAsset = std::find_if( - parents.cbegin(), - parents.cend(), - [](const std::shared_ptr& a) { return a->state() == State::Initialized; } + const bool requiring = std::all_of( + _requiringAssets.begin(), _requiringAssets.end(), + [](const std::weak_ptr& asset) { + return asset.lock()->state() == State::Initialized; + } ); - return initializedAsset != parents.cend(); + const bool requesting = std::all_of( + _requestingAssets.begin(), _requestingAssets.end(), + [](const std::weak_ptr& asset) { + return asset.lock()->isInitialized(); + } + ); + + return requiring && requesting; } } // namespace openspace diff --git a/src/scene/assetmanager.cpp b/src/scene/assetmanager.cpp index a1540deebe..946a56bfed 100644 --- a/src/scene/assetmanager.cpp +++ b/src/scene/assetmanager.cpp @@ -105,10 +105,7 @@ void AssetManager::removeAll() { ZoneScoped _pendingStateChangeCommands.clear(); - std::vector> allAssets = - _assetLoader.rootAsset().requestedAssets(); - - for (const std::shared_ptr& a : allAssets) { + for (const Asset* a : _assetLoader.rootAsset().requestedAssets()) { _pendingStateChangeCommands[a->assetFilePath()] = false; } } diff --git a/src/scene/scenelicensewriter.cpp b/src/scene/scenelicensewriter.cpp index 90319fe9d6..b954008889 100644 --- a/src/scene/scenelicensewriter.cpp +++ b/src/scene/scenelicensewriter.cpp @@ -48,10 +48,10 @@ std::string SceneLicenseWriter::generateJson() const { std::stringstream json; json << "["; - std::vector> assets = + std::vector assets = global::openSpaceEngine.assetManager().rootAsset().subTreeAssets(); - for (const std::shared_ptr& asset : assets) { + for (const Asset* asset : assets) { std::optional meta = asset->metaInformation(); if (!meta.has_value()) { From f605ea942234b22c305579a3f2d972df849ef11a Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Sun, 10 May 2020 14:03:42 +0200 Subject: [PATCH 11/48] Some more cleanup --- include/openspace/scene/asset.h | 23 ++++--------- include/openspace/scene/assetloader.h | 2 -- src/scene/asset.cpp | 49 +++------------------------ src/scene/assetloader.cpp | 18 +++++----- 4 files changed, 19 insertions(+), 73 deletions(-) diff --git a/include/openspace/scene/asset.h b/include/openspace/scene/asset.h index 25eb53860f..83749a11ba 100644 --- a/include/openspace/scene/asset.h +++ b/include/openspace/scene/asset.h @@ -49,9 +49,6 @@ public: InitializationFailed }; - using StateChangeCallback = std::function; - using CallbackHandle = size_t; - struct MetaInformation { std::string name; std::string version; @@ -101,12 +98,6 @@ public: * its own synchronizations and required assets' synchronizations could start. */ bool startSynchronizations(); - bool hasSyncingOrResolvedParent() const; - bool isSynchronized() const; - bool isSyncingOrResolved() const; - bool cancelAllSynchronizations(); - bool cancelUnwantedSynchronizations(); - bool restartAllSynchronizations(); float requiredSynchronizationProgress() const; float requestedSynchronizationProgress(); @@ -134,16 +125,9 @@ public: std::vector requiredAssets() const; std::vector requiringAssets() const; - std::vector requiredSubTreeAssets() const; std::vector subTreeAssets() const; std::vector childAssets() const; - bool isRequired() const; - bool isRequested() const; - bool shouldBeInitialized() const; - - std::string resolveLocalResource(std::string resourceName) const; - void setMetaInformation(MetaInformation metaInformation); std::optional metaInformation() const; @@ -153,7 +137,14 @@ private: void requiredAssetChangedState(Asset::State childState); void requestedAssetChangedState(Asset* child, Asset::State childState); + bool isSynchronized() const; + bool isSyncingOrResolved() const; bool isSyncResolveReady(); + bool hasSyncingOrResolvedParent() const; + bool cancelAllSynchronizations(); + bool cancelUnwantedSynchronizations(); + + std::vector requiredSubTreeAssets() const; std::atomic _state; AssetLoader* _loader; diff --git a/include/openspace/scene/assetloader.h b/include/openspace/scene/assetloader.h index d404b1417d..52a3084078 100644 --- a/include/openspace/scene/assetloader.h +++ b/include/openspace/scene/assetloader.h @@ -49,7 +49,6 @@ int request(lua_State* state); int exists(lua_State* state); int localResource(lua_State* state); int syncedResource(lua_State* state); -int noOperation(lua_State* state); int exportAsset(lua_State* state); } // namespace assetloader @@ -165,7 +164,6 @@ public: void assetUnrequested(Asset* parent, std::shared_ptr child); private: - std::shared_ptr require(const std::string& identifier); std::shared_ptr request(const std::string& identifier); void unrequest(const std::string& identifier); diff --git a/src/scene/asset.cpp b/src/scene/asset.cpp index 9470b97183..5cc5e52b2d 100644 --- a/src/scene/asset.cpp +++ b/src/scene/asset.cpp @@ -43,7 +43,7 @@ namespace { size_t nSyncedBytes = 0; for (const Asset* a : assets) { - const std::vector& s = a->ownSynchronizations(); + std::vector s = a->ownSynchronizations(); for (ResourceSynchronization* sync : s) { if (sync->nTotalBytesIsKnown()) { @@ -81,11 +81,6 @@ Asset::Asset(AssetLoader* loader, SynchronizationWatcher* watcher, std::string a , _assetPath(std::move(assetPath)) {} -std::string Asset::resolveLocalResource(std::string resourceName) const { - std::string dir = assetDirectory(); - return dir + ghoul::filesystem::FileSystem::PathSeparator + std::move(resourceName); -} - void Asset::setMetaInformation(MetaInformation metaInformation) { _metaInformation = std::move(metaInformation); } @@ -264,8 +259,6 @@ std::vector Asset::requiredSubTreeAssets() const { std::unordered_set assets({ this }); for (const std::shared_ptr& dep : _requiredAssets) { std::vector subTree = dep->requiredSubTreeAssets(); - - std::copy(subTree.begin(), subTree.end(), std::inserter(assets, assets.end())); } std::vector assetVector(assets.begin(), assets.end()); @@ -406,13 +399,11 @@ bool Asset::startSynchronizations() { } bool Asset::cancelAllSynchronizations() { - const std::vector& children = childAssets(); + std::vector children = childAssets(); bool cancelledAnySync = std::any_of( children.cbegin(), children.cend(), - [](Asset* child) { - return child->cancelAllSynchronizations(); - } + std::mem_fn(&Asset::cancelAllSynchronizations) ); for (const std::shared_ptr& s : _synchronizations) { @@ -437,9 +428,7 @@ bool Asset::cancelUnwantedSynchronizations() { bool cancelledAnySync = std::any_of( children.begin(), children.end(), - [](Asset* child) { - return child->cancelUnwantedSynchronizations(); - } + std::mem_fn(&Asset::cancelUnwantedSynchronizations) ); for (const std::shared_ptr& s : _synchronizations) { @@ -455,11 +444,6 @@ bool Asset::cancelUnwantedSynchronizations() { return cancelledAnySync; } -bool Asset::restartAllSynchronizations() { - cancelAllSynchronizations(); - return startSynchronizations(); -} - float Asset::requiredSynchronizationProgress() const { std::vector assets = requiredSubTreeAssets(); return syncProgress(assets); @@ -889,29 +873,4 @@ std::vector Asset::childAssets() const { return children; } -bool Asset::isRequired() const { - return !_requiringAssets.empty(); -} - -bool Asset::isRequested() const { - return !_requestingAssets.empty(); -} - -bool Asset::shouldBeInitialized() const { - const bool requiring = std::all_of( - _requiringAssets.begin(), _requiringAssets.end(), - [](const std::weak_ptr& asset) { - return asset.lock()->state() == State::Initialized; - } - ); - const bool requesting = std::all_of( - _requestingAssets.begin(), _requestingAssets.end(), - [](const std::weak_ptr& asset) { - return asset.lock()->isInitialized(); - } - ); - - return requiring && requesting; -} - } // namespace openspace diff --git a/src/scene/assetloader.cpp b/src/scene/assetloader.cpp index cd8b0d8077..9642504ccf 100644 --- a/src/scene/assetloader.cpp +++ b/src/scene/assetloader.cpp @@ -472,12 +472,6 @@ int AssetLoader::onDeinitializeDependencyLua(Asset* dependant, Asset* dependency return 0; } -std::shared_ptr AssetLoader::require(const std::string& identifier) { - std::shared_ptr asset = getAsset(identifier); - _currentAsset->require(asset); - return asset; -} - std::shared_ptr AssetLoader::request(const std::string& identifier) { std::shared_ptr asset = getAsset(identifier); Asset* parent = _currentAsset; @@ -603,13 +597,16 @@ void AssetLoader::callOnDependencyDeinitialize(Asset* asset, Asset* dependant) { int AssetLoader::localResourceLua(Asset* asset) { ghoul::lua::checkArgumentsAndThrow(*_luaState, 1, "lua::localResourceLua"); - std::string resourceName = ghoul::lua::value( + std::string name = ghoul::lua::value( *_luaState, 1, ghoul::lua::PopValue::Yes ); - const std::string resolved = asset->resolveLocalResource(resourceName); - lua_pushstring(*_luaState, resolved.c_str()); + + const std::string resolvedName = + asset->assetDirectory() + ghoul::filesystem::FileSystem::PathSeparator + name; + + lua_pushstring(*_luaState, resolvedName.c_str()); ghoul_assert(lua_gettop(*_luaState) == 1, "Incorrect number of items left on stack"); return 1; @@ -662,7 +659,8 @@ int AssetLoader::requireLua(Asset* dependant) { std::string assetName = luaL_checkstring(*_luaState, 1); lua_settop(*_luaState, 0); - std::shared_ptr dependency = require(assetName); + std::shared_ptr dependency = getAsset(assetName); + _currentAsset->require(dependency); if (!dependency) { return ghoul::lua::luaError( From 2f2f136685fe2a13dcaf099e1413cbb5b9dc1116 Mon Sep 17 00:00:00 2001 From: Micah Acinapura Date: Tue, 12 May 2020 16:55:35 -0400 Subject: [PATCH 12/48] fix template and writer for scene license info --- data/web/documentation/scenelicense.hbs | 14 ++++++-------- src/scene/scenelicensewriter.cpp | 16 ++++++++++++++-- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/data/web/documentation/scenelicense.hbs b/data/web/documentation/scenelicense.hbs index 0399a74564..ee9bce0479 100644 --- a/data/web/documentation/scenelicense.hbs +++ b/data/web/documentation/scenelicense.hbs @@ -3,14 +3,12 @@

- - {{module}} - -

{{name}}

-
-

{{attribution}}

-

{{url}}

-

{{licenseText}}

+

Asset - {{name}}

+

{{description}}

+

Version - {{version}}

+

Author - {{author}}

+

Associated URL - {{url}}

+

Filepath - {{path}}

diff --git a/src/scene/scenelicensewriter.cpp b/src/scene/scenelicensewriter.cpp index b954008889..bd2e2ff8ec 100644 --- a/src/scene/scenelicensewriter.cpp +++ b/src/scene/scenelicensewriter.cpp @@ -51,6 +51,16 @@ std::string SceneLicenseWriter::generateJson() const { std::vector assets = global::openSpaceEngine.assetManager().rootAsset().subTreeAssets(); + int metaTotal = 0; + for (const Asset* asset : assets) { + std::optional meta = asset->metaInformation(); + if (!meta.has_value()) { + continue; + } + metaTotal++; + } + + int metaCount = 0; for (const Asset* asset : assets) { std::optional meta = asset->metaInformation(); @@ -69,10 +79,12 @@ std::string SceneLicenseWriter::generateJson() const { json << fmt::format(replStr, "author", escapedJson(meta->author)); json << fmt::format(replStr, "url", escapedJson(meta->url)); //json << fmt::format(replStr2, "licenseText", escapedJson(license.licenseText)); - json << fmt::format(replStr2, "license", escapedJson(meta->license)); + json << fmt::format(replStr, "license", escapedJson(meta->license)); + json << fmt::format(replStr2, "path", escapedJson(asset->assetFilePath())); json << "}"; - if (&asset != &(assets.back())) { + metaCount++; + if (metaCount != metaTotal) { json << ","; } } From 9c2b5eefb2fbd1e312ce33c330b5aa3f3aae5fa0 Mon Sep 17 00:00:00 2001 From: eriksunden Date: Mon, 25 May 2020 11:02:55 +0200 Subject: [PATCH 13/48] Updated SGCT submodule to latest changes --- apps/OpenSpace/ext/sgct | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/OpenSpace/ext/sgct b/apps/OpenSpace/ext/sgct index df7c5414cc..902ad00320 160000 --- a/apps/OpenSpace/ext/sgct +++ b/apps/OpenSpace/ext/sgct @@ -1 +1 @@ -Subproject commit df7c5414cc97783e0c32c212db746f49a83020a1 +Subproject commit 902ad00320c79b3f876530698ec1828c8dfceaab From 2c1035f05dd1bc6a3542a7e4f9553c44db2fe326 Mon Sep 17 00:00:00 2001 From: Jonathas Costa Date: Thu, 28 May 2020 17:01:08 -0400 Subject: [PATCH 14/48] Temporary solution for precision problems in spherical grids. --- .../rendering/renderablesphericalgrid.cpp | 22 +++++++++++++------ modules/base/shaders/grid_fs.glsl | 13 ++++++++--- modules/base/shaders/grid_vs.glsl | 17 ++++++++------ 3 files changed, 35 insertions(+), 17 deletions(-) diff --git a/modules/base/rendering/renderablesphericalgrid.cpp b/modules/base/rendering/renderablesphericalgrid.cpp index f551902794..893da2b927 100644 --- a/modules/base/rendering/renderablesphericalgrid.cpp +++ b/modules/base/rendering/renderablesphericalgrid.cpp @@ -214,16 +214,22 @@ void RenderableSphericalGrid::render(const RenderData& data, RendererTasks&){ const glm::dmat4 modelViewTransform = data.camera.combinedViewMatrix() * modelTransform; - _gridProgram->setUniform("modelViewTransform", glm::mat4(modelViewTransform)); - _gridProgram->setUniform("projectionTransform", data.camera.projectionMatrix()); - + _gridProgram->setUniform("modelViewTransform", modelViewTransform); + _gridProgram->setUniform("projectionTransform", glm::dmat4(data.camera.projectionMatrix())); + _gridProgram->setUniform("gridColor", _gridColor); + float adjustedLineWidth = 1.f; + +#ifndef __APPLE__ + adjustedLineWidth = _lineWidth; +#endif + // Saves current state: GLboolean isBlendEnabled = glIsEnabledi(GL_BLEND, 0); - GLboolean isLineSmoothEnabled = glIsEnabled(GL_LINE_SMOOTH); GLfloat currentLineWidth; glGetFloatv(GL_LINE_WIDTH, ¤tLineWidth); + GLboolean isLineSmoothEnabled = glIsEnabled(GL_LINE_SMOOTH); GLenum blendEquationRGB, blendEquationAlpha, blendDestAlpha, blendDestRGB, blendSrcAlpha, blendSrcRGB; @@ -235,11 +241,11 @@ void RenderableSphericalGrid::render(const RenderData& data, RendererTasks&){ glGetIntegerv(GL_BLEND_SRC_RGB, &blendSrcRGB); // Changes GL state: - glLineWidth(_lineWidth); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glLineWidth(adjustedLineWidth); glEnablei(GL_BLEND, 0); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_LINE_SMOOTH); - + glBindVertexArray(_vaoID); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _iBufferID); glDrawElements(_mode, _isize, GL_UNSIGNED_INT, nullptr); @@ -251,9 +257,11 @@ void RenderableSphericalGrid::render(const RenderData& data, RendererTasks&){ glLineWidth(currentLineWidth); glBlendEquationSeparate(blendEquationRGB, blendEquationAlpha); glBlendFuncSeparate(blendSrcRGB, blendDestRGB, blendSrcAlpha, blendDestAlpha); + if (!isBlendEnabled) { glDisablei(GL_BLEND, 0); } + if (!isLineSmoothEnabled) { glDisable(GL_LINE_SMOOTH); } diff --git a/modules/base/shaders/grid_fs.glsl b/modules/base/shaders/grid_fs.glsl index 3f1e1e13f1..c3073eebd5 100644 --- a/modules/base/shaders/grid_fs.glsl +++ b/modules/base/shaders/grid_fs.glsl @@ -27,6 +27,7 @@ in float vs_screenSpaceDepth; in vec4 vs_positionViewSpace; +flat in double vs_double_depth; uniform vec4 gridColor; uniform float opacity; @@ -34,9 +35,15 @@ uniform float opacity; Fragment getFragment() { Fragment frag; frag.color = gridColor; - frag.color.a *= opacity; - frag.depth = vs_screenSpaceDepth; + frag.color.a *= opacity; + // JCC: Temp solution for depth precision problems. + frag.depth = float(vs_double_depth); + //frag.depth = vs_screenSpaceDepth; frag.gPosition = vs_positionViewSpace; - frag.gNormal = vec4(0.0, 0.0, 0.0, 1.0); + + // There is no normal here + frag.gNormal = vec4(0.0, 0.0, -1.0, 1.0); + return frag; + } diff --git a/modules/base/shaders/grid_vs.glsl b/modules/base/shaders/grid_vs.glsl index d5b710ad4e..13d227aed4 100644 --- a/modules/base/shaders/grid_vs.glsl +++ b/modules/base/shaders/grid_vs.glsl @@ -30,16 +30,19 @@ layout(location = 0) in vec3 in_position; out float vs_screenSpaceDepth; out vec4 vs_positionViewSpace; +flat out double vs_double_depth; -uniform mat4 modelViewTransform; -uniform mat4 projectionTransform; +uniform dmat4 modelViewTransform; +uniform dmat4 projectionTransform; void main() { - vec4 positionViewSpace = modelViewTransform * vec4(in_position, 1.0); - vec4 positionClipSpace = projectionTransform * positionViewSpace; - vec4 positionScreenSpace = z_normalization(positionClipSpace); - vs_screenSpaceDepth = positionScreenSpace.w; - vs_positionViewSpace = positionViewSpace; + dvec4 positionViewSpace = modelViewTransform * dvec4(in_position, 1.0); + dvec4 positionClipSpace = projectionTransform * positionViewSpace; + vec4 positionScreenSpace = z_normalization(vec4(positionClipSpace)); + + vs_double_depth = positionClipSpace.w; + vs_screenSpaceDepth = float(positionClipSpace.w); + vs_positionViewSpace = vec4(positionViewSpace); gl_Position = positionScreenSpace; } From c0ae26e83e82b421fb9a975200e7b46434574998 Mon Sep 17 00:00:00 2001 From: Jonathas Costa Date: Thu, 28 May 2020 17:13:45 -0400 Subject: [PATCH 15/48] Fixed issue. --- modules/base/rendering/renderablesphere.cpp | 77 +++++++++++---------- 1 file changed, 39 insertions(+), 38 deletions(-) diff --git a/modules/base/rendering/renderablesphere.cpp b/modules/base/rendering/renderablesphere.cpp index 37939db68a..ae91a2f15e 100644 --- a/modules/base/rendering/renderablesphere.cpp +++ b/modules/base/rendering/renderablesphere.cpp @@ -362,48 +362,49 @@ void RenderableSphere::render(const RenderData& data, RendererTasks&) { float adjustedTransparency = _opacity; - if (_fadeInThreshold > -1.0) { - const float logDistCamera = glm::log(static_cast( - glm::distance(data.camera.positionVec3(), data.modelTransform.translation) - )); - const float startLogFadeDistance = glm::log(_size * _fadeInThreshold); - const float stopLogFadeDistance = startLogFadeDistance + 1.f; + if (!_disableFadeInDistance) { + if (_fadeInThreshold > -1.0) { + const float logDistCamera = glm::log(static_cast( + glm::distance(data.camera.positionVec3(), data.modelTransform.translation) + )); + const float startLogFadeDistance = glm::log(_size * _fadeInThreshold); + const float stopLogFadeDistance = startLogFadeDistance + 1.f; - if (logDistCamera > startLogFadeDistance && logDistCamera < stopLogFadeDistance) { - const float fadeFactor = glm::clamp( - (logDistCamera - startLogFadeDistance) / - (stopLogFadeDistance - startLogFadeDistance), - 0.f, - 1.f - ); - adjustedTransparency *= fadeFactor; + if (logDistCamera > startLogFadeDistance && logDistCamera < stopLogFadeDistance) { + const float fadeFactor = glm::clamp( + (logDistCamera - startLogFadeDistance) / + (stopLogFadeDistance - startLogFadeDistance), + 0.f, + 1.f + ); + adjustedTransparency *= fadeFactor; + } + else if (logDistCamera <= startLogFadeDistance) { + adjustedTransparency = 0.f; + } } - else if (logDistCamera <= startLogFadeDistance) { - adjustedTransparency = 0.f; + + if (_fadeOutThreshold > -1.0) { + const float logDistCamera = glm::log(static_cast( + glm::distance(data.camera.positionVec3(), data.modelTransform.translation) + )); + const float startLogFadeDistance = glm::log(_size * _fadeOutThreshold); + const float stopLogFadeDistance = startLogFadeDistance + 1.f; + + if (logDistCamera > startLogFadeDistance && logDistCamera < stopLogFadeDistance) { + const float fadeFactor = glm::clamp( + (logDistCamera - startLogFadeDistance) / + (stopLogFadeDistance - startLogFadeDistance), + 0.f, + 1.f + ); + adjustedTransparency *= (1.f - fadeFactor); + } + else if (logDistCamera >= stopLogFadeDistance) { + adjustedTransparency = 0.f; + } } } - - if (_fadeOutThreshold > -1.0) { - const float logDistCamera = glm::log(static_cast( - glm::distance(data.camera.positionVec3(), data.modelTransform.translation) - )); - const float startLogFadeDistance = glm::log(_size * _fadeOutThreshold); - const float stopLogFadeDistance = startLogFadeDistance + 1.f; - - if (logDistCamera > startLogFadeDistance && logDistCamera < stopLogFadeDistance) { - const float fadeFactor = glm::clamp( - (logDistCamera - startLogFadeDistance) / - (stopLogFadeDistance - startLogFadeDistance), - 0.f, - 1.f - ); - adjustedTransparency *= (1.f - fadeFactor); - } - else if (logDistCamera >= stopLogFadeDistance) { - adjustedTransparency = 0.f; - } - } - // Performance wise if (adjustedTransparency < 0.01f) { return; From fbd83c9e842bb5eabd888e367100dc19baa8161a Mon Sep 17 00:00:00 2001 From: Jonathas Costa Date: Fri, 5 Jun 2020 17:15:54 -0400 Subject: [PATCH 16/48] Removed hack and fixed SGCT. --- apps/OpenSpace/ext/sgct | 2 +- modules/base/shaders/grid_fs.glsl | 5 +---- modules/base/shaders/grid_vs.glsl | 2 -- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/apps/OpenSpace/ext/sgct b/apps/OpenSpace/ext/sgct index 902ad00320..16b4804681 160000 --- a/apps/OpenSpace/ext/sgct +++ b/apps/OpenSpace/ext/sgct @@ -1 +1 @@ -Subproject commit 902ad00320c79b3f876530698ec1828c8dfceaab +Subproject commit 16b4804681f12681deeaf321efdfe3b92e7d28e3 diff --git a/modules/base/shaders/grid_fs.glsl b/modules/base/shaders/grid_fs.glsl index c3073eebd5..e2865a33b4 100644 --- a/modules/base/shaders/grid_fs.glsl +++ b/modules/base/shaders/grid_fs.glsl @@ -27,7 +27,6 @@ in float vs_screenSpaceDepth; in vec4 vs_positionViewSpace; -flat in double vs_double_depth; uniform vec4 gridColor; uniform float opacity; @@ -36,9 +35,7 @@ Fragment getFragment() { Fragment frag; frag.color = gridColor; frag.color.a *= opacity; - // JCC: Temp solution for depth precision problems. - frag.depth = float(vs_double_depth); - //frag.depth = vs_screenSpaceDepth; + frag.depth = vs_screenSpaceDepth; frag.gPosition = vs_positionViewSpace; // There is no normal here diff --git a/modules/base/shaders/grid_vs.glsl b/modules/base/shaders/grid_vs.glsl index 13d227aed4..c6006a73ef 100644 --- a/modules/base/shaders/grid_vs.glsl +++ b/modules/base/shaders/grid_vs.glsl @@ -30,7 +30,6 @@ layout(location = 0) in vec3 in_position; out float vs_screenSpaceDepth; out vec4 vs_positionViewSpace; -flat out double vs_double_depth; uniform dmat4 modelViewTransform; uniform dmat4 projectionTransform; @@ -40,7 +39,6 @@ void main() { dvec4 positionClipSpace = projectionTransform * positionViewSpace; vec4 positionScreenSpace = z_normalization(vec4(positionClipSpace)); - vs_double_depth = positionClipSpace.w; vs_screenSpaceDepth = float(positionClipSpace.w); vs_positionViewSpace = vec4(positionViewSpace); From ea72753ea300a4cbaa304c26858af2260906cd24 Mon Sep 17 00:00:00 2001 From: Jonathas Costa Date: Fri, 5 Jun 2020 15:51:56 -0400 Subject: [PATCH 17/48] Small changes. --- modules/base/rendering/renderablesphericalgrid.cpp | 5 ++++- modules/base/shaders/grid_vs.glsl | 12 ++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/modules/base/rendering/renderablesphericalgrid.cpp b/modules/base/rendering/renderablesphericalgrid.cpp index 893da2b927..02439931ce 100644 --- a/modules/base/rendering/renderablesphericalgrid.cpp +++ b/modules/base/rendering/renderablesphericalgrid.cpp @@ -215,7 +215,10 @@ void RenderableSphericalGrid::render(const RenderData& data, RendererTasks&){ modelTransform; _gridProgram->setUniform("modelViewTransform", modelViewTransform); - _gridProgram->setUniform("projectionTransform", glm::dmat4(data.camera.projectionMatrix())); + _gridProgram->setUniform( + "MVPTransform", + glm::dmat4(data.camera.projectionMatrix()) * modelViewTransform + ); _gridProgram->setUniform("gridColor", _gridColor); diff --git a/modules/base/shaders/grid_vs.glsl b/modules/base/shaders/grid_vs.glsl index c6006a73ef..45941de4ce 100644 --- a/modules/base/shaders/grid_vs.glsl +++ b/modules/base/shaders/grid_vs.glsl @@ -32,12 +32,16 @@ out float vs_screenSpaceDepth; out vec4 vs_positionViewSpace; uniform dmat4 modelViewTransform; -uniform dmat4 projectionTransform; +uniform dmat4 MVPTransform; void main() { - dvec4 positionViewSpace = modelViewTransform * dvec4(in_position, 1.0); - dvec4 positionClipSpace = projectionTransform * positionViewSpace; - vec4 positionScreenSpace = z_normalization(vec4(positionClipSpace)); + dvec4 objPosDouble = dvec4(in_position, 1.0); + dvec4 positionViewSpace = modelViewTransform * objPosDouble; + dvec4 positionClipSpace = MVPTransform * objPosDouble; + + positionClipSpace.z = 0.0; + + vec4 positionScreenSpace = vec4(positionClipSpace); vs_screenSpaceDepth = float(positionClipSpace.w); vs_positionViewSpace = vec4(positionViewSpace); From f82a0d14ad3ea19f4bf9ff5d9aa172f00d87e94d Mon Sep 17 00:00:00 2001 From: Micah Date: Fri, 5 Jun 2020 16:42:31 -0400 Subject: [PATCH 18/48] aded time range to voyager rotations; disabled spice exceptions by default; updated space module to read spiceexpection value; --- .../scene/solarsystem/missions/voyager/voyager1.asset | 7 ++++++- .../scene/solarsystem/missions/voyager/voyager2.asset | 7 ++++++- modules/space/spacemodule.cpp | 6 +++++- openspace.cfg | 3 +++ 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/data/assets/scene/solarsystem/missions/voyager/voyager1.asset b/data/assets/scene/solarsystem/missions/voyager/voyager1.asset index f206b8a6b4..c5a8ae6b0c 100644 --- a/data/assets/scene/solarsystem/missions/voyager/voyager1.asset +++ b/data/assets/scene/solarsystem/missions/voyager/voyager1.asset @@ -61,7 +61,12 @@ local Voyager1 = { Rotation = { Type = "SpiceRotation", SourceFrame = "VG1_SC_BUS", - DestinationFrame = "GALACTIC" + DestinationFrame = "GALACTIC", + TimeFrame = { + Type = "TimeFrameInterval", + Start = "1977-SEP-05 14:10:11.786", + End = "2027-DEC-27" + } } }, GUI = { diff --git a/data/assets/scene/solarsystem/missions/voyager/voyager2.asset b/data/assets/scene/solarsystem/missions/voyager/voyager2.asset index 36f3d74089..f1a87c9e13 100644 --- a/data/assets/scene/solarsystem/missions/voyager/voyager2.asset +++ b/data/assets/scene/solarsystem/missions/voyager/voyager2.asset @@ -64,7 +64,12 @@ local Voyager2 = { Rotation = { Type = "SpiceRotation", SourceFrame = "VG2_SC_BUS", - DestinationFrame = "GALACTIC" + DestinationFrame = "GALACTIC", + TimeFrame = { + Type = "TimeFrameInterval", + Start = "1977-AUG-20 16:07:06.535", + End = "2027-DEC-27" + } } }, GUI = { diff --git a/modules/space/spacemodule.cpp b/modules/space/spacemodule.cpp index 81e86e6ccf..e720068f87 100644 --- a/modules/space/spacemodule.cpp +++ b/modules/space/spacemodule.cpp @@ -68,7 +68,7 @@ SpaceModule::SpaceModule() addProperty(_showSpiceExceptions); } -void SpaceModule::internalInitialize(const ghoul::Dictionary&) { +void SpaceModule::internalInitialize(const ghoul::Dictionary& dictionary) { FactoryManager::ref().addFactory( std::make_unique>(), "PlanetGeometry" @@ -106,6 +106,10 @@ void SpaceModule::internalInitialize(const ghoul::Dictionary&) { auto fGeometry = FactoryManager::ref().factory(); ghoul_assert(fGeometry, "Planet geometry factory was not created"); fGeometry->registerClass("SimpleSphere"); + + if (dictionary.hasKeyAndValue(SpiceExceptionInfo.identifier)) { + _showSpiceExceptions = dictionary.value(SpiceExceptionInfo.identifier); + } } void SpaceModule::internalDeinitializeGL() { diff --git a/openspace.cfg b/openspace.cfg index a557e5468d..f57badd935 100644 --- a/openspace.cfg +++ b/openspace.cfg @@ -144,6 +144,9 @@ ModuleConfigurations = { -- GuiScale = 2.0, Enabled = true, Visible = true + }, + Space = { + ShowExceptions = false } } From 4c49cc0fdfc267ed0b46da733058ad53d92c5425 Mon Sep 17 00:00:00 2001 From: Jonathas Costa Date: Mon, 8 Jun 2020 13:47:47 -0400 Subject: [PATCH 19/48] Removed 4-tuple color in favor of 3-tulpe color plus opacity. Changed abs to fabs when needed. --- apps/OpenSpace/ext/sgct | 2 +- data/assets/scene/digitaluniverse/grids.asset | 15 ++++++++++----- .../base/rendering/renderablesphericalgrid.cpp | 16 +++++++++++----- modules/base/rendering/renderablesphericalgrid.h | 4 ++-- modules/base/shaders/grid_fs.glsl | 12 ++++++------ modules/base/shaders/grid_vs.glsl | 14 ++++++-------- src/scene/scenegraphnode.cpp | 4 ++-- 7 files changed, 38 insertions(+), 29 deletions(-) diff --git a/apps/OpenSpace/ext/sgct b/apps/OpenSpace/ext/sgct index 16b4804681..72aaa72369 160000 --- a/apps/OpenSpace/ext/sgct +++ b/apps/OpenSpace/ext/sgct @@ -1 +1 @@ -Subproject commit 16b4804681f12681deeaf321efdfe3b92e7d28e3 +Subproject commit 72aaa7236923c54987429e14df6039217fad7f14 diff --git a/data/assets/scene/digitaluniverse/grids.asset b/data/assets/scene/digitaluniverse/grids.asset index cb17a78754..19a38264a5 100644 --- a/data/assets/scene/digitaluniverse/grids.asset +++ b/data/assets/scene/digitaluniverse/grids.asset @@ -24,7 +24,8 @@ local radio = { Renderable = { Type = "RenderableSphericalGrid", Enabled = false, - GridColor = { 0.3, 0.84, 1.0, 0.3}, + Opacity = 0.3, + GridColor = { 0.3, 0.84, 1.0}, LineWidth = 2.0, GridMatrix = { -0.05487554, 0.4941095, -0.8676661 , 0.0, -0.9938214 , -0.1109906, -0.0003515167, 0.0, @@ -49,7 +50,8 @@ local oort = { Renderable = { Type = "RenderableSphericalGrid", Enabled = false, - GridColor = { 0.8, 0.4, 0.4, 0.25}, + Opacity = 0.25, + GridColor = { 0.8, 0.4, 0.4}, LineWidth = 2.0, GridMatrix = { -0.05487554, 0.4941095, -0.8676661 , 0.0, -0.9938214 , -0.1109906, -0.0003515167, 0.0, @@ -74,7 +76,8 @@ local ecliptic = { Renderable = { Type = "RenderableSphericalGrid", Enabled = false, - GridColor = { 0.74, 0.26, 0.26, 0.5}, + Opacity = 0.5, + GridColor = { 0.74, 0.26, 0.26}, LineWidth = 2.0, GridMatrix = { -0.05487554, 0.4941095, -0.8676661 , 0.0, -0.9938214 , -0.1109906, -0.0003515167, 0.0, @@ -127,7 +130,8 @@ local equatorial = { Renderable = { Type = "RenderableSphericalGrid", Enabled = false, - GridColor = { 0.69, 0.68, 0.29, 0.8}, + Opacity = 0.8, + GridColor = { 0.69, 0.68, 0.29}, LineWidth = 2.0, GridMatrix = { -0.05487554, 0.4941095, -0.8676661, 0.0, -0.8734371 , -0.4448296, -0.1980764, 0.0, @@ -181,7 +185,8 @@ local galactic = { Type = "RenderableSphericalGrid", Enabled = false, LineWidth = 2.0, - GridColor = { 0.0, 0.6, 0.6, 0.6} + Opacity = 0.6, + GridColor = { 0.0, 0.6, 0.6} }, GUI = { Name = "Galactic Sphere", diff --git a/modules/base/rendering/renderablesphericalgrid.cpp b/modules/base/rendering/renderablesphericalgrid.cpp index 02439931ce..0418a701d2 100644 --- a/modules/base/rendering/renderablesphericalgrid.cpp +++ b/modules/base/rendering/renderablesphericalgrid.cpp @@ -80,7 +80,7 @@ documentation::Documentation RenderableSphericalGrid::Documentation() { }, { GridColorInfo.identifier, - new DoubleVector4Verifier, + new DoubleVector3Verifier, Optional::Yes, GridColorInfo.description }, @@ -107,9 +107,9 @@ RenderableSphericalGrid::RenderableSphericalGrid(const ghoul::Dictionary& dictio , _gridMatrix(GridMatrixInfo, glm::mat4(1.f)) , _gridColor( GridColorInfo, - glm::vec4(0.5f, 0.5, 0.5f, 1.f), - glm::vec4(0.f), - glm::vec4(1.f) + glm::vec3(0.5f, 0.5, 0.5f), + glm::vec3(0.f), + glm::vec3(1.f) ) , _segments(SegmentsInfo, 36, 4, 200) , _lineWidth(LineWidthInfo, 0.5f, 0.f, 20.f) @@ -129,7 +129,7 @@ RenderableSphericalGrid::RenderableSphericalGrid(const ghoul::Dictionary& dictio addProperty(_gridMatrix); if (dictionary.hasKey(GridColorInfo.identifier)) { - _gridColor = dictionary.value(GridColorInfo.identifier); + _gridColor = dictionary.value(GridColorInfo.identifier); } _gridColor.setViewOption(properties::Property::ViewOptions::Color); addProperty(_gridColor); @@ -233,6 +233,10 @@ void RenderableSphericalGrid::render(const RenderData& data, RendererTasks&){ GLfloat currentLineWidth; glGetFloatv(GL_LINE_WIDTH, ¤tLineWidth); GLboolean isLineSmoothEnabled = glIsEnabled(GL_LINE_SMOOTH); + + GLenum currentDepthFunction; + glGetIntegerv(GL_DEPTH_FUNC, ¤tDepthFunction); + glDepthFunc(GL_LEQUAL); GLenum blendEquationRGB, blendEquationAlpha, blendDestAlpha, blendDestRGB, blendSrcAlpha, blendSrcRGB; @@ -268,6 +272,8 @@ void RenderableSphericalGrid::render(const RenderData& data, RendererTasks&){ if (!isLineSmoothEnabled) { glDisable(GL_LINE_SMOOTH); } + + glDepthFunc(currentDepthFunction); } void RenderableSphericalGrid::update(const UpdateData&) { diff --git a/modules/base/rendering/renderablesphericalgrid.h b/modules/base/rendering/renderablesphericalgrid.h index 84400e2547..dadc57343e 100644 --- a/modules/base/rendering/renderablesphericalgrid.h +++ b/modules/base/rendering/renderablesphericalgrid.h @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include namespace ghoul::opengl { class ProgramObject; } @@ -63,7 +63,7 @@ protected: ghoul::opengl::ProgramObject* _gridProgram; properties::DMat4Property _gridMatrix; - properties::Vec4Property _gridColor; + properties::Vec3Property _gridColor; properties::IntProperty _segments; properties::FloatProperty _lineWidth; diff --git a/modules/base/shaders/grid_fs.glsl b/modules/base/shaders/grid_fs.glsl index e2865a33b4..e0f676a74d 100644 --- a/modules/base/shaders/grid_fs.glsl +++ b/modules/base/shaders/grid_fs.glsl @@ -25,18 +25,18 @@ #include "fragment.glsl" #include "PowerScaling/powerScaling_fs.hglsl" -in float vs_screenSpaceDepth; +in float vs_depthClipSpace; in vec4 vs_positionViewSpace; -uniform vec4 gridColor; +uniform vec3 gridColor; uniform float opacity; Fragment getFragment() { Fragment frag; - frag.color = gridColor; - frag.color.a *= opacity; - frag.depth = vs_screenSpaceDepth; - frag.gPosition = vs_positionViewSpace; + frag.color.rgb = gridColor; + frag.color.a = opacity; + frag.depth = vs_depthClipSpace; + frag.gPosition = vs_positionViewSpace; // There is no normal here frag.gNormal = vec4(0.0, 0.0, -1.0, 1.0); diff --git a/modules/base/shaders/grid_vs.glsl b/modules/base/shaders/grid_vs.glsl index 45941de4ce..587048960c 100644 --- a/modules/base/shaders/grid_vs.glsl +++ b/modules/base/shaders/grid_vs.glsl @@ -28,23 +28,21 @@ layout(location = 0) in vec3 in_position; -out float vs_screenSpaceDepth; +out float vs_depthClipSpace; out vec4 vs_positionViewSpace; uniform dmat4 modelViewTransform; uniform dmat4 MVPTransform; void main() { - dvec4 objPosDouble = dvec4(in_position, 1.0); - dvec4 positionViewSpace = modelViewTransform * objPosDouble; - dvec4 positionClipSpace = MVPTransform * objPosDouble; + dvec4 objPosDouble = dvec4(in_position, 1.0); + dvec4 positionViewSpace = modelViewTransform * objPosDouble; + dvec4 positionClipSpace = MVPTransform * objPosDouble; positionClipSpace.z = 0.0; - vec4 positionScreenSpace = vec4(positionClipSpace); - - vs_screenSpaceDepth = float(positionClipSpace.w); + vs_depthClipSpace = float(positionClipSpace.w); vs_positionViewSpace = vec4(positionViewSpace); - gl_Position = positionScreenSpace; + gl_Position = vec4(positionClipSpace); } diff --git a/src/scene/scenegraphnode.cpp b/src/scene/scenegraphnode.cpp index dc304556eb..c1d7dd7036 100644 --- a/src/scene/scenegraphnode.cpp +++ b/src/scene/scenegraphnode.cpp @@ -735,13 +735,13 @@ void SceneGraphNode::computeScreenSpaceData(RenderData& newData) { ); constexpr const double RadiusThreshold = 2.0; - const double r = abs(_screenSizeRadius - screenSpaceRadius); + const double r = std::fabs(_screenSizeRadius - screenSpaceRadius); if (r > RadiusThreshold) { _screenSizeRadius = screenSpaceRadius; } constexpr const double ZoomThreshold = 0.1; - const double d = abs(_distFromCamToNode - distFromCamToNode); + const double d = std::fabs(_distFromCamToNode - distFromCamToNode); if (d > (ZoomThreshold * distFromCamToNode)) { _distFromCamToNode = distFromCamToNode; } From 11b31b6c7b3af4bdf87cffd107b93f289dd8e8de Mon Sep 17 00:00:00 2001 From: Micah Acinapura Date: Tue, 9 Jun 2020 17:14:26 -0400 Subject: [PATCH 20/48] Rename Lola Clear to Lola Color as per convo with Carter --- data/assets/scene/solarsystem/planets/earth/moon/moon.asset | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data/assets/scene/solarsystem/planets/earth/moon/moon.asset b/data/assets/scene/solarsystem/planets/earth/moon/moon.asset index 851e8d135c..642e0a0e90 100644 --- a/data/assets/scene/solarsystem/planets/earth/moon/moon.asset +++ b/data/assets/scene/solarsystem/planets/earth/moon/moon.asset @@ -100,12 +100,12 @@ local Moon = { }, { Identifier = "Lola_Clr_Shade_Utah", - Name = "Lola Clear Shade [Utah]", + Name = "Lola Color Shade [Utah]", FilePath = mapServiceConfigs .. "/Utah/LolaClrShade.wms" }, { Identifier = "Lola_Clr_Shade_Sweden", - Name = "Lola Clear Shade [Sweden]", + Name = "Lola Color Shade [Sweden]", FilePath = mapServiceConfigs .. "/LiU/Lola_Clr_Shade.wms" }, { From df1bf45486ddc7b936a105d0f44507eb6b80c8a2 Mon Sep 17 00:00:00 2001 From: Micah Acinapura Date: Tue, 9 Jun 2020 17:15:50 -0400 Subject: [PATCH 21/48] Earth: rename BMNH to BMNG for next generation. --- data/assets/scene/solarsystem/planets/earth/earth.asset | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data/assets/scene/solarsystem/planets/earth/earth.asset b/data/assets/scene/solarsystem/planets/earth/earth.asset index 7b26c55ecc..2d96e1fe99 100644 --- a/data/assets/scene/solarsystem/planets/earth/earth.asset +++ b/data/assets/scene/solarsystem/planets/earth/earth.asset @@ -112,12 +112,12 @@ local Earth = { ) }, { - Name = "BMNH [Utah]", + Name = "BMNG [Utah]", Identifier = "BMNG_Utah", FilePath = mapServiceConfigsPath .. "/Utah/Bmng.wms" }, { - Name = "BMNH [Sweden]", + Name = "BMNG [Sweden]", Identifier = "BMNG_Sweden", FilePath = mapServiceConfigsPath .. "/LiU/Bmng.wms" }, From 46970b9981fb610139804501695e1ea6d3c54fe2 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Fri, 12 Jun 2020 19:03:57 +0200 Subject: [PATCH 22/48] Fix global positioning error introduced by misleading operator ordering (closes #1170) --- src/rendering/renderengine.cpp | 2 +- src/scene/scenegraphnode.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rendering/renderengine.cpp b/src/rendering/renderengine.cpp index 50cf01876d..d720adce60 100644 --- a/src/rendering/renderengine.cpp +++ b/src/rendering/renderengine.cpp @@ -517,7 +517,7 @@ void RenderEngine::updateScene() { const Time& integrateFromTime = global::timeManager.integrateFromTime(); _scene->update({ - { glm::dvec3(0.0), glm::dmat3(1.0), glm::dvec3(1.0) }, + TransformData{ glm::dvec3(0.0), glm::dmat3(1.0), glm::dvec3(1.0) }, currentTime, integrateFromTime, _doPerformanceMeasurements diff --git a/src/scene/scenegraphnode.cpp b/src/scene/scenegraphnode.cpp index dc304556eb..a142f02c4d 100644 --- a/src/scene/scenegraphnode.cpp +++ b/src/scene/scenegraphnode.cpp @@ -821,7 +821,7 @@ glm::dvec3 SceneGraphNode::calculateWorldPosition() const { const glm::dvec3 ws = _parent->worldScale(); const glm::dvec3 p = position(); - return wp + wrot * ws * p; + return wp + wrot * (ws * p); } else { return position(); From 7fb81a9ca2fde71d5606883175b4f197f31f9343 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Fri, 12 Jun 2020 19:43:21 +0200 Subject: [PATCH 23/48] Improve the performance of Borisov's trajectory by reducing the sampling rate from one sample per minute to one sample per week (it doesn't really change directions that fast anyway) --- apps/OpenSpace/ext/sgct | 2 +- apps/OpenSpace/main.cpp | 1 - .../scene/solarsystem/interstellar/c-2019_q4_borisov.asset | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/apps/OpenSpace/ext/sgct b/apps/OpenSpace/ext/sgct index 902ad00320..95d4237eaf 160000 --- a/apps/OpenSpace/ext/sgct +++ b/apps/OpenSpace/ext/sgct @@ -1 +1 @@ -Subproject commit 902ad00320c79b3f876530698ec1828c8dfceaab +Subproject commit 95d4237eaf2dc683c1782753f921f6b6ef373db0 diff --git a/apps/OpenSpace/main.cpp b/apps/OpenSpace/main.cpp index e7f534c60c..55de859016 100644 --- a/apps/OpenSpace/main.cpp +++ b/apps/OpenSpace/main.cpp @@ -57,7 +57,6 @@ #include #include #include -#include #include #include diff --git a/data/assets/scene/solarsystem/interstellar/c-2019_q4_borisov.asset b/data/assets/scene/solarsystem/interstellar/c-2019_q4_borisov.asset index 7d41e166ec..a21679ce59 100644 --- a/data/assets/scene/solarsystem/interstellar/c-2019_q4_borisov.asset +++ b/data/assets/scene/solarsystem/interstellar/c-2019_q4_borisov.asset @@ -20,7 +20,7 @@ local C2019Q4BorisovTrail = { Color = { 0.9, 0.9, 0.0 }, StartTime = "2015 JAN 01 00:00:00", EndTime = "2024 JAN 01 00:00:00", - SampleInterval = 60 + SampleInterval = 60 * 60 * 24 * 7 }, GUI = { Name = "C-2019 Q4 Borisov Trail", From d2fbfdbf227a270ac16ae4ec117c81e55f12eaa5 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Fri, 12 Jun 2020 21:50:05 +0200 Subject: [PATCH 24/48] Remove unused globebrowsing instrumentation --- ext/ghoul | 2 +- modules/globebrowsing/CMakeLists.txt | 5 -- modules/globebrowsing/globebrowsingmodule.cpp | 82 ------------------- modules/globebrowsing/globebrowsingmodule.h | 25 ------ modules/globebrowsing/src/renderableglobe.cpp | 24 ------ modules/globebrowsing/src/renderableglobe.h | 4 - 6 files changed, 1 insertion(+), 141 deletions(-) diff --git a/ext/ghoul b/ext/ghoul index 767fa3e42e..a634fc1515 160000 --- a/ext/ghoul +++ b/ext/ghoul @@ -1 +1 @@ -Subproject commit 767fa3e42e1831ade7deb5b4b099c2c5a823c9f9 +Subproject commit a634fc15154ee51462e379917299fbe546c9fd1d diff --git a/modules/globebrowsing/CMakeLists.txt b/modules/globebrowsing/CMakeLists.txt index ec5c7f389c..70834fe46a 100644 --- a/modules/globebrowsing/CMakeLists.txt +++ b/modules/globebrowsing/CMakeLists.txt @@ -117,11 +117,6 @@ create_new_module( ${HEADER_FILES} ${SOURCE_FILES} ${SHADER_FILES} ) -option(OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION "Instrumentation for GlobeBrowsing Performance" OFF) -if (OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION) - target_compile_definitions(openspace-module-globebrowsing INTERFACE "OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION") -endif () - install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/gdal_data DESTINATION modules/globebrowsing) if (WIN32) diff --git a/modules/globebrowsing/globebrowsingmodule.cpp b/modules/globebrowsing/globebrowsingmodule.cpp index b7cea3cb2d..7314da9eff 100644 --- a/modules/globebrowsing/globebrowsingmodule.cpp +++ b/modules/globebrowsing/globebrowsingmodule.cpp @@ -106,14 +106,6 @@ namespace { "The maximum size of the MemoryAwareTileCache, on the CPU and GPU." }; -#ifdef OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION - constexpr const openspace::properties::Property::PropertyInfo InstrumentationInfo = { - "SaveInstrumentationInfo", - "Save Instrumentation Info", - "If enabled, the instrumentation data is saved to disk at the end of the frame." - }; -#endif // OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION - openspace::GlobeBrowsingModule::Capabilities parseSubDatasets(char** subDatasets, int nSubdatasets) @@ -176,24 +168,12 @@ GlobeBrowsingModule::GlobeBrowsingModule() , _wmsCacheLocation(WMSCacheLocationInfo, "${BASE}/cache_gdal") , _wmsCacheSizeMB(WMSCacheSizeInfo, 1024) , _tileCacheSizeMB(TileCacheSizeInfo, 1024) -#ifdef OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION - , _saveInstrumentation(InstrumentationInfo, false) -#endif // OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION { addProperty(_wmsCacheEnabled); addProperty(_offlineMode); addProperty(_wmsCacheLocation); addProperty(_wmsCacheSizeMB); addProperty(_tileCacheSizeMB); - -#ifdef OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION - _saveInstrumentation.onChange([&]() { - if (_saveInstrumentation) { - _frameInfo.lastSavedFrame = global::renderEngine.frameNumber(); - } - }); - addProperty(_saveInstrumentation); -#endif // OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION } void GlobeBrowsingModule::internalInitialize(const ghoul::Dictionary& dict) { @@ -268,45 +248,6 @@ void GlobeBrowsingModule::internalInitialize(const ghoul::Dictionary& dict) { _tileCache->update(); }); - // Postdraw -#ifdef OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION - global::callback::postDraw.emplace_back([&]() { - ZoneScopedN("GlobeBrowsingModule") - - // >= as we might have multiple frames per postDraw call (stereo rendering, - // fisheye, etc) - const uint16_t next = _frameInfo.lastSavedFrame + _frameInfo.saveEveryNthFrame; - const bool shouldSave = _saveInstrumentation && - global::renderEngine.frameNumber() >= next; - if (shouldSave) { - using K = const globebrowsing::RenderableGlobe*; - using V = std::vector; - for (const std::pair& i : _frameInfo.frames) { - std::string filename = fmt::format( - "_inst_globebrowsing_{}_{}_{}.txt", - i.first->owner()->identifier(), // Owner of the renderable has a name - _frameInfo.lastSavedFrame, - _frameInfo.saveEveryNthFrame - ); - std::ofstream file(absPath("${BIN}/" + filename)); - for (const FrameInfo& f : i.second) { - std::string line = fmt::format( - "{}\t{}\t{}\t{}", - f.iFrame, - f.nTilesRenderedLocal, - f.nTilesRenderedGlobal, - f.nTilesUploaded - ); - file << line << '\n'; - } - } - - _frameInfo.frames.clear(); - _frameInfo.lastSavedFrame = global::renderEngine.frameNumber(); - } - }); -#endif // OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION - // Deinitialize global::callback::deinitialize.emplace_back([&]() { ZoneScopedN("GlobeBrowsingModule") @@ -834,27 +775,4 @@ uint64_t GlobeBrowsingModule::wmsCacheSize() const { return size * 1024 * 1024; } -#ifdef OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION -void GlobeBrowsingModule::addFrameInfo(globebrowsing::RenderableGlobe* globe, - uint32_t nTilesRenderedLocal, - uint32_t nTilesRenderedGlobal, - uint32_t nTilesUploaded) -{ - auto it = _frameInfo.frames.find(globe); - if (it == _frameInfo.frames.end()) { - _frameInfo.frames[globe] = std::vector(); - _frameInfo.frames[globe].reserve(_frameInfo.saveEveryNthFrame); - } - else { - it->second.push_back({ - global::renderEngine.frameNumber(), - nTilesRenderedLocal, - nTilesRenderedGlobal, - nTilesUploaded - }); - } -} - -#endif // OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION - } // namespace openspace diff --git a/modules/globebrowsing/globebrowsingmodule.h b/modules/globebrowsing/globebrowsingmodule.h index e6af83d999..cf3612ca66 100644 --- a/modules/globebrowsing/globebrowsingmodule.h +++ b/modules/globebrowsing/globebrowsingmodule.h @@ -95,11 +95,6 @@ public: std::string wmsCacheLocation() const; uint64_t wmsCacheSize() const; // bytes -#ifdef OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION - void addFrameInfo(globebrowsing::RenderableGlobe* globe, uint32_t nTilesRenderedLocal, - uint32_t nTilesRenderedGlobal, uint32_t nTilesUploaded); -#endif // OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION - protected: void internalInitialize(const ghoul::Dictionary&) override; @@ -141,26 +136,6 @@ private: std::map _capabilitiesMap; std::multimap _urlList; - -#ifdef OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION - struct FrameInfo { - uint64_t iFrame = 0; - uint32_t nTilesRenderedLocal = 0; - uint32_t nTilesRenderedGlobal = 0; - uint32_t nTilesUploaded = 0; - }; - - struct { - std::unordered_map< - globebrowsing::RenderableGlobe*, - std::vector - > frames; - - uint64_t lastSavedFrame = 0; - const uint16_t saveEveryNthFrame = 2048; - } _frameInfo; - properties::BoolProperty _saveInstrumentation; -#endif // OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION }; } // namespace openspace diff --git a/modules/globebrowsing/src/renderableglobe.cpp b/modules/globebrowsing/src/renderableglobe.cpp index b883b6acfb..6109087b54 100644 --- a/modules/globebrowsing/src/renderableglobe.cpp +++ b/modules/globebrowsing/src/renderableglobe.cpp @@ -50,13 +50,6 @@ #include #include -#ifdef OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION -#include -#include -openspace::GlobeBrowsingModule* _module = nullptr; - -#endif // OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION - namespace { // Global flags to modify the RenderableGlobe constexpr const bool LimitLevelByAvailableData = true; @@ -709,10 +702,6 @@ RenderableGlobe::RenderableGlobe(const ghoul::Dictionary& dictionary) _generalProperties.shadowMapping = true; } _generalProperties.shadowMapping.onChange(notifyShaderRecompilation); - -#ifdef OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION - _module = global::moduleEngine.module(); -#endif // OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION } void RenderableGlobe::initializeGL() { @@ -921,11 +910,7 @@ void RenderableGlobe::update(const UpdateData& data) { _shadowComponent.update(data); } -#ifdef OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION - _nUploadedTiles = _layerManager.update(); -#else _layerManager.update(); -#endif // OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION if (_nLayersIsDirty) { std::array lgs = @@ -1237,15 +1222,6 @@ void RenderableGlobe::renderChunks(const RenderData& data, RendererTasks&, } _localRenderer.program->deactivate(); -#ifdef OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION - _module->addFrameInfo( - this, - std::min(localCount, ChunkBufferSize), - std::min(globalCount, ChunkBufferSize), - _nUploadedTiles - ); -#endif // OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION - if (_debugProperties.showChunkBounds || _debugProperties.showChunkAABB) { for (int i = 0; i < std::min(globalCount, ChunkBufferSize); ++i) { debugRenderChunk( diff --git a/modules/globebrowsing/src/renderableglobe.h b/modules/globebrowsing/src/renderableglobe.h index ab4045d893..59f2c51b38 100644 --- a/modules/globebrowsing/src/renderableglobe.h +++ b/modules/globebrowsing/src/renderableglobe.h @@ -297,10 +297,6 @@ private: // Labels GlobeLabelsComponent _globeLabelsComponent; ghoul::Dictionary _labelsDictionary; - -#ifdef OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION - int _nUploadedTiles = 0; -#endif // OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION }; } // namespace openspace::globebrowsing From 74a572ec10e7766d51d560e729d30bd38d788227 Mon Sep 17 00:00:00 2001 From: Micah Acinapura Date: Fri, 12 Jun 2020 18:38:10 -0400 Subject: [PATCH 25/48] update iss asset --- .../planets/earth/satellites/misc/iss.asset | 745 ++++++++++++++++-- 1 file changed, 693 insertions(+), 52 deletions(-) diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/misc/iss.asset b/data/assets/scene/solarsystem/planets/earth/satellites/misc/iss.asset index 4f36cfc683..59209f9005 100644 --- a/data/assets/scene/solarsystem/planets/earth/satellites/misc/iss.asset +++ b/data/assets/scene/solarsystem/planets/earth/satellites/misc/iss.asset @@ -9,25 +9,32 @@ local filename = "ISS.txt" local nodes = {} local tle = satelliteHelper.downloadTLEFile(asset, url, identifier, filename) -local modelsLocation = asset.syncedResource({ +local textures = asset.syncedResource({ + Name = "ISS Textures", + Type = "HttpSynchronization", + Identifier = "iss_textures", + Version = 1 +}) + +local models = asset.syncedResource({ Name = "ISS Models", Type = "HttpSynchronization", Identifier = "iss_model", - Version = 1 + Version = 2 }) +local LightSources = assetHelper.getDefaultLightSources( + sunTransforms.SolarSystemBarycenter.Identifier) + + local initializeAndAddNodes = function() local lineElement = satelliteHelper.makeSingleLineElement(tle, filename) local period = satelliteHelper.getPeriodFromElement(lineElement) local path = tle .. "/" .. filename --- TLE data is only relevant in EarthInertial frame which means the model --- will inherit some irrelevant rotations from its parent. To get around that --- we perform the reverse rotation back to EarthBarycenter frame after applying --- the TLE translation local iss = { - Identifier = identifier, + Identifier = "ISS", Parent = transforms.EarthInertial.Identifier, Transform = { Translation = { @@ -50,70 +57,704 @@ local initializeAndAddNodes = function() } } - local issModel = { - Identifier = identifier .. "_model", +local parentNode = { + Identifier = "ISSparentNode", Parent = iss.Identifier, Transform = { Rotation = { - Type = "FixedRotation", - Attached = "ISS_model", - XAxis = { 1.0, 0.0, 0.0 }, - XAxisOrthogonal = true, - ZAxis = transforms.EarthInertial.Identifier + Type = "FixedRotation", + Attached = "ISSparentNode", + XAxis = { 0.01, -1.0, 0.56 }, + XAxisOrthogonal = true, + YAxis = transforms.EarthInertial.Identifier } }, - Renderable = { - Type = "RenderableModel", - Geometry = { - Type = "MultiModelGeometry", - GeometryFile = modelsLocation .. "/iss.obj" - }, - ColorTexture = modelsLocation .. "/gray.png", - LightSources = assetHelper.getDefaultLightSources(sunTransforms.SolarSystemBarycenter.Identifier) + GUI = { + Name = "parentNode", + Path = "/Solar System/Planets/Earth/Satellites/ISS", + Hidden = true, + } +} + +local zero = { + Identifier = "ISSzero", + Parent = parentNode.Identifier, + Transform = { }, - Tag = { "earth_satellite", "ISS" }, - GUI = { - Path = "/Solar System/Planets/Earth/Satellites/ISS" - } - } - - local issTrail = { - Identifier = identifier .. "_trail", - Parent = transforms.EarthInertial.Identifier, Renderable = { - Type = "RenderableTrailOrbit", - Translation = { - Type = "TLETranslation", - Body = identifier, - Observer = transforms.EarthInertial.Identifier, - File = path, - LineNumber = 1 + Type = "RenderableModel", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/0.obj" }, - Color = { 0.9, 0.6715, 0.0 }, - Fade = 1.5, - Period = period, - Resolution = 320 - }, - Tag = { "earth_satellite", "ISS" }, - GUI = { - Path = "/Solar System/Planets/Earth/Satellites/ISS" + ColorTexture = textures .. "/0.png", + LightSources = LightSources + }, + GUI = { + Name = "0", + Path = "/Solar System/Planets/Earth/Satellites/ISS", + Hidden = true, } - } +} - local myNodes = { iss, issModel, issTrail } +local one = { + Identifier = "ISSone", + Parent = parentNode.Identifier, + Transform = { + }, + Renderable = { + Type = "RenderableModel", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/1.obj" + }, + ColorTexture = textures .. "/1.png", + LightSources = LightSources + }, + GUI = { + Name = "1", + Path = "/Solar System/Planets/Earth/Satellites/ISS", + Hidden = true, + } +} + + +local two = { + Identifier = "ISStwo", + Parent = parentNode.Identifier, + Transform = { + }, + Renderable = { + Type = "RenderableModel", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/2.obj" + }, + ColorTexture = textures .. "/2.png", + LightSources = LightSources + }, + GUI = { + Name = "2", + Path = "/Solar System/Planets/Earth/Satellites/ISS", + Hidden = true, + } +} + +local three = { + Identifier = "ISSthree", + Parent = parentNode.Identifier, + Transform = { + }, + Renderable = { + Type = "RenderableModel", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/3.obj" + }, + ColorTexture = textures .. "/3.png", + LightSources = LightSources + }, + GUI = { + Name = "3", + Path = "/Solar System/Planets/Earth/Satellites/ISS", + Hidden = true, + } +} + +local four = { + Identifier = "ISSfour", + Parent = parentNode.Identifier, + Transform = { + }, + Renderable = { + Type = "RenderableModel", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/4.obj" + }, + ColorTexture = textures .. "/4.png", + LightSources = LightSources + }, + GUI = { + Name = "4", + Path = "/Solar System/Planets/Earth/Satellites/ISS", + Hidden = true, + } +} + +local five = { + Identifier = "ISSfive", + Parent = parentNode.Identifier, + Transform = { + }, + Renderable = { + Type = "RenderableModel", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/5.obj" + }, + ColorTexture = textures .. "/5.png", + LightSources = LightSources + }, + GUI = { + Name = "5", + Path = "/Solar System/Planets/Earth/Satellites/ISS", + Hidden = true, + } +} + +local six = { + Identifier = "ISSsix", + Parent = parentNode.Identifier, + Transform = { + }, + Renderable = { + Type = "RenderableModel", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/6.obj" + }, + ColorTexture = textures .. "/6.png", + LightSources = LightSources + }, + GUI = { + Name = "6", + Path = "/Solar System/Planets/Earth/Satellites/ISS", + Hidden = true, + } +} +local seven = { + Identifier = "ISSseven", + Parent = parentNode.Identifier, + Transform = { + }, + Renderable = { + Type = "RenderableModel", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/7.obj" + }, + ColorTexture = textures .. "/7.png", + LightSources = LightSources + }, + GUI = { + Name = "7", + Path = "/Solar System/Planets/Earth/Satellites/ISS", + Hidden = true, + } +} + +local eight = { + Identifier = "ISSeight", + Parent = parentNode.Identifier, + Transform = { + }, + Renderable = { + Type = "RenderableModel", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/8.obj" + }, + ColorTexture = textures .. "/8.png", + LightSources = LightSources + }, + GUI = { + Name = "8", + Path = "/Solar System/Planets/Earth/Satellites/ISS", + Hidden = true, + } +} + +local ten = { + Identifier = "ISSten", + Parent = parentNode.Identifier, + Transform = { + }, + Renderable = { + Type = "RenderableModel", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/10.obj" + }, + ColorTexture = textures .. "/10.png", + LightSources = LightSources + }, + GUI = { + Name = "10", + Path = "/Solar System/Planets/Earth/Satellites/ISS", + Hidden = true, + } +} + +local eleven = { + Identifier = "ISSeleven", + Parent = parentNode.Identifier, + Transform = { + }, + Renderable = { + Type = "RenderableModel", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/11.obj" + }, + ColorTexture = textures .. "/11.png", + LightSources = LightSources + }, + GUI = { + Name = "11", + Path = "/Solar System/Planets/Earth/Satellites/ISS", + Hidden = true, + } +} + +local thirteen = { + Identifier = "ISSthirteen", + Parent = parentNode.Identifier, + Transform = { + }, + Renderable = { + Type = "RenderableModel", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/13.obj" + }, + ColorTexture = textures .. "/13.png", + LightSources = LightSources + }, + GUI = { + Name = "13", + Path = "/Solar System/Planets/Earth/Satellites/ISS", + Hidden = true, + } +} + +local fourteen = { + Identifier = "ISSfourteen", + Parent = parentNode.Identifier, + Transform = { + }, + Renderable = { + Type = "RenderableModel", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/14.obj" + }, + ColorTexture = textures .. "/14.png", + LightSources = LightSources + }, + GUI = { + Name = "14", + Path = "/Solar System/Planets/Earth/Satellites/ISS", + Hidden = true, + } +} + +local fifteen = { + Identifier = "ISSfifteen", + Parent = parentNode.Identifier, + Transform = { + }, + Renderable = { + Type = "RenderableModel", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/15.obj" + }, + ColorTexture = textures .. "/15.png", + LightSources = LightSources + }, + GUI = { + Name = "15", + Path = "/Solar System/Planets/Earth/Satellites/ISS", + Hidden = true, + } +} + +local sixteen = { + Identifier = "ISSsixteen", + Parent = parentNode.Identifier, + Transform = { + }, + Renderable = { + Type = "RenderableModel", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/16.obj" + }, + ColorTexture = textures .. "/16.png", + LightSources = LightSources + }, + GUI = { + Name = "16", + Path = "/Solar System/Planets/Earth/Satellites/ISS", + Hidden = true, + } +} + +local seventeen = { + Identifier = "ISSseventeen", + Parent = parentNode.Identifier, + Transform = { + }, + Renderable = { + Type = "RenderableModel", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/17.obj" + }, + ColorTexture = textures .. "/17.png", + LightSources = LightSources + }, + GUI = { + Name = "17", + Path = "/Solar System/Planets/Earth/Satellites/ISS", + Hidden = true, + } +} + +local nineteen = { + Identifier = "ISSnineteen", + Parent = parentNode.Identifier, + Transform = { + }, + Renderable = { + Type = "RenderableModel", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/19.obj" + }, + ColorTexture = textures .. "/19.png", + LightSources = LightSources + }, + GUI = { + Name = "19", + Path = "/Solar System/Planets/Earth/Satellites/ISS", + Hidden = true, + } +} + +local twentyone = { + Identifier = "ISStwentyone", + Parent = parentNode.Identifier, + Transform = { + }, + Renderable = { + Type = "RenderableModel", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/21.obj" + }, + ColorTexture = textures .. "/21.png", + LightSources = LightSources + }, + GUI = { + Name = "21", + Path = "/Solar System/Planets/Earth/Satellites/ISS", + Hidden = true, + } +} + +local twentytwo = { + Identifier = "ISStwentytwo", + Parent = parentNode.Identifier, + Transform = { + }, + Renderable = { + Type = "RenderableModel", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/22.obj" + }, + ColorTexture = textures .. "/22.png", + LightSources = LightSources + }, + GUI = { + Name = "22", + Path = "/Solar System/Planets/Earth/Satellites/ISS", + Hidden = true, + } +} + +local twentythree = { + Identifier = "ISStwentythree", + Parent = parentNode.Identifier, + Transform = { + }, + Renderable = { + Type = "RenderableModel", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/23.obj" + }, + ColorTexture = textures .. "/23.png", + LightSources = LightSources + }, + GUI = { + Name = "23", + Path = "/Solar System/Planets/Earth/Satellites/ISS", + Hidden = true, + } +} + +local twentyfour = { + Identifier = "ISStwentyfour", + Parent = parentNode.Identifier, + Transform = { + }, + Renderable = { + Type = "RenderableModel", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/24.obj" + }, + ColorTexture = textures .. "/24.png", + LightSources = LightSources + }, + GUI = { + Name = "24", + Path = "/Solar System/Planets/Earth/Satellites/ISS", + Hidden = true, + } +} + +local twentyfive = { + Identifier = "ISStwentyfive", + Parent = parentNode.Identifier, + Transform = { + }, + Renderable = { + Type = "RenderableModel", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/25.obj" + }, + ColorTexture = textures .. "/25.png", + LightSources = LightSources + }, + GUI = { + Name = "25", + Path = "/Solar System/Planets/Earth/Satellites/ISS", + Hidden = true, + } +} + +local foilsilver = { + Identifier = "ISSfoilsilver", + Parent = parentNode.Identifier, + Transform = { + }, + Renderable = { + Type = "RenderableModel", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/foilsilver.obj" + }, + ColorTexture = textures .. "/foil.png", + LightSources = LightSources + }, + GUI = { + Name = "foilsilver", + Path = "/Solar System/Planets/Earth/Satellites/ISS", + Hidden = true, + } +} + +local olive = { + Identifier = "ISSolive", + Parent = parentNode.Identifier, + Transform = { + }, + Renderable = { + Type = "RenderableModel", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/olive.obj" + }, + ColorTexture = textures .. "/olive.png", + LightSources = LightSources + }, + GUI = { + Name = "olive", + Path = "/Solar System/Planets/Earth/Satellites/ISS", + Hidden = true, + } +} + +local basemetal = { + Identifier = "ISSbasemetal", + Parent = parentNode.Identifier, + Transform = { + }, + Renderable = { + Type = "RenderableModel", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/basemetal.obj" + }, + ColorTexture = textures .. "/basemetal.png", + LightSources = LightSources + }, + GUI = { + Name = "basemetal", + Path = "/Solar System/Planets/Earth/Satellites/ISS", + Hidden = true, + } +} + +local white_20 = { + Identifier = "ISSwhite_20", + Parent = parentNode.Identifier, + Transform = { + }, + Renderable = { + Type = "RenderableModel", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/white_20.obj" + }, + ColorTexture = textures .. "/white_20.png", + LightSources = LightSources + }, + GUI = { + Name = "white_20", + Path = "/Solar System/Planets/Earth/Satellites/ISS", + Hidden = true, + } +} + +local plasticblack = { + Identifier = "ISSplasticblack", + Parent = parentNode.Identifier, + Transform = { + }, + Renderable = { + Type = "RenderableModel", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/plasticblack.obj" + }, + ColorTexture = textures .. "/plasticblack.png", + LightSources = LightSources + }, + GUI = { + Name = "plasticblack", + Path = "/Solar System/Planets/Earth/Satellites/ISS", + Hidden = true, + } +} + +local ecostresswhite = { + Identifier = "ISSecostresswhite", + Parent = parentNode.Identifier, + Transform = { + }, + Renderable = { + Type = "RenderableModel", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/ecostresswhite.obj" + }, + ColorTexture = textures .. "/ecostresswhite.png", + LightSources = LightSources + }, + GUI = { + Name = "ecostresswhite", + Path = "/Solar System/Planets/Earth/Satellites/ISS", + Hidden = true, + } +} + +local plain = { + Identifier = "ISSplain", + Parent = parentNode.Identifier, + Transform = { + }, + Renderable = { + Type = "RenderableModel", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/plain.obj" + }, + ColorTexture = textures .. "/white_20.png", + LightSources = LightSources + }, + GUI = { + Name = "plain", + Path = "/Solar System/Planets/Earth/Satellites/ISS", + Hidden = true, + } +} + + +local issTrail = { + Identifier = identifier .. "_trail", + Parent = transforms.EarthInertial.Identifier, + Renderable = { + Type = "RenderableTrailOrbit", + Translation = { + Type = "TLETranslation", + Body = identifier, + Observer = transforms.EarthInertial.Identifier, + File = path, + LineNumber = 1 + }, + Color = { 0.9, 0.6715, 0.0 }, + Fade = 1.5, + Period = period, + Resolution = 320 + }, + Tag = { "earth_satellite", "ISS" }, + GUI = { + Name = "ISS Trail", + Path = "/Solar System/Planets/Earth/Satellites/ISS" + } +} + + local myNodes = { + iss, + parentNode, + zero, + one, + two, + three, + four, + five, + six, + seven, + eight, + ten, + eleven, + thirteen, + fourteen, + fifteen, + sixteen, + seventeen, + nineteen, + twentyone, + twentytwo, + twentythree, + twentyfour, + twentyfive, + foilsilver, + olive, + basemetal, + white_20, + plasticblack, + ecostresswhite, + plain, + issTrail + } for _, node in ipairs(myNodes) do openspace.addSceneGraphNode(node) end return myNodes + end asset.onInitialize(function () nodes = initializeAndAddNodes() + openspace.setPropertyValueSingle("Scene.parentNode.Rotation.yAxis-InvertObject", true) end) -asset.onDeinitialize(function () - openspace.removeSceneGraphNode(nodes[3].Identifier) -- Removing trail - openspace.removeSceneGraphNode(nodes[1].Identifier) -- Removing ISS and model recursively -end) From f5e45992b6cb528268d881e9d1837523da5af59a Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Sat, 13 Jun 2020 01:35:55 +0200 Subject: [PATCH 26/48] Add new non-inertial reference frame to correctly place Apollo 8 trail Remove unused dedicated launch trail asset file --- .../solarsystem/missions/apollo/apollo8.asset | 2 +- .../missions/apollo/apollo8launchtrail.asset | 74 ------------------- .../planets/earth/transforms.asset | 24 +++++- modules/base/timeframe/timeframeinterval.cpp | 8 +- 4 files changed, 27 insertions(+), 81 deletions(-) delete mode 100644 data/assets/scene/solarsystem/missions/apollo/apollo8launchtrail.asset diff --git a/data/assets/scene/solarsystem/missions/apollo/apollo8.asset b/data/assets/scene/solarsystem/missions/apollo/apollo8.asset index 627d264bef..fc54aeacfc 100644 --- a/data/assets/scene/solarsystem/missions/apollo/apollo8.asset +++ b/data/assets/scene/solarsystem/missions/apollo/apollo8.asset @@ -193,7 +193,7 @@ local Apollo8MoonTrail = { local Apollo8EarthBarycenterTrail = { Identifier = "Apollo8EarthBarycenterTrail", - Parent = "EarthBarycenter", + Parent = "EarthCenter", Renderable = { Type = "RenderableTrailTrajectory", Translation = { diff --git a/data/assets/scene/solarsystem/missions/apollo/apollo8launchtrail.asset b/data/assets/scene/solarsystem/missions/apollo/apollo8launchtrail.asset deleted file mode 100644 index 701051ff6e..0000000000 --- a/data/assets/scene/solarsystem/missions/apollo/apollo8launchtrail.asset +++ /dev/null @@ -1,74 +0,0 @@ -local assetHelper = asset.require('util/asset_helper') -local sunTransforms = asset.require('scene/solarsystem/sun/transforms') -local kernelsFolder = asset.syncedResource({ - Name = "Apollo Kernels", - Type = "HttpSynchronization", - Identifier = "apollo_spice", - Version = 1 -}) - -local kernels = { - kernelsFolder .. "/moon_080317.tf", - kernelsFolder .. "/apollo8.tf", - kernelsFolder .. "/moon_pa_de421_1900-2050.bpc", - kernelsFolder .. '/apollo8.tsc', - kernelsFolder .. '/apollo8.bsp', - kernelsFolder .. '/apollo8_earthrise.bc', -} - -local apolloSpiceId = "-908" - - -local Apollo8LaunchTrail = { - Identifier = "Apollo8LaunchTrail", - Parent = "Earth", - Renderable = { - Type = "RenderableTrailTrajectory", - Translation = { - Type = "SpiceTranslation", - Target = apolloSpiceId, - Observer = "EARTH", - Frame = "IAU_EARTH", - Kernels = kernels - }, - Color = { 0.70, 0.50, 0.20 }, - StartTime = "1968 DEC 21 12:51:00", - EndTime = "1968 DEC 21 23:23:22", - SampleInterval = 30 - }, - GUI = { - Name = "Apollo 8 Launch Trail", - Path = "/Solar System/Missions/Apollo" - } -} - -local Apollo8EarthBarycenterTrail = { - Identifier = "Apollo8EarthBarycenterTrail", - Parent = "EarthBarycenter", - Renderable = { - Type = "RenderableTrailTrajectory", - Translation = { - Type = "SpiceTranslation", - Target = apolloSpiceId, - Observer = "EARTH BARYCENTER", - Frame = "GALACTIC", - Kernels = kernels - }, - Color = { 1, 0.0, 0.0 }, - StartTime = "1968 DEC 21", - EndTime = "1968 DEC 28", - SampleInterval = 30, - Enabled = false, - }, - GUI = { - Name = "Apollo 8 Earth Barycenter Trail", - Path = "/Solar System/Missions/Apollo" - } -} - -local exportList = { - Apollo8LaunchTrail, - Apollo8EarthBarycenterTrail, -} - -assetHelper.registerSceneGraphNodesAndExport(asset, exportList) diff --git a/data/assets/scene/solarsystem/planets/earth/transforms.asset b/data/assets/scene/solarsystem/planets/earth/transforms.asset index 39fe3a9304..c0052befb6 100644 --- a/data/assets/scene/solarsystem/planets/earth/transforms.asset +++ b/data/assets/scene/solarsystem/planets/earth/transforms.asset @@ -10,7 +10,7 @@ local EarthBarycenter = { Transform = { Translation = { Type = "SpiceTranslation", - Target = "EARTH", + Target = "EARTH BARYCENTER", Observer = "SUN" } }, @@ -21,10 +21,27 @@ local EarthBarycenter = { } } +local EarthCenter = { + Identifier = "EarthCenter", + Parent = EarthBarycenter.Identifier, + Transform = { + Translation = { + Type = "SpiceTranslation", + Target = "EARTH", + Observer = "EARTH BARYCENTER" + } + }, + GUI = { + Name = "Earth Center", + Path = "/Solar System/Planets/Earth", + Hidden = true + } +} + local EarthInertial = { -- The default reference frame for Earth-orbiting satellites Identifier = "EarthInertial", - Parent = EarthBarycenter.Identifier, + Parent = EarthCenter.Identifier, Transform = { Rotation = { Type = "SpiceRotation", @@ -41,7 +58,7 @@ local EarthInertial = { local EarthIAU = { Identifier = "EarthIAU", - Parent = EarthBarycenter.Identifier, + Parent = EarthCenter.Identifier, Transform = { Rotation = { Type = "SpiceRotation", @@ -58,6 +75,7 @@ local EarthIAU = { assetHelper.registerSceneGraphNodesAndExport(asset, { EarthBarycenter, + EarthCenter, EarthInertial, EarthIAU }) diff --git a/modules/base/timeframe/timeframeinterval.cpp b/modules/base/timeframe/timeframeinterval.cpp index 53d8ebc1b9..2627d44e6e 100644 --- a/modules/base/timeframe/timeframeinterval.cpp +++ b/modules/base/timeframe/timeframeinterval.cpp @@ -124,9 +124,11 @@ TimeFrameInterval::TimeFrameInterval(const ghoul::Dictionary& dictionary) addProperty(_hasEnd); addProperty(_end); - documentation::testSpecificationAndThrow(Documentation(), - dictionary, - "TimeFrameInterval"); + documentation::testSpecificationAndThrow( + Documentation(), + dictionary, + "TimeFrameInterval" + ); if (dictionary.hasValue(StartInfo.identifier)) { _start = SpiceManager::ref().ephemerisTimeFromDate( From 4412af4e0d183c2609c2f815866e5ca6789c6dd3 Mon Sep 17 00:00:00 2001 From: Micah Acinapura Date: Fri, 12 Jun 2020 19:40:52 -0400 Subject: [PATCH 27/48] rework iss model parts to use assethelper --- .../planets/earth/satellites/misc/iss.asset | 752 ++---------------- 1 file changed, 60 insertions(+), 692 deletions(-) diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/misc/iss.asset b/data/assets/scene/solarsystem/planets/earth/satellites/misc/iss.asset index 59209f9005..f0274ee4cd 100644 --- a/data/assets/scene/solarsystem/planets/earth/satellites/misc/iss.asset +++ b/data/assets/scene/solarsystem/planets/earth/satellites/misc/iss.asset @@ -9,13 +9,6 @@ local filename = "ISS.txt" local nodes = {} local tle = satelliteHelper.downloadTLEFile(asset, url, identifier, filename) -local textures = asset.syncedResource({ - Name = "ISS Textures", - Type = "HttpSynchronization", - Identifier = "iss_textures", - Version = 1 -}) - local models = asset.syncedResource({ Name = "ISS Models", Type = "HttpSynchronization", @@ -53,698 +46,73 @@ local initializeAndAddNodes = function() Tag = { "earth_satellite", "ISS" }, GUI = { Path = "/Solar System/Planets/Earth/Satellites/ISS", - Hiden = true + Hiden = false } } -local parentNode = { - Identifier = "ISSparentNode", - Parent = iss.Identifier, - Transform = { - Rotation = { - Type = "FixedRotation", - Attached = "ISSparentNode", - XAxis = { 0.01, -1.0, 0.56 }, - XAxisOrthogonal = true, - YAxis = transforms.EarthInertial.Identifier - } - }, - GUI = { - Name = "parentNode", - Path = "/Solar System/Planets/Earth/Satellites/ISS", - Hidden = true, - } -} - -local zero = { - Identifier = "ISSzero", - Parent = parentNode.Identifier, - Transform = { - }, - Renderable = { - Type = "RenderableModel", - Geometry = { - Type = "MultiModelGeometry", - GeometryFile = models .. "/0.obj" - }, - ColorTexture = textures .. "/0.png", - LightSources = LightSources - }, - GUI = { - Name = "0", - Path = "/Solar System/Planets/Earth/Satellites/ISS", - Hidden = true, - } -} - -local one = { - Identifier = "ISSone", - Parent = parentNode.Identifier, - Transform = { - }, - Renderable = { - Type = "RenderableModel", - Geometry = { - Type = "MultiModelGeometry", - GeometryFile = models .. "/1.obj" - }, - ColorTexture = textures .. "/1.png", - LightSources = LightSources - }, - GUI = { - Name = "1", - Path = "/Solar System/Planets/Earth/Satellites/ISS", - Hidden = true, - } -} - - -local two = { - Identifier = "ISStwo", - Parent = parentNode.Identifier, - Transform = { - }, - Renderable = { - Type = "RenderableModel", - Geometry = { - Type = "MultiModelGeometry", - GeometryFile = models .. "/2.obj" - }, - ColorTexture = textures .. "/2.png", - LightSources = LightSources - }, - GUI = { - Name = "2", - Path = "/Solar System/Planets/Earth/Satellites/ISS", - Hidden = true, - } -} - -local three = { - Identifier = "ISSthree", - Parent = parentNode.Identifier, - Transform = { - }, - Renderable = { - Type = "RenderableModel", - Geometry = { - Type = "MultiModelGeometry", - GeometryFile = models .. "/3.obj" - }, - ColorTexture = textures .. "/3.png", - LightSources = LightSources - }, - GUI = { - Name = "3", - Path = "/Solar System/Planets/Earth/Satellites/ISS", - Hidden = true, - } -} - -local four = { - Identifier = "ISSfour", - Parent = parentNode.Identifier, - Transform = { - }, - Renderable = { - Type = "RenderableModel", - Geometry = { - Type = "MultiModelGeometry", - GeometryFile = models .. "/4.obj" - }, - ColorTexture = textures .. "/4.png", - LightSources = LightSources - }, - GUI = { - Name = "4", - Path = "/Solar System/Planets/Earth/Satellites/ISS", - Hidden = true, - } -} - -local five = { - Identifier = "ISSfive", - Parent = parentNode.Identifier, - Transform = { - }, - Renderable = { - Type = "RenderableModel", - Geometry = { - Type = "MultiModelGeometry", - GeometryFile = models .. "/5.obj" - }, - ColorTexture = textures .. "/5.png", - LightSources = LightSources - }, - GUI = { - Name = "5", - Path = "/Solar System/Planets/Earth/Satellites/ISS", - Hidden = true, - } -} - -local six = { - Identifier = "ISSsix", - Parent = parentNode.Identifier, - Transform = { - }, - Renderable = { - Type = "RenderableModel", - Geometry = { - Type = "MultiModelGeometry", - GeometryFile = models .. "/6.obj" - }, - ColorTexture = textures .. "/6.png", - LightSources = LightSources - }, - GUI = { - Name = "6", - Path = "/Solar System/Planets/Earth/Satellites/ISS", - Hidden = true, - } -} -local seven = { - Identifier = "ISSseven", - Parent = parentNode.Identifier, - Transform = { - }, - Renderable = { - Type = "RenderableModel", - Geometry = { - Type = "MultiModelGeometry", - GeometryFile = models .. "/7.obj" - }, - ColorTexture = textures .. "/7.png", - LightSources = LightSources - }, - GUI = { - Name = "7", - Path = "/Solar System/Planets/Earth/Satellites/ISS", - Hidden = true, - } -} - -local eight = { - Identifier = "ISSeight", - Parent = parentNode.Identifier, - Transform = { - }, - Renderable = { - Type = "RenderableModel", - Geometry = { - Type = "MultiModelGeometry", - GeometryFile = models .. "/8.obj" - }, - ColorTexture = textures .. "/8.png", - LightSources = LightSources - }, - GUI = { - Name = "8", - Path = "/Solar System/Planets/Earth/Satellites/ISS", - Hidden = true, - } -} - -local ten = { - Identifier = "ISSten", - Parent = parentNode.Identifier, - Transform = { - }, - Renderable = { - Type = "RenderableModel", - Geometry = { - Type = "MultiModelGeometry", - GeometryFile = models .. "/10.obj" - }, - ColorTexture = textures .. "/10.png", - LightSources = LightSources - }, - GUI = { - Name = "10", - Path = "/Solar System/Planets/Earth/Satellites/ISS", - Hidden = true, - } -} - -local eleven = { - Identifier = "ISSeleven", - Parent = parentNode.Identifier, - Transform = { - }, - Renderable = { - Type = "RenderableModel", - Geometry = { - Type = "MultiModelGeometry", - GeometryFile = models .. "/11.obj" - }, - ColorTexture = textures .. "/11.png", - LightSources = LightSources - }, - GUI = { - Name = "11", - Path = "/Solar System/Planets/Earth/Satellites/ISS", - Hidden = true, - } -} - -local thirteen = { - Identifier = "ISSthirteen", - Parent = parentNode.Identifier, - Transform = { - }, - Renderable = { - Type = "RenderableModel", - Geometry = { - Type = "MultiModelGeometry", - GeometryFile = models .. "/13.obj" - }, - ColorTexture = textures .. "/13.png", - LightSources = LightSources - }, - GUI = { - Name = "13", - Path = "/Solar System/Planets/Earth/Satellites/ISS", - Hidden = true, - } -} - -local fourteen = { - Identifier = "ISSfourteen", - Parent = parentNode.Identifier, - Transform = { - }, - Renderable = { - Type = "RenderableModel", - Geometry = { - Type = "MultiModelGeometry", - GeometryFile = models .. "/14.obj" - }, - ColorTexture = textures .. "/14.png", - LightSources = LightSources - }, - GUI = { - Name = "14", - Path = "/Solar System/Planets/Earth/Satellites/ISS", - Hidden = true, - } -} - -local fifteen = { - Identifier = "ISSfifteen", - Parent = parentNode.Identifier, - Transform = { - }, - Renderable = { - Type = "RenderableModel", - Geometry = { - Type = "MultiModelGeometry", - GeometryFile = models .. "/15.obj" - }, - ColorTexture = textures .. "/15.png", - LightSources = LightSources - }, - GUI = { - Name = "15", - Path = "/Solar System/Planets/Earth/Satellites/ISS", - Hidden = true, - } -} - -local sixteen = { - Identifier = "ISSsixteen", - Parent = parentNode.Identifier, - Transform = { - }, - Renderable = { - Type = "RenderableModel", - Geometry = { - Type = "MultiModelGeometry", - GeometryFile = models .. "/16.obj" - }, - ColorTexture = textures .. "/16.png", - LightSources = LightSources - }, - GUI = { - Name = "16", - Path = "/Solar System/Planets/Earth/Satellites/ISS", - Hidden = true, - } -} - -local seventeen = { - Identifier = "ISSseventeen", - Parent = parentNode.Identifier, - Transform = { - }, - Renderable = { - Type = "RenderableModel", - Geometry = { - Type = "MultiModelGeometry", - GeometryFile = models .. "/17.obj" - }, - ColorTexture = textures .. "/17.png", - LightSources = LightSources - }, - GUI = { - Name = "17", - Path = "/Solar System/Planets/Earth/Satellites/ISS", - Hidden = true, - } -} - -local nineteen = { - Identifier = "ISSnineteen", - Parent = parentNode.Identifier, - Transform = { - }, - Renderable = { - Type = "RenderableModel", - Geometry = { - Type = "MultiModelGeometry", - GeometryFile = models .. "/19.obj" - }, - ColorTexture = textures .. "/19.png", - LightSources = LightSources - }, - GUI = { - Name = "19", - Path = "/Solar System/Planets/Earth/Satellites/ISS", - Hidden = true, - } -} - -local twentyone = { - Identifier = "ISStwentyone", - Parent = parentNode.Identifier, - Transform = { - }, - Renderable = { - Type = "RenderableModel", - Geometry = { - Type = "MultiModelGeometry", - GeometryFile = models .. "/21.obj" - }, - ColorTexture = textures .. "/21.png", - LightSources = LightSources - }, - GUI = { - Name = "21", - Path = "/Solar System/Planets/Earth/Satellites/ISS", - Hidden = true, - } -} - -local twentytwo = { - Identifier = "ISStwentytwo", - Parent = parentNode.Identifier, - Transform = { - }, - Renderable = { - Type = "RenderableModel", - Geometry = { - Type = "MultiModelGeometry", - GeometryFile = models .. "/22.obj" - }, - ColorTexture = textures .. "/22.png", - LightSources = LightSources - }, - GUI = { - Name = "22", - Path = "/Solar System/Planets/Earth/Satellites/ISS", - Hidden = true, - } -} - -local twentythree = { - Identifier = "ISStwentythree", - Parent = parentNode.Identifier, - Transform = { - }, - Renderable = { - Type = "RenderableModel", - Geometry = { - Type = "MultiModelGeometry", - GeometryFile = models .. "/23.obj" - }, - ColorTexture = textures .. "/23.png", - LightSources = LightSources - }, - GUI = { - Name = "23", - Path = "/Solar System/Planets/Earth/Satellites/ISS", - Hidden = true, - } -} - -local twentyfour = { - Identifier = "ISStwentyfour", - Parent = parentNode.Identifier, - Transform = { - }, - Renderable = { - Type = "RenderableModel", - Geometry = { - Type = "MultiModelGeometry", - GeometryFile = models .. "/24.obj" - }, - ColorTexture = textures .. "/24.png", - LightSources = LightSources - }, - GUI = { - Name = "24", - Path = "/Solar System/Planets/Earth/Satellites/ISS", - Hidden = true, - } -} - -local twentyfive = { - Identifier = "ISStwentyfive", - Parent = parentNode.Identifier, - Transform = { - }, - Renderable = { - Type = "RenderableModel", - Geometry = { - Type = "MultiModelGeometry", - GeometryFile = models .. "/25.obj" - }, - ColorTexture = textures .. "/25.png", - LightSources = LightSources - }, - GUI = { - Name = "25", - Path = "/Solar System/Planets/Earth/Satellites/ISS", - Hidden = true, - } -} - -local foilsilver = { - Identifier = "ISSfoilsilver", - Parent = parentNode.Identifier, - Transform = { - }, - Renderable = { - Type = "RenderableModel", - Geometry = { - Type = "MultiModelGeometry", - GeometryFile = models .. "/foilsilver.obj" - }, - ColorTexture = textures .. "/foil.png", - LightSources = LightSources - }, - GUI = { - Name = "foilsilver", - Path = "/Solar System/Planets/Earth/Satellites/ISS", - Hidden = true, - } -} - -local olive = { - Identifier = "ISSolive", - Parent = parentNode.Identifier, - Transform = { - }, - Renderable = { - Type = "RenderableModel", - Geometry = { - Type = "MultiModelGeometry", - GeometryFile = models .. "/olive.obj" - }, - ColorTexture = textures .. "/olive.png", - LightSources = LightSources - }, - GUI = { - Name = "olive", - Path = "/Solar System/Planets/Earth/Satellites/ISS", - Hidden = true, - } -} - -local basemetal = { - Identifier = "ISSbasemetal", - Parent = parentNode.Identifier, - Transform = { - }, - Renderable = { - Type = "RenderableModel", - Geometry = { - Type = "MultiModelGeometry", - GeometryFile = models .. "/basemetal.obj" - }, - ColorTexture = textures .. "/basemetal.png", - LightSources = LightSources - }, - GUI = { - Name = "basemetal", - Path = "/Solar System/Planets/Earth/Satellites/ISS", - Hidden = true, - } -} - -local white_20 = { - Identifier = "ISSwhite_20", - Parent = parentNode.Identifier, - Transform = { - }, - Renderable = { - Type = "RenderableModel", - Geometry = { - Type = "MultiModelGeometry", - GeometryFile = models .. "/white_20.obj" - }, - ColorTexture = textures .. "/white_20.png", - LightSources = LightSources - }, - GUI = { - Name = "white_20", - Path = "/Solar System/Planets/Earth/Satellites/ISS", - Hidden = true, - } -} - -local plasticblack = { - Identifier = "ISSplasticblack", - Parent = parentNode.Identifier, - Transform = { - }, - Renderable = { - Type = "RenderableModel", - Geometry = { - Type = "MultiModelGeometry", - GeometryFile = models .. "/plasticblack.obj" - }, - ColorTexture = textures .. "/plasticblack.png", - LightSources = LightSources - }, - GUI = { - Name = "plasticblack", - Path = "/Solar System/Planets/Earth/Satellites/ISS", - Hidden = true, - } -} - -local ecostresswhite = { - Identifier = "ISSecostresswhite", - Parent = parentNode.Identifier, - Transform = { - }, - Renderable = { - Type = "RenderableModel", - Geometry = { - Type = "MultiModelGeometry", - GeometryFile = models .. "/ecostresswhite.obj" - }, - ColorTexture = textures .. "/ecostresswhite.png", - LightSources = LightSources - }, - GUI = { - Name = "ecostresswhite", - Path = "/Solar System/Planets/Earth/Satellites/ISS", - Hidden = true, - } -} - -local plain = { - Identifier = "ISSplain", - Parent = parentNode.Identifier, - Transform = { - }, - Renderable = { - Type = "RenderableModel", - Geometry = { - Type = "MultiModelGeometry", - GeometryFile = models .. "/plain.obj" - }, - ColorTexture = textures .. "/white_20.png", - LightSources = LightSources - }, - GUI = { - Name = "plain", - Path = "/Solar System/Planets/Earth/Satellites/ISS", - Hidden = true, - } -} - - -local issTrail = { - Identifier = identifier .. "_trail", - Parent = transforms.EarthInertial.Identifier, - Renderable = { - Type = "RenderableTrailOrbit", - Translation = { - Type = "TLETranslation", - Body = identifier, - Observer = transforms.EarthInertial.Identifier, - File = path, - LineNumber = 1 + local parentNode = { + Identifier = "ISSparentNode", + Parent = iss.Identifier, + Transform = { + Rotation = { + Type = "FixedRotation", + Attached = "ISSparentNode", + XAxis = { 0.01, -1.0, 0.56 }, + XAxisOrthogonal = true, + YAxis = transforms.EarthInertial.Identifier + } }, - Color = { 0.9, 0.6715, 0.0 }, - Fade = 1.5, - Period = period, - Resolution = 320 - }, - Tag = { "earth_satellite", "ISS" }, - GUI = { - Name = "ISS Trail", - Path = "/Solar System/Planets/Earth/Satellites/ISS" + GUI = { + Name = "parentNode", + Path = "/Solar System/Planets/Earth/Satellites/ISS", + Hidden = true, + } } -} - local myNodes = { - iss, - parentNode, - zero, - one, - two, - three, - four, - five, - six, - seven, - eight, - ten, - eleven, - thirteen, - fourteen, - fifteen, - sixteen, - seventeen, - nineteen, - twentyone, - twentytwo, - twentythree, - twentyfour, - twentyfive, - foilsilver, - olive, - basemetal, - white_20, - plasticblack, - ecostresswhite, - plain, - issTrail + local list = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "10", "11", + "13", "14", "15", "16", "17", "19", "21", "22", "23", "24", "25", + "foilsilver", "olive", "basemetal", "white_20", "plasticblack", "ecostresswhite", + "plain"} + + local myNodes = {iss, parentNode} + for i, info in ipairs(list) do + myNodes[#myNodes + 1] = assetHelper.createModelPart( + parentNode.Identifier, + sunTransforms.SolarSystemBarycenter.Identifier, + models, + info, + info .. ".png", + true + ) + end + + local issTrail = { + Identifier = identifier .. "_trail", + Parent = transforms.EarthInertial.Identifier, + Renderable = { + Type = "RenderableTrailOrbit", + Translation = { + Type = "TLETranslation", + Body = identifier, + Observer = transforms.EarthInertial.Identifier, + File = path, + LineNumber = 1 + }, + Color = { 0.9, 0.6715, 0.0 }, + Fade = 1.5, + Period = period, + Resolution = 320 + }, + Tag = { "earth_satellite", "ISS" }, + GUI = { + Name = "ISS Trail", + Path = "/Solar System/Planets/Earth/Satellites/ISS" + } } + + myNodes[#myNodes + 1] = issTrail + for _, node in ipairs(myNodes) do openspace.addSceneGraphNode(node) end @@ -755,6 +123,6 @@ end asset.onInitialize(function () nodes = initializeAndAddNodes() - openspace.setPropertyValueSingle("Scene.parentNode.Rotation.yAxis-InvertObject", true) + openspace.setPropertyValueSingle("Scene.ISSparentNode.Rotation.yAxis-InvertObject", true) end) From d1fcd353d7218e6889cb9128317e9dd56b950266 Mon Sep 17 00:00:00 2001 From: Micah Acinapura Date: Fri, 12 Jun 2020 19:42:43 -0400 Subject: [PATCH 28/48] iss asset cleanup --- .../solarsystem/planets/earth/satellites/misc/iss.asset | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/misc/iss.asset b/data/assets/scene/solarsystem/planets/earth/satellites/misc/iss.asset index f0274ee4cd..1eca717d22 100644 --- a/data/assets/scene/solarsystem/planets/earth/satellites/misc/iss.asset +++ b/data/assets/scene/solarsystem/planets/earth/satellites/misc/iss.asset @@ -16,10 +16,6 @@ local models = asset.syncedResource({ Version = 2 }) -local LightSources = assetHelper.getDefaultLightSources( - sunTransforms.SolarSystemBarycenter.Identifier) - - local initializeAndAddNodes = function() local lineElement = satelliteHelper.makeSingleLineElement(tle, filename) @@ -62,8 +58,8 @@ local initializeAndAddNodes = function() YAxis = transforms.EarthInertial.Identifier } }, - GUI = { - Name = "parentNode", + GUI = { + Name = "ISSparentNode", Path = "/Solar System/Planets/Earth/Satellites/ISS", Hidden = true, } @@ -110,7 +106,6 @@ local initializeAndAddNodes = function() } } - myNodes[#myNodes + 1] = issTrail for _, node in ipairs(myNodes) do From 0049a2db38bd24dfbe056fc788a9ca54b1c797a1 Mon Sep 17 00:00:00 2001 From: Micah Acinapura Date: Fri, 5 Jun 2020 04:13:01 -0400 Subject: [PATCH 29/48] mars2020 first commit --- data/assets/mars.scene | 65 + .../missions/insight/shortcuts.asset | 62 + .../missions/perseverance/model.asset | 1246 +++++++++++++++++ .../missions/perseverance/perseverance.asset | 5 + .../missions/perseverance/shortcuts.asset | 70 + .../missions/perseverance/trail.asset | 94 ++ .../missions/perseverance/transforms.asset | 528 +++++++ data/assets/util/scene_helper.asset | 77 + 8 files changed, 2147 insertions(+) create mode 100644 data/assets/mars.scene create mode 100644 data/assets/scene/solarsystem/missions/insight/shortcuts.asset create mode 100644 data/assets/scene/solarsystem/missions/perseverance/model.asset create mode 100644 data/assets/scene/solarsystem/missions/perseverance/perseverance.asset create mode 100644 data/assets/scene/solarsystem/missions/perseverance/shortcuts.asset create mode 100644 data/assets/scene/solarsystem/missions/perseverance/trail.asset create mode 100644 data/assets/scene/solarsystem/missions/perseverance/transforms.asset diff --git a/data/assets/mars.scene b/data/assets/mars.scene new file mode 100644 index 0000000000..63f26cbdb3 --- /dev/null +++ b/data/assets/mars.scene @@ -0,0 +1,65 @@ +asset.require('./base') +local sceneHelper = asset.require('util/scene_helper') + +local perseveranceAsset = asset.require('scene/solarsystem/missions/perseverance/perseverance') +local perseveranceShortcuts = asset.require('scene/solarsystem/missions/perseverance/shortcuts') + +local insightAsset = asset.require('scene/solarsystem/missions/insight/edl') +local insightShortcuts = asset.require('scene/solarsystem/missions/insight/shortcuts') + + +local insightEDLShortcuts = sceneHelper.extractShortcuts({"Insight Height Offset", + "Enable HiRISE", + "Insight EDL Time", + "Insight EDL NavigationState"}, + insightShortcuts.Shortcuts) + +local insightDisableShortcuts = sceneHelper.extractShortcuts({ + "Default Height Offset", + "Disable HiRISE"}, + insightShortcuts.Shortcuts) + +local PerseverenceLandedShortcuts = sceneHelper.extractShortcuts({ + "Perseverance Height Offset", + "Perseverance landed time", + -- "Show Perseverance Trail", + "Enable HiRISE"}, + perseveranceShortcuts.Shortcuts) + + +local Keybindings = { + sceneHelper.createKeyBindFromShortcuts("i", + insightEDLShortcuts, + "/Missions/Insight", + "Set and goto Insight Landing", + "Setup scene for insight EDL" + ), + sceneHelper.createKeyBindFromShortcuts("SHIFT+i", + insightDisableShortcuts, + "/Missions/Insight", + "Unset Insight Landing", + "Disable Mars layer settings used for insight EDL" + ), + sceneHelper.createKeyBindFromShortcuts("p", + PerseverenceLandedShortcuts, + "/Missions/Perseverance" + ) +} + +asset.onInitialize(function () + + local now = openspace.time.currentWallTime() + openspace.time.setTime(now) + + sceneHelper.bindKeys(Keybindings) + + openspace.globebrowsing.goToGeo("Mars", 58.5877, 16.1924, 8000000) + + openspace.markInterestingNodes({ "Mars", insightAsset.Insight.Identifier }) + +end) + +asset.onDeinitialize(function () + sceneHelper.unbindKeys(Keybindings) + openspace.removeInterestingNodes({ "Mars", insightAsset.Insight.Identifier}) +end) diff --git a/data/assets/scene/solarsystem/missions/insight/shortcuts.asset b/data/assets/scene/solarsystem/missions/insight/shortcuts.asset new file mode 100644 index 0000000000..200b231d6e --- /dev/null +++ b/data/assets/scene/solarsystem/missions/insight/shortcuts.asset @@ -0,0 +1,62 @@ +--insight/shortcuts.asset + +local InsightEntryTime = "2018 NOV 26 19:39:03.68" + +local insightNavigationSate = "{" .. + "Anchor = 'Insight'," .. + "Pitch = 0.567457E-4," .. + "Position = { 1.240506E1,-1.369270E1,-2.423553E0 }," .. + "ReferenceFrame = 'Root',".. + "Up = { 0.441211E0,0.247019E0,0.862737E0 }," .. + "Yaw = -0.446853E-4}" + +local Shortcuts = { + { + Command = "openspace.setPropertyValueSingle('Scene.Mars.Renderable.Layers.HeightLayers.Mola_Utah.Settings.Offset', -469.300000);" .. + "openspace.setPropertyValueSingle('Scene.Mars.Renderable.Layers.HeightLayers.OnMarsHiRISELS.Settings.Offset', -470.800006);", + Documentation = "Enable Insight landing height layer offset", + Name = "Insight Height Offset", + GuiPath = "/Missions/Insight", + Local = false + }, + { + Command = "openspace.setPropertyValueSingle('Scene.Mars.Renderable.Layers.HeightLayers.Mola_Utah.Settings.Offset', 0);" .. + "openspace.setPropertyValueSingle('Scene.Mars.Renderable.Layers.HeightLayers.OnMarsHiRISELS.Settings.Offset', 0);", + Documentation = "Disable Insight landing height layer offset", + Name = "Default Height Offset", + GuiPath = "/Missions/Insight", + Local = false + }, + { + Command = "openspace.setPropertyValueSingle('Scene.Mars.Renderable.Layers.HeightLayers.OnMarsHiRISELS.Enabled', true);" .. + "openspace.setPropertyValueSingle('Scene.Mars.Renderable.Layers.ColorLayers.OnMarsHiRISELS.Enabled', true);", + Documentation = "Enables HiRISE layer for insight landing", + Name = "Enable HiRISE", + GuiPath = "/Missions/Insight", + Local = false + }, + { + Command = "openspace.setPropertyValueSingle('Scene.Mars.Renderable.Layers.HeightLayers.OnMarsHiRISELS.Enabled', false);" .. + "openspace.setPropertyValueSingle('Scene.Mars.Renderable.Layers.ColorLayers.OnMarsHiRISELS.Enabled', false);", + Documentation = "Disables HiRISE layer used for insight landing", + Name = "Disable HiRISE", + GuiPath = "/Missions/Insight", + Local = false + }, + { + Command = "openspace.navigation.setNavigationState(" .. insightNavigationSate .. ");", + Documentation = "Change the camera state for the start of Insight EDL", + Name = "Insight EDL NavigationState", + GuiPath = "/Missions/Insight", + Local = false + }, + { + Command = "openspace.time.setPause(true);openspace.time.setTime('" .. InsightEntryTime .. "');", + Documentation = "Change the time for the start of Insight EDL", + Name = "Insight EDL Time", + GuiPath = "/Missions/Insight", + Local = false + }, +} + +asset.export("Shortcuts", Shortcuts) diff --git a/data/assets/scene/solarsystem/missions/perseverance/model.asset b/data/assets/scene/solarsystem/missions/perseverance/model.asset new file mode 100644 index 0000000000..9f970b5043 --- /dev/null +++ b/data/assets/scene/solarsystem/missions/perseverance/model.asset @@ -0,0 +1,1246 @@ +--perseverance/model.asset +local assetHelper = asset.require('util/asset_helper') +local transforms = asset.require('./transforms') +local marsTransforms = asset.require('scene/solarsystem/planets/mars/transforms') +local sunTransforms = asset.require('scene/solarsystem/sun/transforms') +-- asset.require('./fov') + +local LightSources = { + { + Type = "SceneGraphLightSource", + Identifier = "Sun", + Node = sunTransforms.SolarSystemBarycenter.Identifier, + Intensity = 1.0 + }, + { + Identifier = "Camera", + Type = "CameraLightSource", + Intensity = 0.5 + } +} + +local models = asset.syncedResource({ + Name = "Mars 2020 Kernels", + Type = "HttpSynchronization", + Identifier = "perseverance_models", + Version = 1 +}) + +local textures = asset.syncedResource({ + Name = "Mars 2020 Kernels", + Type = "HttpSynchronization", + Identifier = "perseverance_textures", + Version = 1 +}) + + + +-- Perseverance Model -- +local Perseverance = { + Identifier = "PerseveranceM", + Parent = transforms.MSL_Body.Identifier, + GUI = { + Name = "Perseverance Position", + Path = "/Solar System/Missions/Perseverance" + } +} + + +-- Perseverance Model -- +local PerseveranceModel = { + Identifier = "PerseveranceModel", + Parent = Perseverance.Identifier, + GUI = { + Name = "Perseverance Model", + Path = "/Solar System/Missions/Perseverance" + } +} + +-- Perseverance Model Instruments -- +local Body = { + Identifier = "body", + Parent = PerseveranceModel.Identifier, + Renderable = { + Type = "RenderableModel", + Body = "MARS SCIENCE LABORATORY", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/MSL_BODY_new_1.obj" + }, + ColorTexture = textures .. "/tex_01.png", + LightSources = LightSources, + PerformShading = false, + GUI = { + Name = "Perseverance Model Body", + Hidden = false, + Path = "/Solar System/Missions/Perseverance/Model" + } + } +} + +local Body_detail = { + Identifier = "Body_detail", + Parent = Body.Identifier, + Renderable = { + Type = "RenderableModel", + Body = "MARS SCIENCE LABORATORY", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/MSL_BODY_new_1_new_detail.obj" + }, + ColorTexture = textures .. "/tex_01.png", + LightSources = LightSources, + PerformShading = false, + GUI = { + Name = "Body Detail", + Hidden = true, + Path = "/Solar System/Missions/Perseverance/Model" + } + } +} + +local Body_staticParts_1 = { + Identifier = "Body_staticParts_1", + Parent = Body.Identifier, + Renderable = { + Type = "RenderableModel", + Body = "MARS SCIENCE LABORATORY", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/MSL_BODY_new_2.obj" + }, + ColorTexture = textures .. "/tex_02.png", + LightSources = LightSources, + PerformShading = false, + GUI = { + Path = "/Solar System/Missions/Perseverance/Model", + Hidden = true + } + } +} + +local Body_staticParts_2 = { + Identifier = "Body_staticParts_2", + Parent = Body.Identifier, + Renderable = { + Type = "RenderableModel", + Body = "MARS SCIENCE LABORATORY", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/MSL_BODY_new_3.obj" + }, + ColorTexture = textures .. "/tex_03.png", + LightSources = LightSources, + PerformShading = false, + GUI = { + Path = "/Solar System/Missions/Perseverance/Model", + Hidden = true + } + } +} + +local Body_staticParts_3 = { + Identifier = "Body_staticParts_3", + Parent = Body.Identifier, + Renderable = { + Type = "RenderableModel", + Body = "MARS SCIENCE LABORATORY", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/MSL_BODY_new_4.obj" + }, + ColorTexture = textures .. "/tex_04.png", + LightSources = LightSources, + PerformShading = false, + GUI = { + Path = "/Solar System/Missions/Perseverance/Model", + Hidden = true + } + } +} + +local Body_staticParts_4 = { + Identifier = "Body_staticParts_4", + Parent = Body.Identifier, + Renderable = { + Type = "RenderableModel", + Body = "MARS SCIENCE LABORATORY", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/MSL_BODY_new_5.obj" + }, + ColorTexture = textures .. "/tex_05.png", + LightSources = LightSources, + PerformShading = false, + GUI = { + Path = "/Solar System/Missions/Perseverance/Model", + Hidden = true + } + } +} + +local Body_staticParts_5 = { + Identifier = "Body_staticParts_5", + Parent = Body.Identifier, + Renderable = { + Type = "RenderableModel", + Body = "MARS SCIENCE LABORATORY", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/MSL_BODY_new_A0.obj" + }, + ColorTexture = textures .. "/parts_AO.png", + LightSources = LightSources, + PerformShading = false, + GUI = { + Path = "/Solar System/Missions/Perseverance/Model", + Hidden = true + } + } +} + +-- RA AZ +local RA_Shoulder_AZ = { + Identifier = "RA_Shoulder_AZ", + Parent = transforms.RA_Shoulder_AZ_Location.Identifier, + Renderable = { + Type = "RenderableModel", + Body = "MARS SCIENCE LABORATORY", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/MSL_RA_SHOULDER_AZ_new.obj" + }, + ColorTexture = textures .. "/tex_03.png", + LightSources = LightSources, + PerformShading = false, + GUI = { + Path = "/Solar System/Missions/Perseverance/Model", + Hidden = true + } + } +} + +local RA_Shoulder_AZ_detail_1 = { + Identifier = "RA_Shoulder_AZ_detail_1", + Parent = RA_Shoulder_AZ.Identifier, + Renderable = { + Type = "RenderableModel", + Body = "MARS SCIENCE LABORATORY", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/MSL_RA_SHOULDER_AZ_detail_1.obj" + }, + ColorTexture = textures .. "/tex_05.png", + LightSources = LightSources, + PerformShading = false, + GUI = { + Path = "/Solar System/Missions/Perseverance/Model", + Hidden = true + } + } +} + +local RA_Shoulder_AZ_detail_2 = { + Identifier = "RA_Shoulder_AZ_detail_2", + Parent = RA_Shoulder_AZ.Identifier, + Renderable = { + Type = "RenderableModel", + Body = "MARS SCIENCE LABORATORY", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/MSL_RA_SHOULDER_AZ_detail_2.obj" + }, + ColorTexture = textures .. "/tex_01.png", + LightSources = LightSources, + PerformShading = false, + GUI = { + Path = "/Solar System/Missions/Perseverance/Model", + Hidden = true + } + } +} + +---- RA EL +local RA_Shoulder_EL_1 = { + Identifier = "RA_Shoulder_EL_1", + Parent = transforms.RA_Shoulder_EL_Location.Identifier, + Renderable = { + Type = "RenderableModel", + Body = "MARS SCIENCE LABORATORY", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/MSL_RA_SHOULDER_EL_1.obj" + }, + ColorTexture = textures .. "/tex_01.png", + LightSources = LightSources, + PerformShading = false, + GUI = { + Path = "/Solar System/Missions/Perseverance/Model", + Hidden = true + } + } +} + + +local RA_Shoulder_EL_detail_1 = { + Identifier = "RA_Shoulder_EL_detail_1", + Parent = RA_Shoulder_EL_1.Identifier, + Renderable = { + Type = "RenderableModel", + Body = "MARS SCIENCE LABORATORY", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/MSL_RA_SHOULDER_EL_detail_1.obj" + }, + ColorTexture = textures .. "/tex_04.png", + LightSources = LightSources, + PerformShading = false, + GUI = { + Path = "/Solar System/Missions/Perseverance/Model", + Hidden = true + } + } +} + +local RA_Shoulder_EL_detail_2 = { + Identifier = "RA_Shoulder_EL_detail_2", + Parent = RA_Shoulder_EL_1.Identifier, + Renderable = { + Type = "RenderableModel", + Body = "MARS SCIENCE LABORATORY", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/MSL_RA_SHOULDER_EL_detail_2.obj" + }, + ColorTexture = textures .. "/tex_05.png", + LightSources = LightSources, + PerformShading = false, + GUI = { + Path = "/Solar System/Missions/Perseverance/Model", + Hidden = true + } + } +} + + + +local RA_Shoulder_EL_2 = { + Identifier = "RA_Shoulder_EL_2", + Parent = RA_Shoulder_EL_1.Identifier, + Renderable = { + Type = "RenderableModel", + Body = "MARS SCIENCE LABORATORY", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/MSL_RA_SHOULDER_EL_2.obj" + }, + ColorTexture = textures .. "/tex_03.png", + LightSources = LightSources, + PerformShading = false, + GUI = { + Path = "/Solar System/Missions/Perseverance/Model", + Hidden = true + } + } +} + +-- RA ELBOW +local RA_Elbow_1 = { + Identifier = "RA_Elbow_1", + Parent = transforms.RA_Elbow_Location.Identifier, + Renderable = { + Type = "RenderableModel", + Body = "MARS SCIENCE LABORATORY", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/MSL_RA_ELBOW_1.obj" + }, + ColorTexture = textures .. "/tex_01.png", + LightSources = LightSources, + PerformShading = false, + GUI = { + Path = "/Solar System/Missions/Perseverance/Model", + Hidden = true + } + } +} + +local RA_Elbow_detail_1 = { + Identifier = "RA_Elbow_detail_1", + Parent = RA_Elbow_1.Identifier, + Renderable = { + Type = "RenderableModel", + Body = "MARS SCIENCE LABORATORY", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/MSL_RA_ELBOW_detail_1.obj" + }, + ColorTexture = textures .. "/tex_04.png", + LightSources = LightSources, + PerformShading = false, + GUI = { + Path = "/Solar System/Missions/Perseverance/Model", + Hidden = true + } + } +} + +local RA_Elbow_detail_2 = { + Identifier = "RA_Elbow_detail_2", + Parent = RA_Elbow_1.Identifier, + Renderable = { + Type = "RenderableModel", + Body = "MARS SCIENCE LABORATORY", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/MSL_RA_ELBOW_detail_2.obj" + }, + ColorTexture = textures .. "/tex_05.png", + LightSources = LightSources, + PerformShading = false, + GUI = { + Path = "/Solar System/Missions/Perseverance/Model", + Hidden = true + } + } +} + + +local RA_Elbow_2 = { + Identifier = "RA_Elbow_2", + Parent = RA_Elbow_1.Identifier, + Renderable = { + Type = "RenderableModel", + Body = "MARS SCIENCE LABORATORY", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/MSL_RA_ELBOW_2.obj" + }, + ColorTexture = textures .. "/tex_03.png", + LightSources = LightSources, + PerformShading = false, + GUI = { + Path = "/Solar System/Missions/Perseverance/Model", + Hidden = true + } + } +} + + +-- RA WRIST +local RA_Wrist = { + Identifier = "RA_Wrist", + Parent = transforms.RA_Wrist_Location.Identifier, + Renderable = { + Type = "RenderableModel", + Body = "MARS SCIENCE LABORATORY", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/MSL_RA_TURRET_new_1.obj" + }, + ColorTexture = textures .. "/tex_03.png", + LightSources = LightSources, + PerformShading = false, + GUI = { + Path = "/Solar System/Missions/Perseverance/Model", + Hidden = true + } + } +} + +local RA_Wrist_details = { + Identifier = "RA_Wrist_details", + Parent = RA_Wrist.Identifier, + Renderable = { + Type = "RenderableModel", + Body = "MARS SCIENCE LABORATORY", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/MSL_RA_TURRET_new_1_details.obj" + }, + ColorTexture = textures .. "/tex_01.png", + LightSources = LightSources, + PerformShading = false, + GUI = { + Path = "/Solar System/Missions/Perseverance/Model", + Hidden = true + } + } +} + +-- RA TURRET +local RA_Turret = { + Identifier = "RA_Turret", + Parent = transforms.RA_Turret_Location.Identifier, + Renderable = { + Type = "RenderableModel", + Body = "MARS SCIENCE LABORATORY", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/MSL_RA_TURRET_new_2.obj" + }, + ColorTexture = textures .. "/tex_04.png", + LightSources = LightSources, + PerformShading = false, + GUI = { + Path = "/Solar System/Missions/Perseverance/Model", + Hidden = true + } + } +} + + +local RA_Turret_details_1 = { + Identifier = "RA_Turret_details_1", + Parent = RA_Turret.Identifier, + Renderable = { + Type = "RenderableModel", + Body = "MARS SCIENCE LABORATORY", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/MSL_RA_TURRET_new_2_detail_1.obj" + }, + ColorTexture = textures .. "/tex_05.png", + LightSources = LightSources, + PerformShading = false, + GUI = { + Path = "/Solar System/Missions/Perseverance/Model", + Hidden = true + } + } +} + +local RA_Turret_details_2 = { + Identifier = "RA_Turret_details_2", + Parent = RA_Turret.Identifier, + Renderable = { + Type = "RenderableModel", + Body = "MARS SCIENCE LABORATORY", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/MSL_RA_TURRET_new_2_detail_2.obj" + }, + ColorTexture = textures .. "/tex_03.png", + LightSources = LightSources, + PerformShading = false, + GUI = { + Path = "/Solar System/Missions/Perseverance/Model", + Hidden = true + } + } +} + +-- MastCam-- +local RSM_root = { + Identifier = "RSM_root", + Parent = transforms.RSM_ROOT_Location.Identifier, + Renderable = { + Type = "RenderableModel", + Body = "MARS SCIENCE LABORATORY", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/MSL_RSM_ROOT.obj" + + }, + ColorTexture = textures .. "/tex_04.png", + LightSources = LightSources, + PerformShading = false, + GUI = { + Path = "/Solar System/Missions/Perseverance/Model", + Hidden = true + } + } +} + +local RSM_AZ = { + Identifier = "RSM_AZ", + Parent = transforms.RSM_AZ_Location.Identifier, + Renderable = { + Type = "RenderableModel", + Body = "MARS SCIENCE LABORATORY", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/MSL_RSM_AZ.obj" + }, + ColorTexture = textures .. "/tex_04.png", + LightSources = LightSources, + PerformShading = false, + GUI = { + Path = "/Solar System/Missions/Perseverance/Model", + Hidden = true + } + } +} + +local RSM_EL = { + Identifier = "RSM_EL", + Parent = transforms.RSM_EL_Location.Identifier, + Renderable = { + Type = "RenderableModel", + Body = "MARS SCIENCE LABORATORY", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/MSL_RSM_EL.obj" + }, + ColorTexture = textures .. "/tex_04.png", + LightSources = LightSources, + PerformShading = false, + GUI = { + Path = "/Solar System/Missions/Perseverance/Model", + Hidden = true + } + } +} + +---- HGA ---- +local HGA_AZ = { + Identifier = "HGA_AZ", + Parent = transforms.HGA_AZ_Location.Identifier, + Renderable = { + Type = "RenderableModel", + Body = "MARS SCIENCE LABORATORY", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/MSL_HGA_AZ_0ANGLE.obj" + }, + ColorTexture = textures .. "/tex_02.png", + LightSources = LightSources, + PerformShading = false, + GUI = { + Path = "/Solar System/Missions/Perseverance/Model", + Hidden = true + } + } +} + +local HGA_EL = { + Identifier = "HGA_EL", + Parent = transforms.HGA_EL_Location.Identifier, + Renderable = { + Type = "RenderableModel", + Body = "MARS SCIENCE LABORATORY", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/MSL_HGA_EL.obj" + }, + ColorTexture = textures .. "/tex_02.png", + LightSources = LightSources, + PerformShading = false, + GUI = { + Path = "/Solar System/Missions/Perseverance/Model", + Hidden = true + } + } +} + +---- SAM & CHEMIN ---- +local SAM_Cover_1 = { + Identifier = "SAM_Cover_1", + Parent = transforms.SAM_Cover_1_Location.Identifier, + Renderable = { + Type = "RenderableModel", + Body = "MARS SCIENCE LABORATORY", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/MSL_SAM_FIXED_COVER_1.obj" + }, + ColorTexture = textures .. "/MSLTextureTest.png", + LightSources = LightSources, + PerformShading = false, + GUI = { + Path = "/Solar System/Missions/Perseverance/Model", + Hidden = true + } + } +} + +local SAM_Cover_2 = { + Identifier = "SAM_Cover_2", + Parent = transforms.SAM_Cover_2_Location.Identifier, + Renderable = { + Type = "RenderableModel", + Body = "MARS SCIENCE LABORATORY", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/MSL_SAM_FIXED_COVER_2.obj" + }, + ColorTexture = textures .. "/MSLTextureTest.png", + LightSources = LightSources, + PerformShading = false, + GUI = { + Path = "/Solar System/Missions/Perseverance/Model", + Hidden = true + } + } +} + +local CHEMIN_Bottom = { + Identifier = "CHEMIN_Bottom", + Parent = transforms.CHEMIN_Location.Identifier, + Renderable = { + Type = "RenderableModel", + Body = "MARS SCIENCE LABORATORY", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/MSL_CHEMIN.obj" + }, + ColorTexture = textures .. "/MSLTextureTest.png", + LightSources = LightSources, + PerformShading = false, + GUI = { + Path = "/Solar System/Missions/Perseverance/Model", + Hidden = true + } + } +} + +-- Wheels -- +local Wheel_Base = { + Identifier = "Wheel_Base", + Parent = transforms.Wheel_base_Location.Identifier, + Renderable = { + Type = "RenderableModel", + Body = "MARS SCIENCE LABORATORY", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/MSL_WHEEL_BASE.obj" + }, + ColorTexture = textures .. "/tex_02.png", + LightSources = LightSources, + PerformShading = false, + GUI = { + Path = "/Solar System/Missions/Perseverance/Model", + Hidden = true + } + } +} +local Wheel_Base_2 = { + Identifier = "Wheel_Base_2", + Parent = Wheel_Base.Identifier, + Renderable = { + Type = "RenderableModel", + Body = "MARS SCIENCE LABORATORY", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/MSL_WHEEL_BASE_2.obj" + }, + ColorTexture = textures .. "/tex_03.png", + LightSources = LightSources, + PerformShading = false, + GUI = { + Path = "/Solar System/Missions/Perseverance/Model", + Hidden = true + } + } +} + +-- LEFT SIDE -- +local Wheel_Leg_1_L = { + Identifier = "Wheel_Leg_1_L", + Parent = transforms.Leg_1_L_Location.Identifier, + Renderable = { + Type = "RenderableModel", + Body = "MARS SCIENCE LABORATORY", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/MSL_WHEEL_LEG_1_L.obj" + }, + ColorTexture = textures .. "/tex_03.png", + LightSources = LightSources, + PerformShading = false, + GUI = { + Path = "/Solar System/Missions/Perseverance/Model", + Hidden = true + } + } +} + +local Wheel_Leg_1A_L_detail = { + Identifier = "Wheel_Leg_1A_L_detail", + Parent = Wheel_Leg_1_L.Identifier, + Renderable = { + Type = "RenderableModel", + Body = "MARS SCIENCE LABORATORY", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/MSL_WHEEL_LEG_1A_L_detail.obj" + }, + ColorTexture = textures .. "/tex_05.png", + LightSources = LightSources, + PerformShading = false, + GUI = { + Path = "/Solar System/Missions/Perseverance/Model", + Hidden = true + } + } +} + +local Wheel_Leg_1B_L_detail = { + Identifier = "Wheel_Leg_1B_L_detail", + Parent = Wheel_Leg_1_L.Identifier, + Renderable = { + Type = "RenderableModel", + Body = "MARS SCIENCE LABORATORY", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/MSL_WHEEL_LEG_1B_L_detail.obj" + }, + ColorTexture = textures .. "/tex_05.png", + LightSources = LightSources, + PerformShading = false, + GUI = { + Path = "/Solar System/Missions/Perseverance/Model", + Hidden = true + } + } +} + +local Wheel_Leg_2_L = { + Identifier = "Wheel_Leg_2_L", + Parent = transforms.Leg_2_L_Location.Identifier, + Renderable = { + Type = "RenderableModel", + Body = "MARS SCIENCE LABORATORY", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/MSL_WHEEL_LEG_2_L_new.obj" + }, + ColorTexture = textures .. "/tex_03.png", + LightSources = LightSources, + PerformShading = false, + GUI = { + Path = "/Solar System/Missions/Perseverance/Model", + Hidden = true + } + } +} + +local Wheel_Wrist_F_L = { + Identifier = "Wheel_Wrist_F_L", + Parent = transforms.Wrist_F_L_Location.Identifier, + Renderable = { + Type = "RenderableModel", + Body = "MARS SCIENCE LABORATORY", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/MSL_WHEEL_WRIST_F_L.obj" + }, + ColorTexture = textures .. "/tex_02.png", + LightSources = LightSources, + PerformShading = false, + GUI = { + Path = "/Solar System/Missions/Perseverance/Model", + Hidden = true + } + } +} + +local Wheel_Wrist_hub_F_L = { + Identifier = "Wheel_Wrist_hub_F_L", + Parent = Wheel_Wrist_F_L.Identifier, + Renderable = { + Type = "RenderableModel", + Body = "MARS SCIENCE LABORATORY", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/MSL_WHEEL_WRIST_1B_F_L.obj" + }, + ColorTexture = textures .. "/tex_02.png", + LightSources = LightSources, + PerformShading = false, + GUI = { + Path = "/Solar System/Missions/Perseverance/Model", + Hidden = true + } + } +} + +local Wheel_F_L = { + Identifier = "Wheel_F_L", + Parent = transforms.Wheel_F_L_Location.Identifier, + Renderable = { + Type = "RenderableModel", + Body = "MARS SCIENCE LABORATORY", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/MSL_WHEEL_L.obj" + }, + ColorTexture = textures .. "/tex_03.png", + LightSources = LightSources, + PerformShading = false, + GUI = { + Path = "/Solar System/Missions/Perseverance/Model", + Hidden = true + } + } +} + +local Wheel_C_L = { + Identifier = "Wheel_C_L", + Parent = transforms.Wheel_C_L_Location.Identifier, + Renderable = { + Type = "RenderableModel", + Body = "MARS SCIENCE LABORATORY", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/MSL_WHEEL_L.obj" + }, + ColorTexture = textures .. "/tex_03.png", + LightSources = LightSources, + PerformShading = false, + GUI = { + Path = "/Solar System/Missions/Perseverance/Model", + Hidden = true + } + } +} + +local Wheel_Wrist_B_L = { + Identifier = "Wheel_Wrist_B_L", + Parent = transforms.Wrist_B_L_Location.Identifier, + Renderable = { + Type = "RenderableModel", + Body = "MARS SCIENCE LABORATORY", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/MSL_WHEEL_WRIST_B_L.obj" + }, + ColorTexture = textures .. "/tex_02.png", + LightSources = LightSources, + PerformShading = false, + GUI = { + Path = "/Solar System/Missions/Perseverance/Model", + Hidden = true + } + } +} + +local Wheel_Wrist_hub_B_L = { + Identifier = "Wheel_Wrist_hub_B_L", + Parent = Wheel_Wrist_B_L.Identifier, + Renderable = { + Type = "RenderableModel", + Body = "MARS SCIENCE LABORATORY", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/MSL_WHEEL_WRIST_1B_B_L.obj" + }, + ColorTexture = textures .. "/tex_02.png", + LightSources = LightSources, + PerformShading = false, + GUI = { + Path = "/Solar System/Missions/Perseverance/Model", + Hidden = true + } + } +} + +local Wheel_B_L = { + Identifier = "Wheel_B_L", + Parent = transforms.Wheel_B_L_Location.Identifier, + Renderable = { + Type = "RenderableModel", + Body = "MARS SCIENCE LABORATORY", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/MSL_WHEEL_L.obj" + }, + ColorTexture = textures .. "/tex_03.png", + LightSources = LightSources, + PerformShading = false, + GUI = { + Path = "/Solar System/Missions/Perseverance/Model", + Hidden = true + } + } +} + +-- RIGHT SIDE -- +local Wheel_Leg_1_R = { + Identifier = "Wheel_Leg_1_R", + Parent = transforms.Leg_1_R_Location.Identifier, + Renderable = { + Type = "RenderableModel", + Body = "MARS SCIENCE LABORATORY", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/MSL_WHEEL_LEG_1_R.obj" + }, + ColorTexture = textures .. "/tex_03.png", + LightSources = LightSources, + PerformShading = false, + GUI = { + Path = "/Solar System/Missions/Perseverance/Model", + Hidden = true + } + } +} + +local Wheel_Leg_1A_R_detail = { + Identifier = "Wheel_Leg_1A_R_detail", + Parent = Wheel_Leg_1_R.Identifier, + Renderable = { + Type = "RenderableModel", + Body = "MARS SCIENCE LABORATORY", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/MSL_WHEEL_LEG_1A_R_detail.obj" + }, + ColorTexture = textures .. "/tex_05.png", + LightSources = LightSources, + PerformShading = false, + GUI = { + Path = "/Solar System/Missions/Perseverance/Model", + Hidden = true + } + } +} + +local Wheel_Leg_1B_R_detail = { + Identifier = "Wheel_Leg_1B_R_detail", + Parent = Wheel_Leg_1_R.Identifier, + Renderable = { + Type = "RenderableModel", + Body = "MARS SCIENCE LABORATORY", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/MSL_WHEEL_LEG_1B_R_detail.obj" + }, + ColorTexture = textures .. "/tex_05.png", + LightSources = LightSources, + PerformShading = false, + GUI = { + Path = "/Solar System/Missions/Perseverance/Model", + Hidden = true + } + } +} + +local Wheel_Leg_2_R = { + Identifier = "Wheel_Leg_2_R", + Parent = transforms.Leg_2_R_Location.Identifier, + Renderable = { + Type = "RenderableModel", + Body = "MARS SCIENCE LABORATORY", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/MSL_WHEEL_LEG_2_R_new.obj" + }, + ColorTexture = textures .. "/tex_03.png", + LightSources = LightSources, + PerformShading = false, + GUI = { + Path = "/Solar System/Missions/Perseverance/Model", + Hidden = true + } + } +} + +local Wheel_Wrist_F_R = { + Identifier = "Wheel_Wrist_F_R", + Parent = transforms.Wrist_F_R_Location.Identifier, + Renderable = { + Type = "RenderableModel", + Body = "MARS SCIENCE LABORATORY", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/MSL_WHEEL_WRIST_F_R.obj" + --GeometryFile = models .. "/MSL_WHEEL_WRIST_F_L.obj" + }, + ColorTexture = textures .. "/tex_02.png", + LightSources = LightSources, + PerformShading = false, + GUI = { + Path = "/Solar System/Missions/Perseverance/Model", + Hidden = true + } + } +} + +local Wheel_Wrist_hub_F_R = { + Identifier = "Wheel_Wrist_hub_F_R", + Parent = Wheel_Wrist_F_R.Identifier, + Renderable = { + Type = "RenderableModel", + Body = "MARS SCIENCE LABORATORY", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/MSL_WHEEL_WRIST_1B_F_R.obj" + }, + ColorTexture = textures .. "/tex_02.png", + LightSources = LightSources, + PerformShading = false, + GUI = { + Path = "/Solar System/Missions/Perseverance/Model", + Hidden = true + } + } +} + + +local Wheel_F_R = { + Identifier = "Wheel_F_R", + Parent = transforms.Wheel_F_R_Location.Identifier, + Renderable = { + Type = "RenderableModel", + Body = "MARS SCIENCE LABORATORY", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/MSL_WHEEL_R.obj" + }, + ColorTexture = textures .. "/tex_03.png", + LightSources = LightSources, + PerformShading = false, + GUI = { + Path = "/Solar System/Missions/Perseverance/Model", + Hidden = true + } + } +} + + +local Wheel_C_R = { + Identifier = "Wheel_C_R", + Parent = transforms.Wheel_C_R_Location.Identifier, + Renderable = { + Type = "RenderableModel", + Body = "MARS SCIENCE LABORATORY", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/MSL_WHEEL_R.obj" + }, + ColorTexture = textures .. "/tex_03.png", + LightSources = LightSources, + PerformShading = false, + GUI = { + Path = "/Solar System/Missions/Perseverance/Model", + Hidden = true + } + } +} + +local Wheel_Wrist_B_R = { + Identifier = "Wheel_Wrist_B_R", + Parent = transforms.Wrist_B_R_Location.Identifier, + Renderable = { + Type = "RenderableModel", + Body = "MARS SCIENCE LABORATORY", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/MSL_WHEEL_WRIST_1A_B_R.obj" + }, + ColorTexture = textures .. "/tex_02.png", + LightSources = LightSources, + PerformShading = false, + GUI = { + Path = "/Solar System/Missions/Perseverance/Model", + Hidden = true + } + } +} + +local Wheel_Wrist_hub_B_R = { + Identifier = "Wheel_Wrist_hub_B_R", + Parent = Wheel_Wrist_B_R.Identifier, + Renderable = { + Type = "RenderableModel", + Body = "MARS SCIENCE LABORATORY", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/MSL_WHEEL_WRIST_1B_B_R.obj" + }, + ColorTexture = textures .. "/tex_02.png", + LightSources = LightSources, + PerformShading = false, + GUI = { + Path = "/Solar System/Missions/Perseverance/Model", + Hidden = true + } + } +} + +local Wheel_B_R = { + Identifier = "Wheel_B_R", + Parent = transforms.Wheel_B_R_Location.Identifier, + Renderable = { + Type = "RenderableModel", + Body = "MARS SCIENCE LABORATORY", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = models .. "/MSL_WHEEL_R.obj" + }, + ColorTexture = textures .. "/tex_03.png", + LightSources = LightSources, + PerformShading = false, + GUI = { + Path = "/Solar System/Missions/Perseverance/Model", + Hidden = true + } + } +} + +assetHelper.registerSceneGraphNodesAndExport(asset, { + Perseverance, + PerseveranceModel, + Body, + Body_detail, + Body_staticParts_1, + Body_staticParts_2, + Body_staticParts_3, + Body_staticParts_4, + Body_staticParts_5, + + RA_Shoulder_AZ, + RA_Shoulder_AZ_detail_1, + RA_Shoulder_AZ_detail_2, + RA_Shoulder_EL_1, + RA_Shoulder_EL_detail_1, + RA_Shoulder_EL_detail_2, + RA_Shoulder_EL_2, + RA_Elbow_1, + RA_Elbow_detail_1, + RA_Elbow_detail_2, + RA_Elbow_2, + RA_Wrist, + RA_Wrist_details, + RA_Turret, + RA_Turret_details_1, + RA_Turret_details_2, + + RSM_root, + RSM_AZ, + RSM_EL, + + HGA_AZ, + HGA_EL, + + SAM_Cover_1, + SAM_Cover_2, + CHEMIN_Bottom, + + Wheel_Base, + Wheel_Base_2, + Wheel_Leg_1_L, + Wheel_Leg_1A_L_detail, + Wheel_Leg_1B_L_detail, + Wheel_Leg_2_L, + Wheel_Wrist_F_L, + Wheel_Wrist_hub_F_L, + Wheel_F_L, + Wheel_C_L, + Wheel_Wrist_B_L, + Wheel_Wrist_hub_B_L, + Wheel_B_L, + Wheel_Leg_1_R, + Wheel_Leg_1A_R_detail, + Wheel_Leg_1B_R_detail, + Wheel_Leg_2_R, + Wheel_Wrist_F_R, + Wheel_Wrist_hub_F_R, + Wheel_F_R, + Wheel_C_R, + Wheel_Wrist_B_R, + Wheel_Wrist_hub_B_R, + Wheel_B_R + +}) \ No newline at end of file diff --git a/data/assets/scene/solarsystem/missions/perseverance/perseverance.asset b/data/assets/scene/solarsystem/missions/perseverance/perseverance.asset new file mode 100644 index 0000000000..64667cbd70 --- /dev/null +++ b/data/assets/scene/solarsystem/missions/perseverance/perseverance.asset @@ -0,0 +1,5 @@ +--perseverance.asset +asset.require('./model') +asset.require('./trail') + + diff --git a/data/assets/scene/solarsystem/missions/perseverance/shortcuts.asset b/data/assets/scene/solarsystem/missions/perseverance/shortcuts.asset new file mode 100644 index 0000000000..5f52afa237 --- /dev/null +++ b/data/assets/scene/solarsystem/missions/perseverance/shortcuts.asset @@ -0,0 +1,70 @@ +--perseverance/shortcuts.asset + +local PerseveranceLaunchTime = "2020 JUL 17 13:56:42" +local PerseveranceLandingTime = "2021 FEB 18 20:32:16" + +local PerseveranceNavigationSate = "{" .. + "Anchor = 'Insight'," .. + "Pitch = 0.567457E-4," .. + "Position = { 1.240506E1,-1.369270E1,-2.423553E0 }," .. + "ReferenceFrame = 'Root',".. + "Up = { 0.441211E0,0.247019E0,0.862737E0 }," .. + "Yaw = -0.446853E-4}" + +local Shortcuts = { + { + Command = "openspace.setPropertyValueSingle('Scene.Mars.Renderable.Layers.HeightLayers.Mola_Utah.Settings.Offset', -469.300000);" .. + "openspace.setPropertyValueSingle('Scene.Mars.Renderable.Layers.HeightLayers.OnMarsHiRISELS.Settings.Offset', -470.800006);", + Documentation = "Enable height layer offset for Perseverance landing trail", + Name = "Perseverance Height Offset", + GuiPath = "/Missions/Insight", + Local = false + }, + { + Command = "openspace.setPropertyValueSingle('Scene.Mars.Renderable.Layers.HeightLayers.Mola_Utah.Settings.Offset', 0);" .. + "openspace.setPropertyValueSingle('Scene.Mars.Renderable.Layers.HeightLayers.OnMarsHiRISELS.Settings.Offset', 0);", + Documentation = "Disable Perseverance landing height layer offset", + Name = "Default Height Offset", + GuiPath = "/Missions/Insight", + Local = false + }, + { + Command = "openspace.setPropertyValueSingle('Scene.Mars.Renderable.Layers.HeightLayers.OnMarsHiRISELS.Enabled', true);" .. + "openspace.setPropertyValueSingle('Scene.Mars.Renderable.Layers.ColorLayers.OnMarsHiRISELS.Enabled', true);", + Documentation = "Enables HiRISE layer for Perseverance", + Name = "Enable HiRISE", + GuiPath = "/Missions/Insight", + Local = false + }, + { + Command = "openspace.setPropertyValueSingle('Scene.Mars.Renderable.Layers.HeightLayers.OnMarsHiRISELS.Enabled', false);" .. + "openspace.setPropertyValueSingle('Scene.Mars.Renderable.Layers.ColorLayers.OnMarsHiRISELS.Enabled', false);", + Documentation = "Disables HiRISE layer used for Perseverance", + Name = "Disable HiRISE", + GuiPath = "/Missions/Insight", + Local = false + }, + { + Command = "openspace.navigation.setNavigationState(" .. PerseveranceNavigationSate .. ");", + Documentation = "Change the camera state for the start of Insight EDL", + Name = "Insight EDL NavigationState", + GuiPath = "/Missions/Insight", + Local = false + }, + { + Command = "openspace.time.setPause(true);openspace.time.setTime('" .. PerseveranceLaunchTime .. "');", + Documentation = "Change the time for Perseverance launch", + Name = "Perseverance launch time", + GuiPath = "/Missions/Perseverance", + Local = false + }, + { + Command = "openspace.time.setPause(true);openspace.time.setTime('" .. PerseveranceLandingTime .. "');", + Documentation = "Change the time for when Perseverance has landed", + Name = "Perseverance landed time", + GuiPath = "/Missions/Perseverance", + Local = false + }, +} + +asset.export("Shortcuts", Shortcuts) diff --git a/data/assets/scene/solarsystem/missions/perseverance/trail.asset b/data/assets/scene/solarsystem/missions/perseverance/trail.asset new file mode 100644 index 0000000000..666c2c5694 --- /dev/null +++ b/data/assets/scene/solarsystem/missions/perseverance/trail.asset @@ -0,0 +1,94 @@ +--trail.asset +local assetHelper = asset.require('util/asset_helper') +local sunTransforms = asset.require('scene/solarsystem/sun/transforms') +local marsTransforms = asset.require('scene/solarsystem/planets/mars/transforms') + +local kernels = asset.syncedResource({ + Name = "Mars 2020 Kernels", + Type = "HttpSynchronization", + Identifier = "perseverance_kernels", + Version = 1 +}) + +local m2020_kernels = { + kernels .. "/m2020.tf", + + kernels .. "/m2020.tls", + kernels .. "/naif0012.tls", + + kernels .. "/m2020.tsc", + + kernels .. "/m2020_FMAresponse_JEZ_20200717_P000.cruise.bsp", + kernels .. "/m2020_FMAresponse_JEZ_20200717_P000.edl.bsp", +} + +local startTime = "2020 JUL 17 13:56:42" +local approachMars = "2021 FEB 11 20:32:16" +local endTime = "2021 FEB 18 20:32:16" + +local PerseveranceNode = { + Identifier = "PerseveranceNode", + Parent = sunTransforms.SolarSystemBarycenter.Identifier, + Transform = { + Translation = { + Type = "SpiceTranslation", + Target = "-168", + Observer = "SUN", + Kernels = m2020_kernels + }, + }, + GUI = { + Name = "Perseverance Node", + Path = "/Solar System/Missions/Perseverance", + } +} + +local PerseveranceTrailSun = { + Identifier = "PerseveranceTrailSun", + Parent = sunTransforms.SolarSystemBarycenter.Identifier, + Renderable = { + Type = "RenderableTrailTrajectory", + Translation = { + Type = "SpiceTranslation", + Target = "-168", + Observer = "SUN", + Kernels = m2020_kernels + }, + Color = { 0.2, 0.7, 0.1 }, + StartTime = startTime, + EndTime = endTime, + SampleInterval = 100 + }, + GUI = { + Name = "Perseverance Trail", + Path = "/Solar System/Missions/Perseverance", + } +} + +local PerseveranceTrailMars = { + Identifier = "PerseveranceTrailMars", + Parent = marsTransforms.MarsBarycenter.Identifier, + Renderable = { + Type = "RenderableTrailTrajectory", + Translation = { + Type = "SpiceTranslation", + Target = "-168", + Observer = "MARS", + Kernels = m2020_kernels + }, + Color = { 0.7, 0.9, 0.6 }, + StartTime = approachMars, + EndTime = endTime, + SampleInterval = 100 + }, + GUI = { + Name = "Perseverance Trail (Mars)", + Path = "/Solar System/Missions/Perseverance", + } +} + +assetHelper.registerSceneGraphNodesAndExport(asset, { + PerseveranceNode, + PerseveranceTrailSun, + PerseveranceTrailMars +}) \ No newline at end of file diff --git a/data/assets/scene/solarsystem/missions/perseverance/transforms.asset b/data/assets/scene/solarsystem/missions/perseverance/transforms.asset new file mode 100644 index 0000000000..3811e4e8e0 --- /dev/null +++ b/data/assets/scene/solarsystem/missions/perseverance/transforms.asset @@ -0,0 +1,528 @@ +local assetHelper = asset.require('util/asset_helper') +local marsTransforms = asset.require('scene/solarsystem/planets/mars/transforms') +local marsAsset = asset.require('scene/solarsystem/planets/mars/mars') + + +local m2020_pos = { + Identifier = "m2020_pos", + Parent = marsAsset.Mars.Identifier, + Transform = { + Translation = { + Type = "GlobeTranslation", + Globe = "Mars", + Latitude = 18.3628, + Longitude = 77.5945, + UseHeightmap = true + }, + }, + GUI = { + Path = "/Solar System/Missions/Perseverance/Transforms", + Hidden = true, + } +} + +local MSL_Body = { + Identifier = "MSL_Body", + Parent = m2020_pos.Identifier, + Transform = { + Translation = { + Type = "StaticTranslation", + Position = { 0, 0.0, 2.8 } + }, + Rotation = { + Type = "StaticRotation", + Rotation = { -1.884960,0.000000,2.905970 } + } + }, + GUI = { + Path = "/Solar System/Missions/Perseverance/Transforms", + Hidden = true + } +} + +---- ROBOTIC ARM RA ---- +local RA_Base_Location = { + Identifier = "RA_Base_Location", + Parent = MSL_Body.Identifier, + Transform = { + Translation = { + Type = "StaticTranslation", + Position = { 1.111, -0.4525, -0.106 } + }, + }, + GUI = { + Path = "/Solar System/Missions/Perseverance/Transforms", + Hidden = true + } +} + + +--AZ +local RA_Shoulder_AZ_Location = { + Identifier = "RA_Shoulder_AZ_Location", + Parent = RA_Base_Location.Identifier, + Transform = { + Translation = { + Type = "StaticTranslation", + Position = {0.0, 0.0, -0.08} + } + }, + GUI = { + Path = "/Solar System/Missions/Perseverance/Transforms", + Hidden = true + } +} + +----EL +local RA_Shoulder_EL_Location = { + Identifier = "RA_Shoulder_EL_Location", + Parent = RA_Shoulder_AZ_Location.Identifier, + Transform = { + Translation = { + Type = "StaticTranslation", + Position = {0.17, 0.2, -0.005} + } + }, + GUI = { + Path = "/Solar System/Missions/Perseverance/Transforms", + Hidden = true + } +} + +--ELBOW +local RA_Elbow_Location = { + Identifier = "RA_Elbow_Location", + Parent = RA_Shoulder_EL_Location.Identifier, + Transform = { + Translation = { + Type = "StaticTranslation", + Position = {0.83, -0.2, 0.0 } + } + }, + GUI = { + Path = "/Solar System/Missions/Perseverance/Transforms", + Hidden = true + } +} + +--WRIST +local RA_Wrist_Location = { + Identifier = "RA_Wrist_Location", + Parent = RA_Elbow_Location.Identifier, + Transform = { + Translation = { + Type = "StaticTranslation", + Position = {0.77, 0.13, 0.035} + } + }, + GUI = { + Path = "/Solar System/Missions/Perseverance/Transforms", + Hidden = true + } +} + +--TURRET +local RA_Turret_Location = { + Identifier = "RA_Turret_Location", + Parent = RA_Wrist_Location.Identifier, + Transform = { + Translation = { + Type = "StaticTranslation", + Position = {0.0, 0.04, -0.15} + } + }, + GUI = { + Path = "/Solar System/Missions/Perseverance/Transforms", + Hidden = true + } +} + +--MAHLI +local RA_Mahli_Location = { + Identifier = "RA_Mahli_Location", + Parent = RA_Turret_Location.Identifier +} + +---- MASTCAM RSM ---- +local RSM_ROOT_Location = { + Identifier = "RSM_ROOT_Location", + Parent = MSL_Body.Identifier, + Transform = { + Translation = { + Type = "StaticTranslation", + Position = {0.7039, 0.5769, -0.563} + } + }, + GUI = { + Path = "/Solar System/Missions/Perseverance/Transforms", + Hidden = true + } +} + +local RSM_AZ_Location = { + Identifier = "RSM_AZ_Location", + Parent = RSM_ROOT_Location.Identifier, + Transform = { + Translation = { + Type = "StaticTranslation", + Position = {0.0, 0.008, 0.0} + } + }, + GUI = { + Path = "/Solar System/Missions/Perseverance/Transforms", + Hidden = true + } +} + +local RSM_ZERO_EL_Location = { + Identifier = "RSM_ZERO_EL_Location", + Parent = RSM_AZ_Location.Identifier, + GUI = { + Path = "/Solar System/Missions/Perseverance/Transforms", + Hidden = true + } +} + +local RSM_EL_Location = { + Identifier = "RSM_EL_Location", + Parent = RSM_AZ_Location.Identifier, + Transform = { + Translation = { + Type = "StaticTranslation", + --Position = {0.0, 0.0, -0.664} + Position = {0.002, 0.007, -0.688} + } + }, + GUI = { + Path = "/Solar System/Missions/Perseverance/Transforms", + Hidden = true + } +} + +---- HIGH GAIN ANTENNA HGA ---- +local HGA_AZ_Location = { + Identifier = "HGA_AZ_Location", + Parent = MSL_Body.Identifier, + Transform = { + Translation = { + Type = "StaticTranslation", + Position = {-0.46, -0.47, -0.55} + } + }, + GUI = { + Path = "/Solar System/Missions/Perseverance/Transforms", + Hidden = true + } +} + +local HGA_EL_Location = { + Identifier = "HGA_EL_Location", + Parent = HGA_AZ_Location.Identifier, + Transform = { + Translation = { + Type = "StaticTranslation", + Position = {0.0, 0.0, -0.17} + } + }, + GUI = { + Path = "/Solar System/Missions/Perseverance/Transforms", + Hidden = true + } +} + +---- SAM & HEMIN ---- +local SAM_Cover_1_Location = { + Identifier = "SAM_Cover_1_Location", + Parent = MSL_Body.Identifier, + GUI = { + Path = "/Solar System/Missions/Perseverance/Transforms", + Hidden = true + } +} + +local SAM_Cover_2_Location = { + Identifier = "SAM_Cover_2_Location", + Parent = MSL_Body.Identifier, + GUI = { + Path = "/Solar System/Missions/Perseverance/Transforms", + Hidden = true + } +} + +local CHEMIN_Location = { + Identifier = "CHEMIN_Location", + Parent = MSL_Body.Identifier, + GUI = { + Path = "/Solar System/Missions/Perseverance/Transforms", + Hidden = true + } +} + +---- Wheels ---- +local Wheel_base_Location = { + Identifier = "Wheel_base_Location", + Parent = MSL_Body.Identifier, + GUI = { + Path = "/Solar System/Missions/Perseverance/Transforms", + Hidden = true + } +} + +-- Left side -- +local Leg_1_L_Location = { + Identifier = "Leg_1_L_Location", + Parent = Wheel_base_Location.Identifier, + Transform = { + Translation = { + Type = "StaticTranslation", + Position = {0.217, -0.812, -0.215} --for the right side + } + }, + GUI = { + Path = "/Solar System/Missions/Perseverance/Transforms", + Hidden = true + } +} + +local Leg_2_L_Location = { + Identifier = "Leg_2_L_Location", + Parent = Leg_1_L_Location.Identifier, + Transform = { + Translation = { + Type = "StaticTranslation", + Position = {-0.74, -0.00380, 0.223} --CORRECT, DONT CHANGE + } + }, + GUI = { + Path = "/Solar System/Missions/Perseverance/Transforms", + Hidden = true + } +} + +local Wrist_F_L_Location = { + Identifier = "Wrist_F_L_Location", + Parent = Leg_1_L_Location.Identifier, + Transform = { + Translation = { + Type = "StaticTranslation", + Position = {0.8839, -0.2659, 0.2} --CORRECT, DONT TOUCH + } + }, + GUI = { + Path = "/Solar System/Missions/Perseverance/Transforms", + Hidden = true + } +} + +local Wheel_F_L_Location = { + Identifier = "Wheel_F_L_Location", + Parent = Wrist_F_L_Location.Identifier, + Transform = { + Translation = { + Type = "StaticTranslation", + Position = {0.0, 0.0, 0.426} + } + }, + GUI = { + Path = "/Solar System/Missions/Perseverance/Transforms", + Hidden = true + } +} + +local Wheel_C_L_Location = { + Identifier = "Wheel_C_L_Location", + Parent = Leg_2_L_Location.Identifier, + Transform = { + Translation = { + Type = "StaticTranslation", + Position = {0.45, -0.4, 0.403} + } + }, + GUI = { + Path = "/Solar System/Missions/Perseverance/Transforms", + Hidden = true + } +} + + +local Wrist_B_L_Location = { + Identifier = "Wrist_B_L_Location", + Parent = Leg_2_L_Location.Identifier, + Transform = { + Translation = { + Type = "StaticTranslation", + Position = {-0.627, -0.2635, -0.022} --CORRECT, DONT CHANGE + } + }, + GUI = { + Path = "/Solar System/Missions/Perseverance/Transforms", + Hidden = true + } +} + + +local Wheel_B_L_Location = { + Identifier = "Wheel_B_L_Location", + Parent = Wrist_B_L_Location.Identifier, + Transform = { + Translation = { + Type = "StaticTranslation", + Position = {0.0, -0.0, 0.426} + } + }, + GUI = { + Path = "/Solar System/Missions/Perseverance/Transforms", + Hidden = true + } +} + + +-- wheels, Right Side -- +local Leg_1_R_Location = { + Identifier = "Leg_1_R_Location", + Parent = Wheel_base_Location.Identifier, + Transform = { + Translation = { + Type = "StaticTranslation", + Position = {0.217, 0.812, -0.215} --Check with caroline!!! + } + }, + GUI = { + Path = "/Solar System/Missions/Perseverance/Transforms", + Hidden = true + } +} + +local Leg_2_R_Location = { + Identifier = "Leg_2_R_Location", + Parent = Leg_1_R_Location.Identifier, + Transform = { + Translation = { + Type = "StaticTranslation", + --Position = {-0.74, 0.0, 0.24} + Position = {-0.74, 0.00380, 0.223} --want to use this one, once the center point is changed in maya + + } + }, + GUI = { + Path = "/Solar System/Missions/Perseverance/Transforms", + Hidden = true + } +} + +local Wrist_F_R_Location = { + Identifier = "Wrist_F_R_Location", + Parent = Leg_1_R_Location.Identifier, + Transform = { + Translation = { + Type = "StaticTranslation", + Position = {0.882, 0.259, 0.215} + --Position = {0.8839, 0.2659, 0.2} --position for the Wrist_F_L + } + }, + GUI = { + Path = "/Solar System/Missions/Perseverance/Transforms", + Hidden = true + } +} + +local Wheel_F_R_Location = { + Identifier = "Wheel_F_R_Location", + Parent = Wrist_F_R_Location.Identifier, + Transform = { + Translation = { + Type = "StaticTranslation", + Position = {0.0, 0.0, 0.426} + } + }, + GUI = { + Path = "/Solar System/Missions/Perseverance/Transforms", + Hidden = true + } +} + +local Wheel_C_R_Location = { + Identifier = "Wheel_C_R_Location", + Parent = Leg_2_R_Location.Identifier, + Transform = { + Translation = { + Type = "StaticTranslation", + Position = {0.45, 0.4, 0.403} + } + }, + GUI = { + Path = "/Solar System/Missions/Perseverance/Transforms", + Hidden = true + } +} + +local Wrist_B_R_Location = { + Identifier = "Wrist_B_R_Location", + Parent = Leg_2_R_Location.Identifier, + Transform = { + Translation = { + Type = "StaticTranslation", + Position = {-0.6208, 0.2759, -0.025} + } + }, + GUI = { + Path = "/Solar System/Missions/Perseverance/Transforms", + Hidden = true + } +} + +local Wheel_B_R_Location = { + Identifier = "Wheel_B_R_Location", + Parent = Wrist_B_R_Location.Identifier, + Transform = { + Translation = { + Type = "StaticTranslation", + Position = {0.0, -0.0005, 0.426} + } + }, + GUI = { + Path = "/Solar System/Missions/Perseverance/Transforms", + Hidden = true + } +} + +assetHelper.registerSceneGraphNodesAndExport(asset, { + + m2020_pos, + MSL_Body, + RA_Base_Location, + RA_Shoulder_AZ_Location, + RA_Shoulder_EL_Location, + RA_Elbow_Location, + RA_Wrist_Location, + RA_Turret_Location, + RA_Mahli_Location, + RSM_ROOT_Location, + RSM_AZ_Location, + RSM_ZERO_EL_Location, + RSM_EL_Location, + + HGA_AZ_Location, + HGA_EL_Location, + SAM_Cover_1_Location, + SAM_Cover_2_Location, + CHEMIN_Location, + + Wheel_base_Location, + Leg_1_L_Location, + Leg_2_L_Location, + Wrist_F_L_Location, + Wheel_F_L_Location, + Wheel_C_L_Location, + Wrist_B_L_Location, + Wheel_B_L_Location, + + Leg_1_R_Location, + Leg_2_R_Location, + Wrist_F_R_Location, + Wheel_F_R_Location, + Wheel_C_R_Location, + Wrist_B_R_Location, + Wheel_B_R_Location +}) + diff --git a/data/assets/util/scene_helper.asset b/data/assets/util/scene_helper.asset index 3bf977dc1b..cf3fd966ca 100644 --- a/data/assets/util/scene_helper.asset +++ b/data/assets/util/scene_helper.asset @@ -66,3 +66,80 @@ local setDeltaTimeKeys = function(t) return result end asset.export("setDeltaTimeKeys", setDeltaTimeKeys) + + +--shortcut function +local function has_value (tab, val) + for index, value in ipairs(tab) do + -- We grab the first index of our sub-table instead + if value[1] == val then + return true + end + end + + return false +end + +local extractShortcuts = function(names, shortcuts) + local foundShortcuts = {}; + + if type(names) ~= "table" then + openspace.printWarning("scene_helper.extractShortcuts invalid paramater names (not Table)") + end + + if type(shortcuts) ~= "table" then + openspace.printWarning("scene_helper.extractShortcuts invalid paramater shortcuts (not Table)") + end + + for _, shortcut in ipairs(shortcuts) do + for _, name in ipairs(names ) do + if (shortcut.Name == name) then + foundShortcuts[#foundShortcuts+1] = shortcut + end + end + end + + return foundShortcuts +end +asset.export("extractShortcuts", extractShortcuts) + +local createKeyBindFromShortcuts = function(key, shortcuts, guipath, title, documentation) + if type(key) ~= "string" then + openspace.printWarning("scene_helper.createKeyBindFromShortcuts invalid paramater key (not String)") + end + + if type(shortcuts) ~= "table" or #shortcuts == 0 then + openspace.printWarning("scene_helper.createKeyBindFromShortcuts invalid paramater shortcuts (not Table or empty)") + end + + -- if type(guipath) ~= "string" then + -- guipath = shortcuts[0].GuiPath + -- end + + local concatTitle = type(title) ~= "string" + local concatDocumentation = type(documentation) ~= "string" + + local keybind = { + Key = key, + Command = "", + Name = name or "", + Documentation = documentation or "", + GuiPath = guipath or "", + Local = false + } + + for _, shortcut in ipairs(shortcuts) do + keybind.Command = keybind.Command .. shortcut.Command + if concatTitle then + keybind.Name = keybind.Name .. "/" .. shortcut.Name + end + if concatDocumentation then + keybind.Documentation = keybind.Documentation .. "," .. shortcut.Documentation + end + + keybind.Local = keybind.Local and shortcut.Local + end + + return keybind +end +asset.export("createKeyBindFromShortcuts", createKeyBindFromShortcuts) \ No newline at end of file From b43c234541cc3633f92ce7df4195c681b13d086e Mon Sep 17 00:00:00 2001 From: Micah Acinapura Date: Fri, 12 Jun 2020 21:08:20 -0400 Subject: [PATCH 30/48] mars2020 landed --- data/assets/mars.scene | 6 +---- .../missions/perseverance/model.asset | 7 ++---- .../missions/perseverance/shortcuts.asset | 4 +-- .../missions/perseverance/transforms.asset | 25 +++---------------- openspace.cfg | 1 + 5 files changed, 9 insertions(+), 34 deletions(-) diff --git a/data/assets/mars.scene b/data/assets/mars.scene index 63f26cbdb3..e8da3de029 100644 --- a/data/assets/mars.scene +++ b/data/assets/mars.scene @@ -7,7 +7,6 @@ local perseveranceShortcuts = asset.require('scene/solarsystem/missions/persever local insightAsset = asset.require('scene/solarsystem/missions/insight/edl') local insightShortcuts = asset.require('scene/solarsystem/missions/insight/shortcuts') - local insightEDLShortcuts = sceneHelper.extractShortcuts({"Insight Height Offset", "Enable HiRISE", "Insight EDL Time", @@ -22,7 +21,6 @@ local insightDisableShortcuts = sceneHelper.extractShortcuts({ local PerseverenceLandedShortcuts = sceneHelper.extractShortcuts({ "Perseverance Height Offset", "Perseverance landed time", - -- "Show Perseverance Trail", "Enable HiRISE"}, perseveranceShortcuts.Shortcuts) @@ -47,7 +45,6 @@ local Keybindings = { } asset.onInitialize(function () - local now = openspace.time.currentWallTime() openspace.time.setTime(now) @@ -55,8 +52,7 @@ asset.onInitialize(function () openspace.globebrowsing.goToGeo("Mars", 58.5877, 16.1924, 8000000) - openspace.markInterestingNodes({ "Mars", insightAsset.Insight.Identifier }) - + openspace.markInterestingNodes({ "Mars", insightAsset.Insight.Identifier, "Perseverance" }) end) asset.onDeinitialize(function () diff --git a/data/assets/scene/solarsystem/missions/perseverance/model.asset b/data/assets/scene/solarsystem/missions/perseverance/model.asset index 9f970b5043..42211bef42 100644 --- a/data/assets/scene/solarsystem/missions/perseverance/model.asset +++ b/data/assets/scene/solarsystem/missions/perseverance/model.asset @@ -33,19 +33,16 @@ local textures = asset.syncedResource({ Version = 1 }) - - -- Perseverance Model -- local Perseverance = { - Identifier = "PerseveranceM", + Identifier = "Perseverance", Parent = transforms.MSL_Body.Identifier, GUI = { - Name = "Perseverance Position", + Name = "Perseverance", Path = "/Solar System/Missions/Perseverance" } } - -- Perseverance Model -- local PerseveranceModel = { Identifier = "PerseveranceModel", diff --git a/data/assets/scene/solarsystem/missions/perseverance/shortcuts.asset b/data/assets/scene/solarsystem/missions/perseverance/shortcuts.asset index 5f52afa237..44da54bf80 100644 --- a/data/assets/scene/solarsystem/missions/perseverance/shortcuts.asset +++ b/data/assets/scene/solarsystem/missions/perseverance/shortcuts.asset @@ -13,8 +13,8 @@ local PerseveranceNavigationSate = "{" .. local Shortcuts = { { - Command = "openspace.setPropertyValueSingle('Scene.Mars.Renderable.Layers.HeightLayers.Mola_Utah.Settings.Offset', -469.300000);" .. - "openspace.setPropertyValueSingle('Scene.Mars.Renderable.Layers.HeightLayers.OnMarsHiRISELS.Settings.Offset', -470.800006);", + Command = "openspace.setPropertyValueSingle('Scene.Mars.Renderable.Layers.HeightLayers.Mola_Utah.Settings.Offset', -1677.088867);" .. + "openspace.setPropertyValueSingle('Scene.Mars.Renderable.Layers.HeightLayers.OnMarsHiRISELS.Settings.Offset', -1677.088867);", Documentation = "Enable height layer offset for Perseverance landing trail", Name = "Perseverance Height Offset", GuiPath = "/Missions/Insight", diff --git a/data/assets/scene/solarsystem/missions/perseverance/transforms.asset b/data/assets/scene/solarsystem/missions/perseverance/transforms.asset index 3811e4e8e0..b7b063c130 100644 --- a/data/assets/scene/solarsystem/missions/perseverance/transforms.asset +++ b/data/assets/scene/solarsystem/missions/perseverance/transforms.asset @@ -1,29 +1,12 @@ local assetHelper = asset.require('util/asset_helper') local marsTransforms = asset.require('scene/solarsystem/planets/mars/transforms') local marsAsset = asset.require('scene/solarsystem/planets/mars/mars') +local trailAsset = asset.require('./trail') -local m2020_pos = { - Identifier = "m2020_pos", - Parent = marsAsset.Mars.Identifier, - Transform = { - Translation = { - Type = "GlobeTranslation", - Globe = "Mars", - Latitude = 18.3628, - Longitude = 77.5945, - UseHeightmap = true - }, - }, - GUI = { - Path = "/Solar System/Missions/Perseverance/Transforms", - Hidden = true, - } -} - local MSL_Body = { Identifier = "MSL_Body", - Parent = m2020_pos.Identifier, + Parent = trailAsset.PerseveranceNode.Identifier, Transform = { Translation = { Type = "StaticTranslation", @@ -31,7 +14,7 @@ local MSL_Body = { }, Rotation = { Type = "StaticRotation", - Rotation = { -1.884960,0.000000,2.905970 } + Rotation = { -0.521593,0.648407,2.888407 } } }, GUI = { @@ -487,8 +470,6 @@ local Wheel_B_R_Location = { } assetHelper.registerSceneGraphNodesAndExport(asset, { - - m2020_pos, MSL_Body, RA_Base_Location, RA_Shoulder_AZ_Location, diff --git a/openspace.cfg b/openspace.cfg index f57badd935..ad59b8f18e 100644 --- a/openspace.cfg +++ b/openspace.cfg @@ -60,6 +60,7 @@ Asset = "default" -- Asset = "apollo_sites" -- Asset = "touch" -- Asset = "dawn" +-- Asset = "mars" -- Sets the profile that should be loaded by OpenSpace. Profiles are going to replace -- assets in a future versions and shouldn't be used at the same time as the 'Asset' From ca4fb75eb402234382140ee432466506e0fb09c2 Mon Sep 17 00:00:00 2001 From: Micah Acinapura Date: Fri, 12 Jun 2020 21:41:07 -0400 Subject: [PATCH 31/48] added rotation to correct deepsky objects --- .../scene/digitaluniverse/deepsky.asset | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/data/assets/scene/digitaluniverse/deepsky.asset b/data/assets/scene/digitaluniverse/deepsky.asset index af41b8d18c..035d7fc50a 100644 --- a/data/assets/scene/digitaluniverse/deepsky.asset +++ b/data/assets/scene/digitaluniverse/deepsky.asset @@ -43,6 +43,12 @@ local deepSkyPoints = { --CorrectionSizeFactor = 10.45 EnablePixelSizeControl = true }, + Transform = { + Rotation = { + Type = "StaticRotation", + Rotation = { 0, 0, 3.14159265359 } + } + }, GUI = { Name = "Deep Sky Objects Points", Path = "/Universe/Galaxies" @@ -66,10 +72,45 @@ local deepSkyImages = { --FadeInDistances = {0.001, 0.05010}, PlaneMinSize = 5.0 }, + Transform = { + Rotation = { + Type = "StaticRotation", + Rotation = {3.14159265359, 3.14159265359, 0 } + } + }, GUI = { Name = "Deep Sky Objects Images", Path = "/Universe/Galaxies" } } +local deepSkyImages2 = { + Identifier = "DeepSkyObjectsImages2", + Renderable = { + Type = "RenderablePlanesCloud", + Enabled = false, + Color = { 1.0, 1.0, 1.0 }, + Transparency = 0.99, + ScaleFactor = 1.0, + File = speck .. "/dso.speck", + TexturePath = textures, + Luminosity = "radius", + ScaleLuminosity = 0.001, + Unit = "Mpc", + -- Fade in value in the same unit as "Unit" + --FadeInDistances = {0.001, 0.05010}, + PlaneMinSize = 5.0 + }, + Transform = { + Rotation = { + Type = "StaticRotation", + Rotation = {3.14159265359, 3.14159265359, 0 } + } + }, + GUI = { + Name = "Deep Sky Objects Images2", + Path = "/Universe/Galaxies" + } +} + assetHelper.registerSceneGraphNodesAndExport(asset, { deepSkyPoints, deepSkyImages }) From 57cfa0a3d47df38652573d2b48c6e5d1190d1d4a Mon Sep 17 00:00:00 2001 From: Micah Acinapura Date: Fri, 12 Jun 2020 21:42:08 -0400 Subject: [PATCH 32/48] removing test node --- .../scene/digitaluniverse/deepsky.asset | 29 ------------------- 1 file changed, 29 deletions(-) diff --git a/data/assets/scene/digitaluniverse/deepsky.asset b/data/assets/scene/digitaluniverse/deepsky.asset index 035d7fc50a..66793c377f 100644 --- a/data/assets/scene/digitaluniverse/deepsky.asset +++ b/data/assets/scene/digitaluniverse/deepsky.asset @@ -84,33 +84,4 @@ local deepSkyImages = { } } -local deepSkyImages2 = { - Identifier = "DeepSkyObjectsImages2", - Renderable = { - Type = "RenderablePlanesCloud", - Enabled = false, - Color = { 1.0, 1.0, 1.0 }, - Transparency = 0.99, - ScaleFactor = 1.0, - File = speck .. "/dso.speck", - TexturePath = textures, - Luminosity = "radius", - ScaleLuminosity = 0.001, - Unit = "Mpc", - -- Fade in value in the same unit as "Unit" - --FadeInDistances = {0.001, 0.05010}, - PlaneMinSize = 5.0 - }, - Transform = { - Rotation = { - Type = "StaticRotation", - Rotation = {3.14159265359, 3.14159265359, 0 } - } - }, - GUI = { - Name = "Deep Sky Objects Images2", - Path = "/Universe/Galaxies" - } -} - assetHelper.registerSceneGraphNodesAndExport(asset, { deepSkyPoints, deepSkyImages }) From b76cc949f843996c843a142271da2e72a892d05b Mon Sep 17 00:00:00 2001 From: Micah Date: Fri, 12 Jun 2020 23:46:22 -0400 Subject: [PATCH 33/48] added constellation asset from ccny --- .../constellations/constellation_art.asset | 54 ++++++++++++ .../constellations/constellation_data.csv | 85 +++++++++++++++++++ .../generate_constellations.asset | 80 +++++++++++++++++ 3 files changed, 219 insertions(+) create mode 100644 data/assets/scene/milkyway/constellations/constellation_art.asset create mode 100644 data/assets/scene/milkyway/constellations/constellation_data.csv create mode 100644 data/assets/scene/milkyway/constellations/generate_constellations.asset diff --git a/data/assets/scene/milkyway/constellations/constellation_art.asset b/data/assets/scene/milkyway/constellations/constellation_art.asset new file mode 100644 index 0000000000..e0a85b4a8e --- /dev/null +++ b/data/assets/scene/milkyway/constellations/constellation_art.asset @@ -0,0 +1,54 @@ +local assetHelper = asset.require('util/asset_helper') +local sceneHelper = asset.require('util/scene_helper') +local constellationHelper = asset.require('./generate_constellations') + +local constellationsCSV = asset.localResource('constellation_data.csv') + +local nodes = {} + +local Keybindings = { + { + Key = "c", + Name = "Show Constellation Art", + Command = "openspace.setPropertyValue('Scene.Constellation Art*.Renderable.Opacity',0);" .. + "openspace.setPropertyValue('Scene.Constellation Art*.Renderable.Enabled', true);" .. + "openspace.setPropertyValue('Scene.Constellation Art*.Renderable.Opacity', 0.1,2);", + Documentation = "Enables and fades up constellation art work", + GuiPath = "/Rendering", + Local = false + }, + { + Key = "shift+c", + Name = "Hide Constellation Art", + Command = "openspace.setPropertyValue('Scene.Constellation Art*.Renderable.Opacity', 0, 2);", + Documentation = "Fades out constellation artwork", + GuiPath = "/Rendering", + Local = false + }, + { + Key = "ctrl+c", + Name = "Disable Constellation Art", + Command = "openspace.setPropertyValue('Scene.Constellation Art*.Renderable.Enabled', false);", + Documentation = "Disable constellation artwork", + GuiPath = "/Rendering", + Local = false + } +} + +asset.onInitialize(function () + + sceneHelper.bindKeys(Keybindings) + nodes = constellationHelper.getConstellations('Constellation Art', constellationsCSV) + + for _, n in ipairs(nodes) do + openspace.addSceneGraphNode(n); + end +end) + +asset.onDeinitialize(function () + sceneHelper.unbindKeys(Keybindings) + + for _, n in ipairs(nodes) do + openspace.removeSceneGraphNode(n.Identifier); + end +end) diff --git a/data/assets/scene/milkyway/constellations/constellation_data.csv b/data/assets/scene/milkyway/constellations/constellation_data.csv new file mode 100644 index 0000000000..7c02f310de --- /dev/null +++ b/data/assets/scene/milkyway/constellations/constellation_data.csv @@ -0,0 +1,85 @@ +Data about Constellations columns are: group, name, x, y, z, scale, imageName, rotX, rotY, rotZ, centerStar +normal,Ori,Orion,-550.8742,-259.3621,-188.9620,1.5,Ori.png,1.128407,1.058407,1.668407,HD37128 +zodiac,Tau,Taurus,-18.7277,-0.3175,-6.9092,1.2,Tau.png,1.198407,0.908407,1.378407,Aldebran +zodiac,Ari,Aries,-13.2892,9.4519,-11.9378,0.8,Ari.png,0.668407,0.538407,0.518407,Hamal +zodiac,Gem,Gemini,-362.5493,-102.2245,79.4030,0.85,Gem.png,-0.731593,2.268407,-0.451593,Mekbuda +zodiac,Cnc,Cancer,-30.9209,-16.4584,22.6601,0.8,Cnc.png,-1.151593,1.888407,-1.041593,HD74442 +zodiac,Leo,Leo,-17.9030,-13.2719,31.4196,1.33,Leo.png,-0.131593,2.448407,0.418407,HD89484 +zodiac,Vir,Virgo,36.5809,-35.1877,62.3341,1.5,Vir.png,-0.371593,3.138407,0.518407,HD116658 +zodiac,Lib,Libra,17.5393,-6.2768,14.5916,1.0,Lib.png,-1.011593,3.138407,1.318407,HD130819 +zodiac,Sco,Scorpius,137.4378,-19.4456,37.3606,1.2,Sco.png,1.698407,-1.001593,-1.751593,HD148478 +zodiac,Sgr,Sagittarius,66.2304,11.1498,-14.8095,1.2,Sgr.png,1.728407,-1.321593,-1.751593,HD175191 +zodiac,Cap,Capricornus,32.9799,20.0621,-29.3945,1.3,Cap.png,1.158407,-0.881593,-0.561593,HD200761 +zodiac,Aqr,Aquarius,86.5090,149.4078,-155.8102,1.2,Aqr.png,-2.921593,-2.391593,-2.551593,-2.511593 +zodiac,Psc,Pisces,-28.0235,45.3150,-76.8893,1.6,Psc.png,0.458407,-0.001593,0.618407,HD4656 +northern,Uma,Ursa Major,-12.0503,7.1931,19.8974,1.6,UMa.png,0.748407,2.398407,0.658407,HD95418 +northern,Dra,Draco,-1.4340,20.6566,23.5098,1.9,Dra.png,0.658407,-2.541593,1.058407,HD137759 +southern,Ant,Antila,-0.2233,-103.8908,42.7940,1.3,Ant.png,1.848407,0.198407,-3.141593,HD90610 +southern,Crv,Corvus,8.0442,-16.8858,19.3984,1.1,Crv.png,2.198407,-0.041593,-2.221593,HD108767 +southern,Cet,Cetus,-28.7960,7.2425,-73.6693,1.5,Cet.png,0.238407,0.368407,0.688407,HD11353 +southern,Cha,Chameleon,53.5121,-108.3624,-38.1807,1.1,Cha.png,-1.801593,2.738407,0.448407,HD92305 +northern,Cam,Camelopardalis,-304.8155,179.0620,71.1454,1.7,Cam.png,2.128407,1.228407,1.478407,HD31910 +equatorial,Aql,Aquila,11.7741,9.7467,-1.6418,1.0,Aql.png,-2.601593,-2.511593,-3.141593,HD182640 +southern,Aps,Apus,31.6370,-32.5620,-16.5786,1.1,Aps.png,-1.691593,-2.281593,0.838407,HD149324 +northern,Lyn,Lynx,-98.3174,4.4830,67.2289,1.2,Lyn.png,1.688407,1.768407,1.668407,HD70272 +southern,Phe,Phoenix,5.0172,-4.2096,-22.8088,1.5,Phe.png,-3.141593,3.138407,-3.141593,HD6595 +northern,Cyg,Cygnus,78.7445,375.2440,12.4995,1.4,Cyg.png,1.668407,-0.931593,-0.261593,HD194093 +southern,Cen,Centaurus,20.1398,-33.1830,9.5915,2.7,Cen.png,-1.291593,3.088407,0.458407,HD110304 +northern,Aur,Auriga,-12.3062,3.8595,1.0302,1.5,Aur.png,1.378407,1.108407,1.178407,HD34029 +northern,Peg,Pegasus,0.9791,32.5947,-27.7339,2.42,Peg.png,0.918407,-0.221593,-0.191593,HD218045 +southern,Hya,Hydra,-2.9043,-33.5496,25.8962,3,Hya.png,-0.531593,2.838407,0.368407,HD93813 +southern,Oct,Octans,22.0434,-27.8601,-24.3108,1.0,Oct.png,-0.911593,0.398407,1.198407,HD214846 +southern,Nor,Norma,34.9251,-17.5643,0.0068,1.0,Nor.png,-1.631593,-2.421593,1.298407,HD146686 +southern,Mus,Musca,48.8888,-79.2952,-10.2828,1.25,Mus.png,-1.871593,3.138407,0.358407,HD109668 +southern,Hyi,Hydrus,3.2767,-4.7183,-4.7829,1.1,Hyi.png,2.438407,-3.141593,-2.381593,HD2151 +northern,Lac,Lacerta,-6.0878,30.5794,-3.6064,1.0,Lac.png,-1.521593,-2.391593,3.138407,HD213558 +equatorial,Lep,Lepus,-212.6297,-184.4909,-132.1156,1.0,Lep.png,-1.801593,-2.351593,-0.861593,HD36673 +southern,Lup,Lupus,129.1166,-102.2983,33.3251,1.2,Lup.png,-1.191593,-2.391593,0.798407,HD129056 +southern,Men,Mensa,2.4149,-8.5586,-4.8892,1.0,Men.png,-2.101593,-2.781593,0.828407,HD43834 +southern,Mic,Microscopium,51.0335,11.1671,-44.3692,1.0,Mic.png,0.728407,-0.831593,-0.561593,HD199951 +equatorial,Mon,Monoceros,-93.0725,-66.8909,8.6548,1.2,Mon.png,-1.331593,1.988407,-0.891593,HD55185 +southern,Pav,Pavo,4.4549,-2.5959,-3.2739,1.3,Pav.png,-2.391593,-2.171593,1.648407,HD190248 +southern,Ind,Indus,133.6149,-53.5569,-115.9552,1.5,Ind.png,-2.031593,-1.491593,1.758407,HD198700 +northern,LMi,Leo Minor,-23.3948,-2.5770,38.0756,1.1,LMi.png,-3.141593,0.478407,-2.201593,HD90537 +northern,Lyr,Lyra,2.8086,6.7630,2.5555,1.0,Lyr.png,-1.831593,-2.091593,3.141500,HD172167 +northern,Her,Hercules,14.0526,14.9773,12.5478,1.3,Her.png,-1.511593,-1.811593,2.288407,HD156164 +southern,Gru,Grus,18.6528,-3.2893,-24.6602,1.3,Gru.png,-3.141593,-2.511593,-2.901593,HD209952 +southern,Crt,Crater,1.5886,-43.9831,40.3390,1.3,Crt.png,-0.521593,3.140000,0.588407,HD98430 +northern,Del,Delphinus,14.8599,24.6150,-8.0550,1.2,Del.png,1.308407,-0.951593,-0.241593,HD196524 +southern,Dor,Dorado,-0.6460,-9.3172,-6.9654,1.2,Dor.png,2.118407,1.768407,-2.901593,HD33262 +northern,Equ,Equuleus,27.7363,41.7071,-27.4371,1.2,Equ.png,-1.801593,-2.511593,2.558407,HD202447 +southern,Eri,Eridanus,-37.5153,-23.5231,-65.6368,2.1,Eri.png,0.128407,0.698407,0.998407,HD20720 +southern,For,Fornax,-14.0351,-17.8282,-46.5514,1.4,For.png,3.138407,2.678407,-2.351593,HD17652 +southern,Hor,Horologium,2.1021,-27.1310,-40.5136,1.2,Hor.png,-3.141593,2.468407,-2.191593,HD16920 +southern,Pyx,Pyxis,-66.7424,-248.9639,26.0445,1.2,Pyx.png,1.838407,-1.651593,2.708407,HD74575 +southern,Ret,Reticulum,2.8130,-37.2904,-33.2644,1.5,Ret.png,1.998407,2.188407,-2.591593,HD27256 +northern,Sge,Sagitta,44.3886,70.9446,-7.6264,1.2,Sge.png,-0.741593,-2.231593,2.108407,HD189319 +southern,Scl,Sculptor,21.6545,-6.8861,-166.5240,1.3,Scl.png,-0.071593,-0.221593,0.638407,HD2429 +southern,Sct,Scutum,48.8939,21.5158,-0.1629,1.2,Sct.png,1.188407,-1.271593,-0.971593,HD171443 +southern,Tuc,Tucana,35.3950,-20.2535,-45.2324,1.1,Tuc.png,-0.351593,-0.161593,0.308407,HD211416 +northern,Tri,Triangulum,-26.6263,21.9119,-16.2254,1.2,Tri.png,1.168407,0.218407,0.558407,HD13161 +southern,TrA,Triangulum Australe,96.2283,-76.4459,-33.5257,1.2,TrA.png,-1.991593,-2.491593,1.128407,HD150798 +southern,Tel,Telescopium,72.3444,-14.5016,-20.0248,1.2,Tel.png,-0.461593,-1.731593,0.298407,HD169467 +southern,Ara,Ara,164.9273,-75.6246,-35.3100,1.1,Ara.png,-1.381593,-2.131593,1.048407,HD157244 +southern,Cae,Caelum,-6.0961,-13.7926,-13.3392,1.0,Cae.png,-0.661593,0.948407,0.418407,HD29875 +southern,CMa,Canis Major,-1.7693,-1.9125,-0.4074,1.3,CMa.png,1.128407,1.048407,1.878407,HD48915 +northern,CMi,Canis Minor,-2.8348,-1.8906,0.7881,1.2,CMi.png,2.538407,1.138407,-3.141593,HD61421 +southern,Vol,Volans,37.6000,-182.7856,-62.6559,1.2,Vol.png,-2.441593,1.988407,-0.351593,HD68520 +northern,UMi,Ursa Minor,-11.3527,27.2100,25.1835,1.3,UMi.png,-2.491593,-0.581593,-2.381593,HD131873 +northern,And,Andromdeda,-32.8276,43.3946,-27.8475,1.6,And.png,-2.021593,-3.141593,-2.521593,HD6860 +northern,Boo,Bootes,11.2468,14.9864,30.4945,2.0,Boo.png,-3.141593,-0.601593,-2.361593,HD135722 +northern,Vul,Vulpecula,46.7540,77.7780,5.3953,1.1,Vul.png,-2.301593,-2.061593,-3.141593,HD131873 +northern,CVn,Canes Venatici,-3.1198,5.7935,33.1368,1.3,CVn.png,0.148407,3.138407,0.428407,HD112413 +southern,Cir,Circinus,11.4255,-11.6937,-1.3129,1.0,Cir.png,1.448407,-0.391593,-2.211593,HD128898 +northern,Com,Coma Berenices,1.9257,-1.2062,12.2465,1.4,Com.png,3.138407,-0.051593,-2.711593,HD114378 +southern,CrA,Corona Australis,146.1322,-4.7492,-53.7124,1.0,CrA.png,-3.141593,-2.021593,-3.141593,HD178345 +northern,CrB,Corona Borealis,33.5737,32.0314,52.9729,1.3,CrB.png,-3.141593,-0.601593,-2.271593,HD143107 +northern,Cas,Cassiopeia,-36.3073,59.4424,-7.6926,1.4,Cas.png,-1.431593,3.128407,-2.331593,HD3712 +northern,Cep,Cepheus,-2.8178,14.4985,2.3848,1.7,Cep.png,-1.331593,-2.291593,-2.931593,HD203280 +southern,Car,Carina Vela Puppis,14.1325,-188.6018,-42.2785,2.0,Car.png,2.078407,1.048407,-3.111593,HD71129 +northern,Col,Columba,-11.2568,-20.5973,-11.9895,1.0,Col.png,2.518407,1.358407,-2.981593,HD39425 +northern,Per,Perseus,-139.8202,79.8063,-16.2631,1.3,Per.png,-1.751593,2.428407,-2.411593,HD22928 +northern,Oph,Ophiuchus,127.9419,14.0822,56.2015,3.2,Oph.png,2.178407,-0.781593,-1.681593,HD149757 +southern,PsA,Piscis Austrinus,99.9977,47.6679,-199.6345,1.0,PsA.png,3.138407,-2.541593,-2.881593,HD214748 +southern,Cru,Crux,49.3509,-85.0446,-0.6223,1.1,Cru.png,1.718407,0.048407,-2.741593,HD108248 +southern,Pic,Pictor,-4.5417,-45.5649,-27.1768,1.0,Pic.png,2.568407,2.138407,-2.081593,HD39523 diff --git a/data/assets/scene/milkyway/constellations/generate_constellations.asset b/data/assets/scene/milkyway/constellations/generate_constellations.asset new file mode 100644 index 0000000000..05e42db473 --- /dev/null +++ b/data/assets/scene/milkyway/constellations/generate_constellations.asset @@ -0,0 +1,80 @@ +local assetHelper = asset.require('util/asset_helper') +local transforms = asset.require("scene/solarsystem/sun/transforms") + +local images = asset.syncedResource({ + Name = "Constellation Images", + Type = "HttpSynchronization", + Identifier = "constellation_images", + Version = 1 +}) + +--function that reads the file + +local getConstellations = function (guiPath, constellationfile) + local genConstellations = {}; + --skip the first line + local notFirstLine = false; + -- define parsec to meters + local PARSEC_CONSTANT = 3.0856776E16; + -- how many parsecs away do you want the images to be? + -- this setting puts the billboards at the location of the constellation bounds grid from DU. + -- but they can really be anywhere since the billboard size will scale with distance. + local distanceMultiplier = 3.2; + local baseScale = 1e17; + for line in io.lines(openspace.absPath(constellationfile)) do + if (notFirstLine) then + -- describes the data + local matchstring = '(.-),(.-),(.-),(.-),(.-),(.-),(.-),(.-),(.-),(.-),(.-),(.-)$' + local group, abbreviation, name, x, y, z, scale, imageName, rotX, rotY, rotZ, centerStar = line:match(matchstring) + local magVec = math.sqrt(x*x+y*y+z*z) + local normx = x/magVec + local normy = y/magVec + local normz = z/magVec + + group = (group == '' and globe or group) + + local aconstellation = { + Identifier = guiPath .. '-' .. name, + Parent = transforms.SolarSystemBarycenter.Identifier, + Transform = { + Translation = { + Type = "StaticTranslation", + -- position is in parsecs from the SolarSystemBarycenter, so convert to meters + Position = {normx*PARSEC_CONSTANT*distanceMultiplier, normy*PARSEC_CONSTANT*distanceMultiplier, normz*PARSEC_CONSTANT*distanceMultiplier} + }, + Rotation = { + Type = "StaticRotation", + Rotation = {tonumber(rotX),tonumber(rotY),tonumber(rotZ)} + } + + }, + Renderable = { + Type = "RenderablePlaneImageLocal", + Size = tonumber(baseScale*scale*distanceMultiplier/10), + Enabled = false, + Origin = "Center", + Billboard = false, + Texture = images .. "/" .. imageName, + BlendMode = "Additive", + Opacity = 0.1 + }, + Tag = { "ConstellationArtImage", group }, + GUI = { + Name = name .. ' Image', + Path = '/Milky Way/' .. guiPath + } + + } + + table.insert(genConstellations, aconstellation); + + + + else + notFirstLine = true + end + end + return genConstellations +end + +asset.export('getConstellations', getConstellations) From da955a6c29a8ffa3cc75e3b0cbc0d121282ea4e7 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Sat, 13 Jun 2020 13:08:47 +0200 Subject: [PATCH 34/48] General cleanup of Apollo scenes --- data/assets/apollo8.profile | 2 +- data/assets/apollo8.scene | 3 +- data/assets/apollo_sites.profile | 10 +- data/assets/apollo_sites.scene | 18 +- .../missions/apollo/{ => 11}/apollo11.asset | 83 ++-- .../missions/apollo/11/kernels.asset | 16 + .../apollo/{a11_lem.asset => 11/lem.asset} | 28 +- .../lem_descent.asset} | 21 +- .../lem_descent_rotation.asset} | 0 .../lem_flipbook.asset} | 4 +- .../missions/apollo/11/models.asset | 8 + .../missions/apollo/15/apollo15.asset | 115 +++++ .../missions/apollo/15/kernels.asset | 92 ++++ .../missions/apollo/17/boulder_models.asset | 8 + .../apollo/{ => 17}/bouldersstation2.asset | 51 +- .../apollo/{ => 17}/bouldersstation6.asset | 55 +-- .../apollo/{ => 17}/bouldersstation7.asset | 30 +- .../apollo/{a17_lem.asset => 17/lem.asset} | 24 +- .../missions/apollo/8/apollo8.asset | 3 + .../missions/apollo/8/kernels.asset | 17 + .../missions/apollo/8/launch_model.asset | 65 +++ .../solarsystem/missions/apollo/8/model.asset | 93 ++++ .../missions/apollo/8/trails.asset | 81 ++++ .../solarsystem/missions/apollo/a15.asset | 203 -------- .../missions/apollo/a15kernels.asset | 86 ---- .../solarsystem/missions/apollo/apollo8.asset | 235 --------- .../missions/apollo/apollo_csm.asset | 448 +++++++++--------- .../apollo/apollo_globebrowsing.asset | 10 +- .../missions/apollo/apollo_lem.asset | 14 +- .../missions/apollo/insignias_map.asset | 16 +- modules/base/rendering/renderablemodel.cpp | 14 +- 31 files changed, 865 insertions(+), 988 deletions(-) rename data/assets/scene/solarsystem/missions/apollo/{ => 11}/apollo11.asset (72%) create mode 100644 data/assets/scene/solarsystem/missions/apollo/11/kernels.asset rename data/assets/scene/solarsystem/missions/apollo/{a11_lem.asset => 11/lem.asset} (50%) rename data/assets/scene/solarsystem/missions/apollo/{apollo11_lem_descent.asset => 11/lem_descent.asset} (98%) rename data/assets/scene/solarsystem/missions/apollo/{apollo11_lem_descent_rotation.asset => 11/lem_descent_rotation.asset} (100%) rename data/assets/scene/solarsystem/missions/apollo/{apollo_11_lem_flipbook.asset => 11/lem_flipbook.asset} (89%) create mode 100644 data/assets/scene/solarsystem/missions/apollo/11/models.asset create mode 100644 data/assets/scene/solarsystem/missions/apollo/15/apollo15.asset create mode 100644 data/assets/scene/solarsystem/missions/apollo/15/kernels.asset create mode 100644 data/assets/scene/solarsystem/missions/apollo/17/boulder_models.asset rename data/assets/scene/solarsystem/missions/apollo/{ => 17}/bouldersstation2.asset (74%) rename data/assets/scene/solarsystem/missions/apollo/{ => 17}/bouldersstation6.asset (72%) rename data/assets/scene/solarsystem/missions/apollo/{ => 17}/bouldersstation7.asset (65%) rename data/assets/scene/solarsystem/missions/apollo/{a17_lem.asset => 17/lem.asset} (61%) create mode 100644 data/assets/scene/solarsystem/missions/apollo/8/apollo8.asset create mode 100644 data/assets/scene/solarsystem/missions/apollo/8/kernels.asset create mode 100644 data/assets/scene/solarsystem/missions/apollo/8/launch_model.asset create mode 100644 data/assets/scene/solarsystem/missions/apollo/8/model.asset create mode 100644 data/assets/scene/solarsystem/missions/apollo/8/trails.asset delete mode 100644 data/assets/scene/solarsystem/missions/apollo/a15.asset delete mode 100644 data/assets/scene/solarsystem/missions/apollo/a15kernels.asset delete mode 100644 data/assets/scene/solarsystem/missions/apollo/apollo8.asset diff --git a/data/assets/apollo8.profile b/data/assets/apollo8.profile index f9a9c003fc..7c7b3f73bb 100644 --- a/data/assets/apollo8.profile +++ b/data/assets/apollo8.profile @@ -3,7 +3,7 @@ #Asset scene/solarsystem/planets/earth/moon/moon required -scene/solarsystem/missions/apollo/apollo8 required +scene/solarsystem/missions/apollo/8/apollo8 required scene/solarsystem/planets/earth/earth required #Property diff --git a/data/assets/apollo8.scene b/data/assets/apollo8.scene index 6ec4a8b9d5..fd8fcebb42 100644 --- a/data/assets/apollo8.scene +++ b/data/assets/apollo8.scene @@ -5,7 +5,7 @@ local sceneHelper = asset.require('util/scene_helper') asset.require('scene/solarsystem/planets/earth/moon/moon') -asset.require('scene/solarsystem/missions/apollo/apollo8.asset') +asset.require('scene/solarsystem/missions/apollo/8/apollo8.asset') -- Custom Keybindings local Keybindings = { @@ -118,7 +118,6 @@ asset.onInitialize(function () openspace.markInterestingNodes({ "Earth", "Moon", "Apollo8", "Apollo8Launch" }) openspace.setPropertyValueSingle('NavigationHandler.OrbitalNavigator.MinimumAllowedDistance', 0.000000); - openspace.setPropertyValueSingle('Scene.Moon.Renderable.LodScaleFactor', 24.0); openspace.globebrowsing.goToGeo(earthAsset.Earth.Identifier, 20, -60, 15000000) end) diff --git a/data/assets/apollo_sites.profile b/data/assets/apollo_sites.profile index f014e5b36d..9c42c9fa97 100644 --- a/data/assets/apollo_sites.profile +++ b/data/assets/apollo_sites.profile @@ -3,17 +3,15 @@ #Asset scene/solarsystem/planets/earth/moon/moon required -scene/solarsystem/missions/apollo/apollo8 required -scene/solarsystem/missions/apollo/apollo11 required -scene/solarsystem/missions/apollo/a17_lem required +scene/solarsystem/missions/apollo/8/apollo8 required +scene/solarsystem/missions/apollo/11/apollo11 required +scene/solarsystem/missions/apollo/17/lem required scene/solarsystem/missions/apollo/apollo_globebrowsing required -scene/solarsystem/missions/apollo/apollo_11_lem_flipbook required +scene/solarsystem/missions/apollo/11/lem_flipbook required scene/solarsystem/missions/apollo/insignias_map required #Property setPropertyValueSingle Scene.Moon.Renderable.Layers.ColorLayers.A17_travmap.BlendMode 0 -setPropertyValueSingle Scene.Apollo11LemDescentModel.Renderable.RotationVector { 273.750,28.0,309.85 } -setPropertyValueSingle Scene.Apollo11LemLandedModel.Renderable.RotationVector { 273.750,28.0,309.85 } setPropertyValueSingle Scene.Moon.Renderable.PerformShading false #Keybinding diff --git a/data/assets/apollo_sites.scene b/data/assets/apollo_sites.scene index e2ecc6ea29..aaf8a3c147 100644 --- a/data/assets/apollo_sites.scene +++ b/data/assets/apollo_sites.scene @@ -1,15 +1,14 @@ asset.require('./base') ---moonrocks.scene local sceneHelper = asset.require('util/scene_helper') --- local station2 = asset.require('scene/solarsystem/missions/apollo/bouldersstation2') --- local station6 = asset.require('scene/solarsystem/missions/apollo/bouldersstation6') --- local station7 = asset.require('scene/solarsystem/missions/apollo/bouldersstation7') -asset.require('scene/solarsystem/missions/apollo/apollo8') -asset.require('scene/solarsystem/missions/apollo/apollo11') -asset.require('scene/solarsystem/missions/apollo/a17_lem') +-- local station2 = asset.require('scene/solarsystem/missions/apollo/17/bouldersstation2') +-- local station6 = asset.require('scene/solarsystem/missions/apollo/17/bouldersstation6') +-- local station7 = asset.require('scene/solarsystem/missions/apollo/17/bouldersstation7') +asset.require('scene/solarsystem/missions/apollo/8/apollo8') +asset.require('scene/solarsystem/missions/apollo/11/apollo11') +asset.require('scene/solarsystem/missions/apollo/17/lem') asset.require('scene/solarsystem/missions/apollo/apollo_globebrowsing') -asset.require('scene/solarsystem/missions/apollo/apollo_11_lem_flipbook') +asset.require('scene/solarsystem/missions/apollo/11/lem_flipbook') asset.require('scene/solarsystem/missions/apollo/insignias_map') local Keybindings = { @@ -100,9 +99,6 @@ asset.onInitialize(function () -- openspace.setPropertyValueSingle('Scene.Moon.Renderable.Layers.HeightLayers.LRO_NAC_Apollo_11.Enabled', true); -- openspace.setPropertyValueSingle('Scene.Moon.Renderable.Layers.ColorLayers.A11_M177481212_p_longlat.Enabled', true); - openspace.setPropertyValueSingle('Scene.Apollo11LemDescentModel.Renderable.RotationVector', { 273.750,28.0,309.85 }); - openspace.setPropertyValueSingle('Scene.Apollo11LemLandedModel.Renderable.RotationVector', { 273.750,28.0,309.85 }); - openspace.globebrowsing.goToGeo(moonAsset.Moon.Identifier, 20, -60, 15000000) openspace.setPropertyValueSingle("Scene.Moon.Renderable.PerformShading", false) diff --git a/data/assets/scene/solarsystem/missions/apollo/apollo11.asset b/data/assets/scene/solarsystem/missions/apollo/11/apollo11.asset similarity index 72% rename from data/assets/scene/solarsystem/missions/apollo/apollo11.asset rename to data/assets/scene/solarsystem/missions/apollo/11/apollo11.asset index fb55dbe9ff..c65cd3c47a 100644 --- a/data/assets/scene/solarsystem/missions/apollo/apollo11.asset +++ b/data/assets/scene/solarsystem/missions/apollo/11/apollo11.asset @@ -1,39 +1,24 @@ -local assetHelper = asset.require('util/asset_helper') -local sunTransforms = asset.require('scene/solarsystem/sun/transforms') -local descentKeyframes = asset.require('./apollo11_lem_descent.asset') -local descentRotationKeyframes = asset.require('./apollo11_lem_descent_rotation.asset') -local model = asset.require('scene/solarsystem/missions/apollo/lem_model') +local asset_helper = asset.require('util/asset_helper') +local sun_transforms = asset.require('scene/solarsystem/sun/transforms') +local moon_transforms = asset.require('scene/solarsystem/planets/earth/moon/moon') + +local descentKeyframes = asset.require('./lem_descent.asset') +local descentRotationKeyframes = asset.require('./lem_descent_rotation.asset') + +local lem_model = asset.require('scene/solarsystem/missions/apollo/lem_model') +local kernels = asset.require('./kernels').kernels + +local models = asset.require('./models').models asset.require('spice/base') -local kernelsFolder = asset.syncedResource({ - Name = "Apollo Kernels", - Type = "HttpSynchronization", - Identifier = "apollo_11_spice", - Version = 1 -}) - -local modelFolder = asset.syncedResource({ - Name = "Apollo Models", - Type = "HttpSynchronization", - Identifier = "apollo_11_models", - Version = 1 -}) - -local kernels = { - kernelsFolder .. "/moon_080317.tf", - kernelsFolder .. "/apollo_naif_ids.tf", - kernelsFolder .. "/moon_pa_de421_1900-2050.bpc", - kernelsFolder .. '/apollo11_orbits_full9km.bsp', - kernelsFolder .. '/apollo11_orbits_lm9km.bsp', -} --landing - 1969-07-20T20:17:40 local apolloSpiceId = "-911" local apolloLemSpiceId = "-911500" local Apollo11Position = { Identifier = "Apollo11Position", - Parent = "Moon", + Parent = moon_transforms.Moon.Identifier, TimeFrame = { Type = "TimeFrameInterval", Start = "1969 JUL 19 19:38:29.183", @@ -58,28 +43,27 @@ local Apollo11Position = { local Apollo11Model = { Identifier = "Apollo11", Parent = Apollo11Position.Identifier, + TimeFrame = { + Type = "TimeFrameInterval", + Start = "1969 JUL 19 19:38:29.183", + End = "1969 JUL 22 04:55:35.183" + }, Transform = { Scale = { Type = "StaticScale", Scale = 20.0 } }, - TimeFrame = { - Type = "TimeFrameInterval", - Start = "1969 JUL 19 19:38:29.183", - End = "1969 JUL 22 04:55:35.183" - }, Renderable = { Type = "RenderableModel", Geometry = { Type = "MultiModelGeometry", - GeometryFile = modelFolder .. "/Apollo_CSM_shrunk_rotated_xy_double_size.obj" + GeometryFile = models .. "/Apollo_CSM_shrunk_rotated_xy_double_size.obj" }, - ColorTexture = modelFolder .. "/gray.png", - LightSources = assetHelper.getDefaultLightSources(sunTransforms.SolarSystemBarycenter.Identifier) + ColorTexture = models .. "/gray.png", + LightSources = asset_helper.getDefaultLightSources(sun_transforms.SolarSystemBarycenter.Identifier) }, GUI = { - Hidden = false, Name = "Apollo 11 CSM", Path = "/Solar System/Missions/Apollo/11" } @@ -87,7 +71,7 @@ local Apollo11Model = { local Apollo11MoonTrail = { Identifier = "Apollo11MoonTrail", - Parent = "Moon", + Parent = moon_transforms.Moon.Identifier, Renderable = { Type = "RenderableTrailTrajectory", Translation = { @@ -102,7 +86,7 @@ local Apollo11MoonTrail = { EndTime = "1969 JUL 22 04:55:35.183", SampleInterval = 60, EnableFade = false, - Enabled = false, + Enabled = false }, GUI = { Name = "Apollo 11 Moon Orbits", @@ -140,7 +124,7 @@ local lemRotation = { local Apollo11LemTrail = { Identifier = "Apollo11LemTrail", - Parent = "Moon", + Parent = moon_transforms.Moon.Identifier, Renderable = { Type = "RenderableTrailTrajectory", Translation = lemTranslation, @@ -159,7 +143,7 @@ local Apollo11LemTrail = { local Apollo11LemPosition = { Identifier = "Apollo11LemPosition", - Parent = "Moon", + Parent = moon_transforms.Moon.Identifier, TimeFrame = { Type = "TimeFrameInterval", Start = "1969 JUL 20 19:10:25.183" @@ -169,7 +153,6 @@ local Apollo11LemPosition = { Rotation = lemRotation }, GUI = { - Hidden = false, Name = "Apollo 11 Lunar Lander Position", Path = "/Solar System/Missions/Apollo/11" } @@ -194,14 +177,14 @@ local Apollo11LemDescentModel = { Type = "RenderableModel", Geometry = { Type = "MultiModelGeometry", - GeometryFile = model.modelFolder .. "/lmremoved.obj" + GeometryFile = lem_model.modelFolder .. "/lmremoved.obj" }, SpecularIntensity = 0.0, - ColorTexture = model.modelFolder .. "/LM-2_ver2clean_u1_v1.jpeg", - LightSources = assetHelper.getDefaultLightSources(sunTransforms.SolarSystemBarycenter.Identifier) + RotationVector = { 273.750,28.0,309.85 }, + ColorTexture = lem_model.modelFolder .. "/LM-2_ver2clean_u1_v1.jpeg", + LightSources = asset_helper.getDefaultLightSources(sun_transforms.SolarSystemBarycenter.Identifier) }, GUI = { - Hidden = false, Name = "Apollo 11 Descent Lem", Path = "/Solar System/Missions/Apollo/11" } @@ -224,14 +207,14 @@ local Apollo11LemLandedModel = { Type = "RenderableModel", Geometry = { Type = "MultiModelGeometry", - GeometryFile = model.modelFolder .. "/LM-2_ver2clean.obj" + GeometryFile = lem_model.modelFolder .. "/LM-2_ver2clean.obj" }, SpecularIntensity = 0.0, - ColorTexture = model.modelFolder .. "/LM-2_ver2clean_u1_v1.jpeg", - LightSources = assetHelper.getDefaultLightSources(sunTransforms.SolarSystemBarycenter.Identifier) + RotationVector = { 273.750,28.0,309.85 }, + ColorTexture = lem_model.modelFolder .. "/LM-2_ver2clean_u1_v1.jpeg", + LightSources = asset_helper.getDefaultLightSources(sun_transforms.SolarSystemBarycenter.Identifier) }, GUI = { - Hidden = false, Name = "Apollo 11 Landed Lem", Path = "/Solar System/Missions/Apollo/11" } @@ -248,4 +231,4 @@ local exportList = { Apollo11LemTrail, } -assetHelper.registerSceneGraphNodesAndExport(asset, exportList) +asset_helper.registerSceneGraphNodesAndExport(asset, exportList) diff --git a/data/assets/scene/solarsystem/missions/apollo/11/kernels.asset b/data/assets/scene/solarsystem/missions/apollo/11/kernels.asset new file mode 100644 index 0000000000..d1ffcf55e4 --- /dev/null +++ b/data/assets/scene/solarsystem/missions/apollo/11/kernels.asset @@ -0,0 +1,16 @@ +local kernelsFolder = asset.syncedResource({ + Name = "Apollo Kernels", + Type = "HttpSynchronization", + Identifier = "apollo_11_spice", + Version = 1 +}) + +local kernels = { + kernelsFolder .. "/moon_080317.tf", + kernelsFolder .. "/apollo_naif_ids.tf", + kernelsFolder .. "/moon_pa_de421_1900-2050.bpc", + kernelsFolder .. '/apollo11_orbits_full9km.bsp', + kernelsFolder .. '/apollo11_orbits_lm9km.bsp', +} + +asset.export('kernels', kernels) diff --git a/data/assets/scene/solarsystem/missions/apollo/a11_lem.asset b/data/assets/scene/solarsystem/missions/apollo/11/lem.asset similarity index 50% rename from data/assets/scene/solarsystem/missions/apollo/a11_lem.asset rename to data/assets/scene/solarsystem/missions/apollo/11/lem.asset index 05b81e0af4..badedf0412 100644 --- a/data/assets/scene/solarsystem/missions/apollo/a11_lem.asset +++ b/data/assets/scene/solarsystem/missions/apollo/11/lem.asset @@ -1,18 +1,18 @@ -- a11_lem.asset -local assetHelper = asset.require('util/asset_helper') -local sunTransforms = asset.require('scene/solarsystem/sun/transforms') -local moonAsset = asset.require('scene/solarsystem/planets/earth/moon/moon') +local asset_helper = asset.require('util/asset_helper') +local sun_transforms = asset.require('scene/solarsystem/sun/transforms') +local moon_asset = asset.require('scene/solarsystem/planets/earth/moon/moon') -local model = asset.require('scene/solarsystem/missions/apollo/lem_model') +local lem_model = asset.require('scene/solarsystem/missions/apollo/lem_model') local Apollo11Lem = { Identifier = "Apollo11Lem", - Parent = moonAsset.Moon.Identifier, + Parent = moon_asset.Moon.Identifier, Transform = { Translation = { Type = "GlobeTranslation", - Globe = moonAsset.Moon.Identifier, + Globe = moon_asset.Moon.Identifier, Longitude = -360+23.47306, Latitude = 0.67402, Altitude = -1927.65, @@ -38,10 +38,11 @@ local Apollo11LemModel = { Type = "RenderableModel", Geometry = { Type = "MultiModelGeometry", - GeometryFile = model.modelFolder .. "/LM-2_ver2clean.obj" + GeometryFile = lem_model.modelFolder .. "/LM-2_ver2clean.obj" }, - ColorTexture = model.modelFolder .. "/LM-2_ver2clean_u1_v1.jpeg", - LightSources = assetHelper.getDefaultLightSources(sunTransforms.SolarSystemBarycenter.Identifier) + RotationVector = { 91.044090,171.229706,111.666664 }, + ColorTexture = lem_model.modelFolder .. "/LM-2_ver2clean_u1_v1.jpeg", + LightSources = asset_helper.getDefaultLightSources(sun_transforms.SolarSystemBarycenter.Identifier) }, GUI = { Hidden = false, @@ -50,11 +51,4 @@ local Apollo11LemModel = { } } -assetHelper.registerSceneGraphNodesAndExport(asset, { - Apollo11Lem, - Apollo11LemModel -}) - -asset.onInitialize(function () - openspace.setPropertyValueSingle('Scene.Apollo11LemModel.Renderable.RotationVector', { 91.044090,171.229706,111.666664} ); -end) +asset_helper.registerSceneGraphNodesAndExport(asset, { Apollo11Lem, Apollo11LemModel }) diff --git a/data/assets/scene/solarsystem/missions/apollo/apollo11_lem_descent.asset b/data/assets/scene/solarsystem/missions/apollo/11/lem_descent.asset similarity index 98% rename from data/assets/scene/solarsystem/missions/apollo/apollo11_lem_descent.asset rename to data/assets/scene/solarsystem/missions/apollo/11/lem_descent.asset index 93128f5181..3102e6a618 100644 --- a/data/assets/scene/solarsystem/missions/apollo/apollo11_lem_descent.asset +++ b/data/assets/scene/solarsystem/missions/apollo/11/lem_descent.asset @@ -1,16 +1,16 @@ -- The following keyframe data was converted from the_last_four_minutes_2019-06-09.kml, -- which is available at http://apollo.mem-tek.com/GoogleMoonKMZ.html --- In the conversion, some assumptions and simplifications were made: --- * The descent markers in the KML have Point nodes expressed "relative to ground" --- We assume that the ground is fixed at altitude 1927.65 meters below the reference ellipsoid, --- in order to match height data from a height map constructed from LRO data. --- * We manually offset the coordiantes slightly, by 0.013496003622691433 degrees in longitude and -0.007472581881668883 degrees in latitude, --- in order to match the landing spot specified at long: 23.47306, lat: 0.67402 extracted from footage from LRO. --- The kml file provided 23.45956399637731, lat: 0.6814925818816688 as the landing coordinates - hence the manual offset. --- If more accurate height/color maps are aqcuired, these values can be adjusted by running the conversion script again. --- For more information, contact emil.axelsson@liu.se. - +--[[ +In the conversion, some assumptions and simplifications were made: + * The descent markers in the KML have Point nodes expressed "relative to ground". + We assume that the ground is fixed at altitude 1927.65 meters below the reference ellipsoid, + in order to match height data from a height map constructed from LRO data. + * We manually offset the coordiantes slightly, by 0.013496003622691433 degrees in longitude and -0.007472581881668883 degrees in latitude, + in order to match the landing spot specified at long: 23.47306, lat: 0.67402 extracted from footage from LRO. + The kml file provided 23.45956399637731, lat: 0.6814925818816688 as the landing coordinates - hence the manual offset. + If more accurate height/color maps are aqcuired, these values can be adjusted by running the conversion script again. +]]-- local keyframes = { ['1969-07-20T20:13:40'] = { @@ -1832,4 +1832,3 @@ local keyframes = { }; asset.export('keyframes', keyframes); - diff --git a/data/assets/scene/solarsystem/missions/apollo/apollo11_lem_descent_rotation.asset b/data/assets/scene/solarsystem/missions/apollo/11/lem_descent_rotation.asset similarity index 100% rename from data/assets/scene/solarsystem/missions/apollo/apollo11_lem_descent_rotation.asset rename to data/assets/scene/solarsystem/missions/apollo/11/lem_descent_rotation.asset diff --git a/data/assets/scene/solarsystem/missions/apollo/apollo_11_lem_flipbook.asset b/data/assets/scene/solarsystem/missions/apollo/11/lem_flipbook.asset similarity index 89% rename from data/assets/scene/solarsystem/missions/apollo/apollo_11_lem_flipbook.asset rename to data/assets/scene/solarsystem/missions/apollo/11/lem_flipbook.asset index 4a342dd10f..1d0025bc74 100644 --- a/data/assets/scene/solarsystem/missions/apollo/apollo_11_lem_flipbook.asset +++ b/data/assets/scene/solarsystem/missions/apollo/11/lem_flipbook.asset @@ -1,8 +1,8 @@ ---apollo_11_lem_flipbook.asset local helper = asset.require('util/vrt_flipbook_helper') +local moon_asset = asset.require('scene/solarsystem/planets/earth/moon/moon') local assetPrefix = "A11flip"; -local assetGlobe = "Moon"; +local assetGlobe = moon_asset.Moon.Identifier; local flipbookCount = 19; local flipbook = nil; diff --git a/data/assets/scene/solarsystem/missions/apollo/11/models.asset b/data/assets/scene/solarsystem/missions/apollo/11/models.asset new file mode 100644 index 0000000000..36b3d25a94 --- /dev/null +++ b/data/assets/scene/solarsystem/missions/apollo/11/models.asset @@ -0,0 +1,8 @@ +local modelFolder = asset.syncedResource({ + Name = "Apollo Models", + Type = "HttpSynchronization", + Identifier = "apollo_11_models", + Version = 1 +}) + +asset.export('models', modelFolder) diff --git a/data/assets/scene/solarsystem/missions/apollo/15/apollo15.asset b/data/assets/scene/solarsystem/missions/apollo/15/apollo15.asset new file mode 100644 index 0000000000..770592ba8e --- /dev/null +++ b/data/assets/scene/solarsystem/missions/apollo/15/apollo15.asset @@ -0,0 +1,115 @@ +local assetHelper = asset.require('util/asset_helper') +local moon_transforms = asset.require('scene/solarsystem/planets/earth/moon/moon') +local sun_transforms = asset.require('scene/solarsystem/sun/transforms') +local csm = asset.require('../apollo_csm') +asset.require('spice/base') + +local kernels = asset.require('scene/solarsystem/missions/apollo/15/kernels').kernels + + +-- local models = asset.syncedResource({ +-- Name = "Apollo 15 Models", +-- Type = "HttpSynchronization", +-- Identifier = "apollo_models", +-- Version = 1 +-- }) + +local LightSources = { + { + Type = "SceneGraphLightSource", + Identifier = "Sun", + Node = sun_transforms.SolarSystemBarycenter.Identifier, + Intensity = 1.0 + }, + -- { + -- Identifier = "Camera", + -- Type = "CameraLightSource", + -- Intensity = 0.5, + -- Enabled = false + -- } +} + + +local Apollo15 = { + Identifier = "Apollo15", + Parent = moon_transforms.Moon.Identifier, + Transform = { + Translation = { + Type = "SpiceTranslation", + Target = "APOLLO 15", + Observer = "MOON", + Frame = "IAU_MOON", + Kernels = kernels + }, + Rotation = { + Type = "SpiceRotation", + SourceFrame = "A15_METRIC", + DestinationFrame = "GALACTIC" + } + }, + TimeFrame = { + Type = "TimeFrameInterval", + Start = "1971-07-30T02:22:00.00", + End = "1971-08-01T18:05:00.00" + }, + GUI = { + Name = "Apollo 15", + Path = "/Solar System/Missions/Apollo/15" + } +} + +-- local Apollo15Main = { +-- Identifier = "Apollo15Main", +-- Parent = Apollo15.Identifier, +-- Renderable = { +-- Type = "RenderableModel", +-- Geometry = { +-- Type = "MultiModelGeometry", +-- -- GeometryFile = models .. "/Apollo_Spacecraft.obj" +-- GeometryFile = models .. "/Apollo_CSM_shrunk_rotated_xy_doubble_size.obj" +-- }, +-- ColorTexture = models .. "/gray.png", +-- LightSources = LightSources, +-- DisableFaceCulling = true +-- }, +-- GUI = { +-- Name = "Apollo 15 Main", +-- Path = "/Solar System/Missions/Apollo 15" +-- } +-- } + +local Apollo15Trail = { + Identifier = "Apollo15Trail", + Parent = moon_transforms.Moon.Identifier, + Renderable = { + Type = "RenderableTrailTrajectory", + Translation = { + Type = "SpiceTranslation", + Target = "APOLLO 15", + Observer = "MOON", + Frame = "IAU_MOON", + Kernels = kernels + }, + Color = { 0.70, 0.50, 0.20 }, + StartTime = "1971 JUL 26", + EndTime = "1971 AUG 01 14:30:41.680", + SampleInterval = 2 + }, + GUI = { + Name = "Apollo 15 Trail", + Path = "/Solar System/Missions/Apollo/15" + } +} + + +local model_part = csm.createCsmModel(Apollo15.Identifier) + +local list = { Apollo15, Apollo15Trail } +for k,v in pairs(model_part) do + v.GUI.Path = "/Solar System/Missions/Apollo/15/Model" + table.insert(list, v) +end + + +assetHelper.registerSceneGraphNodesAndExport(asset, list) + diff --git a/data/assets/scene/solarsystem/missions/apollo/15/kernels.asset b/data/assets/scene/solarsystem/missions/apollo/15/kernels.asset new file mode 100644 index 0000000000..1b00fd7596 --- /dev/null +++ b/data/assets/scene/solarsystem/missions/apollo/15/kernels.asset @@ -0,0 +1,92 @@ +local folder = asset.syncedResource({ + Name = "Apollo Kernels", + Type = "HttpSynchronization", + Identifier = "apollo_spice", + Version = 1 +}) + +local kernels = { + folder .. "/apollo15.0001.tsc", + + -- folder .. '/AS15-P_v01.bc', + folder .. '/apollo15.0001.tf', + folder .. '/apollo15MetricAddendum002.ti', + -- folder .. '/apollo15PanoramicAddendum001.ti', + folder .. '/apollo15_metric.0002.ti', + -- folder .. '/apollo15_panoramic.0001.ti', + folder .. '/apollo15-1.bsp', + folder .. '/AS15-M_v01.bc', + -- folder .. '/AS15-M_v01.bsp', +} + +-- local kernels = { +-- --sclk +-- folder .. "apollo15.0001.tsc", + +-- --pck +-- folder .. "moon_080317.tf", +-- folder .. "moon_assoc_me.tf", + +-- --ik +-- folder .. "apollo15_metric_v2.0001.ti", +-- folder .. "apollo15_panoramic.0001.ti", + +-- --tspk +-- folder .. "de421.bsp", +-- folder .. "moon_pa_de421_1900-2050.bpc", + +-- --iak +-- folder .. "apollo15MetricAddendum002.ti", +-- folder .. "apolloPanAddendum001.ti", + +-- --fk +-- folder .. "apollo15_v2.0001.tf", +-- folder .. "apollo15_v2.0002.tf", + +-- --spk +-- folder .. "AS15_M_REV23_SMITHED_V01.bsp", +-- folder .. "AS15_M_REV4.bsp ", +-- folder .. "AS15_M_REV70_SMITHED_V01.bsp", +-- folder .. "AS15_M_REV04_v2.bsp ", +-- folder .. "AS15_M_REV27_SMITHED_V01.bsp", +-- folder .. "AS15_M_REV44_SMITHED_V01.bsp", +-- folder .. "AS15_M_REV71_SMITHED_V01.bsp", +-- folder .. "AS15_M_REV15_SMITHED_V01.bsp", +-- folder .. "AS15_M_REV33_SMITHED_V01.bsp", +-- folder .. "AS15_M_REV50_SMITHED_V01.bsp", +-- folder .. "AS15_M_REV71_SMITHED_V02.bsp", +-- folder .. "AS15_M_REV15_v2.bsp ", +-- folder .. "AS15_M_REV34_SMITHED_V01.bsp", +-- folder .. "AS15_M_REV60_SMITHED_V01.bsp", +-- folder .. "AS15_M_REV72_v2.bsp", +-- folder .. "AS15_M_REV16_SMITHED_V01.bsp", +-- folder .. "AS15_M_REV35_SMITHED_V02.bsp", +-- folder .. "AS15_M_REV62_SMITHED_V01.bsp", +-- folder .. "AS15_M_REV22_SMITHED_V01.bsp", +-- folder .. "AS15_M_REV38_SMITHED_V01.bsp", +-- folder .. "AS15_M_REV63_SMITHED_V01.bsp", + +-- --ck +-- folder .. "AS15_M_REV04_SMITHED_V01.bc", +-- folder .. "AS15_M_REV15_SMITHED_V01.bc", +-- folder .. "AS15_M_REV16_SMITHED_V01.bc", +-- folder .. "AS15_M_REV22_SMITHED_V01.bc", +-- folder .. "AS15_M_REV23_SMITHED_V01.bc", +-- folder .. "AS15_M_REV27_SMITHED_V01.bc", +-- folder .. "AS15_M_REV33_SMITHED_V01.bc", +-- folder .. "AS15_M_REV34_SMITHED_V01.bc", +-- folder .. "AS15_M_REV35_SMITHED_V01.bc", +-- folder .. "AS15_M_REV35_SMITHED_V02.bc", +-- folder .. "AS15_M_REV38_SMITHED_V01.bc", +-- folder .. "AS15_M_REV44_SMITHED_V01.bc", +-- folder .. "AS15_M_REV50_SMITHED_V01.bc", +-- folder .. "AS15_M_REV60_SMITHED_V01.bc", +-- folder .. "AS15_M_REV62_SMITHED_V01.bc", +-- folder .. "AS15_M_REV63_SMITHED_V01.bc", +-- folder .. "AS15_M_REV70_SMITHED_V01.bc", +-- folder .. "AS15_M_REV71_SMITHED_V01.bc", +-- folder .. "AS15_M_REV71_SMITHED_V02.bc", +-- folder .. "AS15_M_REV72_v2.bc", +-- } + +asset.export("kernels", kernels) diff --git a/data/assets/scene/solarsystem/missions/apollo/17/boulder_models.asset b/data/assets/scene/solarsystem/missions/apollo/17/boulder_models.asset new file mode 100644 index 0000000000..7868bae468 --- /dev/null +++ b/data/assets/scene/solarsystem/missions/apollo/17/boulder_models.asset @@ -0,0 +1,8 @@ +local models = asset.syncedResource({ + Name = "Apollo Boulders Models", + Type = "HttpSynchronization", + Identifier = "apollo_boulders", + Version = 1 +}) + +asset.export('models', models) diff --git a/data/assets/scene/solarsystem/missions/apollo/bouldersstation2.asset b/data/assets/scene/solarsystem/missions/apollo/17/bouldersstation2.asset similarity index 74% rename from data/assets/scene/solarsystem/missions/apollo/bouldersstation2.asset rename to data/assets/scene/solarsystem/missions/apollo/17/bouldersstation2.asset index 2d096b99d0..f709f0bc2b 100644 --- a/data/assets/scene/solarsystem/missions/apollo/bouldersstation2.asset +++ b/data/assets/scene/solarsystem/missions/apollo/17/bouldersstation2.asset @@ -1,20 +1,13 @@ -local sunTransforms = asset.require('scene/solarsystem/sun/transforms') -local assetHelper = asset.require('util/asset_helper') -local earthAsset = asset.require('scene/solarsystem/planets/earth/earth') -local moonAsset = asset.require('scene/solarsystem/planets/earth/moon/moon') - -local models = asset.syncedResource({ - Name = "Apollo Models", - Type = "HttpSynchronization", - Identifier = "apollo_boulders", - Version = 1 -}) +local sun_transforms = asset.require('scene/solarsystem/sun/transforms') +local asset_helper = asset.require('util/asset_helper') +local moon_asset = asset.require('scene/solarsystem/planets/earth/moon/moon') +local models = asset.require('./boulder_models').models local LightSources = { { Type = "SceneGraphLightSource", Identifier = "Sun", - Node = sunTransforms.SolarSystemBarycenter.Identifier, + Node = sun_transforms.SolarSystemBarycenter.Identifier, Intensity = 1.0 }, { @@ -26,11 +19,11 @@ local LightSources = { local Station2Boulder1Holder = { Identifier = "Station_2_Boulder1", - Parent = moonAsset.Moon.Identifier, + Parent = moon_asset.Moon.Identifier, Transform = { Translation = { Type = "GlobeTranslation", - Globe = moonAsset.Moon.Identifier, + Globe = moon_asset.Moon.Identifier, Longitude = -360+30.5294692, Latitude = 20.098824, Altitude = -2442.8, @@ -58,6 +51,7 @@ local Station2Boulder1Model = { Type = "MultiModelGeometry", GeometryFile = models .. "/b1-v2.obj" }, + RotationVector = { 243.243256 ,206.270264, 309.677429 }, ColorTexture = models .. "/b1-v2_u1_v1.jpeg", LightSources = LightSources, PerformShading = false, @@ -71,11 +65,11 @@ local Station2Boulder1Model = { local Station2Boulder2Holder = { Identifier = "Station_2_Boulder2", - Parent = moonAsset.Moon.Identifier, + Parent = moon_asset.Moon.Identifier, Transform = { Translation = { Type = "GlobeTranslation", - Globe = moonAsset.Moon.Identifier, + Globe = moon_asset.Moon.Identifier, Longitude = -360+30.5287892, Latitude = 20.098240, Altitude = -2434.6, @@ -103,6 +97,7 @@ local Station2Boulder2Model = { Type = "MultiModelGeometry", GeometryFile = models .. "/b2model.obj" }, + RotationVector = { 66.162155, 7.783780, 114.193550 }, ColorTexture = models .. "/b2model_u1_v1.jpeg", LightSources = LightSources, PerformShading = false, @@ -116,11 +111,11 @@ local Station2Boulder2Model = { local Station2Boulder3Holder = { Identifier = "Station_2_Boulder3", - Parent = moonAsset.Moon.Identifier, + Parent = moon_asset.Moon.Identifier, Transform = { Translation = { Type = "GlobeTranslation", - Globe = moonAsset.Moon.Identifier, + Globe = moon_asset.Moon.Identifier, Longitude = -360+30.5294692, Latitude = 20.098610, Altitude = -2441.55, @@ -148,6 +143,7 @@ local Station2Boulder3Model = { Type = "MultiModelGeometry", GeometryFile = models .. "/b3model.obj" }, + RotationVector = { 161.513519 ,243.243256, 65.806450 }, ColorTexture = models .. "/b3model_u1_v1.jpeg", LightSources = LightSources, PerformShading = false, @@ -159,25 +155,8 @@ local Station2Boulder3Model = { } } -assetHelper.registerSceneGraphNodesAndExport(asset, { +asset_helper.registerSceneGraphNodesAndExport(asset, { Station2Boulder1Holder, Station2Boulder1Model, Station2Boulder2Holder, Station2Boulder2Model, Station2Boulder3Holder, Station2Boulder3Model }) - -asset.onInitialize(function () - openspace.setPropertyValueSingle( - 'Scene.Station2Boulder1Model.Renderable.RotationVector', - { 243.243256 ,206.270264, 309.677429 } - ); - - openspace.setPropertyValueSingle( - 'Scene.Station2Boulder3Model.Renderable.RotationVector', - { 161.513519 ,243.243256, 65.806450 } - ); - - openspace.setPropertyValueSingle( - 'Scene.Station2Boulder2Model.Renderable.RotationVector', - { 66.162155, 7.783780, 114.193550 } - ); -end) diff --git a/data/assets/scene/solarsystem/missions/apollo/bouldersstation6.asset b/data/assets/scene/solarsystem/missions/apollo/17/bouldersstation6.asset similarity index 72% rename from data/assets/scene/solarsystem/missions/apollo/bouldersstation6.asset rename to data/assets/scene/solarsystem/missions/apollo/17/bouldersstation6.asset index 919de3f9a8..d013b8fea4 100644 --- a/data/assets/scene/solarsystem/missions/apollo/bouldersstation6.asset +++ b/data/assets/scene/solarsystem/missions/apollo/17/bouldersstation6.asset @@ -1,20 +1,13 @@ - -local sunTransforms = asset.require('scene/solarsystem/sun/transforms') -local assetHelper = asset.require('util/asset_helper') - -local models = asset.syncedResource({ - Name = "Apollo Models", - Type = "HttpSynchronization", - Identifier = "apollo_boulders", - Version = 1 -}) - +local sun_transforms = asset.require('scene/solarsystem/sun/transforms') +local asset_helper = asset.require('util/asset_helper') +local moon_asset = asset.require('scene/solarsystem/planets/earth/moon/moon') +local models = asset.require('./boulder_models').models local LightSources = { { Type = "SceneGraphLightSource", Identifier = "Sun", - Node = sunTransforms.SolarSystemBarycenter.Identifier, + Node = sun_transforms.SolarSystemBarycenter.Identifier, Intensity = 1.0 }, { @@ -24,17 +17,14 @@ local LightSources = { } } -local earthAsset = asset.require('scene/solarsystem/planets/earth/earth') -local moonAsset = asset.require('scene/solarsystem/planets/earth/moon/moon') - local Station6Frag1Holder = { Identifier = "Station_6_Fragment1", - Parent = moonAsset.Moon.Identifier, + Parent = moon_asset.Moon.Identifier, Transform = { Translation = { Type = "GlobeTranslation", - Globe = moonAsset.Moon.Identifier, + Globe = moon_asset.Moon.Identifier, Longitude = -360+30.80068, Latitude = 20.2903, Altitude = -2562.6, @@ -53,7 +43,7 @@ local Station6Frag1Model = { Transform = { Translation = { Type = "GlobeTranslation", - Globe = moonAsset.Moon.Identifier, + Globe = moon_asset.Moon.Identifier, Longitude = -360+30.8007, Latitude = 20.2903, Altitude = -2562.6, @@ -72,6 +62,7 @@ local Station6Frag1Model = { Type = "MultiModelGeometry", GeometryFile = models .. "/A17-S6-frag1.obj" }, + RotationVector = { 235.909088,165.000000,286.299194 }, ColorTexture = models .. "/A17-S6-frag1.png", LightSources = LightSources, PerformShading = false, @@ -87,7 +78,7 @@ local Station6Frag1Model = { local Station6Frag23Holder = { Identifier = "Station_6_Fragments_2_3", - Parent = moonAsset.Moon.Identifier, + Parent = moon_asset.Moon.Identifier, GUI = { Name = "Station 6 Fragments 2 & 3 Holder", Path = "/Solar System/Missions/Apollo/17/Station 6" @@ -105,7 +96,7 @@ local Station6Frag2Model = { }, Translation = { Type = "GlobeTranslation", - Globe = moonAsset.Moon.Identifier, + Globe = moon_asset.Moon.Identifier, Longitude = -360+30.80055, Latitude = 20.289808, Altitude = -2566.5, @@ -118,6 +109,7 @@ local Station6Frag2Model = { Type = "MultiModelGeometry", GeometryFile = models .. "/station6_boulder_frag2.obj" }, + RotationVector = { 336.959991,210.239990,325.984253 }, ColorTexture = models .. "/frag2crop_u1_v1.jpeg", LightSources = LightSources, PerformShading = false, @@ -129,8 +121,6 @@ local Station6Frag2Model = { } } - - local Station6Frag3Model = { Identifier = "A17S6F3", Parent = Station6Frag23Holder.Identifier, @@ -141,7 +131,7 @@ local Station6Frag3Model = { }, Translation = { Type = "GlobeTranslation", - Globe = moonAsset.Moon.Identifier, + Globe = moon_asset.Moon.Identifier, Longitude = -360+30.80053, Latitude = 20.29030, Altitude = -2563.0, @@ -154,6 +144,7 @@ local Station6Frag3Model = { Type = "MultiModelGeometry", GeometryFile = models .. "/station6_boulder_frag3.obj" }, + RotationVector = { 293.181824,255.000000,4.090910 }, ColorTexture = models .. "/frag3crop_u1_v1.jpeg", LightSources = LightSources, PerformShading = false, @@ -165,22 +156,6 @@ local Station6Frag3Model = { } } - - - -assetHelper.registerSceneGraphNodesAndExport(asset, { +asset_helper.registerSceneGraphNodesAndExport(asset, { Station6Frag1Holder, Station6Frag1Model, Station6Frag23Holder, Station6Frag2Model, Station6Frag3Model, }) - - - - -asset.onInitialize(function () - - openspace.setPropertyValueSingle('Scene.Station6Frag1Model.Renderable.RotationVector', {235.909088,165.000000,286.299194}); - openspace.setPropertyValueSingle('Scene.A17S6F5.Renderable.RotationVector', {336.959991,210.239990,325.984253}); - openspace.setPropertyValueSingle('Scene.A17S6F3.Renderable.RotationVector', {293.181824,255.000000,4.090910}); - openspace.setPropertyValueSingle('Scene.Station6Frag1Model.Renderable.PerformShading', false); - openspace.setPropertyValueSingle("NavigationHandler.OrbitalNavigator.MinimumAllowedDistance", 0.050000) - -end) diff --git a/data/assets/scene/solarsystem/missions/apollo/bouldersstation7.asset b/data/assets/scene/solarsystem/missions/apollo/17/bouldersstation7.asset similarity index 65% rename from data/assets/scene/solarsystem/missions/apollo/bouldersstation7.asset rename to data/assets/scene/solarsystem/missions/apollo/17/bouldersstation7.asset index d2eab52355..d2e9c5146c 100644 --- a/data/assets/scene/solarsystem/missions/apollo/bouldersstation7.asset +++ b/data/assets/scene/solarsystem/missions/apollo/17/bouldersstation7.asset @@ -1,19 +1,13 @@ - -local sunTransforms = asset.require('scene/solarsystem/sun/transforms') -local assetHelper = asset.require('util/asset_helper') - -local models = asset.syncedResource({ - Name = "Apollo Models", - Type = "HttpSynchronization", - Identifier = "apollo_boulders", - Version = 1 -}) +local sun_transforms = asset.require('scene/solarsystem/sun/transforms') +local asset_helper = asset.require('util/asset_helper') +local moon_asset = asset.require('scene/solarsystem/planets/earth/moon/moon') +local models = asset.require('./boulder_models').models local LightSources = { { Type = "SceneGraphLightSource", Identifier = "Sun", - Node = sunTransforms.SolarSystemBarycenter.Identifier, + Node = sun_transforms.SolarSystemBarycenter.Identifier, Intensity = 1.0 }, { @@ -23,15 +17,13 @@ local LightSources = { } } -local moonAsset = asset.require('scene/solarsystem/planets/earth/moon/moon') - local Station7BoulderHolder = { Identifier = "Station_7_Boulder", - Parent = moonAsset.Moon.Identifier, + Parent = moon_asset.Moon.Identifier, Transform = { Translation = { Type = "GlobeTranslation", - Globe = moonAsset.Moon.Identifier, + Globe = moon_asset.Moon.Identifier, Longitude = -360+30.8165882, Latitude = 20.2908556, Altitude = -2593.5, @@ -59,6 +51,7 @@ local Station7BoulderModel = { Type = "MultiModelGeometry", GeometryFile = models .. "/b7model.obj" }, + RotationVector = { 1.945950,274.378387,212.903214 }, ColorTexture = models .. "/b7model_u1_v1.jpeg", LightSources = LightSources, PerformShading = false, @@ -70,11 +63,6 @@ local Station7BoulderModel = { } } - -assetHelper.registerSceneGraphNodesAndExport(asset, { +asset_helper.registerSceneGraphNodesAndExport(asset, { Station7BoulderHolder, Station7BoulderModel }) - -asset.onInitialize(function () - openspace.setPropertyValueSingle('Scene.Station7BoulderModel.Renderable.RotationVector', {1.945950,274.378387,212.903214}); -end) diff --git a/data/assets/scene/solarsystem/missions/apollo/a17_lem.asset b/data/assets/scene/solarsystem/missions/apollo/17/lem.asset similarity index 61% rename from data/assets/scene/solarsystem/missions/apollo/a17_lem.asset rename to data/assets/scene/solarsystem/missions/apollo/17/lem.asset index dd2d134127..50f81a1693 100644 --- a/data/assets/scene/solarsystem/missions/apollo/a17_lem.asset +++ b/data/assets/scene/solarsystem/missions/apollo/17/lem.asset @@ -1,17 +1,16 @@ ---a17_lem.asset -local assetHelper = asset.require('util/asset_helper') -local sunTransforms = asset.require('scene/solarsystem/sun/transforms') -local moonAsset = asset.require('scene/solarsystem/planets/earth/moon/moon') +local asset_helper = asset.require('util/asset_helper') +local sun_transforms = asset.require('scene/solarsystem/sun/transforms') +local moon_asset = asset.require('scene/solarsystem/planets/earth/moon/moon') local model = asset.require('scene/solarsystem/missions/apollo/lem_model') local Apollo17Lem = { Identifier = "Apollo17Lem", - Parent = moonAsset.Moon.Identifier, + Parent = moon_asset.Moon.Identifier, Transform = { Translation = { Type = "GlobeTranslation", - Globe = moonAsset.Moon.Identifier, + Globe = moon_asset.Moon.Identifier, Longitude = -329.22833, Latitude = 20.19092, UseHeightmap = true @@ -40,21 +39,14 @@ local Apollo17LemModel = { GeometryFile = model.modelFolder .. "/LM-2_ver2clean.obj" }, SpecularIntensity = 0.0, + RotationVector = { 110.255219,171.229706,126.666664 }, ColorTexture = model.modelFolder .. "/LM-2_ver2clean_u1_v1.jpeg", - LightSources = assetHelper.getDefaultLightSources(sunTransforms.SolarSystemBarycenter.Identifier) + LightSources = asset_helper.getDefaultLightSources(sun_transforms.SolarSystemBarycenter.Identifier) }, GUI = { - Hidden = false, Name = "Apollo 17 Lem", Path = "/Solar System/Missions/Apollo/17" } } -assetHelper.registerSceneGraphNodesAndExport(asset, { - Apollo17Lem, - Apollo17LemModel, -}) - -asset.onInitialize(function () - openspace.setPropertyValueSingle('Scene.Apollo17LemModel.Renderable.RotationVector', { 110.255219,171.229706,126.666664 }); -end) +asset_helper.registerSceneGraphNodesAndExport(asset, { Apollo17Lem, Apollo17LemModel }) diff --git a/data/assets/scene/solarsystem/missions/apollo/8/apollo8.asset b/data/assets/scene/solarsystem/missions/apollo/8/apollo8.asset new file mode 100644 index 0000000000..4b2a8777a1 --- /dev/null +++ b/data/assets/scene/solarsystem/missions/apollo/8/apollo8.asset @@ -0,0 +1,3 @@ +asset.require('./model') +asset.require('./launch_model') +asset.require('./trails') diff --git a/data/assets/scene/solarsystem/missions/apollo/8/kernels.asset b/data/assets/scene/solarsystem/missions/apollo/8/kernels.asset new file mode 100644 index 0000000000..5baf800205 --- /dev/null +++ b/data/assets/scene/solarsystem/missions/apollo/8/kernels.asset @@ -0,0 +1,17 @@ +local kernelsFolder = asset.syncedResource({ + Name = "Apollo Kernels", + Type = "HttpSynchronization", + Identifier = "apollo_spice", + Version = 1 +}) + +local kernels = { + kernelsFolder .. "/moon_080317.tf", + kernelsFolder .. "/apollo8.tf", + kernelsFolder .. "/moon_pa_de421_1900-2050.bpc", + kernelsFolder .. '/apollo8.tsc', + kernelsFolder .. '/apollo8.bsp', + kernelsFolder .. '/apollo8_earthrise.bc', +} + +asset.export('kernels', kernels) diff --git a/data/assets/scene/solarsystem/missions/apollo/8/launch_model.asset b/data/assets/scene/solarsystem/missions/apollo/8/launch_model.asset new file mode 100644 index 0000000000..1e76c60931 --- /dev/null +++ b/data/assets/scene/solarsystem/missions/apollo/8/launch_model.asset @@ -0,0 +1,65 @@ +local asset_helper = asset.require('util/asset_helper') +local earth_transforms = asset.require('scene/solarsystem/planets/earth/transforms') +local kernels = asset.require('./kernels').kernels +local csm = asset.require('../apollo_csm') + +local apolloSpiceId = "-908" + +local Apollo8Launch = { + Identifier = "Apollo8Launch", + Parent = earth_transforms.EarthIAU.Identifier, + TimeFrame = { + Type = "TimeFrameInterval", + Start = "1968 DEC 21", + End = "1968 DEC 28" + }, + Transform = { + Translation = { + Type = "SpiceTranslation", + Target = apolloSpiceId, + Observer = "EARTH", + Frame = "IAU_EARTH", + Kernels = kernels + }, + }, + GUI = { + Name = "Apollo 8 Launch Capsule", + Path = "/Solar System/Missions/Apollo" + } +} + +local Apollo8LaunchModel = { + Identifier = "Apollo8LaunchModel", + Parent = Apollo8Launch.Identifier, + TimeFrame = { + Type = "TimeFrameInterval", + Start = "1968 DEC 21", + End = "1968 DEC 22" + }, + Transform = { + Scale = { + Type = "StaticScale", + -- The scale of the model is in cm; OpenSpace is in m + Scale = 0.01 + }, + Rotation = { + Type = "StaticRotation", + Rotation = {0.0, 0.0, -3.1415 / 2} + } + }, + GUI = { + Hidden = true, + Name = "Apollo 8 Launch Model", + Path = "/Solar System/Missions/Apollo/8" + } +} + +local launch_model_part = csm.createCsmModel(Apollo8LaunchModel.Identifier) + +local list = { Apollo8Launch, Apollo8LaunchModel } +for k,v in pairs(launch_model_part) do + v.GUI.Path = "/Solar System/Missions/Apollo/8/Model" + table.insert(list, v) +end + +asset_helper.registerSceneGraphNodesAndExport(asset, list) diff --git a/data/assets/scene/solarsystem/missions/apollo/8/model.asset b/data/assets/scene/solarsystem/missions/apollo/8/model.asset new file mode 100644 index 0000000000..4b677cc818 --- /dev/null +++ b/data/assets/scene/solarsystem/missions/apollo/8/model.asset @@ -0,0 +1,93 @@ +local asset_helper = asset.require('util/asset_helper') +local earth_transforms = asset.require('scene/solarsystem/planets/earth/transforms') +local kernels = asset.require('./kernels').kernels +local csm = asset.require('../apollo_csm') + +local apolloSpiceId = "-908" + +local Apollo8 = { + Identifier = "Apollo8", + Parent = earth_transforms.EarthBarycenter.Identifier, + TimeFrame = { + Type = "TimeFrameInterval", + Start = "1968 DEC 21", + End = "1968 DEC 28" + }, + Transform = { + Translation = { + Type = "SpiceTranslation", + Target = apolloSpiceId, + Observer = "EARTH BARYCENTER", + Frame = "GALACTIC", + Kernels = kernels + }, + Rotation = { + Type = "SpiceRotation", + SourceFrame = "A8_EARTHRISE", + DestinationFrame = "GALACTIC", + TimeFrame = { + -- The orientation of Apollo 8 is only available during the few minutes + -- when the Earthrise picture was taken. + Type = "TimeFrameInterval", + Start = "1968 DEC 24 16:37:19", + End = "1968 DEC 24 16:40:15" + } + } + }, + GUI = { + Name = "Apollo 8", + Path = "/Solar System/Missions/Apollo" + } +} + +local Apollo8Model = { + Identifier = "Apollo8Model", + Parent = Apollo8.Identifier, + TimeFrame = { + Type = "TimeFrameInterval", + Start = "1968 DEC 22", + End = "1968 DEC 28" + }, + Transform = { + Scale = { + Type = "StaticScale", + -- The scale of the model is in cm; OpenSpace is in m + Scale = 0.01 + }, + Rotation = { + Type = "StaticRotation", + Rotation = {0.0, 0.0, -3.1415 / 2} + } + }, + GUI = { + Hidden = true, + Name = "Apollo 8 Model", + Path = "/Solar System/Missions/Apollo" + } +} + +-- The pivot node is used for navigation inside the spacecraft +local Apollo8Pivot = { + Identifier = "Apollo8Pivot", + Parent = Apollo8.Identifier, + Transform = { + Translation = { + Type = "StaticTranslation", + Position = { 0, 2.5, 0 } + }, + }, + GUI = { + Name = "Apollo 8 Pivot", + Path = "/Solar System/Missions/Apollo" + } +} + +local model_part = csm.createCsmModel(Apollo8Model.Identifier) + +local list = { Apollo8, Apollo8Model, Apollo8Pivot } +for k,v in pairs(model_part) do + v.GUI.Path = "/Solar System/Missions/Apollo/8/Model" + table.insert(list, v) +end + +asset_helper.registerSceneGraphNodesAndExport(asset, list) diff --git a/data/assets/scene/solarsystem/missions/apollo/8/trails.asset b/data/assets/scene/solarsystem/missions/apollo/8/trails.asset new file mode 100644 index 0000000000..bd5d5f594e --- /dev/null +++ b/data/assets/scene/solarsystem/missions/apollo/8/trails.asset @@ -0,0 +1,81 @@ +local assetHelper = asset.require('util/asset_helper') + +local earth_transforms = asset.require('scene/solarsystem/planets/earth/transforms') +local moon_transforms = asset.require('scene/solarsystem/planets/earth/moon/moon') +local kernels = asset.require('./kernels').kernels + +local apolloSpiceId = "-908" + + +local LaunchTrail = { + Identifier = "Apollo8LaunchTrail", + Parent = earth_transforms.EarthIAU.Identifier, + Renderable = { + Type = "RenderableTrailTrajectory", + Translation = { + Type = "SpiceTranslation", + Target = apolloSpiceId, + Observer = "EARTH", + Frame = "IAU_EARTH", + Kernels = kernels + }, + Color = { 0.70, 0.50, 0.20 }, + StartTime = "1968 DEC 21 12:51:00", + EndTime = "1968 DEC 21 23:23:22", + SampleInterval = 30 + }, + GUI = { + Name = "Apollo 8 Launch Trail", + Path = "/Solar System/Missions/Apollo" + } +} + +local MoonTrail = { + Identifier = "Apollo8MoonTrail", + Parent = moon_transforms.Moon.Identifier, + Renderable = { + Type = "RenderableTrailTrajectory", + Translation = { + Type = "SpiceTranslation", + Target = apolloSpiceId, + Observer = "MOON", + Frame = "IAU_MOON", + Kernels = kernels + }, + Color = { 0.70, 0.50, 0.20 }, + StartTime = "1968 DEC 23", + EndTime = "1968 DEC 26", + SampleInterval = 30, + Enabled = false, + }, + GUI = { + Name = "Apollo 8 Moon Trail", + Path = "/Solar System/Missions/Apollo" + } +} + +local EarthBarycenterTrail = { + Identifier = "Apollo8EarthBarycenterTrail", + Parent = earth_transforms.EarthCenter.Identifier, + Renderable = { + Type = "RenderableTrailTrajectory", + Translation = { + Type = "SpiceTranslation", + Target = apolloSpiceId, + Observer = "EARTH", + Frame = "GALACTIC", + Kernels = kernels + }, + Color = { 0.8, 0.2, 0.2 }, + StartTime = "1968 DEC 21", + EndTime = "1968 DEC 28", + SampleInterval = 30, + Enabled = true, + }, + GUI = { + Name = "Apollo 8 Earth Barycenter Trail", + Path = "/Solar System/Missions/Apollo" + } +} + +assetHelper.registerSceneGraphNodesAndExport(asset, { LaunchTrail, MoonTrail, EarthBarycenterTrail }) diff --git a/data/assets/scene/solarsystem/missions/apollo/a15.asset b/data/assets/scene/solarsystem/missions/apollo/a15.asset deleted file mode 100644 index 659edf4fd2..0000000000 --- a/data/assets/scene/solarsystem/missions/apollo/a15.asset +++ /dev/null @@ -1,203 +0,0 @@ -local assetHelper = asset.require('util/asset_helper') -local sunTransforms = asset.require('scene/solarsystem/sun/transforms') -asset.require('spice/base') - ---asset.require('scene/solarsystem/missions/apollo/a15kernels') - - -local models = asset.syncedResource({ - Name = "Apollo 15 Models", - Type = "HttpSynchronization", - Identifier = "apollo_models", - Version = 1 -}) - -local kernels = asset.syncedResource({ - Name = "Apollo Kernels", - Type = "HttpSynchronization", - Identifier = "apollo_spice", - Version = 1 -}) - -local Kernels = { - kernels .. "/apollo15.0001.tsc", - - -- kernels .. '/AS15-P_v01.bc', - kernels .. '/apollo15.0001.tf', - kernels .. '/apollo15MetricAddendum002.ti', - -- kernels .. '/apollo15PanoramicAddendum001.ti', - kernels .. '/apollo15_metric.0002.ti', - -- kernels .. '/apollo15_panoramic.0001.ti', - kernels .. '/apollo15-1.bsp', - kernels .. '/AS15-M_v01.bc', - -- kernels .. '/AS15-M_v01.bsp', -} - - - --- local Apollo15Kernels = { --- --sclk --- ApolloKernels .. "/apollo15.0001.tsc", - --- --pck --- ApolloKernels .. "/moon_080317.tf", --- ApolloKernels .. "/moon_assoc_me.tf", - --- --ik --- ApolloKernels .. "/apollo15_metric_v2.0001.ti", --- ApolloKernels .. "/apollo15_panoramic.0001.ti", - --- --tspk --- ApolloKernels .. "/de421.bsp", --- ApolloKernels .. "/moon_pa_de421_1900-2050.bpc", - --- --iak --- ApolloKernels .. "/apollo15MetricAddendum002.ti", --- ApolloKernels .. "/apolloPanAddendum001.ti", - --- --fk --- ApolloKernels .. "/apollo15_v2.0001.tf", --- ApolloKernels .. "/apollo15_v2.0002.tf", - --- --spk --- ApolloKernels .. "/AS15_M_REV23_SMITHED_V01.bsp", --- ApolloKernels .. "/AS15_M_REV4.bsp ", --- ApolloKernels .. "/AS15_M_REV70_SMITHED_V01.bsp", --- ApolloKernels .. "/AS15_M_REV04_v2.bsp ", --- ApolloKernels .. "/AS15_M_REV27_SMITHED_V01.bsp", --- ApolloKernels .. "/AS15_M_REV44_SMITHED_V01.bsp", --- ApolloKernels .. "/AS15_M_REV71_SMITHED_V01.bsp", --- ApolloKernels .. "/AS15_M_REV15_SMITHED_V01.bsp", --- ApolloKernels .. "/AS15_M_REV33_SMITHED_V01.bsp", --- ApolloKernels .. "/AS15_M_REV50_SMITHED_V01.bsp", --- ApolloKernels .. "/AS15_M_REV71_SMITHED_V02.bsp", --- ApolloKernels .. "/AS15_M_REV15_v2.bsp ", --- ApolloKernels .. "/AS15_M_REV34_SMITHED_V01.bsp", --- ApolloKernels .. "/AS15_M_REV60_SMITHED_V01.bsp", --- ApolloKernels .. "/AS15_M_REV72_v2.bsp", --- ApolloKernels .. "/AS15_M_REV16_SMITHED_V01.bsp", --- ApolloKernels .. "/AS15_M_REV35_SMITHED_V02.bsp", --- ApolloKernels .. "/AS15_M_REV62_SMITHED_V01.bsp", --- ApolloKernels .. "/AS15_M_REV22_SMITHED_V01.bsp", --- ApolloKernels .. "/AS15_M_REV38_SMITHED_V01.bsp", --- ApolloKernels .. "/AS15_M_REV63_SMITHED_V01.bsp", - --- --ck --- ApolloKernels .. "/AS15_M_REV04_SMITHED_V01.bc", --- ApolloKernels .. "/AS15_M_REV15_SMITHED_V01.bc", --- ApolloKernels .. "/AS15_M_REV16_SMITHED_V01.bc", --- ApolloKernels .. "/AS15_M_REV22_SMITHED_V01.bc", --- ApolloKernels .. "/AS15_M_REV23_SMITHED_V01.bc", --- ApolloKernels .. "/AS15_M_REV27_SMITHED_V01.bc", --- ApolloKernels .. "/AS15_M_REV33_SMITHED_V01.bc", --- ApolloKernels .. "/AS15_M_REV34_SMITHED_V01.bc", --- ApolloKernels .. "/AS15_M_REV35_SMITHED_V01.bc", --- ApolloKernels .. "/AS15_M_REV35_SMITHED_V02.bc", --- ApolloKernels .. "/AS15_M_REV38_SMITHED_V01.bc", --- ApolloKernels .. "/AS15_M_REV44_SMITHED_V01.bc", --- ApolloKernels .. "/AS15_M_REV50_SMITHED_V01.bc", --- ApolloKernels .. "/AS15_M_REV60_SMITHED_V01.bc", --- ApolloKernels .. "/AS15_M_REV62_SMITHED_V01.bc", --- ApolloKernels .. "/AS15_M_REV63_SMITHED_V01.bc", --- ApolloKernels .. "/AS15_M_REV70_SMITHED_V01.bc", --- ApolloKernels .. "/AS15_M_REV71_SMITHED_V01.bc", --- ApolloKernels .. "/AS15_M_REV71_SMITHED_V02.bc", --- ApolloKernels .. "/AS15_M_REV72_v2.bc", --- } - - - - -local LightSources = { - { - Type = "SceneGraphLightSource", - Identifier = "Sun", - Node = sunTransforms.SolarSystemBarycenter.Identifier, - Intensity = 1.0 - }, - -- { - -- Identifier = "Camera", - -- Type = "CameraLightSource", - -- Intensity = 0.5, - -- Enabled = false - -- } -} - - -local Apollo15 = { - Identifier = "Apollo15", - Parent = "Moon", - Transform = { - Translation = { - Type = "SpiceTranslation", - Target = "APOLLO 15", - Observer = "MOON", - Frame = "IAU_MOON", - Kernels = Kernels - }, - Rotation = { - Type = "SpiceRotation", - SourceFrame = "A15_METRIC", - DestinationFrame = "GALACTIC" - } - }, - TimeFrame = { -- Using Spice kernels for 1850-2150 - Type = "TimeFrameInterval", - Start = "1971-07-30T02:22:00.00", - End = "1971-08-01T18:05:00.00" - }, - GUI = { - Name = "Apollo 15", - Path = "/Solar System/Missions/Apollo 15" - } -} - -local Apollo15Main = { - Identifier = "Apollo15Main", - Parent = Apollo15.Identifier, - Renderable = { - Type = "RenderableModel", - Geometry = { - Type = "MultiModelGeometry", --- GeometryFile = models .. "/Apollo_Spacecraft.obj" - GeometryFile = models .. "/Apollo_CSM_shrunk_rotated_xy_doubble_size.obj" - }, - ColorTexture = models .. "/gray.png", - LightSources = LightSources, - DisableFaceCulling = true - }, - GUI = { - Name = "Apollo 15 Main", - Path = "/Solar System/Missions/Apollo 15" - } -} - -local Apollo15Trail = { - Identifier = "Apollo15Trail", - Parent = "Moon", - Renderable = { - Type = "RenderableTrailTrajectory", - Translation = { - Type = "SpiceTranslation", - Target = "APOLLO 15", - Observer = "MOON", - Frame = "IAU_MOON", - Kernels = Kernels - }, - Color = { 0.70, 0.50, 0.20 }, - StartTime = "1971 JUL 26", - EndTime = "1971 AUG 01 14:30:41.680", - SampleInterval = 2 - }, - GUI = { - Name = "Apollo 15 Trail", - Path = "/Solar System/Missions/Apollo 15" - } -} - -assetHelper.registerSceneGraphNodesAndExport(asset, { - Apollo15, - Apollo15Main, - Apollo15Trail -}) - diff --git a/data/assets/scene/solarsystem/missions/apollo/a15kernels.asset b/data/assets/scene/solarsystem/missions/apollo/a15kernels.asset deleted file mode 100644 index eca91e2614..0000000000 --- a/data/assets/scene/solarsystem/missions/apollo/a15kernels.asset +++ /dev/null @@ -1,86 +0,0 @@ -local ApolloKernels = asset.syncedResource({ - Name = "Apollo Kernels", - Type = "HttpSynchronization", - Identifier = "apollo_spice", - Version = 1 -}) - -local Apollo15Kernels = { - - - - --sclk - ApolloKernels .. "apollo15.0001.tsc", - - --pck - ApolloKernels .. "moon_080317.tf", - ApolloKernels .. "moon_assoc_me.tf", - - --ik - ApolloKernels .. "apollo15_metric_v2.0001.ti", - ApolloKernels .. "apollo15_panoramic.0001.ti", - - --tspk - ApolloKernels .. "de421.bsp", - ApolloKernels .. "moon_pa_de421_1900-2050.bpc", - - --iak - ApolloKernels .. "apollo15MetricAddendum002.ti", - ApolloKernels .. "apolloPanAddendum001.ti", - - --fk - ApolloKernels .. "apollo15_v2.0001.tf", - ApolloKernels .. "apollo15_v2.0002.tf", - - --spk - ApolloKernels .. "AS15_M_REV23_SMITHED_V01.bsp", - ApolloKernels .. "AS15_M_REV4.bsp ", - ApolloKernels .. "AS15_M_REV70_SMITHED_V01.bsp", - ApolloKernels .. "AS15_M_REV04_v2.bsp ", - ApolloKernels .. "AS15_M_REV27_SMITHED_V01.bsp", - ApolloKernels .. "AS15_M_REV44_SMITHED_V01.bsp", - ApolloKernels .. "AS15_M_REV71_SMITHED_V01.bsp", - ApolloKernels .. "AS15_M_REV15_SMITHED_V01.bsp", - ApolloKernels .. "AS15_M_REV33_SMITHED_V01.bsp", - ApolloKernels .. "AS15_M_REV50_SMITHED_V01.bsp", - ApolloKernels .. "AS15_M_REV71_SMITHED_V02.bsp", - ApolloKernels .. "AS15_M_REV15_v2.bsp ", - ApolloKernels .. "AS15_M_REV34_SMITHED_V01.bsp", - ApolloKernels .. "AS15_M_REV60_SMITHED_V01.bsp", - ApolloKernels .. "AS15_M_REV72_v2.bsp", - ApolloKernels .. "AS15_M_REV16_SMITHED_V01.bsp", - ApolloKernels .. "AS15_M_REV35_SMITHED_V02.bsp", - ApolloKernels .. "AS15_M_REV62_SMITHED_V01.bsp", - ApolloKernels .. "AS15_M_REV22_SMITHED_V01.bsp", - ApolloKernels .. "AS15_M_REV38_SMITHED_V01.bsp", - ApolloKernels .. "AS15_M_REV63_SMITHED_V01.bsp", - - --ck - ApolloKernels .. "AS15_M_REV04_SMITHED_V01.bc", - ApolloKernels .. "AS15_M_REV15_SMITHED_V01.bc", - ApolloKernels .. "AS15_M_REV16_SMITHED_V01.bc", - ApolloKernels .. "AS15_M_REV22_SMITHED_V01.bc", - ApolloKernels .. "AS15_M_REV23_SMITHED_V01.bc", - ApolloKernels .. "AS15_M_REV27_SMITHED_V01.bc", - ApolloKernels .. "AS15_M_REV33_SMITHED_V01.bc", - ApolloKernels .. "AS15_M_REV34_SMITHED_V01.bc", - ApolloKernels .. "AS15_M_REV35_SMITHED_V01.bc", - ApolloKernels .. "AS15_M_REV35_SMITHED_V02.bc", - ApolloKernels .. "AS15_M_REV38_SMITHED_V01.bc", - ApolloKernels .. "AS15_M_REV44_SMITHED_V01.bc", - ApolloKernels .. "AS15_M_REV50_SMITHED_V01.bc", - ApolloKernels .. "AS15_M_REV60_SMITHED_V01.bc", - ApolloKernels .. "AS15_M_REV62_SMITHED_V01.bc", - ApolloKernels .. "AS15_M_REV63_SMITHED_V01.bc", - ApolloKernels .. "AS15_M_REV70_SMITHED_V01.bc", - ApolloKernels .. "AS15_M_REV71_SMITHED_V01.bc", - ApolloKernels .. "AS15_M_REV71_SMITHED_V02.bc", - ApolloKernels .. "AS15_M_REV72_v2.bc", - - -} - - - ---asset.export("ApolloKernels", Kernels) -asset.export("Apollo15Kernels", Apollo15Kernels) diff --git a/data/assets/scene/solarsystem/missions/apollo/apollo8.asset b/data/assets/scene/solarsystem/missions/apollo/apollo8.asset deleted file mode 100644 index fc54aeacfc..0000000000 --- a/data/assets/scene/solarsystem/missions/apollo/apollo8.asset +++ /dev/null @@ -1,235 +0,0 @@ -local assetHelper = asset.require('util/asset_helper') -local sunTransforms = asset.require('scene/solarsystem/sun/transforms') -local csm = asset.require('./apollo_csm') - -asset.require('spice/base') - -local kernelsFolder = asset.syncedResource({ - Name = "Apollo Kernels", - Type = "HttpSynchronization", - Identifier = "apollo_spice", - Version = 1 -}) - -local kernels = { - kernelsFolder .. "/moon_080317.tf", - kernelsFolder .. "/apollo8.tf", - kernelsFolder .. "/moon_pa_de421_1900-2050.bpc", - kernelsFolder .. '/apollo8.tsc', - kernelsFolder .. '/apollo8.bsp', - kernelsFolder .. '/apollo8_earthrise.bc', -} - -local apolloSpiceId = "-908" - -local Apollo8Launch = { - Identifier = "Apollo8Launch", - Parent = "Earth", - TimeFrame = { -- Using Spice kernels for 1850-2150 - Type = "TimeFrameInterval", - Start = "1968 DEC 21", - End = "1968 DEC 28" - }, - Transform = { - Translation = { - Type = "SpiceTranslation", - Target = apolloSpiceId, - Observer = "EARTH", - Frame = "IAU_EARTH", - Kernels = kernels - }, - }, - GUI = { - Name = "Apollo 8 Launch Capsule", - Path = "/Solar System/Missions/Apollo" - } -} - - -local Apollo8 = { - Identifier = "Apollo8", - Parent = "EarthBarycenter", - TimeFrame = { -- Using Spice kernels for 1850-2150 - Type = "TimeFrameInterval", - Start = "1968 DEC 21", - End = "1968 DEC 28" - }, - Transform = { - Translation = { - Type = "SpiceTranslation", - Target = apolloSpiceId, - Observer = "EARTH BARYCENTER", - Frame = "GALACTIC", - Kernels = kernels - }, - Rotation = { - Type = "SpiceRotation", - SourceFrame = "A8_EARTHRISE", - DestinationFrame = "GALACTIC", - TimeFrame = { - -- The orientation of Apollo 8 is only - -- available during the few minutes when - -- the famous Earthrise picture was taken. - Type = "TimeFrameInterval", - Start = "1968 DEC 24 16:37:19", - End = "1968 DEC 24 16:40:15" - } - } - }, - GUI = { - Name = "Apollo 8", - Path = "/Solar System/Missions/Apollo" - } -} - -local Apollo8LaunchModel = { - Identifier = "Apollo8LaunchModel", - Parent = Apollo8Launch.Identifier, - Transform = { - Scale = { - Type = "StaticScale", - -- The scale of the model is in cm; OpenSpace is in m - Scale = 0.01 - }, - Rotation = { - Type = "StaticRotation", - Rotation = {0.0, 0.0, -3.1415/2} - } - }, - GUI = { - Hidden = true, - Name = "Apollo 8 Launch Model", - Path = "/Solar System/Missions/Apollo" - } -} - -local Apollo8Model = { - Identifier = "Apollo8Model", - Parent = Apollo8.Identifier, - Transform = { - Scale = { - Type = "StaticScale", - -- The scale of the model is in cm; OpenSpace is in m - Scale = 0.01 - }, - Rotation = { - Type = "StaticRotation", - Rotation = {0.0, 0.0, -3.1415/2} - } - }, - GUI = { - Hidden = true, - Name = "Apollo 8 Model", - Path = "/Solar System/Missions/Apollo" - } -} - -local PivotOffset = { 0, 2.5, 0 } - --- The pivot node is used for navigation inside the spacecraft - -local Apollo8Pivot = { - Identifier = "Apollo8Pivot", - Parent = Apollo8.Identifier, - Transform = { - Translation = { - Type = "StaticTranslation", - Position = PivotOffset - }, - }, - GUI = { - Name = "Apollo 8 Pivot", - Path = "/Solar System/Missions/Apollo" - } -} - - -local Apollo8LaunchTrail = { - Identifier = "Apollo8LaunchTrail", - Parent = "Earth", - Renderable = { - Type = "RenderableTrailTrajectory", - Translation = { - Type = "SpiceTranslation", - Target = apolloSpiceId, - Observer = "EARTH", - Frame = "IAU_EARTH", - Kernels = kernels - }, - Color = { 0.70, 0.50, 0.20 }, - StartTime = "1968 DEC 21 12:51:00", - EndTime = "1968 DEC 21 23:23:22", - SampleInterval = 30 - }, - GUI = { - Name = "Apollo 8 Launch Trail", - Path = "/Solar System/Missions/Apollo" - } -} - -local Apollo8MoonTrail = { - Identifier = "Apollo8MoonTrail", - Parent = "Moon", - Renderable = { - Type = "RenderableTrailTrajectory", - Translation = { - Type = "SpiceTranslation", - Target = apolloSpiceId, - Observer = "MOON", - Frame = "IAU_MOON", - Kernels = kernels - }, - Color = { 0.70, 0.50, 0.20 }, - StartTime = "1968 DEC 23", - EndTime = "1968 DEC 26", - SampleInterval = 30, - Enabled = false, - }, - GUI = { - Name = "Apollo 8 Moon Trail", - Path = "/Solar System/Missions/Apollo" - } -} - -local Apollo8EarthBarycenterTrail = { - Identifier = "Apollo8EarthBarycenterTrail", - Parent = "EarthCenter", - Renderable = { - Type = "RenderableTrailTrajectory", - Translation = { - Type = "SpiceTranslation", - Target = apolloSpiceId, - Observer = "EARTH", - Frame = "GALACTIC", - Kernels = kernels - }, - Color = { 0.8, 0.2, 0.2 }, - StartTime = "1968 DEC 21", - EndTime = "1968 DEC 28", - SampleInterval = 30, - Enabled = true, - }, - GUI = { - Name = "Apollo 8 Earth Barycenter Trail", - Path = "/Solar System/Missions/Apollo" - } -} - - -local exportList = { - Apollo8, - Apollo8Model, - Apollo8Launch, - Apollo8LaunchModel, - Apollo8Pivot, - - Apollo8LaunchTrail, - Apollo8MoonTrail, - Apollo8EarthBarycenterTrail -} - -assetHelper.registerSceneGraphNodesAndExport(asset, exportList) --- Registering Command and Service module needs to happen fter the export list --- has been registered, since it depends on the Apollo8Model scene graph node. -csm.registerCsm(asset, Apollo8Model.Identifier) -csm.registerCsm(asset, Apollo8LaunchModel.Identifier) diff --git a/data/assets/scene/solarsystem/missions/apollo/apollo_csm.asset b/data/assets/scene/solarsystem/missions/apollo/apollo_csm.asset index 3f5a1e012e..32581a1597 100644 --- a/data/assets/scene/solarsystem/missions/apollo/apollo_csm.asset +++ b/data/assets/scene/solarsystem/missions/apollo/apollo_csm.asset @@ -1,11 +1,11 @@ -- This asset exports a function to create an Apollo Command and Service Module (CSM). -- Instead of hard-coding the scene graph node parent, -- client assets can decide which object that the CSM should be attached to. --- Usage example: registerCsm(asset, Apollo8.Idenfitier) +-- Usage example: createCsmModel(asset, Apollo8.Idenfitier) -- ...where Apollo8 is the scene graph node identifier to attach the CSM to. -local assetHelper = asset.require('util/asset_helper') -local sunTransforms = asset.require('scene/solarsystem/sun/transforms') +local asset_helper = asset.require('util/asset_helper') +local sun_transforms = asset.require('scene/solarsystem/sun/transforms') local models = asset.syncedResource({ Name = "Apollo Models", @@ -18,115 +18,115 @@ local partsInfo = { -- Data is structured as: Geometry file name (except .obj suffix), texture file name, shading -- Exterior - {"AP08_cone_command_module", "Command_module_diff.png", true}, - {"AP08_cone_hatchdoor_handle_scratched_metal", "scratched_metal_gloss.png", true}, - {"AP08_cone_vent_ports_black", "black.png", true}, - {"AP08_cone_vent_ports_red", "red.png", true}, - {"AP08_cone_hatchdoor_interior", "apollo_hatchdoor_interior.jpg", false}, + { "AP08_cone_command_module", "Command_module_diff.png", true }, + { "AP08_cone_hatchdoor_handle_scratched_metal", "scratched_metal_gloss.png", true }, + { "AP08_cone_vent_ports_black", "black.png", true }, + { "AP08_cone_vent_ports_red", "red.png", true }, + { "AP08_cone_hatchdoor_interior", "apollo_hatchdoor_interior.jpg", false }, - {"AP08_service_black", "black.png", true}, - {"AP08_service_brown", "brown.png", true}, - {"AP08_service_grey", "gray.png", true}, - {"AP08_service_high_gain_antenna", "Antenna_diff.png", true}, - {"AP08_service_module", "Service_module_diff.png", true}, - {"AP08_service_nozzle", "Nozzle_diff.png", true}, - {"AP08_service_pink", "pink.png", true}, - {"AP08_service_red", "red.png", true}, - {"AP08_service_scratched_metal", "scratched_metal_gloss.png", true}, - {"AP08_service_white", "white.png", true}, + { "AP08_service_black", "black.png", true }, + { "AP08_service_brown", "brown.png", true }, + { "AP08_service_grey", "gray.png", true }, + { "AP08_service_high_gain_antenna", "Antenna_diff.png", true }, + { "AP08_service_module", "Service_module_diff.png", true }, + { "AP08_service_nozzle", "Nozzle_diff.png", true }, + { "AP08_service_pink", "pink.png", true }, + { "AP08_service_red", "red.png", true }, + { "AP08_service_scratched_metal", "scratched_metal_gloss.png", true }, + { "AP08_service_white", "white.png", true }, -- Interior - -- {"AP11_int_back_wall_left", "AP11_int_back_wall_left.png", false}, - -- {"AP11_int_back_wall_right", "AP11_int_back_wall_right.png", false}, - -- {"AP11_interior_back_wall_top_0Shape3", "back_wall_top_0Shape3_tpAmbient_paint_03.png", false}, - -- {"AP11_interior_belt_buckles_02_L2", "belt_buckles_02_L2Shape_tpAmbient.png", false}, - -- {"AP11_interior_belt_straps_02", "belt_straps_02Shape_tpAmbient_paint_01.png", false}, - -- {"AP11_interior_black_push_buttons", "push_buttonsShape_tpAmbient.png", false}, - -- {"AP11_interior_bottom_boxes_03", "bottom_boxes_03_paint_01.png", false}, - -- {"AP11_interior_bottom_floor_tp", "bottom_floor_tpAmbient_paint_v002.png", false}, - -- {"AP11_interior_box_back_01", "box_back_01_paint_v001.png", false}, - -- {"AP11_interior_box_back_02", "box_back_02_paint_v001.png", false}, - -- {"AP11_interior_box_back_04", "box_back_04_paint_v001.png", false}, - -- {"AP11_interior_box_lft_lower_01", "box_lft_lower_01Shape_Diffuse_paint_v002.png", false}, - -- {"AP11_interior_box_lft_top", "box_lft_topShape_Diffuse_paint_v009.png", false}, - -- {"AP11_interior_box_mid_tp", "box_mid_tpDiffuse_paint_v001.png", false}, - -- {"AP11_interior_box_rt_top_02", "box_rt_top_02_paint_04.png", false}, - -- {"AP11_interior_brushed_blue_ano", "brushed_blue_ano_paint_01.png", false}, - -- {"AP11_interior_brushed_brass", "brushed_brass_paint_01.png", false}, - -- {"AP11_interior_brushed_grey_ano", "brushed_grey_ano_paint_02.png", false}, - -- {"AP11_interior_canvas_cover", "canvas_coverShape_tpAmbient_paint_01.png", false}, - -- {"AP11_interior_Channel_attachment", "Channel_attachment_Diffuse.png", false}, - -- {"AP11_interior_Channel_baseMetal", "Channel_baseMetal_Diffuse.png", false}, - -- {"AP11_interior_Channel_Material", "Channel_Material_Diffuse.png", false}, - -- {"AP11_interior_Channel_rsMaterial2", "Channel_rsMaterial2_Diffuse.png", false}, - -- {"AP11_interior_cloth_01", "cloth_01Shape_tpAmbient_paint_01.png", false}, - -- {"AP11_interior_coiled_hose", "coiled_hoseShape_tpAmbient.png", false}, - -- {"AP11_interior_control_panel_left_win_plates", "control_panel_left_win_platesShape_tpAmbient.png", false}, - -- {"AP11_interior_control_panel_rt_win_plates", "control_panel_rt_win_platesShape_tpAmbient.png", false}, - -- {"AP11_interior_copper_parts_main_cp", "copper_parts_main_cpShape_tpAmbient.png", false}, - -- {"AP11_interior_dials_main2", "dials_main2Shape_tpAmbient.png", false}, - -- {"AP11_interior_dials_t2", "dials_t2Shape_tpAmbient.png", false}, - -- {"AP11_interior_dial_fixes_01", "dial_fixes_01Shape_tpAmbient.png", false}, - -- {"AP11_interior_fire_ex_02", "fire_ex_02_paint_v001.png", false}, - -- {"AP11_interior_floor_panels_3", "floor_panels_3Shape_tpAmbient_paint_01.png", false}, - -- {"AP11_interior_floor_tile_tex_01", "floor_tile_tex_01.png", false}, - -- {"AP11_interior_grey", "gray.png", false}, - -- {"AP11_interior_handholds_cp", "handholds_cpShape_tpAmbient_paint_05.png", false}, - -- {"AP11_interior_hatch_release_0Shape5", "hatch_release_0Shape5_tpAmbient_paint_02.png", false}, - -- {"AP11_interior_headrests_02", "headrests_02Shape_tpAmbient_paint_01.png", false}, - -- {"AP11_interior_hoses_black_01", "hoses_black_01Shape_tpAmbient_paint_01.png", false}, - -- {"AP11_interior_hoses_white_0Shape1", "hoses_white_0Shape1_tpAmbient_paint_01.png", false}, - -- {"AP11_interior_josticks1", "joysticks1Shape_tpAmbient_paint_01.png", false}, - -- {"AP11_interior_joysticks_fabric1", "joysticks_fabric1_Shape_tpAmbient_paint_01.png", false}, - -- {"AP11_interior_joystick_poles_lft_05", "joystick_poles_lft_05_paint_v002.png", false}, - -- {"AP11_interior_joystick_poles_lft_long_05", "joystick_poles_lft_long_05_paint_v002.png", false}, - -- {"AP11_interior_joystick_poles_rt_05", "joystick_poles_rt_05_paint_v002.png", false}, - -- {"AP11_interior_latch_mechanisms_01", "latch_mechanisms_01Shape_tpAmbient.png", false}, - -- {"AP11_interior_lower_push_buttons", "lower_push_buttonsShape_tpAmbient.png", false}, - -- {"AP11_interior_lower_walls_back", "lower_walls_back_paint_04.png", false}, - -- {"AP11_interior_lower_walls_boxes_head", "lower_walls_boxes_headShape_tpAmbient_paint_v001.png", false}, - -- {"AP11_interior_main_cp_left_smth_03", "main_cp_left_0Shape3_tpAmbient_paint_02.png", false}, - -- {"AP11_interior_main_cp_mid_smth_02", "main_cp_mid_smth_02Shape_tpAmbient_paint_02.png", false}, - -- {"AP11_interior_main_cp_rt_smth", "main_cp_rt_smthShape_tpAmbient_paint_02.png", false}, - -- {"AP11_interior_main_cp_wheels", "main_cp_wheelsShape_tpAmbient.png", false}, - -- {"AP11_interior_metal_brackets_under_hatch", "metal_brackets_under_hatchShape_tpAmbient.png", false}, - -- {"AP11_interior_metal_tunnel_parts", "metal_tunnel_partsShape_tpAmbient_paint_01.png", false}, - -- {"AP11_interior_metal_window_parts", "metal_window_partsShape_tpAmbient_paint_01.png", false}, - -- {"AP11_interior_middle_walls_05", "middle_walls_05_tpAmbient_paint_02.png", false}, - -- {"AP11_interior_middle_walls_0Shape8", "middle_walls_0Shape8_tpAmbient_paint_01.png", false}, - -- {"AP11_interior_mid_tunnel_parts", "mid_tunnel_parts_03Shape_tpAmbient_paint_02.png", false}, - -- {"AP11_interior_new_switch_rails1", "new_switch_rails1Shape_tpAmbient.png", false}, - -- {"AP11_interior_nozzles_02", "nozzles_02Shape_tpAmbient_paint_01.png", false}, - -- {"AP11_interior_outlet_fabric3", "outlet_fabric3Shape_tpAmbient_paint_02.png", false}, - -- {"AP11_interior_pole_end_02", "pole_end_02.png", false}, - -- {"AP11_interior_pole_end_03", "pole_end_03.png", false}, - -- {"AP11_interior_pole_tex_03", "pole_tex_03.png", false}, - -- {"AP11_interior_pole_tex_04", "pole_tex_04.png", false}, - -- {"AP11_interior_pole_tex_05", "pole_tex_05.png", false}, - -- {"AP11_interior_pole_tex_lower_01", "pole_tex_lower_01.png", false}, - -- {"AP11_interior_pole_under_seat_paint_01", "pole_under_seat_paint_01.png", false}, - -- {"AP11_interior_pole_under_seat_square_bar", "pole_under_seat_square_bar_paint_01.png", false}, - -- {"AP11_interior_push_switches_lft1", "push_switches_lft1Shape_tpAmbient.png", false}, - -- {"AP11_interior_random_small_parts_01", "random_small_parts_01Shape_tpAmbient_paint_02.png", false}, - -- {"AP11_interior_red", "red.png", false}, - -- {"AP11_interior_reticle_wheel_tp", "reticle_wheel_tpAmbient_paint_01.png", false}, - -- {"AP11_interior_rivet_paint_v001", "rivet_paint_v001.png", false}, - -- {"AP11_interior_seats_fabric", "seats_fabric_paint_01.png", false}, - -- {"AP11_interior_seat_left_tp", "seat_left_tpAmbient_paint_v001.png", false}, - -- {"AP11_interior_seat_lights_left", "seat_lights_left_Shape_tpAmbient_paint_v001.png", false}, - -- {"AP11_interior_seat_lights_rt", "seat_lights_rt_Shape_tpAmbient_paint_v001.png", false}, - -- {"AP11_interior_seat_middle_tp", "seat_middle_tpAmbient_paint_v001.png", false}, - -- {"AP11_interior_seat_poles_0Shape1", "seat_poles_0Shape1_tpAmbient_paint_01.png", false}, - -- {"AP11_interior_seat_pole_mirror_0Shape1", "seat_pole_mirror_0Shape1_tpAmbient_paint_01.png", false}, - -- {"AP11_interior_seat_rt_tp", "seat_rt_tpAmbient_paint_v001.png", false}, - -- {"AP11_interior_sextant_0Shape2", "sextant_0Shape2_tpAmbient.png", false}, - -- {"AP11_interior_switch_covers_main_middle1", "switch_covers_main_middle1Shape_tpAmbient.png", false}, - -- {"AP11_interior_switch_rails_lft", "switch_rails_lftShape_tpAmbient.png", false}, - -- {"AP11_interior_tunnel_main_cylinder1", "switch_rails_lftShape_tpAmbient.png", false}, - -- {"AP11_interior_tunnel_switches_01", "tunnel_switches_01Shape_tpAmbient.png", false}, - -- {"AP11_interior_tunnel_wheelsShape", "tunnel_wheelsShape_tpAmbient.png", false}, - -- {"AP11_interior_walls_mid_left", "walls_mid_leftShape_tpAmbient_paint_01.png", false}, - -- {"AP11_interior_windows_front_0Shape4", "windows_front_0Shape4_tpAmbient_paint_01.png", false} + -- { "AP11_int_back_wall_left", "AP11_int_back_wall_left.png", false}, + -- { "AP11_int_back_wall_right", "AP11_int_back_wall_right.png", false }, + -- { "AP11_interior_back_wall_top_0Shape3", "back_wall_top_0Shape3_tpAmbient_paint_03.png", false }, + -- { "AP11_interior_belt_buckles_02_L2", "belt_buckles_02_L2Shape_tpAmbient.png", false }, + -- { "AP11_interior_belt_straps_02", "belt_straps_02Shape_tpAmbient_paint_01.png", false }, + -- { "AP11_interior_black_push_buttons", "push_buttonsShape_tpAmbient.png", false }, + -- { "AP11_interior_bottom_boxes_03", "bottom_boxes_03_paint_01.png", false }, + -- { "AP11_interior_bottom_floor_tp", "bottom_floor_tpAmbient_paint_v002.png", false }, + -- { "AP11_interior_box_back_01", "box_back_01_paint_v001.png", false }, + -- { "AP11_interior_box_back_02", "box_back_02_paint_v001.png", false }, + -- { "AP11_interior_box_back_04", "box_back_04_paint_v001.png", false }, + -- { "AP11_interior_box_lft_lower_01", "box_lft_lower_01Shape_Diffuse_paint_v002.png", false }, + -- { "AP11_interior_box_lft_top", "box_lft_topShape_Diffuse_paint_v009.png", false }, + -- { "AP11_interior_box_mid_tp", "box_mid_tpDiffuse_paint_v001.png", false }, + -- { "AP11_interior_box_rt_top_02", "box_rt_top_02_paint_04.png", false }, + -- { "AP11_interior_brushed_blue_ano", "brushed_blue_ano_paint_01.png", false }, + -- { "AP11_interior_brushed_brass", "brushed_brass_paint_01.png", false }, + -- { "AP11_interior_brushed_grey_ano", "brushed_grey_ano_paint_02.png", false }, + -- { "AP11_interior_canvas_cover", "canvas_coverShape_tpAmbient_paint_01.png", false }, + -- { "AP11_interior_Channel_attachment", "Channel_attachment_Diffuse.png", false }, + -- { "AP11_interior_Channel_baseMetal", "Channel_baseMetal_Diffuse.png", false }, + -- { "AP11_interior_Channel_Material", "Channel_Material_Diffuse.png", false }, + -- { "AP11_interior_Channel_rsMaterial2", "Channel_rsMaterial2_Diffuse.png", false }, + -- { "AP11_interior_cloth_01", "cloth_01Shape_tpAmbient_paint_01.png", false }, + -- { "AP11_interior_coiled_hose", "coiled_hoseShape_tpAmbient.png", false }, + -- { "AP11_interior_control_panel_left_win_plates", "control_panel_left_win_platesShape_tpAmbient.png", false }, + -- { "AP11_interior_control_panel_rt_win_plates", "control_panel_rt_win_platesShape_tpAmbient.png", false }, + -- { "AP11_interior_copper_parts_main_cp", "copper_parts_main_cpShape_tpAmbient.png", false }, + -- { "AP11_interior_dials_main2", "dials_main2Shape_tpAmbient.png", false }, + -- { "AP11_interior_dials_t2", "dials_t2Shape_tpAmbient.png", false }, + -- { "AP11_interior_dial_fixes_01", "dial_fixes_01Shape_tpAmbient.png", false }, + -- { "AP11_interior_fire_ex_02", "fire_ex_02_paint_v001.png", false }, + -- { "AP11_interior_floor_panels_3", "floor_panels_3Shape_tpAmbient_paint_01.png", false }, + -- { "AP11_interior_floor_tile_tex_01", "floor_tile_tex_01.png", false }, + -- { "AP11_interior_grey", "gray.png", false }, + -- { "AP11_interior_handholds_cp", "handholds_cpShape_tpAmbient_paint_05.png", false }, + -- { "AP11_interior_hatch_release_0Shape5", "hatch_release_0Shape5_tpAmbient_paint_02.png", false }, + -- { "AP11_interior_headrests_02", "headrests_02Shape_tpAmbient_paint_01.png", false }, + -- { "AP11_interior_hoses_black_01", "hoses_black_01Shape_tpAmbient_paint_01.png", false }, + -- { "AP11_interior_hoses_white_0Shape1", "hoses_white_0Shape1_tpAmbient_paint_01.png", false }, + -- { "AP11_interior_josticks1", "joysticks1Shape_tpAmbient_paint_01.png", false }, + -- { "AP11_interior_joysticks_fabric1", "joysticks_fabric1_Shape_tpAmbient_paint_01.png", false }, + -- { "AP11_interior_joystick_poles_lft_05", "joystick_poles_lft_05_paint_v002.png", false }, + -- { "AP11_interior_joystick_poles_lft_long_05", "joystick_poles_lft_long_05_paint_v002.png", false }, + -- { "AP11_interior_joystick_poles_rt_05", "joystick_poles_rt_05_paint_v002.png", false }, + -- { "AP11_interior_latch_mechanisms_01", "latch_mechanisms_01Shape_tpAmbient.png", false }, + -- { "AP11_interior_lower_push_buttons", "lower_push_buttonsShape_tpAmbient.png", false }, + -- { "AP11_interior_lower_walls_back", "lower_walls_back_paint_04.png", false }, + -- { "AP11_interior_lower_walls_boxes_head", "lower_walls_boxes_headShape_tpAmbient_paint_v001.png", false }, + -- { "AP11_interior_main_cp_left_smth_03", "main_cp_left_0Shape3_tpAmbient_paint_02.png", false }, + -- { "AP11_interior_main_cp_mid_smth_02", "main_cp_mid_smth_02Shape_tpAmbient_paint_02.png", false }, + -- { "AP11_interior_main_cp_rt_smth", "main_cp_rt_smthShape_tpAmbient_paint_02.png", false }, + -- { "AP11_interior_main_cp_wheels", "main_cp_wheelsShape_tpAmbient.png", false }, + -- { "AP11_interior_metal_brackets_under_hatch", "metal_brackets_under_hatchShape_tpAmbient.png", false }, + -- { "AP11_interior_metal_tunnel_parts", "metal_tunnel_partsShape_tpAmbient_paint_01.png", false }, + -- { "AP11_interior_metal_window_parts", "metal_window_partsShape_tpAmbient_paint_01.png", false }, + -- { "AP11_interior_middle_walls_05", "middle_walls_05_tpAmbient_paint_02.png", false }, + -- { "AP11_interior_middle_walls_0Shape8", "middle_walls_0Shape8_tpAmbient_paint_01.png", false }, + -- { "AP11_interior_mid_tunnel_parts", "mid_tunnel_parts_03Shape_tpAmbient_paint_02.png", false }, + -- { "AP11_interior_new_switch_rails1", "new_switch_rails1Shape_tpAmbient.png", false }, + -- { "AP11_interior_nozzles_02", "nozzles_02Shape_tpAmbient_paint_01.png", false }, + -- { "AP11_interior_outlet_fabric3", "outlet_fabric3Shape_tpAmbient_paint_02.png", false }, + -- { "AP11_interior_pole_end_02", "pole_end_02.png", false }, + -- { "AP11_interior_pole_end_03", "pole_end_03.png", false }, + -- { "AP11_interior_pole_tex_03", "pole_tex_03.png", false }, + -- { "AP11_interior_pole_tex_04", "pole_tex_04.png", false }, + -- { "AP11_interior_pole_tex_05", "pole_tex_05.png", false }, + -- { "AP11_interior_pole_tex_lower_01", "pole_tex_lower_01.png", false }, + -- { "AP11_interior_pole_under_seat_paint_01", "pole_under_seat_paint_01.png", false }, + -- { "AP11_interior_pole_under_seat_square_bar", "pole_under_seat_square_bar_paint_01.png", false }, + -- { "AP11_interior_push_switches_lft1", "push_switches_lft1Shape_tpAmbient.png", false }, + -- { "AP11_interior_random_small_parts_01", "random_small_parts_01Shape_tpAmbient_paint_02.png", false }, + -- { "AP11_interior_red", "red.png", false }, + -- { "AP11_interior_reticle_wheel_tp", "reticle_wheel_tpAmbient_paint_01.png", false }, + -- { "AP11_interior_rivet_paint_v001", "rivet_paint_v001.png", false }, + -- { "AP11_interior_seats_fabric", "seats_fabric_paint_01.png", false }, + -- { "AP11_interior_seat_left_tp", "seat_left_tpAmbient_paint_v001.png", false }, + -- { "AP11_interior_seat_lights_left", "seat_lights_left_Shape_tpAmbient_paint_v001.png", false }, + -- { "AP11_interior_seat_lights_rt", "seat_lights_rt_Shape_tpAmbient_paint_v001.png", false }, + -- { "AP11_interior_seat_middle_tp", "seat_middle_tpAmbient_paint_v001.png", false }, + -- { "AP11_interior_seat_poles_0Shape1", "seat_poles_0Shape1_tpAmbient_paint_01.png", false }, + -- { "AP11_interior_seat_pole_mirror_0Shape1", "seat_pole_mirror_0Shape1_tpAmbient_paint_01.png", false }, + -- { "AP11_interior_seat_rt_tp", "seat_rt_tpAmbient_paint_v001.png", false }, + -- { "AP11_interior_sextant_0Shape2", "sextant_0Shape2_tpAmbient.png", false }, + -- { "AP11_interior_switch_covers_main_middle1", "switch_covers_main_middle1Shape_tpAmbient.png", false }, + -- { "AP11_interior_switch_rails_lft", "switch_rails_lftShape_tpAmbient.png", false }, + -- { "AP11_interior_tunnel_main_cylinder1", "switch_rails_lftShape_tpAmbient.png", false }, + -- { "AP11_interior_tunnel_switches_01", "tunnel_switches_01Shape_tpAmbient.png", false }, + -- { "AP11_interior_tunnel_wheelsShape", "tunnel_wheelsShape_tpAmbient.png", false }, + -- { "AP11_interior_walls_mid_left", "walls_mid_leftShape_tpAmbient_paint_01.png", false }, + -- { "AP11_interior_windows_front_0Shape4", "windows_front_0Shape4_tpAmbient_paint_01.png", false } } @@ -134,147 +134,147 @@ local partsInfoFull = { -- Data is structured as: Geometry file name (except .obj suffix), texture file name, shading -- Exterior - {"AP08_cone_command_module", "Command_module_diff.png", true}, - {"AP08_cone_hatchdoor_handle_scratched_metal", "scratched_metal_gloss.png", true}, - {"AP08_cone_vent_ports_black", "black.png", true}, - {"AP08_cone_vent_ports_red", "red.png", true}, - {"AP08_cone_hatchdoor_interior", "apollo_hatchdoor_interior.jpg", false}, + { "AP08_cone_command_module", "Command_module_diff.png", true }, + { "AP08_cone_hatchdoor_handle_scratched_metal", "scratched_metal_gloss.png", true }, + { "AP08_cone_vent_ports_black", "black.png", true }, + { "AP08_cone_vent_ports_red", "red.png", true }, + { "AP08_cone_hatchdoor_interior", "apollo_hatchdoor_interior.jpg", false }, - {"AP08_service_black", "black.png", true}, - {"AP08_service_brown", "brown.png", true}, - {"AP08_service_grey", "gray.png", true}, - {"AP08_service_high_gain_antenna", "Antenna_diff.png", true}, - {"AP08_service_module", "Service_module_diff.png", true}, - {"AP08_service_nozzle", "Nozzle_diff.png", true}, - {"AP08_service_pink", "pink.png", true}, - {"AP08_service_red", "red.png", true}, - {"AP08_service_scratched_metal", "scratched_metal_gloss.png", true}, - {"AP08_service_white", "white.png", true}, + { "AP08_service_black", "black.png", true }, + { "AP08_service_brown", "brown.png", true }, + { "AP08_service_grey", "gray.png", true }, + { "AP08_service_high_gain_antenna", "Antenna_diff.png", true }, + { "AP08_service_module", "Service_module_diff.png", true }, + { "AP08_service_nozzle", "Nozzle_diff.png", true }, + { "AP08_service_pink", "pink.png", true }, + { "AP08_service_red", "red.png", true }, + { "AP08_service_scratched_metal", "scratched_metal_gloss.png", true }, + { "AP08_service_white", "white.png", true }, -- Interior - {"AP11_int_back_wall_left", "AP11_int_back_wall_left.png", false}, - {"AP11_int_back_wall_right", "AP11_int_back_wall_right.png", false}, - {"AP11_interior_back_wall_top_0Shape3", "back_wall_top_0Shape3_tpAmbient_paint_03.png", false}, - {"AP11_interior_belt_buckles_02_L2", "belt_buckles_02_L2Shape_tpAmbient.png", false}, - {"AP11_interior_belt_straps_02", "belt_straps_02Shape_tpAmbient_paint_01.png", false}, - {"AP11_interior_black_push_buttons", "push_buttonsShape_tpAmbient.png", false}, - {"AP11_interior_bottom_boxes_03", "bottom_boxes_03_paint_01.png", false}, - {"AP11_interior_bottom_floor_tp", "bottom_floor_tpAmbient_paint_v002.png", false}, - {"AP11_interior_box_back_01", "box_back_01_paint_v001.png", false}, - {"AP11_interior_box_back_02", "box_back_02_paint_v001.png", false}, - {"AP11_interior_box_back_04", "box_back_04_paint_v001.png", false}, - {"AP11_interior_box_lft_lower_01", "box_lft_lower_01Shape_Diffuse_paint_v002.png", false}, - {"AP11_interior_box_lft_top", "box_lft_topShape_Diffuse_paint_v009.png", false}, - {"AP11_interior_box_mid_tp", "box_mid_tpDiffuse_paint_v001.png", false}, - {"AP11_interior_box_rt_top_02", "box_rt_top_02_paint_04.png", false}, - {"AP11_interior_brushed_blue_ano", "brushed_blue_ano_paint_01.png", false}, - {"AP11_interior_brushed_brass", "brushed_brass_paint_01.png", false}, - {"AP11_interior_brushed_grey_ano", "brushed_grey_ano_paint_02.png", false}, - {"AP11_interior_canvas_cover", "canvas_coverShape_tpAmbient_paint_01.png", false}, - {"AP11_interior_Channel_attachment", "Channel_attachment_Diffuse.png", false}, - {"AP11_interior_Channel_baseMetal", "Channel_baseMetal_Diffuse.png", false}, - {"AP11_interior_Channel_Material", "Channel_Material_Diffuse.png", false}, - {"AP11_interior_Channel_rsMaterial2", "Channel_rsMaterial2_Diffuse.png", false}, - {"AP11_interior_cloth_01", "cloth_01Shape_tpAmbient_paint_01.png", false}, - {"AP11_interior_coiled_hose", "coiled_hoseShape_tpAmbient.png", false}, - {"AP11_interior_control_panel_left_win_plates", "control_panel_left_win_platesShape_tpAmbient.png", false}, - {"AP11_interior_control_panel_rt_win_plates", "control_panel_rt_win_platesShape_tpAmbient.png", false}, - {"AP11_interior_copper_parts_main_cp", "copper_parts_main_cpShape_tpAmbient.png", false}, - {"AP11_interior_dials_main2", "dials_main2Shape_tpAmbient.png", false}, - {"AP11_interior_dials_t2", "dials_t2Shape_tpAmbient.png", false}, - {"AP11_interior_dial_fixes_01", "dial_fixes_01Shape_tpAmbient.png", false}, - {"AP11_interior_fire_ex_02", "fire_ex_02_paint_v001.png", false}, - {"AP11_interior_floor_panels_3", "floor_panels_3Shape_tpAmbient_paint_01.png", false}, - {"AP11_interior_floor_tile_tex_01", "floor_tile_tex_01.png", false}, - {"AP11_interior_grey", "gray.png", false}, - {"AP11_interior_handholds_cp", "handholds_cpShape_tpAmbient_paint_05.png", false}, - {"AP11_interior_hatch_release_0Shape5", "hatch_release_0Shape5_tpAmbient_paint_02.png", false}, - {"AP11_interior_headrests_02", "headrests_02Shape_tpAmbient_paint_01.png", false}, - {"AP11_interior_hoses_black_01", "hoses_black_01Shape_tpAmbient_paint_01.png", false}, - {"AP11_interior_hoses_white_0Shape1", "hoses_white_0Shape1_tpAmbient_paint_01.png", false}, - {"AP11_interior_josticks1", "joysticks1Shape_tpAmbient_paint_01.png", false}, - {"AP11_interior_joysticks_fabric1", "joysticks_fabric1_Shape_tpAmbient_paint_01.png", false}, - {"AP11_interior_joystick_poles_lft_05", "joystick_poles_lft_05_paint_v002.png", false}, - {"AP11_interior_joystick_poles_lft_long_05", "joystick_poles_lft_long_05_paint_v002.png", false}, - {"AP11_interior_joystick_poles_rt_05", "joystick_poles_rt_05_paint_v002.png", false}, - {"AP11_interior_latch_mechanisms_01", "latch_mechanisms_01Shape_tpAmbient.png", false}, - {"AP11_interior_lower_push_buttons", "lower_push_buttonsShape_tpAmbient.png", false}, - {"AP11_interior_lower_walls_back", "lower_walls_back_paint_04.png", false}, - {"AP11_interior_lower_walls_boxes_head", "lower_walls_boxes_headShape_tpAmbient_paint_v001.png", false}, - {"AP11_interior_main_cp_left_smth_03", "main_cp_left_0Shape3_tpAmbient_paint_02.png", false}, - {"AP11_interior_main_cp_mid_smth_02", "main_cp_mid_smth_02Shape_tpAmbient_paint_02.png", false}, - {"AP11_interior_main_cp_rt_smth", "main_cp_rt_smthShape_tpAmbient_paint_02.png", false}, - {"AP11_interior_main_cp_wheels", "main_cp_wheelsShape_tpAmbient.png", false}, - {"AP11_interior_metal_brackets_under_hatch", "metal_brackets_under_hatchShape_tpAmbient.png", false}, - {"AP11_interior_metal_tunnel_parts", "metal_tunnel_partsShape_tpAmbient_paint_01.png", false}, - {"AP11_interior_metal_window_parts", "metal_window_partsShape_tpAmbient_paint_01.png", false}, - {"AP11_interior_middle_walls_05", "middle_walls_05_tpAmbient_paint_02.png", false}, - {"AP11_interior_middle_walls_0Shape8", "middle_walls_0Shape8_tpAmbient_paint_01.png", false}, - {"AP11_interior_mid_tunnel_parts", "mid_tunnel_parts_03Shape_tpAmbient_paint_02.png", false}, - {"AP11_interior_new_switch_rails1", "new_switch_rails1Shape_tpAmbient.png", false}, - {"AP11_interior_nozzles_02", "nozzles_02Shape_tpAmbient_paint_01.png", false}, - {"AP11_interior_outlet_fabric3", "outlet_fabric3Shape_tpAmbient_paint_02.png", false}, - {"AP11_interior_pole_end_02", "pole_end_02.png", false}, - {"AP11_interior_pole_end_03", "pole_end_03.png", false}, - {"AP11_interior_pole_tex_03", "pole_tex_03.png", false}, - {"AP11_interior_pole_tex_04", "pole_tex_04.png", false}, - {"AP11_interior_pole_tex_05", "pole_tex_05.png", false}, - {"AP11_interior_pole_tex_lower_01", "pole_tex_lower_01.png", false}, - {"AP11_interior_pole_under_seat_paint_01", "pole_under_seat_paint_01.png", false}, - {"AP11_interior_pole_under_seat_square_bar", "pole_under_seat_square_bar_paint_01.png", false}, - {"AP11_interior_push_switches_lft1", "push_switches_lft1Shape_tpAmbient.png", false}, - {"AP11_interior_random_small_parts_01", "random_small_parts_01Shape_tpAmbient_paint_02.png", false}, - {"AP11_interior_red", "red.png", false}, - {"AP11_interior_reticle_wheel_tp", "reticle_wheel_tpAmbient_paint_01.png", false}, - {"AP11_interior_rivet_paint_v001", "rivet_paint_v001.png", false}, - {"AP11_interior_seats_fabric", "seats_fabric_paint_01.png", false}, - {"AP11_interior_seat_left_tp", "seat_left_tpAmbient_paint_v001.png", false}, - {"AP11_interior_seat_lights_left", "seat_lights_left_Shape_tpAmbient_paint_v001.png", false}, - {"AP11_interior_seat_lights_rt", "seat_lights_rt_Shape_tpAmbient_paint_v001.png", false}, - {"AP11_interior_seat_middle_tp", "seat_middle_tpAmbient_paint_v001.png", false}, - {"AP11_interior_seat_poles_0Shape1", "seat_poles_0Shape1_tpAmbient_paint_01.png", false}, - {"AP11_interior_seat_pole_mirror_0Shape1", "seat_pole_mirror_0Shape1_tpAmbient_paint_01.png", false}, - {"AP11_interior_seat_rt_tp", "seat_rt_tpAmbient_paint_v001.png", false}, - {"AP11_interior_sextant_0Shape2", "sextant_0Shape2_tpAmbient.png", false}, - {"AP11_interior_switch_covers_main_middle1", "switch_covers_main_middle1Shape_tpAmbient.png", false}, - {"AP11_interior_switch_rails_lft", "switch_rails_lftShape_tpAmbient.png", false}, - {"AP11_interior_tunnel_main_cylinder1", "switch_rails_lftShape_tpAmbient.png", false}, - {"AP11_interior_tunnel_switches_01", "tunnel_switches_01Shape_tpAmbient.png", false}, - {"AP11_interior_tunnel_wheelsShape", "tunnel_wheelsShape_tpAmbient.png", false}, - {"AP11_interior_walls_mid_left", "walls_mid_leftShape_tpAmbient_paint_01.png", false}, - {"AP11_interior_windows_front_0Shape4", "windows_front_0Shape4_tpAmbient_paint_01.png", false} + { "AP11_int_back_wall_left", "AP11_int_back_wall_left.png", false }, + { "AP11_int_back_wall_right", "AP11_int_back_wall_right.png", false }, + { "AP11_interior_back_wall_top_0Shape3", "back_wall_top_0Shape3_tpAmbient_paint_03.png", false }, + { "AP11_interior_belt_buckles_02_L2", "belt_buckles_02_L2Shape_tpAmbient.png", false }, + { "AP11_interior_belt_straps_02", "belt_straps_02Shape_tpAmbient_paint_01.png", false }, + { "AP11_interior_black_push_buttons", "push_buttonsShape_tpAmbient.png", false }, + { "AP11_interior_bottom_boxes_03", "bottom_boxes_03_paint_01.png", false }, + { "AP11_interior_bottom_floor_tp", "bottom_floor_tpAmbient_paint_v002.png", false }, + { "AP11_interior_box_back_01", "box_back_01_paint_v001.png", false }, + { "AP11_interior_box_back_02", "box_back_02_paint_v001.png", false }, + { "AP11_interior_box_back_04", "box_back_04_paint_v001.png", false }, + { "AP11_interior_box_lft_lower_01", "box_lft_lower_01Shape_Diffuse_paint_v002.png", false }, + { "AP11_interior_box_lft_top", "box_lft_topShape_Diffuse_paint_v009.png", false }, + { "AP11_interior_box_mid_tp", "box_mid_tpDiffuse_paint_v001.png", false }, + { "AP11_interior_box_rt_top_02", "box_rt_top_02_paint_04.png", false }, + { "AP11_interior_brushed_blue_ano", "brushed_blue_ano_paint_01.png", false }, + { "AP11_interior_brushed_brass", "brushed_brass_paint_01.png", false }, + { "AP11_interior_brushed_grey_ano", "brushed_grey_ano_paint_02.png", false }, + { "AP11_interior_canvas_cover", "canvas_coverShape_tpAmbient_paint_01.png", false }, + { "AP11_interior_Channel_attachment", "Channel_attachment_Diffuse.png", false }, + { "AP11_interior_Channel_baseMetal", "Channel_baseMetal_Diffuse.png", false }, + { "AP11_interior_Channel_Material", "Channel_Material_Diffuse.png", false }, + { "AP11_interior_Channel_rsMaterial2", "Channel_rsMaterial2_Diffuse.png", false }, + { "AP11_interior_cloth_01", "cloth_01Shape_tpAmbient_paint_01.png", false }, + { "AP11_interior_coiled_hose", "coiled_hoseShape_tpAmbient.png", false }, + { "AP11_interior_control_panel_left_win_plates", "control_panel_left_win_platesShape_tpAmbient.png", false }, + { "AP11_interior_control_panel_rt_win_plates", "control_panel_rt_win_platesShape_tpAmbient.png", false }, + { "AP11_interior_copper_parts_main_cp", "copper_parts_main_cpShape_tpAmbient.png", false }, + { "AP11_interior_dials_main2", "dials_main2Shape_tpAmbient.png", false }, + { "AP11_interior_dials_t2", "dials_t2Shape_tpAmbient.png", false }, + { "AP11_interior_dial_fixes_01", "dial_fixes_01Shape_tpAmbient.png", false }, + { "AP11_interior_fire_ex_02", "fire_ex_02_paint_v001.png", false }, + { "AP11_interior_floor_panels_3", "floor_panels_3Shape_tpAmbient_paint_01.png", false }, + { "AP11_interior_floor_tile_tex_01", "floor_tile_tex_01.png", false }, + { "AP11_interior_grey", "gray.png", false }, + { "AP11_interior_handholds_cp", "handholds_cpShape_tpAmbient_paint_05.png", false }, + { "AP11_interior_hatch_release_0Shape5", "hatch_release_0Shape5_tpAmbient_paint_02.png", false }, + { "AP11_interior_headrests_02", "headrests_02Shape_tpAmbient_paint_01.png", false }, + { "AP11_interior_hoses_black_01", "hoses_black_01Shape_tpAmbient_paint_01.png", false }, + { "AP11_interior_hoses_white_0Shape1", "hoses_white_0Shape1_tpAmbient_paint_01.png", false }, + { "AP11_interior_josticks1", "joysticks1Shape_tpAmbient_paint_01.png", false }, + { "AP11_interior_joysticks_fabric1", "joysticks_fabric1_Shape_tpAmbient_paint_01.png", false }, + { "AP11_interior_joystick_poles_lft_05", "joystick_poles_lft_05_paint_v002.png", false }, + { "AP11_interior_joystick_poles_lft_long_05", "joystick_poles_lft_long_05_paint_v002.png", false }, + { "AP11_interior_joystick_poles_rt_05", "joystick_poles_rt_05_paint_v002.png", false }, + { "AP11_interior_latch_mechanisms_01", "latch_mechanisms_01Shape_tpAmbient.png", false }, + { "AP11_interior_lower_push_buttons", "lower_push_buttonsShape_tpAmbient.png", false }, + { "AP11_interior_lower_walls_back", "lower_walls_back_paint_04.png", false }, + { "AP11_interior_lower_walls_boxes_head", "lower_walls_boxes_headShape_tpAmbient_paint_v001.png", false }, + { "AP11_interior_main_cp_left_smth_03", "main_cp_left_0Shape3_tpAmbient_paint_02.png", false }, + { "AP11_interior_main_cp_mid_smth_02", "main_cp_mid_smth_02Shape_tpAmbient_paint_02.png", false }, + { "AP11_interior_main_cp_rt_smth", "main_cp_rt_smthShape_tpAmbient_paint_02.png", false }, + { "AP11_interior_main_cp_wheels", "main_cp_wheelsShape_tpAmbient.png", false }, + { "AP11_interior_metal_brackets_under_hatch", "metal_brackets_under_hatchShape_tpAmbient.png", false }, + { "AP11_interior_metal_tunnel_parts", "metal_tunnel_partsShape_tpAmbient_paint_01.png", false }, + { "AP11_interior_metal_window_parts", "metal_window_partsShape_tpAmbient_paint_01.png", false }, + { "AP11_interior_middle_walls_05", "middle_walls_05_tpAmbient_paint_02.png", false }, + { "AP11_interior_middle_walls_0Shape8", "middle_walls_0Shape8_tpAmbient_paint_01.png", false }, + { "AP11_interior_mid_tunnel_parts", "mid_tunnel_parts_03Shape_tpAmbient_paint_02.png", false }, + { "AP11_interior_new_switch_rails1", "new_switch_rails1Shape_tpAmbient.png", false }, + { "AP11_interior_nozzles_02", "nozzles_02Shape_tpAmbient_paint_01.png", false }, + { "AP11_interior_outlet_fabric3", "outlet_fabric3Shape_tpAmbient_paint_02.png", false }, + { "AP11_interior_pole_end_02", "pole_end_02.png", false }, + { "AP11_interior_pole_end_03", "pole_end_03.png", false }, + { "AP11_interior_pole_tex_03", "pole_tex_03.png", false }, + { "AP11_interior_pole_tex_04", "pole_tex_04.png", false }, + { "AP11_interior_pole_tex_05", "pole_tex_05.png", false }, + { "AP11_interior_pole_tex_lower_01", "pole_tex_lower_01.png", false }, + { "AP11_interior_pole_under_seat_paint_01", "pole_under_seat_paint_01.png", false }, + { "AP11_interior_pole_under_seat_square_bar", "pole_under_seat_square_bar_paint_01.png", false }, + { "AP11_interior_push_switches_lft1", "push_switches_lft1Shape_tpAmbient.png", false }, + { "AP11_interior_random_small_parts_01", "random_small_parts_01Shape_tpAmbient_paint_02.png", false }, + { "AP11_interior_red", "red.png", false }, + { "AP11_interior_reticle_wheel_tp", "reticle_wheel_tpAmbient_paint_01.png", false }, + { "AP11_interior_rivet_paint_v001", "rivet_paint_v001.png", false }, + { "AP11_interior_seats_fabric", "seats_fabric_paint_01.png", false }, + { "AP11_interior_seat_left_tp", "seat_left_tpAmbient_paint_v001.png", false }, + { "AP11_interior_seat_lights_left", "seat_lights_left_Shape_tpAmbient_paint_v001.png", false }, + { "AP11_interior_seat_lights_rt", "seat_lights_rt_Shape_tpAmbient_paint_v001.png", false }, + { "AP11_interior_seat_middle_tp", "seat_middle_tpAmbient_paint_v001.png", false }, + { "AP11_interior_seat_poles_0Shape1", "seat_poles_0Shape1_tpAmbient_paint_01.png", false }, + { "AP11_interior_seat_pole_mirror_0Shape1", "seat_pole_mirror_0Shape1_tpAmbient_paint_01.png", false }, + { "AP11_interior_seat_rt_tp", "seat_rt_tpAmbient_paint_v001.png", false }, + { "AP11_interior_sextant_0Shape2", "sextant_0Shape2_tpAmbient.png", false }, + { "AP11_interior_switch_covers_main_middle1", "switch_covers_main_middle1Shape_tpAmbient.png", false }, + { "AP11_interior_switch_rails_lft", "switch_rails_lftShape_tpAmbient.png", false }, + { "AP11_interior_tunnel_main_cylinder1", "switch_rails_lftShape_tpAmbient.png", false }, + { "AP11_interior_tunnel_switches_01", "tunnel_switches_01Shape_tpAmbient.png", false }, + { "AP11_interior_tunnel_wheelsShape", "tunnel_wheelsShape_tpAmbient.png", false }, + { "AP11_interior_walls_mid_left", "walls_mid_leftShape_tpAmbient_paint_01.png", false }, + { "AP11_interior_windows_front_0Shape4", "windows_front_0Shape4_tpAmbient_paint_01.png", false } } -asset.export("registerCsm", function (asset, parentNodeIdentifier) +asset.export("createCsmModel", function (parentNodeIdentifier) local parts = {} for i, info in ipairs(partsInfo) do - parts[#parts + 1] = assetHelper.createModelPart( + parts[#parts + 1] = asset_helper.createModelPart( parentNodeIdentifier, - sunTransforms.SolarSystemBarycenter.Identifier, + sun_transforms.SolarSystemBarycenter.Identifier, models, info[1], info[2], info[3] ) end - assetHelper.registerSceneGraphNodesAndExport(asset, parts) + return parts end) -asset.export("registerCsmFull", function (asset, parentNodeIdentifier) +asset.export("createCsmModelFull", function (parentNodeIdentifier) local parts = {} for i, info in ipairs(partsInfoFull) do - parts[#parts + 1] = assetHelper.createModelPart( + parts[#parts + 1] = asset_helper.createModelPart( parentNodeIdentifier, - sunTransforms.SolarSystemBarycenter.Identifier, + sun_transforms.SolarSystemBarycenter.Identifier, models, info[1], info[2], info[3] ) end - assetHelper.registerSceneGraphNodesAndExport(asset, parts) -end) \ No newline at end of file + return parts +end) diff --git a/data/assets/scene/solarsystem/missions/apollo/apollo_globebrowsing.asset b/data/assets/scene/solarsystem/missions/apollo/apollo_globebrowsing.asset index fb9f1e14c5..c9664a8eeb 100644 --- a/data/assets/scene/solarsystem/missions/apollo/apollo_globebrowsing.asset +++ b/data/assets/scene/solarsystem/missions/apollo/apollo_globebrowsing.asset @@ -1,5 +1,5 @@ --apollo_globebrowsing.asset - +local moon_transforms = asset.require('scene/solarsystem/planets/earth/moon/moon') local heightmaps = asset.syncedResource({ Name = "Apollo Globebrowsing Heightmaps", @@ -30,8 +30,8 @@ local stations = asset.syncedResource({ }) asset.onInitialize(function () - openspace.globebrowsing.addBlendingLayersFromDirectory(heightmaps, "Moon") - openspace.globebrowsing.addBlendingLayersFromDirectory(basemaps, "Moon") - openspace.globebrowsing.addBlendingLayersFromDirectory(naclighting, "Moon") - openspace.globebrowsing.addBlendingLayersFromDirectory(stations, "Moon") + openspace.globebrowsing.addBlendingLayersFromDirectory(heightmaps, moon_transforms.Moon.Identifier) + openspace.globebrowsing.addBlendingLayersFromDirectory(basemaps, moon_transforms.Moon.Identifier) + openspace.globebrowsing.addBlendingLayersFromDirectory(naclighting, moon_transforms.Moon.Identifier) + openspace.globebrowsing.addBlendingLayersFromDirectory(stations, moon_transforms.Moon.Identifier) end) diff --git a/data/assets/scene/solarsystem/missions/apollo/apollo_lem.asset b/data/assets/scene/solarsystem/missions/apollo/apollo_lem.asset index 4a7a820d76..9fb6f204ef 100644 --- a/data/assets/scene/solarsystem/missions/apollo/apollo_lem.asset +++ b/data/assets/scene/solarsystem/missions/apollo/apollo_lem.asset @@ -3,11 +3,11 @@ -- This asset exports a function to create an Apollo Lunar Excursion Module (LEM). -- Instead of hard-coding the scene graph node parent, -- client assets can decide which object that the LEM should be attached to. --- Usage example: registerLem(asset, Apollo11Lem.Idenfitier) +-- Usage example: createLem(Apollo11Lem.Idenfitier) -- ...where Apollo11Lem is the scene graph node identifier to attach the LEM to. -local assetHelper = asset.require('util/asset_helper') -local sunTransforms = asset.require('scene/solarsystem/sun/transforms') +local asset_helper = asset.require('util/asset_helper') +local sun_transforms = asset.require('scene/solarsystem/sun/transforms') local models = asset.syncedResource({ Name = "Apollo Models", @@ -35,17 +35,17 @@ local partsInfo = { } -asset.export("registerLem", function (asset, parentNodeIdentifier) +asset.export("createLem", function (parentNodeIdentifier) local parts = {} for i, info in ipairs(partsInfo) do - parts[#parts + 1] = assetHelper.createModelPart( + parts[#parts + 1] = asset_helper.createModelPart( parentNodeIdentifier, - sunTransforms.SolarSystemBarycenter.Identifier, + sun_transforms.SolarSystemBarycenter.Identifier, models, info[1], info[2], info[3] ) end - assetHelper.registerSceneGraphNodesAndExport(asset, parts) + return parts end) diff --git a/data/assets/scene/solarsystem/missions/apollo/insignias_map.asset b/data/assets/scene/solarsystem/missions/apollo/insignias_map.asset index 7aa0159960..6df2f26d4b 100644 --- a/data/assets/scene/solarsystem/missions/apollo/insignias_map.asset +++ b/data/assets/scene/solarsystem/missions/apollo/insignias_map.asset @@ -2,7 +2,7 @@ -- The insignias are invisible by default, but can be enabled using shown or hidden using -- the exported functions `showInsignias(interpolationDuration)` and `hideInsignias(interpolationDuration)`. -local assetHelper = asset.require('util/asset_helper') +local asset_helper = asset.require('util/asset_helper') local insigniasPath = asset.syncedResource({ Name = "Apollo Insignias", @@ -18,37 +18,37 @@ local landingData = { Name = "Apollo 11", Name = "Apollo 11", Texture = "apollo11.png", - LunarModule = {0.67409, 23.47298, 0.0}, + LunarModule = { 0.67409, 23.47298, 0.0 } }, { Identifier = "Apollo12", Name = "Apollo 12", Texture = "apollo12.png", - LunarModule = {-3.01381, -23.41930, 0.0} + LunarModule = { -3.01381, -23.41930, 0.0 } }, { Identifier = "Apollo14", Name = "Apollo 14", Texture = "apollo14.png", - LunarModule = {-3.64544, -17.47139, 0.0} + LunarModule = { -3.64544, -17.47139, 0.0 } }, { Identifier = "Apollo15", Name = "Apollo 15", Texture = "apollo15.png", - LunarModule = {26.13224, 3.63400, 0.0} + LunarModule = { 26.13224, 3.63400, 0.0 } }, { Identifier = "Apollo16", Name = "Apollo 16", Texture = "apollo16.png", - LunarModule = {-8.97341, 15.49859, 0.0} + LunarModule = { -8.97341, 15.49859, 0.0 } }, { Identifier = "Apollo17", Name = "Apollo 17", Texture = "apollo17.png", - LunarModule = {20.18809, 30.77475, 0.0} + LunarModule = { 20.18809, 30.77475, 0.0 } } } @@ -117,4 +117,4 @@ asset.export('hideInsignias', function (interpolationDuration) openspace.setPropertyValue("Scene.Apollo*Insignia.Renderable.Opacity", 0, interpolationDuration) end) -assetHelper.registerSceneGraphNodesAndExport(asset, nodes) \ No newline at end of file +asset_helper.registerSceneGraphNodesAndExport(asset, nodes) diff --git a/modules/base/rendering/renderablemodel.cpp b/modules/base/rendering/renderablemodel.cpp index cec22961fc..6e7ca13dd2 100644 --- a/modules/base/rendering/renderablemodel.cpp +++ b/modules/base/rendering/renderablemodel.cpp @@ -262,6 +262,7 @@ RenderableModel::RenderableModel(const ghoul::Dictionary& dictionary) } } + addPropertySubOwner(_lightSourcePropertyOwner); addPropertySubOwner(_geometry.get()); @@ -278,14 +279,13 @@ RenderableModel::RenderableModel(const ghoul::Dictionary& dictionary) addProperty(_rotationVec); _rotationVec.onChange([this]() { - glm::vec3 degreeVector = _rotationVec; - glm::vec3 radianVector = glm::vec3( - glm::radians(degreeVector.x), - glm::radians(degreeVector.y), - glm::radians(degreeVector.z) - ); - _modelTransform = glm::mat4_cast(glm::quat(radianVector)); + _modelTransform = glm::mat4_cast(glm::quat(glm::radians(_rotationVec.value()))); }); + + + if (dictionary.hasKey(RotationVecInfo.identifier)) { + _rotationVec = dictionary.value(RotationVecInfo.identifier); + } } bool RenderableModel::isReady() const { From dba93380df8dac291bd0d974259031224d0d86ab Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Sat, 13 Jun 2020 14:41:42 +0200 Subject: [PATCH 35/48] Move keybinds to a separate asset file --- .../constellations/constellation_art.asset | 40 +------------------ .../constellation_keybinds.asset | 38 ++++++++++++++++++ .../generate_constellations.asset | 19 +++++---- 3 files changed, 49 insertions(+), 48 deletions(-) create mode 100644 data/assets/scene/milkyway/constellations/constellation_keybinds.asset diff --git a/data/assets/scene/milkyway/constellations/constellation_art.asset b/data/assets/scene/milkyway/constellations/constellation_art.asset index e0a85b4a8e..b4e7b8bc1f 100644 --- a/data/assets/scene/milkyway/constellations/constellation_art.asset +++ b/data/assets/scene/milkyway/constellations/constellation_art.asset @@ -1,53 +1,17 @@ -local assetHelper = asset.require('util/asset_helper') -local sceneHelper = asset.require('util/scene_helper') -local constellationHelper = asset.require('./generate_constellations') +local constellation_helper = asset.require('./generate_constellations') local constellationsCSV = asset.localResource('constellation_data.csv') local nodes = {} -local Keybindings = { - { - Key = "c", - Name = "Show Constellation Art", - Command = "openspace.setPropertyValue('Scene.Constellation Art*.Renderable.Opacity',0);" .. - "openspace.setPropertyValue('Scene.Constellation Art*.Renderable.Enabled', true);" .. - "openspace.setPropertyValue('Scene.Constellation Art*.Renderable.Opacity', 0.1,2);", - Documentation = "Enables and fades up constellation art work", - GuiPath = "/Rendering", - Local = false - }, - { - Key = "shift+c", - Name = "Hide Constellation Art", - Command = "openspace.setPropertyValue('Scene.Constellation Art*.Renderable.Opacity', 0, 2);", - Documentation = "Fades out constellation artwork", - GuiPath = "/Rendering", - Local = false - }, - { - Key = "ctrl+c", - Name = "Disable Constellation Art", - Command = "openspace.setPropertyValue('Scene.Constellation Art*.Renderable.Enabled', false);", - Documentation = "Disable constellation artwork", - GuiPath = "/Rendering", - Local = false - } -} - asset.onInitialize(function () - - sceneHelper.bindKeys(Keybindings) - nodes = constellationHelper.getConstellations('Constellation Art', constellationsCSV) - + nodes = constellation_helper.createConstellations('Constellation Art', constellationsCSV) for _, n in ipairs(nodes) do openspace.addSceneGraphNode(n); end end) asset.onDeinitialize(function () - sceneHelper.unbindKeys(Keybindings) - for _, n in ipairs(nodes) do openspace.removeSceneGraphNode(n.Identifier); end diff --git a/data/assets/scene/milkyway/constellations/constellation_keybinds.asset b/data/assets/scene/milkyway/constellations/constellation_keybinds.asset new file mode 100644 index 0000000000..f527e59fb4 --- /dev/null +++ b/data/assets/scene/milkyway/constellations/constellation_keybinds.asset @@ -0,0 +1,38 @@ +local scene_helper = asset.require('util/scene_helper') + +local Keybindings = { + { + Key = "c", + Name = "Show Constellation Art", + Command = "openspace.setPropertyValue('Scene.Constellation Art*.Renderable.Opacity', 0);" .. + "openspace.setPropertyValue('Scene.Constellation Art*.Renderable.Enabled', true);" .. + "openspace.setPropertyValue('Scene.Constellation Art*.Renderable.Opacity', 0.1, 2);", + Documentation = "Enables and fades up constellation art work", + GuiPath = "/Rendering", + Local = false + }, + { + Key = "SHIFT+c", + Name = "Hide Constellation Art", + Command = "openspace.setPropertyValue('Scene.Constellation Art*.Renderable.Opacity', 0, 2);", + Documentation = "Fades out constellation artwork", + GuiPath = "/Rendering", + Local = false + }, + { + Key = "CTRL+c", + Name = "Disable Constellation Art", + Command = "openspace.setPropertyValue('Scene.Constellation Art*.Renderable.Enabled', false);", + Documentation = "Disable constellation artwork", + GuiPath = "/Rendering", + Local = false + } +} + +asset.onInitialize(function () + scene_helper.bindKeys(Keybindings) +end) + +asset.onDeinitialize(function () + scene_helper.unbindKeys(Keybindings) +end) diff --git a/data/assets/scene/milkyway/constellations/generate_constellations.asset b/data/assets/scene/milkyway/constellations/generate_constellations.asset index 05e42db473..696215b1dd 100644 --- a/data/assets/scene/milkyway/constellations/generate_constellations.asset +++ b/data/assets/scene/milkyway/constellations/generate_constellations.asset @@ -9,8 +9,7 @@ local images = asset.syncedResource({ }) --function that reads the file - -local getConstellations = function (guiPath, constellationfile) +local createConstellations = function (guiPath, constellationfile) local genConstellations = {}; --skip the first line local notFirstLine = false; @@ -26,7 +25,7 @@ local getConstellations = function (guiPath, constellationfile) -- describes the data local matchstring = '(.-),(.-),(.-),(.-),(.-),(.-),(.-),(.-),(.-),(.-),(.-),(.-)$' local group, abbreviation, name, x, y, z, scale, imageName, rotX, rotY, rotZ, centerStar = line:match(matchstring) - local magVec = math.sqrt(x*x+y*y+z*z) + local magVec = math.sqrt(x*x + y*y + z*z) local normx = x/magVec local normy = y/magVec local normz = z/magVec @@ -40,11 +39,15 @@ local getConstellations = function (guiPath, constellationfile) Translation = { Type = "StaticTranslation", -- position is in parsecs from the SolarSystemBarycenter, so convert to meters - Position = {normx*PARSEC_CONSTANT*distanceMultiplier, normy*PARSEC_CONSTANT*distanceMultiplier, normz*PARSEC_CONSTANT*distanceMultiplier} + Position = { + normx * PARSEC_CONSTANT * distanceMultiplier, + normy * PARSEC_CONSTANT * distanceMultiplier, + normz * PARSEC_CONSTANT * distanceMultiplier + } }, Rotation = { Type = "StaticRotation", - Rotation = {tonumber(rotX),tonumber(rotY),tonumber(rotZ)} + Rotation = { tonumber(rotX), tonumber(rotY), tonumber(rotZ) } } }, @@ -63,13 +66,9 @@ local getConstellations = function (guiPath, constellationfile) Name = name .. ' Image', Path = '/Milky Way/' .. guiPath } - } - table.insert(genConstellations, aconstellation); - - else notFirstLine = true end @@ -77,4 +76,4 @@ local getConstellations = function (guiPath, constellationfile) return genConstellations end -asset.export('getConstellations', getConstellations) +asset.export('createConstellations', createConstellations) From a763ffd1021976885401f289ac9bfffa87110b4f Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Sat, 13 Jun 2020 14:45:49 +0200 Subject: [PATCH 36/48] Add meta information for the constellation art --- .../milkyway/constellations/constellation_art.asset | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/data/assets/scene/milkyway/constellations/constellation_art.asset b/data/assets/scene/milkyway/constellations/constellation_art.asset index b4e7b8bc1f..d5771a6cc5 100644 --- a/data/assets/scene/milkyway/constellations/constellation_art.asset +++ b/data/assets/scene/milkyway/constellations/constellation_art.asset @@ -16,3 +16,13 @@ asset.onDeinitialize(function () openspace.removeSceneGraphNode(n.Identifier); end end) + + +asset.meta = { + Name = "Constellation Images", + Version = "1.0", + Description = "Artistic images depicting the constellations", + Author = "James Hedberg", + URL = "ccnyplanetarium.org" + License = "" +} From 1d4da396f3220a17dd131cc832b4dd1cf0a3e90e Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Sat, 13 Jun 2020 15:05:02 +0200 Subject: [PATCH 37/48] Tiny Lua syntax fix --- .../scene/milkyway/constellations/constellation_art.asset | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/assets/scene/milkyway/constellations/constellation_art.asset b/data/assets/scene/milkyway/constellations/constellation_art.asset index d5771a6cc5..28dd39689f 100644 --- a/data/assets/scene/milkyway/constellations/constellation_art.asset +++ b/data/assets/scene/milkyway/constellations/constellation_art.asset @@ -23,6 +23,6 @@ asset.meta = { Version = "1.0", Description = "Artistic images depicting the constellations", Author = "James Hedberg", - URL = "ccnyplanetarium.org" + URL = "ccnyplanetarium.org", License = "" } From e2ead0f5672479075585d677feaa0abcc7ba1865 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Sat, 13 Jun 2020 16:11:27 +0200 Subject: [PATCH 38/48] Some small cleanup --- data/assets/mars.scene | 68 +++--- .../missions/insight/shortcuts.asset | 4 +- .../missions/perseverance/model.asset | 200 +++++++----------- .../missions/perseverance/shortcuts.asset | 8 +- .../missions/perseverance/trail.asset | 12 +- .../missions/perseverance/transforms.asset | 88 ++++---- data/assets/util/scene_helper.asset | 2 +- 7 files changed, 169 insertions(+), 213 deletions(-) diff --git a/data/assets/mars.scene b/data/assets/mars.scene index e8da3de029..0d7a8b34c8 100644 --- a/data/assets/mars.scene +++ b/data/assets/mars.scene @@ -8,54 +8,54 @@ local insightAsset = asset.require('scene/solarsystem/missions/insight/edl') local insightShortcuts = asset.require('scene/solarsystem/missions/insight/shortcuts') local insightEDLShortcuts = sceneHelper.extractShortcuts({"Insight Height Offset", - "Enable HiRISE", - "Insight EDL Time", - "Insight EDL NavigationState"}, - insightShortcuts.Shortcuts) + "Enable HiRISE", + "Insight EDL Time", + "Insight EDL NavigationState"}, + insightShortcuts.Shortcuts) local insightDisableShortcuts = sceneHelper.extractShortcuts({ - "Default Height Offset", - "Disable HiRISE"}, - insightShortcuts.Shortcuts) + "Default Height Offset", + "Disable HiRISE"}, + insightShortcuts.Shortcuts) local PerseverenceLandedShortcuts = sceneHelper.extractShortcuts({ - "Perseverance Height Offset", - "Perseverance landed time", - "Enable HiRISE"}, - perseveranceShortcuts.Shortcuts) + "Perseverance Height Offset", + "Perseverance landed time", + "Enable HiRISE"}, + perseveranceShortcuts.Shortcuts) local Keybindings = { - sceneHelper.createKeyBindFromShortcuts("i", - insightEDLShortcuts, - "/Missions/Insight", - "Set and goto Insight Landing", - "Setup scene for insight EDL" - ), - sceneHelper.createKeyBindFromShortcuts("SHIFT+i", - insightDisableShortcuts, - "/Missions/Insight", - "Unset Insight Landing", - "Disable Mars layer settings used for insight EDL" - ), - sceneHelper.createKeyBindFromShortcuts("p", - PerseverenceLandedShortcuts, - "/Missions/Perseverance" - ) + sceneHelper.createKeyBindFromShortcuts("i", + insightEDLShortcuts, + "/Missions/Insight", + "Set and goto Insight Landing", + "Setup scene for insight EDL" + ), + sceneHelper.createKeyBindFromShortcuts("SHIFT+i", + insightDisableShortcuts, + "/Missions/Insight", + "Unset Insight Landing", + "Disable Mars layer settings used for insight EDL" + ), + sceneHelper.createKeyBindFromShortcuts("p", + PerseverenceLandedShortcuts, + "/Missions/Perseverance" + ) } asset.onInitialize(function () - local now = openspace.time.currentWallTime() - openspace.time.setTime(now) + local now = openspace.time.currentWallTime() + openspace.time.setTime(now) - sceneHelper.bindKeys(Keybindings) + sceneHelper.bindKeys(Keybindings) - openspace.globebrowsing.goToGeo("Mars", 58.5877, 16.1924, 8000000) + openspace.globebrowsing.goToGeo("Mars", 58.5877, 16.1924, 8000000) - openspace.markInterestingNodes({ "Mars", insightAsset.Insight.Identifier, "Perseverance" }) + openspace.markInterestingNodes({ "Mars", insightAsset.Insight.Identifier, "Perseverance" }) end) asset.onDeinitialize(function () - sceneHelper.unbindKeys(Keybindings) - openspace.removeInterestingNodes({ "Mars", insightAsset.Insight.Identifier}) + sceneHelper.unbindKeys(Keybindings) + openspace.removeInterestingNodes({ "Mars", insightAsset.Insight.Identifier}) end) diff --git a/data/assets/scene/solarsystem/missions/insight/shortcuts.asset b/data/assets/scene/solarsystem/missions/insight/shortcuts.asset index 200b231d6e..a5154e9fca 100644 --- a/data/assets/scene/solarsystem/missions/insight/shortcuts.asset +++ b/data/assets/scene/solarsystem/missions/insight/shortcuts.asset @@ -3,8 +3,8 @@ local InsightEntryTime = "2018 NOV 26 19:39:03.68" local insightNavigationSate = "{" .. - "Anchor = 'Insight'," .. - "Pitch = 0.567457E-4," .. + "Anchor = 'Insight'," .. + "Pitch = 0.567457E-4," .. "Position = { 1.240506E1,-1.369270E1,-2.423553E0 }," .. "ReferenceFrame = 'Root',".. "Up = { 0.441211E0,0.247019E0,0.862737E0 }," .. diff --git a/data/assets/scene/solarsystem/missions/perseverance/model.asset b/data/assets/scene/solarsystem/missions/perseverance/model.asset index 42211bef42..10ce0c52fa 100644 --- a/data/assets/scene/solarsystem/missions/perseverance/model.asset +++ b/data/assets/scene/solarsystem/missions/perseverance/model.asset @@ -19,14 +19,14 @@ local LightSources = { } } -local models = asset.syncedResource({ +local models = asset.syncedResource({ Name = "Mars 2020 Kernels", Type = "HttpSynchronization", Identifier = "perseverance_models", Version = 1 }) -local textures = asset.syncedResource({ +local textures = asset.syncedResource({ Name = "Mars 2020 Kernels", Type = "HttpSynchronization", Identifier = "perseverance_textures", @@ -48,14 +48,14 @@ local PerseveranceModel = { Identifier = "PerseveranceModel", Parent = Perseverance.Identifier, GUI = { - Name = "Perseverance Model", + Name = "Perseverance Model", Path = "/Solar System/Missions/Perseverance" } } -- Perseverance Model Instruments -- local Body = { - Identifier = "body", + Identifier = "Perseverance_body", Parent = PerseveranceModel.Identifier, Renderable = { Type = "RenderableModel", @@ -76,7 +76,7 @@ local Body = { } local Body_detail = { - Identifier = "Body_detail", + Identifier = "Perseverance_Body_detail", Parent = Body.Identifier, Renderable = { Type = "RenderableModel", @@ -97,7 +97,7 @@ local Body_detail = { } local Body_staticParts_1 = { - Identifier = "Body_staticParts_1", + Identifier = "Perseverance_Body_staticParts_1", Parent = Body.Identifier, Renderable = { Type = "RenderableModel", @@ -117,7 +117,7 @@ local Body_staticParts_1 = { } local Body_staticParts_2 = { - Identifier = "Body_staticParts_2", + Identifier = "Perseverance_Body_staticParts_2", Parent = Body.Identifier, Renderable = { Type = "RenderableModel", @@ -137,7 +137,7 @@ local Body_staticParts_2 = { } local Body_staticParts_3 = { - Identifier = "Body_staticParts_3", + Identifier = "Perseverance_Body_staticParts_3", Parent = Body.Identifier, Renderable = { Type = "RenderableModel", @@ -157,7 +157,7 @@ local Body_staticParts_3 = { } local Body_staticParts_4 = { - Identifier = "Body_staticParts_4", + Identifier = "Perseverance_Body_staticParts_4", Parent = Body.Identifier, Renderable = { Type = "RenderableModel", @@ -177,7 +177,7 @@ local Body_staticParts_4 = { } local Body_staticParts_5 = { - Identifier = "Body_staticParts_5", + Identifier = "Perseverance_Body_staticParts_5", Parent = Body.Identifier, Renderable = { Type = "RenderableModel", @@ -198,7 +198,7 @@ local Body_staticParts_5 = { -- RA AZ local RA_Shoulder_AZ = { - Identifier = "RA_Shoulder_AZ", + Identifier = "Perseverance_RA_Shoulder_AZ", Parent = transforms.RA_Shoulder_AZ_Location.Identifier, Renderable = { Type = "RenderableModel", @@ -218,7 +218,7 @@ local RA_Shoulder_AZ = { } local RA_Shoulder_AZ_detail_1 = { - Identifier = "RA_Shoulder_AZ_detail_1", + Identifier = "Perseverance_RA_Shoulder_AZ_detail_1", Parent = RA_Shoulder_AZ.Identifier, Renderable = { Type = "RenderableModel", @@ -238,7 +238,7 @@ local RA_Shoulder_AZ_detail_1 = { } local RA_Shoulder_AZ_detail_2 = { - Identifier = "RA_Shoulder_AZ_detail_2", + Identifier = "Perseverance_RA_Shoulder_AZ_detail_2", Parent = RA_Shoulder_AZ.Identifier, Renderable = { Type = "RenderableModel", @@ -259,7 +259,7 @@ local RA_Shoulder_AZ_detail_2 = { ---- RA EL local RA_Shoulder_EL_1 = { - Identifier = "RA_Shoulder_EL_1", + Identifier = "Perseverance_RA_Shoulder_EL_1", Parent = transforms.RA_Shoulder_EL_Location.Identifier, Renderable = { Type = "RenderableModel", @@ -280,7 +280,7 @@ local RA_Shoulder_EL_1 = { local RA_Shoulder_EL_detail_1 = { - Identifier = "RA_Shoulder_EL_detail_1", + Identifier = "Perseverance_RA_Shoulder_EL_detail_1", Parent = RA_Shoulder_EL_1.Identifier, Renderable = { Type = "RenderableModel", @@ -300,7 +300,7 @@ local RA_Shoulder_EL_detail_1 = { } local RA_Shoulder_EL_detail_2 = { - Identifier = "RA_Shoulder_EL_detail_2", + Identifier = "Perseverance_RA_Shoulder_EL_detail_2", Parent = RA_Shoulder_EL_1.Identifier, Renderable = { Type = "RenderableModel", @@ -322,7 +322,7 @@ local RA_Shoulder_EL_detail_2 = { local RA_Shoulder_EL_2 = { - Identifier = "RA_Shoulder_EL_2", + Identifier = "Perseverance_RA_Shoulder_EL_2", Parent = RA_Shoulder_EL_1.Identifier, Renderable = { Type = "RenderableModel", @@ -343,7 +343,7 @@ local RA_Shoulder_EL_2 = { -- RA ELBOW local RA_Elbow_1 = { - Identifier = "RA_Elbow_1", + Identifier = "Perseverance_RA_Elbow_1", Parent = transforms.RA_Elbow_Location.Identifier, Renderable = { Type = "RenderableModel", @@ -363,7 +363,7 @@ local RA_Elbow_1 = { } local RA_Elbow_detail_1 = { - Identifier = "RA_Elbow_detail_1", + Identifier = "Perseverance_RA_Elbow_detail_1", Parent = RA_Elbow_1.Identifier, Renderable = { Type = "RenderableModel", @@ -383,7 +383,7 @@ local RA_Elbow_detail_1 = { } local RA_Elbow_detail_2 = { - Identifier = "RA_Elbow_detail_2", + Identifier = "Perseverance_RA_Elbow_detail_2", Parent = RA_Elbow_1.Identifier, Renderable = { Type = "RenderableModel", @@ -404,7 +404,7 @@ local RA_Elbow_detail_2 = { local RA_Elbow_2 = { - Identifier = "RA_Elbow_2", + Identifier = "Perseverance_RA_Elbow_2", Parent = RA_Elbow_1.Identifier, Renderable = { Type = "RenderableModel", @@ -426,7 +426,7 @@ local RA_Elbow_2 = { -- RA WRIST local RA_Wrist = { - Identifier = "RA_Wrist", + Identifier = "Perseverance_RA_Wrist", Parent = transforms.RA_Wrist_Location.Identifier, Renderable = { Type = "RenderableModel", @@ -446,7 +446,7 @@ local RA_Wrist = { } local RA_Wrist_details = { - Identifier = "RA_Wrist_details", + Identifier = "Perseverance_RA_Wrist_details", Parent = RA_Wrist.Identifier, Renderable = { Type = "RenderableModel", @@ -467,7 +467,7 @@ local RA_Wrist_details = { -- RA TURRET local RA_Turret = { - Identifier = "RA_Turret", + Identifier = "Perseverance_RA_Turret", Parent = transforms.RA_Turret_Location.Identifier, Renderable = { Type = "RenderableModel", @@ -488,7 +488,7 @@ local RA_Turret = { local RA_Turret_details_1 = { - Identifier = "RA_Turret_details_1", + Identifier = "Perseverance_RA_Turret_details_1", Parent = RA_Turret.Identifier, Renderable = { Type = "RenderableModel", @@ -508,7 +508,7 @@ local RA_Turret_details_1 = { } local RA_Turret_details_2 = { - Identifier = "RA_Turret_details_2", + Identifier = "Perseverance_RA_Turret_details_2", Parent = RA_Turret.Identifier, Renderable = { Type = "RenderableModel", @@ -529,7 +529,7 @@ local RA_Turret_details_2 = { -- MastCam-- local RSM_root = { - Identifier = "RSM_root", + Identifier = "Perseverance_RSM_root", Parent = transforms.RSM_ROOT_Location.Identifier, Renderable = { Type = "RenderableModel", @@ -550,7 +550,7 @@ local RSM_root = { } local RSM_AZ = { - Identifier = "RSM_AZ", + Identifier = "Perseverance_RSM_AZ", Parent = transforms.RSM_AZ_Location.Identifier, Renderable = { Type = "RenderableModel", @@ -570,7 +570,7 @@ local RSM_AZ = { } local RSM_EL = { - Identifier = "RSM_EL", + Identifier = "Perseverance_RSM_EL", Parent = transforms.RSM_EL_Location.Identifier, Renderable = { Type = "RenderableModel", @@ -591,7 +591,7 @@ local RSM_EL = { ---- HGA ---- local HGA_AZ = { - Identifier = "HGA_AZ", + Identifier = "Perseverance_HGA_AZ", Parent = transforms.HGA_AZ_Location.Identifier, Renderable = { Type = "RenderableModel", @@ -611,7 +611,7 @@ local HGA_AZ = { } local HGA_EL = { - Identifier = "HGA_EL", + Identifier = "Perseverance_HGA_EL", Parent = transforms.HGA_EL_Location.Identifier, Renderable = { Type = "RenderableModel", @@ -632,7 +632,7 @@ local HGA_EL = { ---- SAM & CHEMIN ---- local SAM_Cover_1 = { - Identifier = "SAM_Cover_1", + Identifier = "Perseverance_SAM_Cover_1", Parent = transforms.SAM_Cover_1_Location.Identifier, Renderable = { Type = "RenderableModel", @@ -652,7 +652,7 @@ local SAM_Cover_1 = { } local SAM_Cover_2 = { - Identifier = "SAM_Cover_2", + Identifier = "Perseverance_SAM_Cover_2", Parent = transforms.SAM_Cover_2_Location.Identifier, Renderable = { Type = "RenderableModel", @@ -672,7 +672,7 @@ local SAM_Cover_2 = { } local CHEMIN_Bottom = { - Identifier = "CHEMIN_Bottom", + Identifier = "Perseverance_CHEMIN_Bottom", Parent = transforms.CHEMIN_Location.Identifier, Renderable = { Type = "RenderableModel", @@ -693,7 +693,7 @@ local CHEMIN_Bottom = { -- Wheels -- local Wheel_Base = { - Identifier = "Wheel_Base", + Identifier = "Perseverance_Wheel_Base", Parent = transforms.Wheel_base_Location.Identifier, Renderable = { Type = "RenderableModel", @@ -712,7 +712,7 @@ local Wheel_Base = { } } local Wheel_Base_2 = { - Identifier = "Wheel_Base_2", + Identifier = "Perseverance_Wheel_Base_2", Parent = Wheel_Base.Identifier, Renderable = { Type = "RenderableModel", @@ -733,7 +733,7 @@ local Wheel_Base_2 = { -- LEFT SIDE -- local Wheel_Leg_1_L = { - Identifier = "Wheel_Leg_1_L", + Identifier = "Perseverance_Wheel_Leg_1_L", Parent = transforms.Leg_1_L_Location.Identifier, Renderable = { Type = "RenderableModel", @@ -753,7 +753,7 @@ local Wheel_Leg_1_L = { } local Wheel_Leg_1A_L_detail = { - Identifier = "Wheel_Leg_1A_L_detail", + Identifier = "Perseverance_Wheel_Leg_1A_L_detail", Parent = Wheel_Leg_1_L.Identifier, Renderable = { Type = "RenderableModel", @@ -773,7 +773,7 @@ local Wheel_Leg_1A_L_detail = { } local Wheel_Leg_1B_L_detail = { - Identifier = "Wheel_Leg_1B_L_detail", + Identifier = "Perseverance_Wheel_Leg_1B_L_detail", Parent = Wheel_Leg_1_L.Identifier, Renderable = { Type = "RenderableModel", @@ -793,7 +793,7 @@ local Wheel_Leg_1B_L_detail = { } local Wheel_Leg_2_L = { - Identifier = "Wheel_Leg_2_L", + Identifier = "Perseverance_Wheel_Leg_2_L", Parent = transforms.Leg_2_L_Location.Identifier, Renderable = { Type = "RenderableModel", @@ -813,7 +813,7 @@ local Wheel_Leg_2_L = { } local Wheel_Wrist_F_L = { - Identifier = "Wheel_Wrist_F_L", + Identifier = "Perseverance_Wheel_Wrist_F_L", Parent = transforms.Wrist_F_L_Location.Identifier, Renderable = { Type = "RenderableModel", @@ -833,7 +833,7 @@ local Wheel_Wrist_F_L = { } local Wheel_Wrist_hub_F_L = { - Identifier = "Wheel_Wrist_hub_F_L", + Identifier = "Perseverance_Wheel_Wrist_hub_F_L", Parent = Wheel_Wrist_F_L.Identifier, Renderable = { Type = "RenderableModel", @@ -853,7 +853,7 @@ local Wheel_Wrist_hub_F_L = { } local Wheel_F_L = { - Identifier = "Wheel_F_L", + Identifier = "Perseverance_Wheel_F_L", Parent = transforms.Wheel_F_L_Location.Identifier, Renderable = { Type = "RenderableModel", @@ -873,7 +873,7 @@ local Wheel_F_L = { } local Wheel_C_L = { - Identifier = "Wheel_C_L", + Identifier = "Perseverance_Wheel_C_L", Parent = transforms.Wheel_C_L_Location.Identifier, Renderable = { Type = "RenderableModel", @@ -893,7 +893,7 @@ local Wheel_C_L = { } local Wheel_Wrist_B_L = { - Identifier = "Wheel_Wrist_B_L", + Identifier = "Perseverance_Wheel_Wrist_B_L", Parent = transforms.Wrist_B_L_Location.Identifier, Renderable = { Type = "RenderableModel", @@ -913,7 +913,7 @@ local Wheel_Wrist_B_L = { } local Wheel_Wrist_hub_B_L = { - Identifier = "Wheel_Wrist_hub_B_L", + Identifier = "Perseverance_Wheel_Wrist_hub_B_L", Parent = Wheel_Wrist_B_L.Identifier, Renderable = { Type = "RenderableModel", @@ -933,7 +933,7 @@ local Wheel_Wrist_hub_B_L = { } local Wheel_B_L = { - Identifier = "Wheel_B_L", + Identifier = "Perseverance_Wheel_B_L", Parent = transforms.Wheel_B_L_Location.Identifier, Renderable = { Type = "RenderableModel", @@ -954,7 +954,7 @@ local Wheel_B_L = { -- RIGHT SIDE -- local Wheel_Leg_1_R = { - Identifier = "Wheel_Leg_1_R", + Identifier = "Perseverance_Wheel_Leg_1_R", Parent = transforms.Leg_1_R_Location.Identifier, Renderable = { Type = "RenderableModel", @@ -974,7 +974,7 @@ local Wheel_Leg_1_R = { } local Wheel_Leg_1A_R_detail = { - Identifier = "Wheel_Leg_1A_R_detail", + Identifier = "Perseverance_Wheel_Leg_1A_R_detail", Parent = Wheel_Leg_1_R.Identifier, Renderable = { Type = "RenderableModel", @@ -994,7 +994,7 @@ local Wheel_Leg_1A_R_detail = { } local Wheel_Leg_1B_R_detail = { - Identifier = "Wheel_Leg_1B_R_detail", + Identifier = "Perseverance_Wheel_Leg_1B_R_detail", Parent = Wheel_Leg_1_R.Identifier, Renderable = { Type = "RenderableModel", @@ -1014,7 +1014,7 @@ local Wheel_Leg_1B_R_detail = { } local Wheel_Leg_2_R = { - Identifier = "Wheel_Leg_2_R", + Identifier = "Perseverance_Wheel_Leg_2_R", Parent = transforms.Leg_2_R_Location.Identifier, Renderable = { Type = "RenderableModel", @@ -1034,7 +1034,7 @@ local Wheel_Leg_2_R = { } local Wheel_Wrist_F_R = { - Identifier = "Wheel_Wrist_F_R", + Identifier = "Perseverance_Wheel_Wrist_F_R", Parent = transforms.Wrist_F_R_Location.Identifier, Renderable = { Type = "RenderableModel", @@ -1055,7 +1055,7 @@ local Wheel_Wrist_F_R = { } local Wheel_Wrist_hub_F_R = { - Identifier = "Wheel_Wrist_hub_F_R", + Identifier = "Perseverance_Wheel_Wrist_hub_F_R", Parent = Wheel_Wrist_F_R.Identifier, Renderable = { Type = "RenderableModel", @@ -1074,9 +1074,8 @@ local Wheel_Wrist_hub_F_R = { } } - local Wheel_F_R = { - Identifier = "Wheel_F_R", + Identifier = "Perseverance_Wheel_F_R", Parent = transforms.Wheel_F_R_Location.Identifier, Renderable = { Type = "RenderableModel", @@ -1095,9 +1094,8 @@ local Wheel_F_R = { } } - local Wheel_C_R = { - Identifier = "Wheel_C_R", + Identifier = "Perseverance_Wheel_C_R", Parent = transforms.Wheel_C_R_Location.Identifier, Renderable = { Type = "RenderableModel", @@ -1117,7 +1115,7 @@ local Wheel_C_R = { } local Wheel_Wrist_B_R = { - Identifier = "Wheel_Wrist_B_R", + Identifier = "Perseverance_Wheel_Wrist_B_R", Parent = transforms.Wrist_B_R_Location.Identifier, Renderable = { Type = "RenderableModel", @@ -1137,7 +1135,7 @@ local Wheel_Wrist_B_R = { } local Wheel_Wrist_hub_B_R = { - Identifier = "Wheel_Wrist_hub_B_R", + Identifier = "Perseverance_Wheel_Wrist_hub_B_R", Parent = Wheel_Wrist_B_R.Identifier, Renderable = { Type = "RenderableModel", @@ -1157,7 +1155,7 @@ local Wheel_Wrist_hub_B_R = { } local Wheel_B_R = { - Identifier = "Wheel_B_R", + Identifier = "Perseverance_Wheel_B_R", Parent = transforms.Wheel_B_R_Location.Identifier, Renderable = { Type = "RenderableModel", @@ -1178,66 +1176,26 @@ local Wheel_B_R = { assetHelper.registerSceneGraphNodesAndExport(asset, { Perseverance, - PerseveranceModel, - Body, - Body_detail, - Body_staticParts_1, - Body_staticParts_2, - Body_staticParts_3, - Body_staticParts_4, - Body_staticParts_5, - - RA_Shoulder_AZ, - RA_Shoulder_AZ_detail_1, - RA_Shoulder_AZ_detail_2, - RA_Shoulder_EL_1, - RA_Shoulder_EL_detail_1, - RA_Shoulder_EL_detail_2, - RA_Shoulder_EL_2, - RA_Elbow_1, - RA_Elbow_detail_1, - RA_Elbow_detail_2, - RA_Elbow_2, - RA_Wrist, - RA_Wrist_details, - RA_Turret, - RA_Turret_details_1, - RA_Turret_details_2, - - RSM_root, - RSM_AZ, - RSM_EL, - - HGA_AZ, - HGA_EL, - - SAM_Cover_1, - SAM_Cover_2, - CHEMIN_Bottom, + PerseveranceModel, - Wheel_Base, - Wheel_Base_2, - Wheel_Leg_1_L, - Wheel_Leg_1A_L_detail, - Wheel_Leg_1B_L_detail, - Wheel_Leg_2_L, - Wheel_Wrist_F_L, - Wheel_Wrist_hub_F_L, - Wheel_F_L, - Wheel_C_L, - Wheel_Wrist_B_L, - Wheel_Wrist_hub_B_L, - Wheel_B_L, - Wheel_Leg_1_R, - Wheel_Leg_1A_R_detail, - Wheel_Leg_1B_R_detail, - Wheel_Leg_2_R, - Wheel_Wrist_F_R, - Wheel_Wrist_hub_F_R, - Wheel_F_R, - Wheel_C_R, - Wheel_Wrist_B_R, - Wheel_Wrist_hub_B_R, + Body, Body_detail, Body_staticParts_1, Body_staticParts_2, Body_staticParts_3, + Body_staticParts_4, Body_staticParts_5, + + RA_Shoulder_AZ, RA_Shoulder_AZ_detail_1, RA_Shoulder_AZ_detail_2, RA_Shoulder_EL_1, + RA_Shoulder_EL_detail_1, RA_Shoulder_EL_detail_2, RA_Shoulder_EL_2, RA_Elbow_1, + RA_Elbow_detail_1, RA_Elbow_detail_2, RA_Elbow_2, RA_Wrist, RA_Wrist_details, + RA_Turret, RA_Turret_details_1, RA_Turret_details_2, + + RSM_root, RSM_AZ, RSM_EL, + + HGA_AZ, HGA_EL, + + SAM_Cover_1, SAM_Cover_2, CHEMIN_Bottom, + + Wheel_Base, Wheel_Base_2, Wheel_Leg_1_L, Wheel_Leg_1A_L_detail, Wheel_Leg_1B_L_detail, + Wheel_Leg_2_L, Wheel_Wrist_F_L, Wheel_Wrist_hub_F_L, Wheel_F_L, Wheel_C_L, + Wheel_Wrist_B_L, Wheel_Wrist_hub_B_L, Wheel_B_L, Wheel_Leg_1_R, + Wheel_Leg_1A_R_detail, Wheel_Leg_1B_R_detail, Wheel_Leg_2_R, Wheel_Wrist_F_R, + Wheel_Wrist_hub_F_R, Wheel_F_R, Wheel_C_R, Wheel_Wrist_B_R, Wheel_Wrist_hub_B_R, Wheel_B_R - -}) \ No newline at end of file +}) diff --git a/data/assets/scene/solarsystem/missions/perseverance/shortcuts.asset b/data/assets/scene/solarsystem/missions/perseverance/shortcuts.asset index 44da54bf80..287cb76164 100644 --- a/data/assets/scene/solarsystem/missions/perseverance/shortcuts.asset +++ b/data/assets/scene/solarsystem/missions/perseverance/shortcuts.asset @@ -3,9 +3,9 @@ local PerseveranceLaunchTime = "2020 JUL 17 13:56:42" local PerseveranceLandingTime = "2021 FEB 18 20:32:16" -local PerseveranceNavigationSate = "{" .. - "Anchor = 'Insight'," .. - "Pitch = 0.567457E-4," .. +local PerseveranceNavigationState = "{" .. + "Anchor = 'Perseverance'," .. + "Pitch = 0.567457E-4," .. "Position = { 1.240506E1,-1.369270E1,-2.423553E0 }," .. "ReferenceFrame = 'Root',".. "Up = { 0.441211E0,0.247019E0,0.862737E0 }," .. @@ -45,7 +45,7 @@ local Shortcuts = { Local = false }, { - Command = "openspace.navigation.setNavigationState(" .. PerseveranceNavigationSate .. ");", + Command = "openspace.navigation.setNavigationState(" .. PerseveranceNavigationState .. ");", Documentation = "Change the camera state for the start of Insight EDL", Name = "Insight EDL NavigationState", GuiPath = "/Missions/Insight", diff --git a/data/assets/scene/solarsystem/missions/perseverance/trail.asset b/data/assets/scene/solarsystem/missions/perseverance/trail.asset index 666c2c5694..42c98c878e 100644 --- a/data/assets/scene/solarsystem/missions/perseverance/trail.asset +++ b/data/assets/scene/solarsystem/missions/perseverance/trail.asset @@ -3,13 +3,15 @@ local assetHelper = asset.require('util/asset_helper') local sunTransforms = asset.require('scene/solarsystem/sun/transforms') local marsTransforms = asset.require('scene/solarsystem/planets/mars/transforms') -local kernels = asset.syncedResource({ +local kernels = asset.syncedResource({ Name = "Mars 2020 Kernels", Type = "HttpSynchronization", Identifier = "perseverance_kernels", Version = 1 }) +local perseverance_id = "-168" + local m2020_kernels = { kernels .. "/m2020.tf", @@ -32,8 +34,8 @@ local PerseveranceNode = { Transform = { Translation = { Type = "SpiceTranslation", - Target = "-168", - Observer = "SUN", + Target = perseverance_id, + Observer = "SUN", Kernels = m2020_kernels }, }, @@ -50,7 +52,7 @@ local PerseveranceTrailSun = { Type = "RenderableTrailTrajectory", Translation = { Type = "SpiceTranslation", - Target = "-168", + Target = perseverance_id, Observer = "SUN", Kernels = m2020_kernels }, @@ -72,7 +74,7 @@ local PerseveranceTrailMars = { Type = "RenderableTrailTrajectory", Translation = { Type = "SpiceTranslation", - Target = "-168", + Target = perseverance_id, Observer = "MARS", Kernels = m2020_kernels }, diff --git a/data/assets/scene/solarsystem/missions/perseverance/transforms.asset b/data/assets/scene/solarsystem/missions/perseverance/transforms.asset index b7b063c130..7197b0e59f 100644 --- a/data/assets/scene/solarsystem/missions/perseverance/transforms.asset +++ b/data/assets/scene/solarsystem/missions/perseverance/transforms.asset @@ -7,7 +7,7 @@ local trailAsset = asset.require('./trail') local MSL_Body = { Identifier = "MSL_Body", Parent = trailAsset.PerseveranceNode.Identifier, - Transform = { + Transform = { Translation = { Type = "StaticTranslation", Position = { 0, 0.0, 2.8 } @@ -27,7 +27,7 @@ local MSL_Body = { local RA_Base_Location = { Identifier = "RA_Base_Location", Parent = MSL_Body.Identifier, - Transform = { + Transform = { Translation = { Type = "StaticTranslation", Position = { 1.111, -0.4525, -0.106 } @@ -39,15 +39,14 @@ local RA_Base_Location = { } } - --AZ local RA_Shoulder_AZ_Location = { Identifier = "RA_Shoulder_AZ_Location", Parent = RA_Base_Location.Identifier, - Transform = { + Transform = { Translation = { Type = "StaticTranslation", - Position = {0.0, 0.0, -0.08} + Position = { 0.0, 0.0, -0.08 } } }, GUI = { @@ -63,7 +62,7 @@ local RA_Shoulder_EL_Location = { Transform = { Translation = { Type = "StaticTranslation", - Position = {0.17, 0.2, -0.005} + Position = { 0.17, 0.2, -0.005 } } }, GUI = { @@ -79,7 +78,7 @@ local RA_Elbow_Location = { Transform = { Translation = { Type = "StaticTranslation", - Position = {0.83, -0.2, 0.0 } + Position = { 0.83, -0.2, 0.0 } } }, GUI = { @@ -95,7 +94,7 @@ local RA_Wrist_Location = { Transform = { Translation = { Type = "StaticTranslation", - Position = {0.77, 0.13, 0.035} + Position = { 0.77, 0.13, 0.035 } } }, GUI = { @@ -111,7 +110,7 @@ local RA_Turret_Location = { Transform = { Translation = { Type = "StaticTranslation", - Position = {0.0, 0.04, -0.15} + Position = { 0.0, 0.04, -0.15 } } }, GUI = { @@ -133,7 +132,7 @@ local RSM_ROOT_Location = { Transform = { Translation = { Type = "StaticTranslation", - Position = {0.7039, 0.5769, -0.563} + Position = { 0.7039, 0.5769, -0.563 } } }, GUI = { @@ -148,7 +147,7 @@ local RSM_AZ_Location = { Transform = { Translation = { Type = "StaticTranslation", - Position = {0.0, 0.008, 0.0} + Position = { 0.0, 0.008, 0.0 } } }, GUI = { @@ -173,7 +172,7 @@ local RSM_EL_Location = { Translation = { Type = "StaticTranslation", --Position = {0.0, 0.0, -0.664} - Position = {0.002, 0.007, -0.688} + Position = { 0.002, 0.007, -0.688 } } }, GUI = { @@ -186,10 +185,10 @@ local RSM_EL_Location = { local HGA_AZ_Location = { Identifier = "HGA_AZ_Location", Parent = MSL_Body.Identifier, - Transform = { + Transform = { Translation = { Type = "StaticTranslation", - Position = {-0.46, -0.47, -0.55} + Position = { -0.46, -0.47, -0.55 } } }, GUI = { @@ -201,10 +200,10 @@ local HGA_AZ_Location = { local HGA_EL_Location = { Identifier = "HGA_EL_Location", Parent = HGA_AZ_Location.Identifier, - Transform = { + Transform = { Translation = { Type = "StaticTranslation", - Position = {0.0, 0.0, -0.17} + Position = { 0.0, 0.0, -0.17 } } }, GUI = { @@ -255,10 +254,10 @@ local Wheel_base_Location = { local Leg_1_L_Location = { Identifier = "Leg_1_L_Location", Parent = Wheel_base_Location.Identifier, - Transform = { + Transform = { Translation = { Type = "StaticTranslation", - Position = {0.217, -0.812, -0.215} --for the right side + Position = { 0.217, -0.812, -0.215 } --for the right side } }, GUI = { @@ -270,10 +269,10 @@ local Leg_1_L_Location = { local Leg_2_L_Location = { Identifier = "Leg_2_L_Location", Parent = Leg_1_L_Location.Identifier, - Transform = { + Transform = { Translation = { Type = "StaticTranslation", - Position = {-0.74, -0.00380, 0.223} --CORRECT, DONT CHANGE + Position = { -0.74, -0.00380, 0.223 } --CORRECT, DONT CHANGE } }, GUI = { @@ -285,10 +284,10 @@ local Leg_2_L_Location = { local Wrist_F_L_Location = { Identifier = "Wrist_F_L_Location", Parent = Leg_1_L_Location.Identifier, - Transform = { + Transform = { Translation = { Type = "StaticTranslation", - Position = {0.8839, -0.2659, 0.2} --CORRECT, DONT TOUCH + Position = { 0.8839, -0.2659, 0.2 } --CORRECT, DONT TOUCH } }, GUI = { @@ -300,10 +299,10 @@ local Wrist_F_L_Location = { local Wheel_F_L_Location = { Identifier = "Wheel_F_L_Location", Parent = Wrist_F_L_Location.Identifier, - Transform = { + Transform = { Translation = { Type = "StaticTranslation", - Position = {0.0, 0.0, 0.426} + Position = { 0.0, 0.0, 0.426 } } }, GUI = { @@ -315,10 +314,10 @@ local Wheel_F_L_Location = { local Wheel_C_L_Location = { Identifier = "Wheel_C_L_Location", Parent = Leg_2_L_Location.Identifier, - Transform = { + Transform = { Translation = { Type = "StaticTranslation", - Position = {0.45, -0.4, 0.403} + Position = { 0.45, -0.4, 0.403 } } }, GUI = { @@ -327,14 +326,13 @@ local Wheel_C_L_Location = { } } - local Wrist_B_L_Location = { Identifier = "Wrist_B_L_Location", Parent = Leg_2_L_Location.Identifier, - Transform = { + Transform = { Translation = { Type = "StaticTranslation", - Position = {-0.627, -0.2635, -0.022} --CORRECT, DONT CHANGE + Position = { -0.627, -0.2635, -0.022 } --CORRECT, DONT CHANGE } }, GUI = { @@ -343,14 +341,13 @@ local Wrist_B_L_Location = { } } - local Wheel_B_L_Location = { Identifier = "Wheel_B_L_Location", Parent = Wrist_B_L_Location.Identifier, - Transform = { + Transform = { Translation = { Type = "StaticTranslation", - Position = {0.0, -0.0, 0.426} + Position = { 0.0, -0.0, 0.426 } } }, GUI = { @@ -359,15 +356,14 @@ local Wheel_B_L_Location = { } } - -- wheels, Right Side -- local Leg_1_R_Location = { Identifier = "Leg_1_R_Location", Parent = Wheel_base_Location.Identifier, - Transform = { + Transform = { Translation = { Type = "StaticTranslation", - Position = {0.217, 0.812, -0.215} --Check with caroline!!! + Position = { 0.217, 0.812, -0.215 } --Check with caroline!!! } }, GUI = { @@ -379,11 +375,11 @@ local Leg_1_R_Location = { local Leg_2_R_Location = { Identifier = "Leg_2_R_Location", Parent = Leg_1_R_Location.Identifier, - Transform = { + Transform = { Translation = { Type = "StaticTranslation", --Position = {-0.74, 0.0, 0.24} - Position = {-0.74, 0.00380, 0.223} --want to use this one, once the center point is changed in maya + Position = { -0.74, 0.00380, 0.223 } --want to use this one, once the center point is changed in maya } }, @@ -396,10 +392,10 @@ local Leg_2_R_Location = { local Wrist_F_R_Location = { Identifier = "Wrist_F_R_Location", Parent = Leg_1_R_Location.Identifier, - Transform = { + Transform = { Translation = { Type = "StaticTranslation", - Position = {0.882, 0.259, 0.215} + Position = { 0.882, 0.259, 0.215 } --Position = {0.8839, 0.2659, 0.2} --position for the Wrist_F_L } }, @@ -412,10 +408,10 @@ local Wrist_F_R_Location = { local Wheel_F_R_Location = { Identifier = "Wheel_F_R_Location", Parent = Wrist_F_R_Location.Identifier, - Transform = { + Transform = { Translation = { Type = "StaticTranslation", - Position = {0.0, 0.0, 0.426} + Position = { 0.0, 0.0, 0.426 } } }, GUI = { @@ -427,10 +423,10 @@ local Wheel_F_R_Location = { local Wheel_C_R_Location = { Identifier = "Wheel_C_R_Location", Parent = Leg_2_R_Location.Identifier, - Transform = { + Transform = { Translation = { Type = "StaticTranslation", - Position = {0.45, 0.4, 0.403} + Position = { 0.45, 0.4, 0.403 } } }, GUI = { @@ -442,10 +438,10 @@ local Wheel_C_R_Location = { local Wrist_B_R_Location = { Identifier = "Wrist_B_R_Location", Parent = Leg_2_R_Location.Identifier, - Transform = { + Transform = { Translation = { Type = "StaticTranslation", - Position = {-0.6208, 0.2759, -0.025} + Position = { -0.6208, 0.2759, -0.025 } } }, GUI = { @@ -460,7 +456,7 @@ local Wheel_B_R_Location = { Transform = { Translation = { Type = "StaticTranslation", - Position = {0.0, -0.0005, 0.426} + Position = { 0.0, -0.0005, 0.426 } } }, GUI = { diff --git a/data/assets/util/scene_helper.asset b/data/assets/util/scene_helper.asset index cf3fd966ca..579af633d8 100644 --- a/data/assets/util/scene_helper.asset +++ b/data/assets/util/scene_helper.asset @@ -142,4 +142,4 @@ local createKeyBindFromShortcuts = function(key, shortcuts, guipath, title, docu return keybind end -asset.export("createKeyBindFromShortcuts", createKeyBindFromShortcuts) \ No newline at end of file +asset.export("createKeyBindFromShortcuts", createKeyBindFromShortcuts) From 19c65047f83b499e9f3a57b255f7678d011e1e2e Mon Sep 17 00:00:00 2001 From: Jonathas Costa Date: Sat, 13 Jun 2020 10:24:54 -0400 Subject: [PATCH 39/48] Changed colors. --- data/assets/scene/digitaluniverse/grids.asset | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/data/assets/scene/digitaluniverse/grids.asset b/data/assets/scene/digitaluniverse/grids.asset index 19a38264a5..319052cef9 100644 --- a/data/assets/scene/digitaluniverse/grids.asset +++ b/data/assets/scene/digitaluniverse/grids.asset @@ -24,7 +24,7 @@ local radio = { Renderable = { Type = "RenderableSphericalGrid", Enabled = false, - Opacity = 0.3, + Opacity = 1.0, GridColor = { 0.3, 0.84, 1.0}, LineWidth = 2.0, GridMatrix = { -0.05487554, 0.4941095, -0.8676661 , 0.0, @@ -50,7 +50,7 @@ local oort = { Renderable = { Type = "RenderableSphericalGrid", Enabled = false, - Opacity = 0.25, + Opacity = 0.8, GridColor = { 0.8, 0.4, 0.4}, LineWidth = 2.0, GridMatrix = { -0.05487554, 0.4941095, -0.8676661 , 0.0, @@ -76,7 +76,7 @@ local ecliptic = { Renderable = { Type = "RenderableSphericalGrid", Enabled = false, - Opacity = 0.5, + Opacity = 1.0, GridColor = { 0.74, 0.26, 0.26}, LineWidth = 2.0, GridMatrix = { -0.05487554, 0.4941095, -0.8676661 , 0.0, @@ -185,7 +185,7 @@ local galactic = { Type = "RenderableSphericalGrid", Enabled = false, LineWidth = 2.0, - Opacity = 0.6, + Opacity = 1.0, GridColor = { 0.0, 0.6, 0.6} }, GUI = { From 976bf3f79b3573f11b47b1e3346624053da2a870 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Sat, 13 Jun 2020 16:38:06 +0200 Subject: [PATCH 40/48] Small cleanup --- .../planets/earth/satellites/misc/iss.asset | 37 ++++++++----------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/misc/iss.asset b/data/assets/scene/solarsystem/planets/earth/satellites/misc/iss.asset index 1eca717d22..5fb881fdd5 100644 --- a/data/assets/scene/solarsystem/planets/earth/satellites/misc/iss.asset +++ b/data/assets/scene/solarsystem/planets/earth/satellites/misc/iss.asset @@ -17,7 +17,6 @@ local models = asset.syncedResource({ }) local initializeAndAddNodes = function() - local lineElement = satelliteHelper.makeSingleLineElement(tle, filename) local period = satelliteHelper.getPeriodFromElement(lineElement) local path = tle .. "/" .. filename @@ -41,8 +40,7 @@ local initializeAndAddNodes = function() }, Tag = { "earth_satellite", "ISS" }, GUI = { - Path = "/Solar System/Planets/Earth/Satellites/ISS", - Hiden = false + Path = "/Solar System/Planets/Earth/Satellites/ISS" } } @@ -70,16 +68,17 @@ local initializeAndAddNodes = function() "foilsilver", "olive", "basemetal", "white_20", "plasticblack", "ecostresswhite", "plain"} - local myNodes = {iss, parentNode} + local nodes = { iss, parentNode } for i, info in ipairs(list) do - myNodes[#myNodes + 1] = assetHelper.createModelPart( - parentNode.Identifier, - sunTransforms.SolarSystemBarycenter.Identifier, - models, - info, - info .. ".png", - true - ) + n = assetHelper.createModelPart( + parentNode.Identifier, + sunTransforms.SolarSystemBarycenter.Identifier, + models, + info, + info .. ".png", + true + ) + table.insert(nodes, n) end local issTrail = { @@ -106,18 +105,14 @@ local initializeAndAddNodes = function() } } - myNodes[#myNodes + 1] = issTrail - - for _, node in ipairs(myNodes) do - openspace.addSceneGraphNode(node) - end - - return myNodes - + table.insert(nodes, issTrail) + return nodes end asset.onInitialize(function () nodes = initializeAndAddNodes() + for _, node in ipairs(nodes) do + openspace.addSceneGraphNode(node) + end openspace.setPropertyValueSingle("Scene.ISSparentNode.Rotation.yAxis-InvertObject", true) end) - From 2ac4cac01c69bb08d149e07495904fbbaba12f52 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Sat, 13 Jun 2020 16:41:31 +0200 Subject: [PATCH 41/48] Update meta information --- .../scene/milkyway/constellations/constellation_art.asset | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data/assets/scene/milkyway/constellations/constellation_art.asset b/data/assets/scene/milkyway/constellations/constellation_art.asset index 28dd39689f..578592a220 100644 --- a/data/assets/scene/milkyway/constellations/constellation_art.asset +++ b/data/assets/scene/milkyway/constellations/constellation_art.asset @@ -23,6 +23,6 @@ asset.meta = { Version = "1.0", Description = "Artistic images depicting the constellations", Author = "James Hedberg", - URL = "ccnyplanetarium.org", - License = "" + URL = "jameshedberg.com", + License = "CC-BY" } From 92f0a57cf6ec011ae5845b851608ad497e6b1a57 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Sat, 13 Jun 2020 16:47:35 +0200 Subject: [PATCH 42/48] Tiny cleanup --- data/assets/scene/digitaluniverse/grids.asset | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/data/assets/scene/digitaluniverse/grids.asset b/data/assets/scene/digitaluniverse/grids.asset index 319052cef9..455d1bc6c0 100644 --- a/data/assets/scene/digitaluniverse/grids.asset +++ b/data/assets/scene/digitaluniverse/grids.asset @@ -25,7 +25,7 @@ local radio = { Type = "RenderableSphericalGrid", Enabled = false, Opacity = 1.0, - GridColor = { 0.3, 0.84, 1.0}, + GridColor = { 0.3, 0.84, 1.0 }, LineWidth = 2.0, GridMatrix = { -0.05487554, 0.4941095, -0.8676661 , 0.0, -0.9938214 , -0.1109906, -0.0003515167, 0.0, @@ -51,7 +51,7 @@ local oort = { Type = "RenderableSphericalGrid", Enabled = false, Opacity = 0.8, - GridColor = { 0.8, 0.4, 0.4}, + GridColor = { 0.8, 0.4, 0.4 }, LineWidth = 2.0, GridMatrix = { -0.05487554, 0.4941095, -0.8676661 , 0.0, -0.9938214 , -0.1109906, -0.0003515167, 0.0, @@ -77,7 +77,7 @@ local ecliptic = { Type = "RenderableSphericalGrid", Enabled = false, Opacity = 1.0, - GridColor = { 0.74, 0.26, 0.26}, + GridColor = { 0.74, 0.26, 0.26 }, LineWidth = 2.0, GridMatrix = { -0.05487554, 0.4941095, -0.8676661 , 0.0, -0.9938214 , -0.1109906, -0.0003515167, 0.0, @@ -131,7 +131,7 @@ local equatorial = { Type = "RenderableSphericalGrid", Enabled = false, Opacity = 0.8, - GridColor = { 0.69, 0.68, 0.29}, + GridColor = { 0.69, 0.68, 0.29 }, LineWidth = 2.0, GridMatrix = { -0.05487554, 0.4941095, -0.8676661, 0.0, -0.8734371 , -0.4448296, -0.1980764, 0.0, @@ -186,7 +186,7 @@ local galactic = { Enabled = false, LineWidth = 2.0, Opacity = 1.0, - GridColor = { 0.0, 0.6, 0.6} + GridColor = { 0.0, 0.6, 0.6 } }, GUI = { Name = "Galactic Sphere", From cdb8509e7bd0c3309efb4327211ec90c14bb7ff7 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Sat, 13 Jun 2020 16:51:53 +0200 Subject: [PATCH 43/48] Update OpenSpace version to 0.15.2 --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ee78a175b4..f0853c7b30 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,8 +28,8 @@ project(OpenSpace) set(OPENSPACE_VERSION_MAJOR 0) set(OPENSPACE_VERSION_MINOR 15) -set(OPENSPACE_VERSION_PATCH 1) -set(OPENSPACE_VERSION_STRING "Beta-5") +set(OPENSPACE_VERSION_PATCH 2) +set(OPENSPACE_VERSION_STRING "Beta-7") set(OPENSPACE_BASE_DIR "${PROJECT_SOURCE_DIR}") From 94e58f10ce185e508d0342666bebd12784416c05 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Sat, 13 Jun 2020 17:06:47 +0200 Subject: [PATCH 44/48] Add the release candidate addon to the version --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f0853c7b30..dad829c6b5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,7 +29,7 @@ project(OpenSpace) set(OPENSPACE_VERSION_MAJOR 0) set(OPENSPACE_VERSION_MINOR 15) set(OPENSPACE_VERSION_PATCH 2) -set(OPENSPACE_VERSION_STRING "Beta-7") +set(OPENSPACE_VERSION_STRING "Beta-7 (RC1)") set(OPENSPACE_BASE_DIR "${PROJECT_SOURCE_DIR}") From 65a3b0d801dc0282b56b05a06f76b1ecab707e77 Mon Sep 17 00:00:00 2001 From: Micah Date: Sat, 13 Jun 2020 12:40:56 -0400 Subject: [PATCH 45/48] asteroid colors with marina --- data/assets/scene/solarsystem/sssb/amor_asteroid.asset | 2 +- data/assets/scene/solarsystem/sssb/apollo_asteroid.asset | 2 +- data/assets/scene/solarsystem/sssb/aten_asteroid.asset | 2 +- data/assets/scene/solarsystem/sssb/atira_asteroid.asset | 2 +- data/assets/scene/solarsystem/sssb/centaur_asteroid.asset | 2 +- data/assets/scene/solarsystem/sssb/chiron-type_comet.asset | 2 +- data/assets/scene/solarsystem/sssb/encke-type_comet.asset | 2 +- data/assets/scene/solarsystem/sssb/halley-type_comet.asset | 2 +- .../scene/solarsystem/sssb/inner_main_belt_asteroid.asset | 2 +- data/assets/scene/solarsystem/sssb/jupiter-family_comet.asset | 2 +- .../assets/scene/solarsystem/sssb/jupiter_trojan_asteroid.asset | 2 +- data/assets/scene/solarsystem/sssb/main_belt_asteroid.asset | 2 +- data/assets/scene/solarsystem/sssb/mars-crossing_asteroid.asset | 2 +- .../scene/solarsystem/sssb/outer_main_belt_asteroid.asset | 2 +- data/assets/scene/solarsystem/sssb/pha.asset | 2 +- .../scene/solarsystem/sssb/transneptunian_object_asteroid.asset | 2 +- 16 files changed, 16 insertions(+), 16 deletions(-) diff --git a/data/assets/scene/solarsystem/sssb/amor_asteroid.asset b/data/assets/scene/solarsystem/sssb/amor_asteroid.asset index b091b688fc..17ef986389 100644 --- a/data/assets/scene/solarsystem/sssb/amor_asteroid.asset +++ b/data/assets/scene/solarsystem/sssb/amor_asteroid.asset @@ -2,7 +2,7 @@ local assetHelper = asset.require('util/asset_helper') local sharedSssb = asset.require('./sssb_shared') local filepath = sharedSssb.downloadSssbDatabaseFile(asset, 'amor_asteroid', 'sssb_data_amor_asteroid') -local object = sharedSssb.createSssbGroupObject('sssb_data_amor_asteroid.csv', "Amor Asteroids", filepath, { 0.9, 0.3, 0.1 }) +local object = sharedSssb.createSssbGroupObject('sssb_data_amor_asteroid.csv', "Amor Asteroids", filepath, { 0.69, 0.47, 0.0 }) object.Renderable.Enabled = false object.Renderable.SegmentQuality = 4 object.Renderable.TrailFade = 11 diff --git a/data/assets/scene/solarsystem/sssb/apollo_asteroid.asset b/data/assets/scene/solarsystem/sssb/apollo_asteroid.asset index 8c86d4e990..bdedf11b31 100644 --- a/data/assets/scene/solarsystem/sssb/apollo_asteroid.asset +++ b/data/assets/scene/solarsystem/sssb/apollo_asteroid.asset @@ -2,7 +2,7 @@ local assetHelper = asset.require('util/asset_helper') local sharedSssb = asset.require('./sssb_shared') local filepath = sharedSssb.downloadSssbDatabaseFile(asset, 'apollo_asteroid', 'sssb_data_apollo_asteroid') -local object = sharedSssb.createSssbGroupObject('sssb_data_apollo_asteroid.csv', "Apollo Asteroids", filepath, { 0.9, 0.3, 0.1 }) +local object = sharedSssb.createSssbGroupObject('sssb_data_apollo_asteroid.csv', "Apollo Asteroids", filepath, { 0.72, 0.5, 0.38 }) object.Renderable.Enabled = false object.Renderable.SegmentQuality = 6 object.Renderable.TrailFade = 10 diff --git a/data/assets/scene/solarsystem/sssb/aten_asteroid.asset b/data/assets/scene/solarsystem/sssb/aten_asteroid.asset index 1dd7af7f10..c03fb30fda 100644 --- a/data/assets/scene/solarsystem/sssb/aten_asteroid.asset +++ b/data/assets/scene/solarsystem/sssb/aten_asteroid.asset @@ -2,7 +2,7 @@ local assetHelper = asset.require('util/asset_helper') local sharedSssb = asset.require('./sssb_shared') local filepath = sharedSssb.downloadSssbDatabaseFile(asset, 'aten_asteroid', 'sssb_data_aten_asteroid') -local object = sharedSssb.createSssbGroupObject('sssb_data_aten_asteroid.csv', "Aten Asteroids", filepath, { 0.9, 0.3, 0.1 }) +local object = sharedSssb.createSssbGroupObject('sssb_data_aten_asteroid.csv', "Aten Asteroids", filepath, { 0.9, 0.43, 0.1 }) object.Renderable.Enabled = false object.Renderable.SegmentQuality = 2 object.Renderable.TrailFade = 18 diff --git a/data/assets/scene/solarsystem/sssb/atira_asteroid.asset b/data/assets/scene/solarsystem/sssb/atira_asteroid.asset index 1029f31430..68b9fde128 100644 --- a/data/assets/scene/solarsystem/sssb/atira_asteroid.asset +++ b/data/assets/scene/solarsystem/sssb/atira_asteroid.asset @@ -2,7 +2,7 @@ local assetHelper = asset.require('util/asset_helper') local sharedSssb = asset.require('./sssb_shared') local filepath = sharedSssb.downloadSssbDatabaseFile(asset, 'atira_asteroid', 'sssb_data_atira_asteroid') -local object = sharedSssb.createSssbGroupObject('sssb_data_atira_asteroid.csv', "Atira Asteroids", filepath, { 0.9, 0.3, 0.1 }) +local object = sharedSssb.createSssbGroupObject('sssb_data_atira_asteroid.csv', "Atira Asteroids", filepath, { 0.08, 0.09, 1.0 }) object.Renderable.Enabled = false object.Renderable.SegmentQuality = 2 object.Renderable.TrailFade = 25 diff --git a/data/assets/scene/solarsystem/sssb/centaur_asteroid.asset b/data/assets/scene/solarsystem/sssb/centaur_asteroid.asset index 68d97d2d9c..e12ca12bd3 100644 --- a/data/assets/scene/solarsystem/sssb/centaur_asteroid.asset +++ b/data/assets/scene/solarsystem/sssb/centaur_asteroid.asset @@ -2,7 +2,7 @@ local assetHelper = asset.require('util/asset_helper') local sharedSssb = asset.require('./sssb_shared') local filepath = sharedSssb.downloadSssbDatabaseFile(asset, 'centaur_asteroid', 'sssb_data_centaur_asteroid') -local object = sharedSssb.createSssbGroupObject('sssb_data_centaur_asteroid.csv', "Centaur Asteroids", filepath, { 0.9, 0.3, 0.1 }) +local object = sharedSssb.createSssbGroupObject('sssb_data_centaur_asteroid.csv', "Centaur Asteroids", filepath, { 0.94, 0.96, 0.94 }) object.Renderable.Enabled = false object.Renderable.SegmentQuality = 6 object.Renderable.TrailFade = 18 diff --git a/data/assets/scene/solarsystem/sssb/chiron-type_comet.asset b/data/assets/scene/solarsystem/sssb/chiron-type_comet.asset index e19c58b335..865ef7c20e 100644 --- a/data/assets/scene/solarsystem/sssb/chiron-type_comet.asset +++ b/data/assets/scene/solarsystem/sssb/chiron-type_comet.asset @@ -2,7 +2,7 @@ local assetHelper = asset.require('util/asset_helper') local sharedSssb = asset.require('./sssb_shared') local filepath = sharedSssb.downloadSssbDatabaseFile(asset, 'chiron-type_comet', 'sssb_data_chiron-type_comet') -local object = sharedSssb.createSssbGroupObject('sssb_data_chiron-type_comet.csv', "Chiron-type Comets", filepath, { 0.9, 0.3, 0.1 }) +local object = sharedSssb.createSssbGroupObject('sssb_data_chiron-type_comet.csv', "Chiron-type Comets", filepath, { 0.69 ,0.47 ,0.8 }) object.Renderable.Enabled = false object.Renderable.SegmentQuality = 10 object.Renderable.TrailFade = 25 diff --git a/data/assets/scene/solarsystem/sssb/encke-type_comet.asset b/data/assets/scene/solarsystem/sssb/encke-type_comet.asset index 451433e6f1..1c3ebe4079 100644 --- a/data/assets/scene/solarsystem/sssb/encke-type_comet.asset +++ b/data/assets/scene/solarsystem/sssb/encke-type_comet.asset @@ -2,7 +2,7 @@ local assetHelper = asset.require('util/asset_helper') local sharedSssb = asset.require('./sssb_shared') local filepath = sharedSssb.downloadSssbDatabaseFile(asset, 'encke-type_comet', 'sssb_data_encke-type_comet') -local object = sharedSssb.createSssbGroupObject('sssb_data_encke-type_comet.csv', "Encke-type Comets", filepath, { 0.9, 0.3, 0.1 }) +local object = sharedSssb.createSssbGroupObject('sssb_data_encke-type_comet.csv', "Encke-type Comets", filepath, { 0.16, 0.25, 1.0 }) object.Renderable.Enabled = false object.Renderable.SegmentQuality = 2 object.Renderable.TrailFade = 23 diff --git a/data/assets/scene/solarsystem/sssb/halley-type_comet.asset b/data/assets/scene/solarsystem/sssb/halley-type_comet.asset index c92a0e1c83..41d1c0f951 100644 --- a/data/assets/scene/solarsystem/sssb/halley-type_comet.asset +++ b/data/assets/scene/solarsystem/sssb/halley-type_comet.asset @@ -2,7 +2,7 @@ local assetHelper = asset.require('util/asset_helper') local sharedSssb = asset.require('./sssb_shared') local filepath = sharedSssb.downloadSssbDatabaseFile(asset, 'halley-type_comet', 'sssb_data_halley-type_comet') -local object = sharedSssb.createSssbGroupObject('sssb_data_halley-type_comet.csv', "Halley-type Comets", filepath, { 0.9, 0.3, 0.1 }) +local object = sharedSssb.createSssbGroupObject('sssb_data_halley-type_comet.csv', "Halley-type Comets", filepath, { 0.3, 0.69, 0.67 }) object.Renderable.Enabled = false object.Renderable.SegmentQuality = 9 object.Renderable.TrailFade = 18 diff --git a/data/assets/scene/solarsystem/sssb/inner_main_belt_asteroid.asset b/data/assets/scene/solarsystem/sssb/inner_main_belt_asteroid.asset index 02426fdbeb..2599e95da7 100644 --- a/data/assets/scene/solarsystem/sssb/inner_main_belt_asteroid.asset +++ b/data/assets/scene/solarsystem/sssb/inner_main_belt_asteroid.asset @@ -2,7 +2,7 @@ local assetHelper = asset.require('util/asset_helper') local sharedSssb = asset.require('./sssb_shared') local filepath = sharedSssb.downloadSssbDatabaseFile(asset, 'inner_main_belt_asteroid', 'sssb_data_inner_main_belt_asteroid') -local object = sharedSssb.createSssbGroupObject('sssb_data_inner_main_belt_asteroid.csv', "Inner Main Asteroid Belt", filepath, { 0.9, 0.3, 0.1 }) +local object = sharedSssb.createSssbGroupObject('sssb_data_inner_main_belt_asteroid.csv', "Inner Main Asteroid Belt", filepath, { 0.86, 0.86, 0.2 }) object.Renderable.Enabled = false object.Renderable.SegmentQuality = 1 object.Renderable.TrailFade = 0.5 diff --git a/data/assets/scene/solarsystem/sssb/jupiter-family_comet.asset b/data/assets/scene/solarsystem/sssb/jupiter-family_comet.asset index b42e8ac0be..e7f4b752bf 100644 --- a/data/assets/scene/solarsystem/sssb/jupiter-family_comet.asset +++ b/data/assets/scene/solarsystem/sssb/jupiter-family_comet.asset @@ -2,7 +2,7 @@ local assetHelper = asset.require('util/asset_helper') local sharedSssb = asset.require('./sssb_shared') local filepath = sharedSssb.downloadSssbDatabaseFile(asset, 'jupiter-family_comet', 'sssb_data_jupiter-family_comet') -local object = sharedSssb.createSssbGroupObject('sssb_data_jupiter-family_comet.csv', "Jupiter-family Comets", filepath, { 0.9, 0.3, 0.1 }) +local object = sharedSssb.createSssbGroupObject('sssb_data_jupiter-family_comet.csv', "Jupiter-family Comets", filepath, { 0.29, 0.46, 0.73 }) object.Renderable.Enabled = false object.Renderable.SegmentQuality = 10 object.Renderable.TrailFade = 28 diff --git a/data/assets/scene/solarsystem/sssb/jupiter_trojan_asteroid.asset b/data/assets/scene/solarsystem/sssb/jupiter_trojan_asteroid.asset index 6be40249c7..1c25cdcc9d 100644 --- a/data/assets/scene/solarsystem/sssb/jupiter_trojan_asteroid.asset +++ b/data/assets/scene/solarsystem/sssb/jupiter_trojan_asteroid.asset @@ -2,7 +2,7 @@ local assetHelper = asset.require('util/asset_helper') local sharedSssb = asset.require('./sssb_shared') local filepath = sharedSssb.downloadSssbDatabaseFile(asset, 'jupiter_trojan_asteroid', 'sssb_data_jupiter_trojan_asteroid') -local object = sharedSssb.createSssbGroupObject('sssb_data_jupiter_trojan_asteroid.csv', "Jupiter Trojan Asteroids", filepath, { 0.9, 0.3, 0.1 }) +local object = sharedSssb.createSssbGroupObject('sssb_data_jupiter_trojan_asteroid.csv', "Jupiter Trojan Asteroids", filepath, { 0.8, 0.7, 0.7 }) object.Renderable.Enabled = false object.Renderable.SegmentQuality = 1 object.Renderable.TrailFade = 5 diff --git a/data/assets/scene/solarsystem/sssb/main_belt_asteroid.asset b/data/assets/scene/solarsystem/sssb/main_belt_asteroid.asset index 503a00dc04..6de71e929e 100644 --- a/data/assets/scene/solarsystem/sssb/main_belt_asteroid.asset +++ b/data/assets/scene/solarsystem/sssb/main_belt_asteroid.asset @@ -2,7 +2,7 @@ local assetHelper = asset.require('util/asset_helper') local sharedSssb = asset.require('./sssb_shared') local filepath = sharedSssb.downloadSssbDatabaseFile(asset, 'main_belt_asteroid', 'sssb_data_main_belt_asteroid') -local object = sharedSssb.createSssbGroupObject('sssb_data_main_belt_asteroid.csv', "Main Asteroid Belt", filepath, { 0.9, 0.3, 0.1 }) +local object = sharedSssb.createSssbGroupObject('sssb_data_main_belt_asteroid.csv', "Main Asteroid Belt", filepath, { 0.58, 0.58, 0.2 }) object.Renderable.Enabled = false object.Renderable.SegmentQuality = 1 object.Renderable.TrailFade = 0.1 diff --git a/data/assets/scene/solarsystem/sssb/mars-crossing_asteroid.asset b/data/assets/scene/solarsystem/sssb/mars-crossing_asteroid.asset index 98cdda1f80..eac38f803b 100644 --- a/data/assets/scene/solarsystem/sssb/mars-crossing_asteroid.asset +++ b/data/assets/scene/solarsystem/sssb/mars-crossing_asteroid.asset @@ -2,7 +2,7 @@ local assetHelper = asset.require('util/asset_helper') local sharedSssb = asset.require('./sssb_shared') local filepath = sharedSssb.downloadSssbDatabaseFile(asset, 'mars-crossing_asteroid', 'sssb_data_mars-crossing_asteroid') -local object = sharedSssb.createSssbGroupObject('sssb_data_mars-crossing_asteroid.csv', "Mars-crossing Asteroids", filepath, { 0.9, 0.3, 0.1 }) +local object = sharedSssb.createSssbGroupObject('sssb_data_mars-crossing_asteroid.csv', "Mars-crossing Asteroids", filepath, { 0.814, 0.305, 0.220 }) object.Renderable.Enabled = false object.Renderable.SegmentQuality = 1 object.Renderable.TrailFade = 13 diff --git a/data/assets/scene/solarsystem/sssb/outer_main_belt_asteroid.asset b/data/assets/scene/solarsystem/sssb/outer_main_belt_asteroid.asset index 995b7623ea..1e81627b4e 100644 --- a/data/assets/scene/solarsystem/sssb/outer_main_belt_asteroid.asset +++ b/data/assets/scene/solarsystem/sssb/outer_main_belt_asteroid.asset @@ -2,7 +2,7 @@ local assetHelper = asset.require('util/asset_helper') local sharedSssb = asset.require('./sssb_shared') local filepath = sharedSssb.downloadSssbDatabaseFile(asset, 'outer_main_belt_asteroid', 'sssb_data_outer_main_belt_asteroid') -local object = sharedSssb.createSssbGroupObject('sssb_data_outer_main_belt_asteroid.csv', "Outer Main Asteroid Belt", filepath, { 0.9, 0.3, 0.1 }) +local object = sharedSssb.createSssbGroupObject('sssb_data_outer_main_belt_asteroid.csv', "Outer Main Asteroid Belt", filepath, { 0.5, 0.50, 0.67 }) object.Renderable.Enabled = false object.Renderable.SegmentQuality = 1 object.Renderable.TrailFade = 2 diff --git a/data/assets/scene/solarsystem/sssb/pha.asset b/data/assets/scene/solarsystem/sssb/pha.asset index 4a66174fdf..b274bd8a3b 100644 --- a/data/assets/scene/solarsystem/sssb/pha.asset +++ b/data/assets/scene/solarsystem/sssb/pha.asset @@ -2,7 +2,7 @@ local assetHelper = asset.require('util/asset_helper') local sharedSssb = asset.require('./sssb_shared') local filepath = sharedSssb.downloadSssbDatabaseFile(asset, 'pha', 'sssb_data_pha') -local object = sharedSssb.createSssbGroupObject('sssb_data_pha.csv', "Potentially Hazardous Asteroids", filepath, { 0.75, 0.2, 0.2 }) +local object = sharedSssb.createSssbGroupObject('sssb_data_pha.csv', "Potentially Hazardous Asteroids", filepath, { 0.98, 0.09, 0.06}) object.Renderable.Enabled = false object.Renderable.SegmentQuality = 3 object.Renderable.TrailFade = 17 diff --git a/data/assets/scene/solarsystem/sssb/transneptunian_object_asteroid.asset b/data/assets/scene/solarsystem/sssb/transneptunian_object_asteroid.asset index 5ef5e3b1e9..725721017d 100644 --- a/data/assets/scene/solarsystem/sssb/transneptunian_object_asteroid.asset +++ b/data/assets/scene/solarsystem/sssb/transneptunian_object_asteroid.asset @@ -2,7 +2,7 @@ local assetHelper = asset.require('util/asset_helper') local sharedSssb = asset.require('./sssb_shared') local filepath = sharedSssb.downloadSssbDatabaseFile(asset, 'transneptunian_object_asteroid', 'sssb_data_transneptunian_object_asteroid') -local object = sharedSssb.createSssbGroupObject('sssb_data_transneptunian_object_asteroid.csv', "Transneptunian Object Asteroids", filepath, { 0.9, 0.3, 0.1 }) +local object = sharedSssb.createSssbGroupObject('sssb_data_transneptunian_object_asteroid.csv', "Transneptunian Object Asteroids", filepath, {0.32, 0.32, 0.34 }) object.Renderable.Enabled = false object.Renderable.SegmentQuality = 8 object.Renderable.TrailFade = 10 From 703296fc27b34875af16f105b28a7177064da4d6 Mon Sep 17 00:00:00 2001 From: Micah Date: Sat, 13 Jun 2020 12:52:33 -0400 Subject: [PATCH 46/48] added globe labels back into renderloop --- modules/globebrowsing/src/renderableglobe.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/globebrowsing/src/renderableglobe.cpp b/modules/globebrowsing/src/renderableglobe.cpp index 6109087b54..61f7c9c840 100644 --- a/modules/globebrowsing/src/renderableglobe.cpp +++ b/modules/globebrowsing/src/renderableglobe.cpp @@ -775,7 +775,7 @@ void RenderableGlobe::render(const RenderData& data, RendererTasks& rendererTask try { // Before Shadows //renderChunks(data, rendererTask); - //_globeLabelsComponent.draw(data); + _globeLabelsComponent.draw(data); if (_hasShadows && _shadowComponent.isEnabled()) { // Set matrices and other GL states From 673ab1025364102f82e9e61ccfd3286dbbe954fa Mon Sep 17 00:00:00 2001 From: Micah Date: Sat, 13 Jun 2020 12:54:26 -0400 Subject: [PATCH 47/48] webgui fix for base profile --- data/assets/base_profile.asset | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/data/assets/base_profile.asset b/data/assets/base_profile.asset index f4a9b7b265..15fdae811f 100644 --- a/data/assets/base_profile.asset +++ b/data/assets/base_profile.asset @@ -14,9 +14,10 @@ asset.require('util/default_dashboard') asset.require('util/default_joystick') -- Load web gui -asset.require('util/webgui') +local webGui = asset.require('util/webgui') asset.onInitialize(function () + webGui.setCefRoute("onscreen") openspace.setDefaultGuiSorting() openspace.globebrowsing.loadWMSServersFromFile( openspace.absPath("${DATA}/globebrowsing_servers.lua") From 1ed043716ee0c14071361aa6e56bbc9b61124f16 Mon Sep 17 00:00:00 2001 From: Micah Date: Sat, 13 Jun 2020 13:18:27 -0400 Subject: [PATCH 48/48] added constellation art to base asset --- data/assets/base.asset | 2 ++ 1 file changed, 2 insertions(+) diff --git a/data/assets/base.asset b/data/assets/base.asset index 3c6406cc80..4fd7e3fe0c 100644 --- a/data/assets/base.asset +++ b/data/assets/base.asset @@ -16,6 +16,8 @@ asset.require('scene/solarsystem/planets/mars/moons/phobos') asset.require('scene/solarsystem/planets/mars/moons/deimos') asset.require('scene/solarsystem/dwarf_planets/pluto/system') asset.request('scene/milkyway/milkyway/volume') +asset.request('scene/milkyway/constellations/constellation_art') +asset.request('scene/milkyway/constellations/constellation_keybinds') assetHelper.requestAll(asset, 'scene/digitaluniverse')