Merge branch 'master' into thesis/2020/radiation

This commit is contained in:
ElonOlsson
2021-10-05 14:52:38 -04:00
53 changed files with 505 additions and 318 deletions

View File

@@ -131,7 +131,6 @@ struct Configuration {
HTTPProxy httpProxy;
// Values not read from the openspace.cfg file
bool usingProfile = false;
std::string sgctConfigNameInitialized;
static documentation::Documentation Documentation;

View File

@@ -26,6 +26,7 @@
#define __OPENSPACE_CORE___OPENSPACEENGINE___H__
#include <openspace/properties/stringproperty.h>
#include <openspace/scene/profile.h>
#include <openspace/util/keys.h>
#include <openspace/util/mouse.h>
#include <openspace/util/touch.h>
@@ -108,7 +109,7 @@ public:
static scripting::LuaLibrary luaLibrary();
private:
void loadSingleAsset(const std::string& assetPath);
void loadAsset(const std::string& assetName);
void loadFonts();
void runGlobalCustomizationScripts();
@@ -136,9 +137,57 @@ private:
// The first frame might take some more time in the update loop, so we need to know to
// disable the synchronization; otherwise a hardware sync will kill us after 1 minute
bool _isFirstRenderingFirstFrame = true;
bool _isRenderingFirstFrame = true;
};
/**
* Sets the camera position using the time contents of a profile. The function will
* set an absolute position or a go-to-geolocation command using the globebrowsing
* module.
* \param p The Profile to be read.
*/
void setCameraFromProfile(const Profile& p);
/**
* Reads a list of modules from a profile, and executes scripts based on whether or
* not the corresponding module is loaded.
*
* \param p The Profile to be read.
*/
void setModulesFromProfile(const Profile& p);
/**
* Registers actions from the contents of a profile.
*
* \param p The Profile to be read.
*/
void setActionsFromProfile(const Profile& p);
/**
* Registers keybindings from the contents of a profile.
*
* \param p The Profile to be read.
*/
void setKeybindingsFromProfile(const Profile& p);
/**
* Reads list of nodes from profile to be marked as interesting nodes.
* If any nodes are listed, a script to mark these will be queued with the
* script engine.
*
* \param p The Profile to be read.
*/
void setMarkInterestingNodesFromProfile(const Profile& p);
/**
* Reads list of "additional scripts" that are added to the profile to be run
* at the end of the initialization. Any openspace lua commands are allowed,
* and will be added to the script queue.
*
* \param p The Profile to be read.
*/
void setAdditionalScriptsFromProfile(const Profile& p);
} // namespace openspace
// Lua functions - exposed for testing

View File

@@ -43,7 +43,6 @@ public:
void triggerAction(const std::string& identifier,
const ghoul::Dictionary& arguments) const;
static scripting::LuaLibrary luaLibrary();
private:

View File

@@ -832,16 +832,16 @@ public:
~SessionRecording_legacy_0085() {}
char FileHeaderVersion[FileHeaderVersionLength+1] = "00.85";
char TargetConvertVersion[FileHeaderVersionLength+1] = "01.00";
std::string fileFormatVersion() {
std::string fileFormatVersion() override {
return std::string(FileHeaderVersion);
}
std::string targetFileFormatVersion() {
std::string targetFileFormatVersion() override {
return std::string(TargetConvertVersion);
}
std::string getLegacyConversionResult(std::string filename, int depth);
std::string getLegacyConversionResult(std::string filename, int depth) override;
struct ScriptMessage_legacy_0085 : public datamessagestructures::ScriptMessage {
void read(std::istream* in) {
void read(std::istream* in) override {
size_t strLen;
//Read string length from file
in->read(reinterpret_cast<char*>(&strLen), sizeof(strLen));
@@ -860,7 +860,7 @@ public:
protected:
bool convertScript(std::stringstream& inStream, DataMode mode, int lineNum,
std::string& inputLine, std::ofstream& outFile, unsigned char* buffer);
std::string& inputLine, std::ofstream& outFile, unsigned char* buffer) override;
};
} // namespace openspace

View File

@@ -36,6 +36,7 @@
#include <openspace/properties/propertyowner.h>
#include <openspace/properties/stringproperty.h>
#include <openspace/properties/scalar/boolproperty.h>
#include <openspace/scene/profile.h>
#include <openspace/util/mouse.h>
#include <openspace/util/keys.h>
#include <optional>

View File

@@ -196,7 +196,9 @@ struct CameraKeyframe {
<< std::fixed << std::setprecision(7) << _rotation.y << ' '
<< std::fixed << std::setprecision(7) << _rotation.z << ' '
<< std::fixed << std::setprecision(7) << _rotation.w << ' ';
out << std::scientific << _scale << ' ';
out << std::fixed
<< std::setprecision(std::numeric_limits<double>::max_digits10)
<< _scale << ' ';
if (_followNodeRotation) {
out << "F ";
}

View File

@@ -76,10 +76,9 @@ public:
SetPropertyValueSingle
};
SetType setType;
SetType setType = SetType::SetPropertyValue;
std::string name;
std::string value;
};
struct Action {
std::string identifier;
@@ -166,19 +165,6 @@ public:
static scripting::LuaLibrary luaLibrary();
};
/**
* This function takes a profile and returns its asset-ifyied version as a string. This
* is the format that is saved as a scene file that, in turn, is provided to OpenSpace as
* the root asset to load. This function is a key step to be able to load a Profile in
* OpenSpace (at the moment).
*
* \param profile The profile that should be converted to the asset-file format
*
* \return The string representation of the provided profile, ready to be loaded as an
* asset
*/
std::string convertToScene(const Profile& profile);
} // namespace openspace
#endif // __OPENSPACE_CORE___PROFILE___H__

