mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-06 03:29:44 -06:00
Adding documentations to more classes
This commit is contained in:
@@ -24,6 +24,9 @@
|
||||
|
||||
#include <modules/base/rendering/screenspaceimage.h>
|
||||
|
||||
#include <openspace/documentation/documentation.h>
|
||||
#include <openspace/documentation/verifier.h>
|
||||
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
#include <openspace/engine/wrapper/windowwrapper.h>
|
||||
#include <openspace/rendering/renderengine.h>
|
||||
@@ -36,39 +39,66 @@ namespace {
|
||||
const char* KeyName = "Name";
|
||||
const char* KeyTexturePath = "TexturePath";
|
||||
const char* KeyUrl = "URL";
|
||||
}
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
|
||||
documentation::Documentation ScreenSpaceImage::Documentation() {
|
||||
using namespace openspace::documentation;
|
||||
return {
|
||||
"ScreenSpace Image",
|
||||
"base_screenspace_image",
|
||||
{
|
||||
{
|
||||
KeyName,
|
||||
new StringVerifier,
|
||||
"Specifies the GUI name of the ScreenspaceImage",
|
||||
Optional::Yes
|
||||
},
|
||||
{
|
||||
KeyTexturePath,
|
||||
new StringVerifier,
|
||||
"Specifies the image that is shown on the screenspace-aligned plane. If "
|
||||
"this value is set and the URL is not, the disk image is used.",
|
||||
Optional::Yes
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
ScreenSpaceImage::ScreenSpaceImage(const ghoul::Dictionary& dictionary)
|
||||
: ScreenSpaceRenderable(dictionary)
|
||||
, _downloadImage(false)
|
||||
, _textureIsDirty(false)
|
||||
, _texturePath("texturePath", "Texture path", "")
|
||||
{
|
||||
std::string name;
|
||||
if (dictionary.getValue(KeyName, name)) {
|
||||
setName(name);
|
||||
} else {
|
||||
documentation::testSpecificationAndThrow(
|
||||
Documentation(),
|
||||
dictionary,
|
||||
"ScreenSpaceImage"
|
||||
);
|
||||
|
||||
if (dictionary.hasKey(KeyName)) {
|
||||
setName(dictionary.value<std::string>(KeyName));
|
||||
}
|
||||
else {
|
||||
static int id = 0;
|
||||
setName("ScreenSpaceImage " + std::to_string(id));
|
||||
++id;
|
||||
}
|
||||
|
||||
addProperty(_texturePath);
|
||||
|
||||
std::string texturePath;
|
||||
if (dictionary.getValue(KeyTexturePath, texturePath)) {
|
||||
_texturePath = texturePath;
|
||||
_texturePath.onChange([this]() { _textureIsDirty = true; });
|
||||
_texturePath = dictionary.value<std::string>(KeyTexturePath);
|
||||
}
|
||||
|
||||
if (dictionary.getValue(KeyUrl, _url)) {
|
||||
_downloadImage = true;
|
||||
}
|
||||
}
|
||||
|
||||
ScreenSpaceImage::~ScreenSpaceImage() {}
|
||||
_texturePath.onChange([this]() { _textureIsDirty = true; });
|
||||
addProperty(_texturePath);
|
||||
}
|
||||
|
||||
bool ScreenSpaceImage::initialize() {
|
||||
_originalViewportSize = OsEng.windowWrapper().currentWindowResolution();
|
||||
|
||||
Reference in New Issue
Block a user