mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-24 21:39:02 -05:00
Merge branch 'develop' of openspace.itn.liu.se:/openspace into develop
This commit is contained in:
@@ -28,3 +28,4 @@ latex/
|
||||
shaders/ABuffer/constants.hglsl
|
||||
*.OpenSpaceGenerated.glsl
|
||||
LuaScripting.txt
|
||||
log.html
|
||||
|
||||
+1
-1
Submodule ext/ghoul updated: 5779abd6be...f90fc354b3
@@ -200,6 +200,20 @@ public:
|
||||
*/
|
||||
std::string guiName() const;
|
||||
|
||||
/**
|
||||
* Returns the description for this Property that contains all necessary information
|
||||
* required for creating a GUI representation. The format of the description is a
|
||||
* valid Lua table, i.e., it is surrounded by a pair of <code>{</code> and
|
||||
* <code>}</code> with key,value pairs between. Each value can either be a number, a
|
||||
* string, a bool, or another table. The general values that every Property must set
|
||||
* are: <code>Identifier</code>, <code>Name</code>, <code>Type</code>. All other
|
||||
* values are specific to the type. If a Property does not override this method, an
|
||||
* empty string is returned.
|
||||
* \return The descriptive text for the Property that can be used for constructing a
|
||||
* GUI representation
|
||||
*/
|
||||
virtual std::string description() const;
|
||||
|
||||
/**
|
||||
* Sets the identifier of the group that this Property belongs to. Property groups can
|
||||
* be used, for example, by GUI application to visually group different properties,
|
||||
@@ -274,6 +288,20 @@ public:
|
||||
const ghoul::Dictionary& metaData() const;
|
||||
|
||||
protected:
|
||||
static const std::string IdentifierKey;
|
||||
static const std::string NameKey;
|
||||
static const std::string TypeKey;
|
||||
static const std::string MetaDataKey;
|
||||
|
||||
/**
|
||||
* Creates the information for the <code>MetaData</code> key-part of the Lua
|
||||
* description for the Property. The result can be included as one key-value pair in
|
||||
* the description text generated by subclasses. Only the metadata curated by the
|
||||
* Property class is used in this method.
|
||||
* \return The metadata information text for the property
|
||||
*/
|
||||
std::string generateMetaDataDescription() const;
|
||||
|
||||
/**
|
||||
* This method must be called by all subclasses whenever the encapsulated value has
|
||||
* changed and a potential listener has to be informed.
|
||||
|
||||
@@ -65,6 +65,8 @@ public:
|
||||
void takeScreenshot();
|
||||
void toggleVisualizeABuffer(bool b);
|
||||
|
||||
void toggleInfoText(bool b);
|
||||
|
||||
void setPerformanceMeasurements(bool performanceMeasurements);
|
||||
bool doesPerformanceMeasurements() const;
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace properties {
|
||||
namespace {
|
||||
const std::string _loggerCat = "Property";
|
||||
const std::string _metaDataKeyGuiName = "guiName";
|
||||
const std::string _metaDataKeyGroup = "group";
|
||||
const std::string _metaDataKeyGroup = "Group";
|
||||
const std::string _metaDataKeyVisible = "isVisible";
|
||||
const std::string _metaDataKeyReadOnly = "isReadOnly";
|
||||
|
||||
@@ -45,7 +45,11 @@ const std::string Property::ViewOptions::Color = "color";
|
||||
const std::string Property::ViewOptions::LightPosition = "lightPosition";
|
||||
const std::string Property::ViewOptions::PowerScaledCoordinate = "powerScaledCoordinate";
|
||||
const std::string Property::ViewOptions::PowerScaledScalar = "powerScaledScalar";
|
||||
|
||||
|
||||
const std::string Property::IdentifierKey = "Identifier";
|
||||
const std::string Property::NameKey = "Name";
|
||||
const std::string Property::TypeKey = "Type";
|
||||
const std::string Property::MetaDataKey = "MetaData";
|
||||
|
||||
Property::Property(std::string identifier, std::string guiName)
|
||||
: _identifier(std::move(identifier))
|
||||
@@ -105,6 +109,10 @@ std::string Property::guiName() const {
|
||||
return std::move(result);
|
||||
}
|
||||
|
||||
std::string Property::description() const {
|
||||
return "";
|
||||
}
|
||||
|
||||
void Property::setGroupIdentifier(std::string groupId) {
|
||||
_metaData.setValue(_metaDataKeyGroup, std::move(groupId));
|
||||
}
|
||||
@@ -133,7 +141,6 @@ const ghoul::Dictionary& Property::metaData() const {
|
||||
|
||||
void Property::onChange(std::function<void()> callback) {
|
||||
_onChangeCallback = std::move(callback);
|
||||
|
||||
}
|
||||
|
||||
PropertyOwner* Property::owner() const
|
||||
@@ -151,5 +158,18 @@ void Property::notifyListener() {
|
||||
_onChangeCallback();
|
||||
}
|
||||
|
||||
std::string Property::generateMetaDataDescription() const {
|
||||
bool isVisible, isReadOnly;
|
||||
_metaData.getValue(_metaDataKeyVisible, isVisible);
|
||||
_metaData.getValue(_metaDataKeyReadOnly, isReadOnly);
|
||||
|
||||
return
|
||||
MetaDataKey + " = {" +
|
||||
_metaDataKeyGroup + " = '" + groupIdentifier() + "',\n" +
|
||||
_metaDataKeyVisible + " = '" + (isVisible ? "true" : "false") + "',\n" +
|
||||
_metaDataKeyReadOnly +" = ;" + (isReadOnly ? "true" : "false") + "'\n" +
|
||||
"},";
|
||||
}
|
||||
|
||||
} // namespace properties
|
||||
} // namespace openspace
|
||||
|
||||
@@ -107,6 +107,22 @@ int visualizeABuffer(lua_State* L) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \ingroup LuaScripts
|
||||
* visualizeABuffer(bool):
|
||||
* Toggle the visualization of the ABuffer
|
||||
*/
|
||||
int showRenderInformation(lua_State* L) {
|
||||
int nArguments = lua_gettop(L);
|
||||
if (nArguments != 1)
|
||||
return luaL_error(L, "Expected %i arguments, got %i", 1, nArguments);
|
||||
|
||||
const int type = lua_type(L, -1);
|
||||
bool b = lua_toboolean(L, -1) != 0;
|
||||
OsEng.renderEngine().toggleInfoText(b);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \ingroup LuaScripts
|
||||
* visualizeABuffer(bool):
|
||||
@@ -506,6 +522,11 @@ void RenderEngine::toggleVisualizeABuffer(bool b) {
|
||||
_visualizer->updateData(_d);
|
||||
}
|
||||
|
||||
|
||||
void RenderEngine::toggleInfoText(bool b) {
|
||||
_showInfo = b;
|
||||
}
|
||||
|
||||
SceneGraph* RenderEngine::sceneGraph()
|
||||
{
|
||||
// TODO custom assert (ticket #5)
|
||||
@@ -594,6 +615,12 @@ scripting::ScriptEngine::LuaLibrary RenderEngine::luaLibrary() {
|
||||
"bool",
|
||||
"Toggles the visualization of the ABuffer"
|
||||
},
|
||||
{
|
||||
"showRenderInformation",
|
||||
&luascriptfunctions::showRenderInformation,
|
||||
"bool",
|
||||
"Toggles the showing of render information on-screen text"
|
||||
},
|
||||
{
|
||||
"setPerformanceMeasurement",
|
||||
&luascriptfunctions::setPerformanceMeasurement,
|
||||
|
||||
Reference in New Issue
Block a user