View File

@@ -27,7 +27,9 @@
#include <openspace/properties/propertyowner.h>
#include <openspace/scene/profile.h>
#include <openspace/scene/scenegraphnode.h>
#include <ghoul/lua/luastate.h>
#include <ghoul/misc/easing.h>
#include <ghoul/misc/exception.h>
#include <ghoul/misc/memorypool.h>
@@ -233,6 +235,16 @@ public:
*/
static scripting::LuaLibrary luaLibrary();
/**
* Sets a property using the 'properties' contents of a profile. The function will
* loop through each setProperty command. A property may be set to a bool, float,
* or string value (which must be converted because a Profile stores all values
* as strings)
*
* \param p The Profile to be read.
*/
void setPropertiesFromProfile(const Profile& p);
private:
/**
* Update dependencies.
@@ -267,6 +279,16 @@ private:
ghoul::MemoryPool<4096> _memoryPool;
};
/**
* Accepts string version of a property value from a profile, converts it to the
* appropriate type, and then pushes the value onto the lua state.
*
* \param L the lua state to push value to
* \param value string representation of the value with which to set property
*/
void propertyPushValueFromProfileToLuaState(ghoul::lua::LuaState& L,
const std::string& value);
} // namespace openspace
#endif // __OPENSPACE_CORE___SCENE___H__

View File

@@ -141,6 +141,20 @@ public:
*/
double advanceTime(double tickTime);
/**
* Sets a relative time from profile.
* \param setTime a string containing time adjustment as described in documentation
* for luascriptfunctions::time_advancedTime
*/
void setTimeRelativeFromProfile(const std::string& setTime);
/**
* Sets an absolute time from profile.
* \param setTime a string containing time to set, which must be a valid
* ISO 8601-like date string of the format YYYY-MM-DDTHH:MN:SS
*/
void setTimeAbsoluteFromProfile(const std::string& setTime);
/**
* Returns the Lua library that contains all Lua functions available to change the
* current time, retrieve the current time etc.

View File

@@ -25,8 +25,11 @@
#ifndef __OPENSPACE_CORE___TIMEMANAGER___H__
#define __OPENSPACE_CORE___TIMEMANAGER___H__
#include <ghoul/lua/luastate.h>
#include <ghoul/lua/lua_helper.h>
#include <openspace/properties/propertyowner.h>
#include <openspace/properties/scalar/floatproperty.h>
#include "openspace/scene/profile.h"
#include <openspace/util/keys.h>
#include <openspace/util/syncdata.h>
#include <openspace/util/time.h>
@@ -75,6 +78,15 @@ public:
* Returns the current delta time, as affected by pause
*/
double deltaTime() const;
/**
* Sets the simulation time using the time contents of a profile. The function will
* set either a relative or absolute time.
*
* \param p The Profile to be read.
*/
void setTimeFromProfile(const Profile& p);
bool isPaused() const;
std::vector<double> deltaTimeSteps() const;